db_matrix.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*!
  2. * \file
  3. * \ingroup db
  4. * \brief Database support for modules.
  5. *
  6. * Database support functions for modules.
  7. *
  8. * @cond
  9. * WARNING:
  10. * This file was autogenerated from the XML source file
  11. * ../../modules/matrix/kamailio-matrix.xml.
  12. * It can be regenerated by running 'make modules' in the db/schema
  13. * directory of the source code. You need to have xsltproc and
  14. * docbook-xsl stylesheets installed.
  15. * ALL CHANGES DONE HERE WILL BE LOST IF THE FILE IS REGENERATED
  16. * @endcond
  17. */
  18. #ifndef db_matrix_h
  19. #define db_matrix_h
  20. /* necessary includes */
  21. #include "../../lib/srdb1/db.h"
  22. #include "../../str.h"
  23. #include "../../ut.h"
  24. #include <string.h>
  25. /* database variables */
  26. extern str matrix_db_url;
  27. extern db1_con_t * matrix_dbh;
  28. extern db_func_t matrix_dbf;
  29. #define matrix_DB_URL { "db_url", PARAM_STR, &matrix_db_url },
  30. #define matrix_DB_TABLE { "matrix_table", PARAM_STR, &matrix_table },
  31. extern str matrix_table;
  32. /* column names */
  33. extern str matrix_first_col;
  34. extern str matrix_second_col;
  35. extern str matrix_res_col;
  36. #define matrix_DB_COLS \
  37. { "matrix_first_col", PARAM_STR, &matrix_first_col }, \
  38. { "matrix_second_col", PARAM_STR, &matrix_second_col }, \
  39. { "matrix_res_col", PARAM_STR, &matrix_res_col }, \
  40. /* table version */
  41. extern const unsigned int matrix_version;
  42. /*
  43. * Closes the DB connection.
  44. */
  45. void matrix_db_close(void);
  46. /*!
  47. * Initialises the DB API, check the table version and closes the connection.
  48. * This should be called from the mod_init function.
  49. *
  50. * \return 0 means ok, -1 means an error occured.
  51. */
  52. int matrix_db_init(void);
  53. /*!
  54. * Initialize the DB connection without checking the table version and DB URL.
  55. * This should be called from child_init. An already existing database
  56. * connection will be closed, and a new one created.
  57. *
  58. * \return 0 means ok, -1 means an error occured.
  59. */
  60. int matrix_db_open(void);
  61. #endif