dbase.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. * $Id$
  3. *
  4. * Postgres module core functions
  5. *
  6. * Portions Copyright (C) 2001-2005 FhG FOKUS
  7. * Copyright (C) 2003 August.Net Services, LLC
  8. * Portions Copyright (C) 2005 iptelorg GmbH
  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. #ifndef _DBASE_H
  32. #define _DBASE_H
  33. #include "../../db/db_con.h"
  34. #include "../../db/db_res.h"
  35. #include "../../db/db_key.h"
  36. #include "../../db/db_op.h"
  37. #include "../../db/db_val.h"
  38. /*
  39. * Initialize database connection
  40. */
  41. db_con_t* pg_init(const char* uri);
  42. /*
  43. * Close a database connection
  44. */
  45. void pg_close(db_con_t* con);
  46. /*
  47. * Free all memory allocated by get_result
  48. */
  49. int pg_db_free_result(db_con_t* con, db_res_t* res);
  50. /*
  51. * Do a query
  52. */
  53. int pg_query(db_con_t* con, db_key_t* keys, db_op_t* ops, db_val_t* vals, db_key_t* cols, int n, int nc,
  54. db_key_t order, db_res_t** res);
  55. /*
  56. * Raw SQL query
  57. */
  58. int pg_raw_query(db_con_t* con, char* query, db_res_t** res);
  59. /*
  60. * Insert a row into table
  61. */
  62. int pg_insert(db_con_t* con, db_key_t* keys, db_val_t* vals, int n);
  63. /*
  64. * Delete a row from table
  65. */
  66. int pg_delete(db_con_t* con, db_key_t* keys, db_op_t* ops, db_val_t* vals, int n);
  67. /*
  68. * Update a row in table
  69. */
  70. int pg_update(db_con_t* con, db_key_t* keys, db_op_t* ops, db_val_t* vals,
  71. db_key_t* ucols, db_val_t* uvals, int n, int un);
  72. /*
  73. * Store name of table that will be used by
  74. * subsequent database functions
  75. */
  76. int pg_use_table(db_con_t* con, const char* table);
  77. #endif /* _DBASE_H */