pdo_pgsql.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Author: Edin Kadribasic <edink@emini.dk> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifdef HAVE_CONFIG_H
  17. #include "config.h"
  18. #endif
  19. #include "php.h"
  20. #include "php_ini.h"
  21. #include "ext/standard/info.h"
  22. #include "pdo/php_pdo.h"
  23. #include "pdo/php_pdo_driver.h"
  24. #include "php_pdo_pgsql.h"
  25. #include "php_pdo_pgsql_int.h"
  26. /* {{{ pdo_sqlite_deps */
  27. static const zend_module_dep pdo_pgsql_deps[] = {
  28. ZEND_MOD_REQUIRED("pdo")
  29. ZEND_MOD_END
  30. };
  31. /* }}} */
  32. /* {{{ pdo_pgsql_module_entry */
  33. zend_module_entry pdo_pgsql_module_entry = {
  34. STANDARD_MODULE_HEADER_EX, NULL,
  35. pdo_pgsql_deps,
  36. "pdo_pgsql",
  37. NULL,
  38. PHP_MINIT(pdo_pgsql),
  39. PHP_MSHUTDOWN(pdo_pgsql),
  40. NULL,
  41. NULL,
  42. PHP_MINFO(pdo_pgsql),
  43. PHP_PDO_PGSQL_VERSION,
  44. STANDARD_MODULE_PROPERTIES
  45. };
  46. /* }}} */
  47. #ifdef COMPILE_DL_PDO_PGSQL
  48. ZEND_GET_MODULE(pdo_pgsql)
  49. #endif
  50. /* true global environment */
  51. /* {{{ PHP_MINIT_FUNCTION */
  52. PHP_MINIT_FUNCTION(pdo_pgsql)
  53. {
  54. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES);
  55. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (zend_long)PGSQL_TRANSACTION_IDLE);
  56. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (zend_long)PGSQL_TRANSACTION_ACTIVE);
  57. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (zend_long)PGSQL_TRANSACTION_INTRANS);
  58. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (zend_long)PGSQL_TRANSACTION_INERROR);
  59. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (zend_long)PGSQL_TRANSACTION_UNKNOWN);
  60. return php_pdo_register_driver(&pdo_pgsql_driver);
  61. }
  62. /* }}} */
  63. /* {{{ PHP_MSHUTDOWN_FUNCTION */
  64. PHP_MSHUTDOWN_FUNCTION(pdo_pgsql)
  65. {
  66. php_pdo_unregister_driver(&pdo_pgsql_driver);
  67. return SUCCESS;
  68. }
  69. /* }}} */
  70. /* {{{ PHP_MINFO_FUNCTION */
  71. PHP_MINFO_FUNCTION(pdo_pgsql)
  72. {
  73. char buf[16];
  74. php_info_print_table_start();
  75. php_info_print_table_row(2, "PDO Driver for PostgreSQL", "enabled");
  76. pdo_libpq_version(buf, sizeof(buf));
  77. php_info_print_table_row(2, "PostgreSQL(libpq) Version", buf);
  78. php_info_print_table_end();
  79. }
  80. /* }}} */