pdo_sqlite.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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: Wez Furlong <wez@php.net> |
  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_sqlite.h"
  27. #include "php_pdo_sqlite_int.h"
  28. #include "zend_exceptions.h"
  29. /* {{{ pdo_sqlite_functions[] */
  30. static const zend_function_entry pdo_sqlite_functions[] = {
  31. PHP_FE_END
  32. };
  33. /* }}} */
  34. /* {{{ pdo_sqlite_deps
  35. */
  36. static const zend_module_dep pdo_sqlite_deps[] = {
  37. ZEND_MOD_REQUIRED("pdo")
  38. ZEND_MOD_END
  39. };
  40. /* }}} */
  41. /* {{{ pdo_sqlite_module_entry
  42. */
  43. zend_module_entry pdo_sqlite_module_entry = {
  44. STANDARD_MODULE_HEADER_EX, NULL,
  45. pdo_sqlite_deps,
  46. "pdo_sqlite",
  47. pdo_sqlite_functions,
  48. PHP_MINIT(pdo_sqlite),
  49. PHP_MSHUTDOWN(pdo_sqlite),
  50. NULL,
  51. NULL,
  52. PHP_MINFO(pdo_sqlite),
  53. PHP_PDO_SQLITE_VERSION,
  54. STANDARD_MODULE_PROPERTIES
  55. };
  56. /* }}} */
  57. #if defined(COMPILE_DL_PDO_SQLITE) || defined(COMPILE_DL_PDO_SQLITE_EXTERNAL)
  58. ZEND_GET_MODULE(pdo_sqlite)
  59. #endif
  60. /* {{{ PHP_MINIT_FUNCTION */
  61. PHP_MINIT_FUNCTION(pdo_sqlite)
  62. {
  63. #ifdef SQLITE_DETERMINISTIC
  64. REGISTER_PDO_CLASS_CONST_LONG("SQLITE_DETERMINISTIC", (zend_long)SQLITE_DETERMINISTIC);
  65. #endif
  66. REGISTER_PDO_CLASS_CONST_LONG("SQLITE_ATTR_OPEN_FLAGS", (zend_long)PDO_SQLITE_ATTR_OPEN_FLAGS);
  67. REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_READONLY", (zend_long)SQLITE_OPEN_READONLY);
  68. REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_READWRITE", (zend_long)SQLITE_OPEN_READWRITE);
  69. REGISTER_PDO_CLASS_CONST_LONG("SQLITE_OPEN_CREATE", (zend_long)SQLITE_OPEN_CREATE);
  70. return php_pdo_register_driver(&pdo_sqlite_driver);
  71. }
  72. /* }}} */
  73. /* {{{ PHP_MSHUTDOWN_FUNCTION */
  74. PHP_MSHUTDOWN_FUNCTION(pdo_sqlite)
  75. {
  76. php_pdo_unregister_driver(&pdo_sqlite_driver);
  77. return SUCCESS;
  78. }
  79. /* }}} */
  80. /* {{{ PHP_MINFO_FUNCTION
  81. */
  82. PHP_MINFO_FUNCTION(pdo_sqlite)
  83. {
  84. php_info_print_table_start();
  85. php_info_print_table_header(2, "PDO Driver for SQLite 3.x", "enabled");
  86. php_info_print_table_row(2, "SQLite Library", sqlite3_libversion());
  87. php_info_print_table_end();
  88. }
  89. /* }}} */
  90. /*
  91. * Local variables:
  92. * tab-width: 4
  93. * c-basic-offset: 4
  94. * End:
  95. * vim600: noet sw=4 ts=4 fdm=marker
  96. * vim<600: noet sw=4 ts=4
  97. */