pdo_firebird.c 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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: Ard Biesheuvel <abies@php.net> |
  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_firebird.h"
  25. #include "php_pdo_firebird_int.h"
  26. /* {{{ pdo_firebird_deps */
  27. static const zend_module_dep pdo_firebird_deps[] = {
  28. ZEND_MOD_REQUIRED("pdo")
  29. ZEND_MOD_END
  30. };
  31. /* }}} */
  32. zend_module_entry pdo_firebird_module_entry = { /* {{{ */
  33. STANDARD_MODULE_HEADER_EX, NULL,
  34. pdo_firebird_deps,
  35. "PDO_Firebird",
  36. NULL,
  37. PHP_MINIT(pdo_firebird),
  38. PHP_MSHUTDOWN(pdo_firebird),
  39. NULL,
  40. NULL,
  41. PHP_MINFO(pdo_firebird),
  42. PHP_PDO_FIREBIRD_VERSION,
  43. STANDARD_MODULE_PROPERTIES
  44. };
  45. /* }}} */
  46. #ifdef COMPILE_DL_PDO_FIREBIRD
  47. ZEND_GET_MODULE(pdo_firebird)
  48. #endif
  49. PHP_MINIT_FUNCTION(pdo_firebird) /* {{{ */
  50. {
  51. REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_DATE_FORMAT", (zend_long) PDO_FB_ATTR_DATE_FORMAT);
  52. REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIME_FORMAT", (zend_long) PDO_FB_ATTR_TIME_FORMAT);
  53. REGISTER_PDO_CLASS_CONST_LONG("FB_ATTR_TIMESTAMP_FORMAT", (zend_long) PDO_FB_ATTR_TIMESTAMP_FORMAT);
  54. if (FAILURE == php_pdo_register_driver(&pdo_firebird_driver)) {
  55. return FAILURE;
  56. }
  57. #ifdef ZEND_SIGNALS
  58. /* firebird replaces some signals at runtime, suppress warnings. */
  59. SIGG(check) = 0;
  60. #endif
  61. return SUCCESS;
  62. }
  63. /* }}} */
  64. PHP_MSHUTDOWN_FUNCTION(pdo_firebird) /* {{{ */
  65. {
  66. php_pdo_unregister_driver(&pdo_firebird_driver);
  67. return SUCCESS;
  68. }
  69. /* }}} */
  70. PHP_MINFO_FUNCTION(pdo_firebird) /* {{{ */
  71. {
  72. char version[64];
  73. isc_get_client_version(version);
  74. php_info_print_table_start();
  75. php_info_print_table_header(2, "PDO Driver for Firebird", "enabled");
  76. php_info_print_table_row(2, "Client Library Version", version);
  77. php_info_print_table_end();
  78. }
  79. /* }}} */