mysqli_priv.h 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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: Georg Richter <georg@php.net> |
  14. +----------------------------------------------------------------------+
  15. */
  16. #ifndef MYSQLI_PRIV_H
  17. #define MYSQLI_PRIV_H
  18. #ifdef PHP_MYSQL_UNIX_SOCK_ADDR
  19. #ifdef MYSQL_UNIX_ADDR
  20. #undef MYSQL_UNIX_ADDR
  21. #endif
  22. #define MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
  23. #endif
  24. extern const zend_function_entry mysqli_functions[];
  25. extern const zend_function_entry mysqli_link_methods[];
  26. extern const zend_function_entry mysqli_stmt_methods[];
  27. extern const zend_function_entry mysqli_result_methods[];
  28. extern const zend_function_entry mysqli_driver_methods[];
  29. extern const zend_function_entry mysqli_warning_methods[];
  30. extern const zend_function_entry mysqli_exception_methods[];
  31. extern const mysqli_property_entry mysqli_link_property_entries[];
  32. extern const mysqli_property_entry mysqli_result_property_entries[];
  33. extern const mysqli_property_entry mysqli_stmt_property_entries[];
  34. extern const mysqli_property_entry mysqli_driver_property_entries[];
  35. extern const mysqli_property_entry mysqli_warning_property_entries[];
  36. extern const zend_property_info mysqli_link_property_info_entries[];
  37. extern const zend_property_info mysqli_result_property_info_entries[];
  38. extern const zend_property_info mysqli_stmt_property_info_entries[];
  39. extern const zend_property_info mysqli_driver_property_info_entries[];
  40. extern const zend_property_info mysqli_warning_property_info_entries[];
  41. extern int php_le_pmysqli(void);
  42. extern void php_mysqli_dtor_p_elements(void *data);
  43. extern void php_mysqli_close(MY_MYSQL * mysql, int close_type, int resource_status);
  44. extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flag, int into_object);
  45. extern void php_clear_stmt_bind(MY_STMT *stmt);
  46. extern void php_clear_mysql(MY_MYSQL *);
  47. #ifdef MYSQLI_USE_MYSQLND
  48. extern MYSQLI_WARNING *php_get_warnings(MYSQLND_CONN_DATA * mysql);
  49. #else
  50. extern MYSQLI_WARNING *php_get_warnings(MYSQL * mysql);
  51. #endif
  52. extern void php_clear_warnings(MYSQLI_WARNING *w);
  53. extern void php_free_stmt_bind_buffer(BIND_BUFFER bbuf, int type);
  54. extern void php_mysqli_report_error(const char *sqlstate, int errorno, const char *error);
  55. extern void php_mysqli_report_index(const char *query, unsigned int status);
  56. extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno, char *format, ...);
  57. #define PHP_MYSQLI_EXPORT(__type) PHP_MYSQLI_API __type
  58. PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry *);
  59. #define MYSQLI_DISABLE_MQ if (mysql->multi_query) { \
  60. mysql_set_server_option(mysql->mysql, MYSQL_OPTION_MULTI_STATEMENTS_OFF); \
  61. mysql->multi_query = 0; \
  62. }
  63. #define MYSQLI_ENABLE_MQ if (!mysql->multi_query) { \
  64. mysql_set_server_option(mysql->mysql, MYSQL_OPTION_MULTI_STATEMENTS_ON); \
  65. mysql->multi_query = 1; \
  66. }
  67. /* Numbers that cannot be represented as a signed int are converted to a string instead (affects 32-bit builds). */
  68. #define MYSQLI_RETURN_LONG_INT(__val) \
  69. { \
  70. if ((__val) < ZEND_LONG_MAX) { \
  71. RETURN_LONG((zend_long) (__val)); \
  72. } else { \
  73. /* always used with my_ulonglong -> %llu */ \
  74. RETURN_STR(strpprintf(0, MYSQLI_LLU_SPEC, (__val))); \
  75. } \
  76. }
  77. #define MYSQLI_STORE_RESULT 0
  78. #define MYSQLI_USE_RESULT 1
  79. #ifdef MYSQLI_USE_MYSQLND
  80. #define MYSQLI_ASYNC 8
  81. #define MYSQLI_STORE_RESULT_COPY_DATA 16
  82. #else
  83. /* libmysql */
  84. #define MYSQLI_ASYNC 0
  85. #define MYSQLI_STORE_RESULT_COPY_DATA 0
  86. #endif
  87. /* for mysqli_fetch_assoc */
  88. #define MYSQLI_ASSOC 1
  89. #define MYSQLI_NUM 2
  90. #define MYSQLI_BOTH 3
  91. /* fetch types */
  92. #define FETCH_SIMPLE 1
  93. #define FETCH_RESULT 2
  94. /*** REPORT MODES ***/
  95. #define MYSQLI_REPORT_OFF 0
  96. #define MYSQLI_REPORT_ERROR 1
  97. #define MYSQLI_REPORT_STRICT 2
  98. #define MYSQLI_REPORT_INDEX 4
  99. #define MYSQLI_REPORT_CLOSE 8
  100. #define MYSQLI_REPORT_ALL 255
  101. #define MYSQLI_REPORT_MYSQL_ERROR(mysql) \
  102. if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql_errno(mysql)) { \
  103. php_mysqli_report_error(mysql_sqlstate(mysql), mysql_errno(mysql), mysql_error(mysql)); \
  104. }
  105. #define MYSQLI_REPORT_STMT_ERROR(stmt) \
  106. if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql_stmt_errno(stmt)) { \
  107. php_mysqli_report_error(mysql_stmt_sqlstate(stmt), mysql_stmt_errno(stmt), mysql_stmt_error(stmt)); \
  108. }
  109. void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, bool in_ctor);
  110. void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS, bool is_method);
  111. #endif /* MYSQLI_PRIV_H */