dbase.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /*
  2. * $Id$
  3. *
  4. * UNIXODBC module core functions
  5. *
  6. * Copyright (C) 2005-2006 Marco Lorrai
  7. * Copyright (C) 2008 1&1 Internet AG
  8. *
  9. * This file is part of Kamailio, a free SIP server.
  10. *
  11. * Kamailio is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License as published by
  13. * the Free Software Foundation; either version 2 of the License, or
  14. * (at your option) any later version
  15. *
  16. * Kamailio is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU General Public License
  22. * along with this program; if not, write to the Free Software
  23. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  24. *
  25. *
  26. * History:
  27. * --------
  28. * 2005-12-01 initial commit (chgen)
  29. */
  30. #ifndef DBASE_H
  31. #define DBASE_H
  32. #include "../../lib/srdb1/db_con.h"
  33. #include "../../lib/srdb1/db_res.h"
  34. #include "../../lib/srdb1/db_key.h"
  35. #include "../../lib/srdb1/db_op.h"
  36. #include "../../lib/srdb1/db_val.h"
  37. /*
  38. * Initialize database connection
  39. */
  40. db1_con_t* db_unixodbc_init(const str* _sqlurl);
  41. /*
  42. * Close a database connection
  43. */
  44. void db_unixodbc_close(db1_con_t* _h);
  45. /*
  46. * Free all memory allocated by get_result
  47. */
  48. int db_unixodbc_free_result(db1_con_t* _h, db1_res_t* _r);
  49. /*
  50. * Do a query
  51. */
  52. int db_unixodbc_query(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _op, const db_val_t* _v,
  53. const db_key_t* _c, const int _n, const int _nc, const db_key_t _o, db1_res_t** _r);
  54. /*
  55. * Fetch rows from a result
  56. */
  57. int db_unixodbc_fetch_result(const db1_con_t* _h, db1_res_t** _r, const int nrows);
  58. /*
  59. * Raw SQL query
  60. */
  61. int db_unixodbc_raw_query(const db1_con_t* _h, const str* _s, db1_res_t** _r);
  62. /*
  63. * Insert a row into table
  64. */
  65. int db_unixodbc_insert(const db1_con_t* _h, const db_key_t* _k, const db_val_t* _v, const int _n);
  66. /*
  67. * Delete a row from table
  68. */
  69. int db_unixodbc_delete(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o, const db_val_t* _v,
  70. const int _n);
  71. /*
  72. * Update a row in table
  73. */
  74. int db_unixodbc_update(const db1_con_t* _h, const db_key_t* _k, const db_op_t* _o, const db_val_t* _v,
  75. const db_key_t* _uk, const db_val_t* _uv, const int _n, const int _un);
  76. /*
  77. * Just like insert, but replace the row if it exists
  78. */
  79. int db_unixodbc_replace(const db1_con_t* handle, const db_key_t* keys, const db_val_t* vals,
  80. const int n, const int _un, const int _m);
  81. /*
  82. * Store name of table that will be used by
  83. * subsequent database functions
  84. */
  85. int db_unixodbc_use_table(db1_con_t* _h, const str* _t);
  86. #endif /* DBASE_H */