km_db_berkeley.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * $Id$
  3. *
  4. * db_berkeley module, portions of this code were templated using
  5. * the dbtext and postgres modules.
  6. * Copyright (C) 2007 Cisco Systems
  7. *
  8. * This file is part of SIP-router, a free SIP server.
  9. *
  10. * SIP-router is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * SIP-router is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * History:
  25. * --------
  26. * 2007-09-19 genesis (wiquan)
  27. */
  28. /*! \file
  29. * Berkeley DB :
  30. *
  31. * \ingroup database
  32. */
  33. #ifndef _KM_BDB_H_
  34. #define _KM_BDB_H_
  35. #include "../../lib/srdb1/db_con.h"
  36. #include "../../lib/srdb1/db_res.h"
  37. #include "../../lib/srdb1/db_key.h"
  38. #include "../../lib/srdb1/db_op.h"
  39. #include "../../lib/srdb1/db_val.h"
  40. #include "../../lib/srdb1/db.h"
  41. /* reloads the berkeley db */
  42. int bdb_reload(char* _n);
  43. void bdb_check_reload(db1_con_t* _con);
  44. int bdb_use_table(db1_con_t* _h, const str* _t);
  45. /*
  46. * Initialize database connection
  47. */
  48. db1_con_t* bdb_init(const str* _sqlurl);
  49. /*
  50. * Close a database connection
  51. */
  52. void bdb_close(db1_con_t* _h);
  53. /*
  54. * Free all memory allocated by get_result
  55. */
  56. int bdb_free_query(db1_con_t* _h, db1_res_t* _r);
  57. /*
  58. * Do a query
  59. */
  60. int km_bdb_query(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v,
  61. db_key_t* _c, int _n, int _nc, db_key_t _o, db1_res_t** _r);
  62. /*
  63. * Raw SQL query
  64. */
  65. int bdb_raw_query(db1_con_t* _h, char* _s, db1_res_t** _r);
  66. /*
  67. * Insert a row into table
  68. */
  69. int bdb_insert(db1_con_t* _h, db_key_t* _k, db_val_t* _v, int _n);
  70. /*
  71. * Delete a row from table
  72. */
  73. int bdb_delete(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v, int _n);
  74. int _bdb_delete_cursor(db1_con_t* _h, db_key_t* _k, db_op_t* _op, db_val_t* _v, int _n);
  75. /*
  76. * Update a row in table
  77. */
  78. int bdb_update(db1_con_t* _h, db_key_t* _k, db_op_t* _o, db_val_t* _v,
  79. db_key_t* _uk, db_val_t* _uv, int _n, int _un);
  80. int bdb_bind_api(db_func_t *dbb);
  81. int km_mod_init(void);
  82. void km_destroy(void);
  83. #endif