dbase.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * $Id$
  3. *
  4. * POSTGRES module, portions of this code were templated using
  5. * the mysql module, thus it's similarity.
  6. *
  7. *
  8. * Copyright (C) 2003 August.Net Services, LLC
  9. *
  10. * This file is part of ser, a free SIP server.
  11. *
  12. * ser is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version
  16. *
  17. * For a license to use the ser software under conditions
  18. * other than those described here, or to purchase support for this
  19. * software, please contact iptel.org by e-mail at the following addresses:
  20. * [email protected]
  21. *
  22. * ser is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program; if not, write to the Free Software
  29. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  30. *
  31. * ---
  32. *
  33. * History
  34. * -------
  35. * 2003-04-06 initial code written (Greg Fausak/Andy Fullford)
  36. *
  37. */
  38. #ifndef DBASE_H
  39. #define DBASE_H
  40. #include "../../db/db_con.h"
  41. #include "../../db/db_res.h"
  42. #include "../../db/db_key.h"
  43. #include "../../db/db_op.h"
  44. #include "../../db/db_val.h"
  45. /*
  46. * Initialize database connection
  47. */
  48. db_con_t* db_init(const char* _sqlurl);
  49. /*
  50. * Close a database connection
  51. */
  52. void db_close(db_con_t* _h);
  53. /*
  54. * Return result of previous query
  55. */
  56. int get_result(db_con_t* _h, db_res_t** _r);
  57. /*
  58. * create a new result anchored on parent memory
  59. */
  60. db_res_t* new_result_pg(char *parent);
  61. /*
  62. * Free all memory allocated by get_result
  63. */
  64. int db_free_query(db_con_t* _h, db_res_t* _r);
  65. /*
  66. * Do a query
  67. */
  68. int db_query(db_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, db_key_t* _c, int _n, int _nc,
  69. db_key_t _o, db_res_t** _r);
  70. /*
  71. * Raw SQL query
  72. */
  73. int db_raw_query(db_con_t* _h, char* _s, db_res_t** _r);
  74. /*
  75. * Insert a row into table
  76. */
  77. int db_insert(db_con_t* _h, db_key_t* _k, db_val_t* _v, int _n);
  78. /*
  79. * Delete a row from table
  80. */
  81. int db_delete(db_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n);
  82. /*
  83. * Update a row in table
  84. */
  85. int db_update(db_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v,
  86. db_key_t* _uk, db_val_t* _uv, int _n, int _un);
  87. #endif /* DBASE_H */