pdo_pgsql.c 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 7 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2018 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: Edin Kadribasic <edink@emini.dk> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifdef HAVE_CONFIG_H
  19. #include "config.h"
  20. #endif
  21. #include "php.h"
  22. #include "php_ini.h"
  23. #include "ext/standard/info.h"
  24. #include "pdo/php_pdo.h"
  25. #include "pdo/php_pdo_driver.h"
  26. #include "php_pdo_pgsql.h"
  27. #include "php_pdo_pgsql_int.h"
  28. #ifdef HAVE_PG_CONFIG_H
  29. #undef PACKAGE_BUGREPORT
  30. #undef PACKAGE_NAME
  31. #undef PACKAGE_STRING
  32. #undef PACKAGE_TARNAME
  33. #undef PACKAGE_VERSION
  34. #include <pg_config.h>
  35. #endif
  36. /* {{{ pdo_pgsql_functions[] */
  37. static const zend_function_entry pdo_pgsql_functions[] = {
  38. PHP_FE_END
  39. };
  40. /* }}} */
  41. /* {{{ pdo_sqlite_deps
  42. */
  43. static const zend_module_dep pdo_pgsql_deps[] = {
  44. ZEND_MOD_REQUIRED("pdo")
  45. ZEND_MOD_END
  46. };
  47. /* }}} */
  48. /* {{{ pdo_pgsql_module_entry */
  49. zend_module_entry pdo_pgsql_module_entry = {
  50. STANDARD_MODULE_HEADER_EX, NULL,
  51. pdo_pgsql_deps,
  52. "pdo_pgsql",
  53. pdo_pgsql_functions,
  54. PHP_MINIT(pdo_pgsql),
  55. PHP_MSHUTDOWN(pdo_pgsql),
  56. NULL,
  57. NULL,
  58. PHP_MINFO(pdo_pgsql),
  59. PHP_PDO_PGSQL_VERSION,
  60. STANDARD_MODULE_PROPERTIES
  61. };
  62. /* }}} */
  63. #ifdef COMPILE_DL_PDO_PGSQL
  64. ZEND_GET_MODULE(pdo_pgsql)
  65. #endif
  66. /* true global environment */
  67. /* {{{ PHP_MINIT_FUNCTION
  68. */
  69. PHP_MINIT_FUNCTION(pdo_pgsql)
  70. {
  71. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_ATTR_DISABLE_PREPARES", PDO_PGSQL_ATTR_DISABLE_PREPARES);
  72. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_IDLE", (zend_long)PGSQL_TRANSACTION_IDLE);
  73. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_ACTIVE", (zend_long)PGSQL_TRANSACTION_ACTIVE);
  74. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INTRANS", (zend_long)PGSQL_TRANSACTION_INTRANS);
  75. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_INERROR", (zend_long)PGSQL_TRANSACTION_INERROR);
  76. REGISTER_PDO_CLASS_CONST_LONG("PGSQL_TRANSACTION_UNKNOWN", (zend_long)PGSQL_TRANSACTION_UNKNOWN);
  77. php_pdo_register_driver(&pdo_pgsql_driver);
  78. return SUCCESS;
  79. }
  80. /* }}} */
  81. /* {{{ PHP_MSHUTDOWN_FUNCTION
  82. */
  83. PHP_MSHUTDOWN_FUNCTION(pdo_pgsql)
  84. {
  85. php_pdo_unregister_driver(&pdo_pgsql_driver);
  86. return SUCCESS;
  87. }
  88. /* }}} */
  89. /* {{{ PHP_MINFO_FUNCTION
  90. */
  91. PHP_MINFO_FUNCTION(pdo_pgsql)
  92. {
  93. php_info_print_table_start();
  94. php_info_print_table_row(2, "PDO Driver for PostgreSQL", "enabled");
  95. #ifdef HAVE_PG_CONFIG_H
  96. php_info_print_table_row(2, "PostgreSQL(libpq) Version", PG_VERSION);
  97. #endif
  98. php_info_print_table_end();
  99. }
  100. /* }}} */
  101. /*
  102. * Local variables:
  103. * tab-width: 4
  104. * c-basic-offset: 4
  105. * End:
  106. * vim600: noet sw=4 ts=4 fdm=marker
  107. * vim<600: noet sw=4 ts=4
  108. */