Back to index

php5  5.3.10
mysqli_priv.h
Go to the documentation of this file.
00001 /*
00002   +----------------------------------------------------------------------+
00003   | PHP Version 5                                                        |
00004   +----------------------------------------------------------------------+
00005   | Copyright (c) 1997-2012 The PHP Group                                |
00006   +----------------------------------------------------------------------+
00007   | This source file is subject to version 3.01 of the PHP license,      |
00008   | that is bundled with this package in the file LICENSE, and is        |
00009   | available through the world-wide-web at the following url:           |
00010   | http://www.php.net/license/3_01.txt                                  |
00011   | If you did not receive a copy of the PHP license and are unable to   |
00012   | obtain it through the world-wide-web, please send a note to          |
00013   | license@php.net so we can mail you a copy immediately.               |
00014   +----------------------------------------------------------------------+
00015   | Author: Georg Richter <georg@php.net>                                |
00016   +----------------------------------------------------------------------+
00017 
00018   $Id: php_mysqli_structs.h 302179 2010-08-13 09:57:04Z andrey $
00019 */
00020 
00021 #ifndef MYSQLI_PRIV_H
00022 #define MYSQLI_PRIV_H
00023 
00024 #ifdef PHP_MYSQL_UNIX_SOCK_ADDR
00025 #ifdef MYSQL_UNIX_ADDR
00026 #undef MYSQL_UNIX_ADDR
00027 #endif
00028 #define MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
00029 #endif
00030 
00031 /* character set support */
00032 #if defined(MYSQLND_VERSION_ID) || MYSQL_VERSION_ID > 50009
00033 #define HAVE_MYSQLI_GET_CHARSET
00034 #endif
00035 
00036 #if defined(MYSQLND_VERSION_ID) || (MYSQL_VERSION_ID > 40112 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID > 50005
00037 #define HAVE_MYSQLI_SET_CHARSET
00038 #endif
00039 
00040 
00041 extern const zend_function_entry mysqli_functions[];
00042 extern const zend_function_entry mysqli_link_methods[];
00043 extern const zend_function_entry mysqli_stmt_methods[];
00044 extern const zend_function_entry mysqli_result_methods[];
00045 extern const zend_function_entry mysqli_driver_methods[];
00046 extern const zend_function_entry mysqli_warning_methods[];
00047 extern const zend_function_entry mysqli_exception_methods[];
00048 
00049 extern const mysqli_property_entry mysqli_link_property_entries[];
00050 extern const mysqli_property_entry mysqli_result_property_entries[];
00051 extern const mysqli_property_entry mysqli_stmt_property_entries[];
00052 extern const mysqli_property_entry mysqli_driver_property_entries[];
00053 extern const mysqli_property_entry mysqli_warning_property_entries[];
00054 
00055 extern zend_property_info mysqli_link_property_info_entries[];
00056 extern zend_property_info mysqli_result_property_info_entries[];
00057 extern zend_property_info mysqli_stmt_property_info_entries[];
00058 extern zend_property_info mysqli_driver_property_info_entries[];
00059 extern zend_property_info mysqli_warning_property_info_entries[];
00060 
00061 extern int php_le_pmysqli(void);
00062 extern void php_mysqli_dtor_p_elements(void *data);
00063 
00064 extern void php_mysqli_close(MY_MYSQL * mysql, int close_type, int resource_status TSRMLS_DC);
00065 
00066 extern void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flag, int into_object);
00067 extern void php_clear_stmt_bind(MY_STMT *stmt TSRMLS_DC);
00068 extern void php_clear_mysql(MY_MYSQL *);
00069 extern MYSQLI_WARNING *php_get_warnings(MYSQL *mysql TSRMLS_DC);
00070 extern void php_clear_warnings(MYSQLI_WARNING *w);
00071 extern void php_free_stmt_bind_buffer(BIND_BUFFER bbuf, int type);
00072 extern void php_mysqli_report_error(const char *sqlstate, int errorno, const char *error TSRMLS_DC);
00073 extern void php_mysqli_report_index(const char *query, unsigned int status TSRMLS_DC);
00074 extern void php_set_local_infile_handler_default(MY_MYSQL *);
00075 extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC, char *format, ...);
00076 
00077 #ifdef HAVE_SPL
00078 extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
00079 #endif
00080 
00081 #define REGISTER_MYSQLI_CLASS_ENTRY(name, mysqli_entry, class_functions) { \
00082        zend_class_entry tmp_ce; \
00083        INIT_CLASS_ENTRY(tmp_ce, name,class_functions); \
00084        tmp_ce.create_object = mysqli_objects_new; \
00085        mysqli_entry = zend_register_internal_class(&tmp_ce TSRMLS_CC); \
00086 } \
00087 
00088 #define PHP_MYSQLI_EXPORT(__type) PHP_MYSQLI_API __type
00089 
00090 PHP_MYSQLI_EXPORT(zend_object_value) mysqli_objects_new(zend_class_entry * TSRMLS_DC);
00091 
00092 
00093 #define MYSQLI_DISABLE_MQ if (mysql->multi_query) { \
00094        mysql_set_server_option(mysql->mysql, MYSQL_OPTION_MULTI_STATEMENTS_OFF); \
00095        mysql->multi_query = 0; \
00096 }
00097 
00098 #define MYSQLI_ENABLE_MQ if (!mysql->multi_query) { \
00099        mysql_set_server_option(mysql->mysql, MYSQL_OPTION_MULTI_STATEMENTS_ON); \
00100        mysql->multi_query = 1; \
00101 }
00102 
00103 
00104 #define MYSQLI_RETURN_LONG_LONG(__val) \
00105 { \
00106        if ((__val) < LONG_MAX) {          \
00107               RETURN_LONG((long) (__val));              \
00108        } else {                           \
00109               char *ret;                  \
00110               /* always used with my_ulonglong -> %llu */ \
00111               int l = spprintf(&ret, 0, MYSQLI_LLU_SPEC, (__val));    \
00112               RETURN_STRINGL(ret, l, 0);         \
00113        }                                  \
00114 }
00115 
00116 #define MYSQLI_STORE_RESULT 0
00117 #define MYSQLI_USE_RESULT   1
00118 #ifdef MYSQLI_USE_MYSQLND
00119 #define MYSQLI_ASYNC        8
00120 #else
00121 /* libmysql */
00122 #define MYSQLI_ASYNC        0
00123 #endif
00124 
00125 /* for mysqli_fetch_assoc */
00126 #define MYSQLI_ASSOC 1
00127 #define MYSQLI_NUM          2
00128 #define MYSQLI_BOTH         3
00129 
00130 /* fetch types */
00131 #define FETCH_SIMPLE        1
00132 #define FETCH_RESULT        2
00133 
00134 /*** REPORT MODES ***/
00135 #define MYSQLI_REPORT_OFF           0
00136 #define MYSQLI_REPORT_ERROR               1
00137 #define MYSQLI_REPORT_STRICT              2
00138 #define MYSQLI_REPORT_INDEX               4
00139 #define MYSQLI_REPORT_CLOSE               8
00140 #define MYSQLI_REPORT_ALL            255
00141 
00142 #define MYSQLI_REPORT_MYSQL_ERROR(mysql) \
00143 if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql_errno(mysql)) { \
00144        php_mysqli_report_error(mysql_sqlstate(mysql), mysql_errno(mysql), mysql_error(mysql) TSRMLS_CC); \
00145 }
00146 
00147 #define MYSQLI_REPORT_STMT_ERROR(stmt) \
00148 if ((MyG(report_mode) & MYSQLI_REPORT_ERROR) && mysql_stmt_errno(stmt)) { \
00149        php_mysqli_report_error(mysql_stmt_sqlstate(stmt), mysql_stmt_errno(stmt), mysql_stmt_error(stmt) TSRMLS_CC); \
00150 }
00151 
00152 void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_connect, zend_bool in_ctor);
00153 
00154 void php_mysqli_init(INTERNAL_FUNCTION_PARAMETERS);
00155 
00156 #endif /* MYSQLI_PRIV_H */