km_dbase.h 2.7 KB

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