km_dbase.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2003 August.Net Services, LLC
  5. * Copyright (C) 2008 1&1 Internet AG
  6. *
  7. * This file is part of Kamailio, a free SIP server.
  8. *
  9. * Kamailio is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version
  13. *
  14. * Kamailio is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  22. *
  23. * History
  24. * -------
  25. * 2003-04-06 initial code written (Greg Fausak/Andy Fullford)
  26. */
  27. /*! \file
  28. * \brief DB_POSTGRES :: Core
  29. * \ingroup db_postgres
  30. * Module: \ref db_postgres
  31. */
  32. #ifndef DBASE_H
  33. #define DBASE_H
  34. #include "../../db/db_con.h"
  35. #include "../../db/db_res.h"
  36. #include "../../db/db_key.h"
  37. #include "../../db/db_op.h"
  38. #include "../../db/db_val.h"
  39. /*
  40. * Initialize database connection
  41. */
  42. db_con_t* db_postgres_init(const str* _url);
  43. /*
  44. * Close a database connection
  45. */
  46. void db_postgres_close(db_con_t* _h);
  47. /*
  48. * Return result of previous query
  49. */
  50. int db_postgres_store_result(const db_con_t* _h, db_res_t** _r);
  51. /*
  52. * Free all memory allocated by get_result
  53. */
  54. int db_postgres_free_result(db_con_t* _h, db_res_t* _r);
  55. /*
  56. * Do a query
  57. */
  58. int db_postgres_query(const db_con_t* _h, const db_key_t* _k, const db_op_t* _op,
  59. const db_val_t* _v, const db_key_t* _c, const int _n, const int _nc,
  60. const db_key_t _o, db_res_t** _r);
  61. /*
  62. * Raw SQL query
  63. */
  64. int db_postgres_raw_query(const db_con_t* _h, const str* _s, db_res_t** _r);
  65. /*
  66. * Insert a row into table
  67. */
  68. int db_postgres_insert(const db_con_t* _h, const db_key_t* _k, const db_val_t* _v,
  69. const int _n);
  70. /*
  71. * Delete a row from table
  72. */
  73. int db_postgres_delete(const db_con_t* _h, const db_key_t* _k, const db_op_t* _o,
  74. const db_val_t* _v, const int _n);
  75. /*
  76. * Update a row in table
  77. */
  78. int db_postgres_update(const db_con_t* _h, const db_key_t* _k, const db_op_t* _o,
  79. const db_val_t* _v, const db_key_t* _uk, const db_val_t* _uv, const int _n,
  80. const int _un);
  81. /*
  82. * fetch rows from a result
  83. */
  84. int db_postgres_fetch_result(const db_con_t* _h, db_res_t** _r, const int nrows);
  85. /*
  86. * Store name of table that will be used by
  87. * subsequent database functions
  88. */
  89. int db_postgres_use_table(db_con_t* _h, const str* _t);
  90. #endif /* DBASE_H */