php_pdo.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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: Wez Furlong <wez@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef PHP_PDO_H
  17. #define PHP_PDO_H
  18. #include "zend.h"
  19. extern zend_module_entry pdo_module_entry;
  20. #define phpext_pdo_ptr &pdo_module_entry
  21. #include "php_version.h"
  22. #define PHP_PDO_VERSION PHP_VERSION
  23. #ifdef PHP_WIN32
  24. # if defined(PDO_EXPORTS) || (!defined(COMPILE_DL_PDO))
  25. # define PDO_API __declspec(dllexport)
  26. # elif defined(COMPILE_DL_PDO)
  27. # define PDO_API __declspec(dllimport)
  28. # else
  29. # define PDO_API /* nothing special */
  30. # endif
  31. #elif defined(__GNUC__) && __GNUC__ >= 4
  32. # define PDO_API __attribute__ ((visibility("default")))
  33. #else
  34. # define PDO_API /* nothing special */
  35. #endif
  36. #ifdef ZTS
  37. # include "TSRM.h"
  38. #endif
  39. PHP_MINIT_FUNCTION(pdo);
  40. PHP_MSHUTDOWN_FUNCTION(pdo);
  41. PHP_MINFO_FUNCTION(pdo);
  42. #define REGISTER_PDO_CLASS_CONST_LONG(const_name, value) \
  43. zend_declare_class_constant_long(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, (zend_long)value);
  44. #define REGISTER_PDO_CLASS_CONST_STRING(const_name, value) \
  45. zend_declare_class_constant_stringl(php_pdo_get_dbh_ce(), const_name, sizeof(const_name)-1, value, sizeof(value)-1);
  46. #define PDO_CONSTRUCT_CHECK \
  47. if (!dbh->driver) { \
  48. zend_throw_error(NULL, "PDO object is not initialized, constructor was not called"); \
  49. RETURN_THROWS(); \
  50. } \
  51. #endif /* PHP_PDO_H */