mirror of
https://github.com/php/php-src.git
synced 2024-11-28 20:34:29 +08:00
ported ext/mysqli
This commit is contained in:
parent
bdbf47df18
commit
c517d6d853
@ -884,7 +884,7 @@ PHP_MSHUTDOWN_FUNCTION(mysqli)
|
||||
#ifndef MYSQLI_USE_MYSQLND
|
||||
#if MYSQL_VERSION_ID >= 40000
|
||||
#ifdef PHP_WIN32
|
||||
unsigned long client_ver = mysql_get_client_version();
|
||||
php_uint_t client_ver = mysql_get_client_version();
|
||||
/*
|
||||
Can't call mysql_server_end() multiple times prior to 5.0.46 on Windows.
|
||||
PHP bug#41350 MySQL bug#25621
|
||||
@ -1105,7 +1105,7 @@ PHP_FUNCTION(mysqli_result_construct)
|
||||
MYSQL_RES *result = NULL;
|
||||
zval *mysql_link;
|
||||
MYSQLI_RESOURCE *mysqli_resource;
|
||||
long resmode = MYSQLI_STORE_RESULT;
|
||||
php_int_t resmode = MYSQLI_STORE_RESULT;
|
||||
|
||||
switch (ZEND_NUM_ARGS()) {
|
||||
case 1:
|
||||
@ -1114,7 +1114,7 @@ PHP_FUNCTION(mysqli_result_construct)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (zend_parse_parameters(2 TSRMLS_CC, "Ol", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) {
|
||||
if (zend_parse_parameters(2 TSRMLS_CC, "Oi", &mysql_link, mysqli_link_class_entry, &resmode)==FAILURE) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -1149,13 +1149,13 @@ PHP_FUNCTION(mysqli_result_construct)
|
||||
|
||||
/* {{{ php_mysqli_fetch_into_hash_aux
|
||||
*/
|
||||
void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long fetchtype TSRMLS_DC)
|
||||
void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC)
|
||||
{
|
||||
#if !defined(MYSQLI_USE_MYSQLND)
|
||||
MYSQL_ROW row;
|
||||
unsigned int i;
|
||||
MYSQL_FIELD *fields;
|
||||
unsigned long *field_len;
|
||||
php_uint_t *field_len;
|
||||
|
||||
if (!(row = mysql_fetch_row(result))) {
|
||||
RETURN_NULL();
|
||||
@ -1238,7 +1238,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_result;
|
||||
long fetchtype;
|
||||
php_int_t fetchtype;
|
||||
zval *ctor_params = NULL;
|
||||
zend_class_entry *ce = NULL;
|
||||
|
||||
@ -1266,7 +1266,7 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags
|
||||
fetchtype = override_flags;
|
||||
} else {
|
||||
fetchtype = MYSQLI_BOTH;
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &fetchtype) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -213,9 +213,9 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in
|
||||
break;
|
||||
|
||||
case 'i': /* Integer */
|
||||
#if SIZEOF_LONG==8
|
||||
#if SIZEOF_ZEND_INT==8
|
||||
bind[ofs].buffer_type = MYSQL_TYPE_LONGLONG;
|
||||
#elif SIZEOF_LONG==4
|
||||
#elif SIZEOF_ZEND_INT==4
|
||||
bind[ofs].buffer_type = MYSQL_TYPE_LONG;
|
||||
#endif
|
||||
bind[ofs].buffer = &Z_IVAL_P(param);
|
||||
@ -284,9 +284,9 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned in
|
||||
type = MYSQL_TYPE_DOUBLE;
|
||||
break;
|
||||
case 'i': /* Integer */
|
||||
#if SIZEOF_LONG==8
|
||||
#if SIZEOF_ZEND_INT==8
|
||||
type = MYSQL_TYPE_LONGLONG;
|
||||
#elif SIZEOF_LONG==4
|
||||
#elif SIZEOF_ZEND_INT==4
|
||||
type = MYSQL_TYPE_LONG;
|
||||
#endif
|
||||
break;
|
||||
@ -326,7 +326,7 @@ PHP_FUNCTION(mysqli_stmt_bind_param)
|
||||
zval *mysql_stmt;
|
||||
char *types;
|
||||
int types_len;
|
||||
unsigned long rc;
|
||||
php_uint_t rc;
|
||||
|
||||
/* calculate and check number of parameters */
|
||||
if (argc < 2) {
|
||||
@ -392,7 +392,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un
|
||||
int i, ofs;
|
||||
int var_cnt = argc - start;
|
||||
long col_type;
|
||||
ulong rc;
|
||||
php_uint_t rc;
|
||||
|
||||
/* prevent leak if variables are already bound */
|
||||
if (stmt->result.var_cnt) {
|
||||
@ -488,7 +488,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc, un
|
||||
/* Changed to my_bool in MySQL 5.1. See MySQL Bug #16144 */
|
||||
my_bool tmp;
|
||||
#else
|
||||
ulong tmp = 0;
|
||||
php_uint_t tmp = 0;
|
||||
#endif
|
||||
stmt->result.buf[ofs].type = IS_STRING;
|
||||
/*
|
||||
@ -578,7 +578,7 @@ PHP_FUNCTION(mysqli_stmt_bind_result)
|
||||
zval *args;
|
||||
int argc = ZEND_NUM_ARGS();
|
||||
int start = 1;
|
||||
ulong rc;
|
||||
php_uint_t rc;
|
||||
MY_STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
|
||||
@ -624,7 +624,7 @@ PHP_FUNCTION(mysqli_change_user)
|
||||
zval *mysql_link = NULL;
|
||||
char *user, *password, *dbname;
|
||||
int user_len, password_len, dbname_len;
|
||||
ulong rc;
|
||||
php_uint_t rc;
|
||||
#if !defined(MYSQLI_USE_MYSQLND) && defined(HAVE_MYSQLI_SET_CHARSET)
|
||||
const CHARSET_INFO * old_charset;
|
||||
#endif
|
||||
@ -752,11 +752,11 @@ PHP_FUNCTION(mysqli_commit)
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
zval *mysql_link;
|
||||
long flags = TRANS_COR_NO_OPT;
|
||||
php_int_t flags = TRANS_COR_NO_OPT;
|
||||
char * name = NULL;
|
||||
int name_len = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
@ -778,9 +778,9 @@ PHP_FUNCTION(mysqli_data_seek)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_result;
|
||||
long offset;
|
||||
php_int_t offset;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -951,7 +951,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
|
||||
MY_STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
unsigned int i;
|
||||
ulong ret;
|
||||
php_uint_t ret;
|
||||
unsigned int uval;
|
||||
my_ulonglong llval;
|
||||
|
||||
@ -996,7 +996,7 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
/* unsigned int (11) */
|
||||
uval= *(unsigned int *) stmt->result.buf[i].val;
|
||||
#if SIZEOF_LONG==4
|
||||
#if SIZEOF_ZEND_INT==4
|
||||
if (uval > INT_MAX) {
|
||||
char *tmp, *p;
|
||||
int j = 10;
|
||||
@ -1047,9 +1047,9 @@ void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
llval= *(my_ulonglong *) stmt->result.buf[i].val;
|
||||
}
|
||||
#if SIZEOF_LONG==8
|
||||
#if SIZEOF_ZEND_INT==8
|
||||
if (uns && llval > 9223372036854775807L) {
|
||||
#elif SIZEOF_LONG==4
|
||||
#elif SIZEOF_ZEND_INT==4
|
||||
if ((uns && llval > L64(2147483647)) ||
|
||||
(!uns && (( L64(2147483647) < (my_longlong) llval) ||
|
||||
(L64(-2147483648) > (my_longlong) llval))))
|
||||
@ -1234,15 +1234,15 @@ PHP_FUNCTION(mysqli_fetch_field_direct)
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_result;
|
||||
const MYSQL_FIELD *field;
|
||||
long offset;
|
||||
php_int_t offset;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
|
||||
|
||||
if (offset < 0 || offset >= (long) mysql_num_fields(result)) {
|
||||
if (offset < 0 || offset >= (php_int_t) mysql_num_fields(result)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field offset is invalid for resultset");
|
||||
RETURN_FALSE;
|
||||
}
|
||||
@ -1263,7 +1263,7 @@ PHP_FUNCTION(mysqli_fetch_lengths)
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_result;
|
||||
unsigned int i;
|
||||
unsigned long *ret;
|
||||
php_uint_t *ret;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
|
||||
return;
|
||||
@ -1315,9 +1315,9 @@ PHP_FUNCTION(mysqli_field_seek)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_result;
|
||||
long fieldnr;
|
||||
php_int_t fieldnr;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_result, mysqli_result_class_entry, &fieldnr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
|
||||
@ -1380,7 +1380,7 @@ PHP_FUNCTION(mysqli_get_client_info)
|
||||
Get MySQL client info */
|
||||
PHP_FUNCTION(mysqli_get_client_version)
|
||||
{
|
||||
RETURN_INT((long)mysql_get_client_version());
|
||||
RETURN_INT((php_int_t)mysql_get_client_version());
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -1550,9 +1550,9 @@ PHP_FUNCTION(mysqli_kill)
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
zval *mysql_link;
|
||||
long processid;
|
||||
php_int_t processid;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
@ -1761,12 +1761,12 @@ PHP_FUNCTION(mysqli_options)
|
||||
MY_MYSQL *mysql;
|
||||
zval *mysql_link = NULL;
|
||||
zval *mysql_value;
|
||||
long mysql_option;
|
||||
php_int_t mysql_option;
|
||||
unsigned int l_value;
|
||||
long ret;
|
||||
php_int_t ret;
|
||||
int expected_type;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oiz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
|
||||
@ -1816,7 +1816,7 @@ PHP_FUNCTION(mysqli_ping)
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
zval *mysql_link;
|
||||
long rc;
|
||||
php_int_t rc;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
|
||||
return;
|
||||
@ -1976,11 +1976,11 @@ PHP_FUNCTION(mysqli_rollback)
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
zval *mysql_link;
|
||||
long flags = TRANS_COR_NO_OPT;
|
||||
php_int_t flags = TRANS_COR_NO_OPT;
|
||||
char * name = NULL;
|
||||
int name_len = 0;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
@ -2003,10 +2003,10 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
|
||||
MY_STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
char *data;
|
||||
long param_nr;
|
||||
php_int_t param_nr;
|
||||
int data_len;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ols", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ois", &mysql_stmt, mysqli_stmt_class_entry, ¶m_nr, &data, &data_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
|
||||
@ -2069,9 +2069,9 @@ PHP_FUNCTION(mysqli_stmt_data_seek)
|
||||
{
|
||||
MY_STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
long offset;
|
||||
php_int_t offset;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (offset < 0) {
|
||||
@ -2296,9 +2296,9 @@ PHP_FUNCTION(mysqli_refresh)
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
zval *mysql_link = NULL;
|
||||
long options;
|
||||
php_int_t options;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_link, mysqli_link_class_entry, &options) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_INITIALIZED);
|
||||
@ -2316,21 +2316,21 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
|
||||
{
|
||||
MY_STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
long mode_in;
|
||||
php_int_t mode_in;
|
||||
#if MYSQL_VERSION_ID >= 50107
|
||||
my_bool mode_b;
|
||||
#endif
|
||||
ulong mode;
|
||||
ulong attr;
|
||||
php_uint_t mode;
|
||||
php_int_t attr;
|
||||
void *mode_p;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oii", &mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
|
||||
|
||||
if (mode_in < 0) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "mode should be non-negative, %ld passed", mode_in);
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "mode should be non-negative, %pd passed", mode_in);
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
||||
@ -2363,11 +2363,11 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
|
||||
{
|
||||
MY_STMT *stmt;
|
||||
zval *mysql_stmt;
|
||||
ulong value = 0;
|
||||
ulong attr;
|
||||
php_uint_t value = 0;
|
||||
php_int_t attr;
|
||||
int rc;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oi", &mysql_stmt, mysqli_stmt_class_entry, &attr) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
|
||||
@ -2380,7 +2380,7 @@ PHP_FUNCTION(mysqli_stmt_attr_get)
|
||||
if (attr == STMT_ATTR_UPDATE_MAX_LENGTH)
|
||||
value = *((my_bool *)&value);
|
||||
#endif
|
||||
RETURN_INT((long)value);
|
||||
RETURN_INT((php_uint_t)value);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
@ -2580,10 +2580,10 @@ PHP_FUNCTION(mysqli_store_result)
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_link;
|
||||
MYSQLI_RESOURCE *mysqli_resource;
|
||||
long flags = 0;
|
||||
php_int_t flags = 0;
|
||||
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_link, mysqli_link_class_entry, &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
@ -2619,7 +2619,7 @@ PHP_FUNCTION(mysqli_thread_id)
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
||||
RETURN_INT((long) mysql_thread_id(mysql->mysql));
|
||||
RETURN_INT((php_int_t) mysql_thread_id(mysql->mysql));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
@ -32,7 +32,7 @@
|
||||
PHP_FUNCTION(mysqli_embedded_server_start)
|
||||
{
|
||||
#ifdef HAVE_EMBEDDED_MYSQLI
|
||||
long start;
|
||||
php_int_t start;
|
||||
zval *args;
|
||||
zval *grps;
|
||||
|
||||
@ -42,7 +42,7 @@ PHP_FUNCTION(mysqli_embedded_server_start)
|
||||
HashPosition pos;
|
||||
int index, rc;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "laa", &start, &args, &grps) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "iaa", &start, &args, &grps) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@
|
||||
|
||||
/* {{{ php_mysqli_set_error
|
||||
*/
|
||||
static void php_mysqli_set_error(long mysql_errno, char *mysql_err TSRMLS_DC)
|
||||
static void php_mysqli_set_error(php_int_t mysql_errno, char *mysql_err TSRMLS_DC)
|
||||
{
|
||||
MyG(error_no) = mysql_errno;
|
||||
if (MyG(error_msg)) {
|
||||
@ -64,7 +64,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||
char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
|
||||
int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0;
|
||||
zend_bool persistent = FALSE;
|
||||
long port = 0, flags = 0;
|
||||
php_int_t port = 0, flags = 0;
|
||||
zend_string *hash_key = NULL;
|
||||
zend_bool new_connection = FALSE;
|
||||
zend_resource *le;
|
||||
@ -87,7 +87,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||
hostname = username = dbname = passwd = socket = NULL;
|
||||
|
||||
if (!is_real_connect) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssls", &hostname, &hostname_len, &username, &username_len,
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|ssssis", &hostname, &hostname_len, &username, &username_len,
|
||||
&passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
@ -105,7 +105,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||
flags |= CLIENT_MULTI_RESULTS; /* needed for mysql_multi_query() */
|
||||
} else {
|
||||
/* We have flags too */
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|sssslsl", &object, mysqli_link_class_entry,
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ssssisi", &object, mysqli_link_class_entry,
|
||||
&hostname, &hostname_len, &username, &username_len, &passwd, &passwd_len, &dbname, &dbname_len, &port, &socket, &socket_len,
|
||||
&flags) == FAILURE) {
|
||||
return;
|
||||
@ -207,7 +207,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
|
||||
if (persistent && MyG(max_persistent) != -1 &&
|
||||
(MyG(num_active_persistent) + MyG(num_inactive_persistent))>= MyG(max_persistent))
|
||||
{
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%ld)",
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Too many open persistent links (%pd)",
|
||||
MyG(num_active_persistent) + MyG(num_inactive_persistent));
|
||||
goto err;
|
||||
}
|
||||
@ -360,9 +360,9 @@ PHP_FUNCTION(mysqli_fetch_all)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
zval *mysql_result;
|
||||
long mode = MYSQLND_FETCH_NUM;
|
||||
php_int_t mode = MYSQLND_FETCH_NUM;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|l", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|i", &mysql_result, mysqli_result_class_entry, &mode) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
|
||||
@ -549,9 +549,9 @@ PHP_FUNCTION(mysqli_query)
|
||||
MYSQL_RES *result = NULL;
|
||||
char *query = NULL;
|
||||
int query_len;
|
||||
long resultmode = MYSQLI_STORE_RESULT;
|
||||
php_int_t resultmode = MYSQLI_STORE_RESULT;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|l", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os|i", &mysql_link, mysqli_link_class_entry, &query, &query_len, &resultmode) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -750,11 +750,11 @@ PHP_FUNCTION(mysqli_poll)
|
||||
{
|
||||
zval *r_array, *e_array, *dont_poll_array;
|
||||
MYSQLND **new_r_array = NULL, **new_e_array = NULL, **new_dont_poll_array = NULL;
|
||||
long sec = 0, usec = 0;
|
||||
php_int_t sec = 0, usec = 0;
|
||||
enum_func_status ret;
|
||||
int desc_num;
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!al|l", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!ai|i", &r_array, &e_array, &dont_poll_array, &sec, &usec) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
if (sec < 0 || usec < 0) {
|
||||
@ -1076,12 +1076,12 @@ PHP_FUNCTION(mysqli_begin_transaction)
|
||||
{
|
||||
MY_MYSQL *mysql;
|
||||
zval *mysql_link;
|
||||
long flags = TRANS_START_NO_OPT;
|
||||
php_int_t flags = TRANS_START_NO_OPT;
|
||||
char * name = NULL;
|
||||
int name_len = -1;
|
||||
zend_bool err = FALSE;
|
||||
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|ls", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
|
||||
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|is", &mysql_link, mysqli_link_class_entry, &flags, &name, &name_len) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
|
||||
|
@ -98,8 +98,8 @@ PHP_MYSQLI_EXPORT(zend_object *) mysqli_objects_new(zend_class_entry * TSRMLS_DC
|
||||
|
||||
#define MYSQLI_RETURN_INT_INT(__val) \
|
||||
{ \
|
||||
if ((__val) < LONG_MAX) { \
|
||||
RETURN_INT((long) (__val)); \
|
||||
if ((__val) < PHP_INT_MAX) { \
|
||||
RETURN_INT((php_int_t) (__val)); \
|
||||
} else { \
|
||||
/* always used with my_ulonglong -> %llu */ \
|
||||
RETURN_STR(strpprintf(0, MYSQLI_LLU_SPEC, (__val))); \
|
||||
|
@ -81,8 +81,8 @@ static zval *__func(mysqli_object *obj, zval *retval TSRMLS_DC) \
|
||||
ZVAL_NULL(retval);\
|
||||
} else {\
|
||||
l = (__ret_type)__int_func(p);\
|
||||
if (l < LONG_MAX) {\
|
||||
ZVAL_INT(retval, (long) l);\
|
||||
if (l < PHP_INT_MAX) {\
|
||||
ZVAL_INT(retval, (php_int_t) l);\
|
||||
} else { \
|
||||
ZVAL_STR(retval, strpprintf(0, __ret_type_sprint_mod, l)); \
|
||||
} \
|
||||
@ -167,8 +167,8 @@ static zval *link_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC)
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (rc < LONG_MAX) {
|
||||
ZVAL_INT(retval, (long) rc);
|
||||
if (rc < PHP_INT_MAX) {
|
||||
ZVAL_INT(retval, (php_int_t) rc);
|
||||
} else {
|
||||
ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
|
||||
}
|
||||
@ -289,7 +289,7 @@ static zval *result_type_read(mysqli_object *obj, zval *retval TSRMLS_DC)
|
||||
static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC)
|
||||
{
|
||||
MYSQL_RES *p;
|
||||
ulong *ret;
|
||||
php_uint_t *ret;
|
||||
uint field_count;
|
||||
|
||||
CHECK_STATUS(MYSQLI_STATUS_VALID);
|
||||
@ -298,7 +298,7 @@ static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC)
|
||||
if (!p || !field_count || !(ret = mysql_fetch_lengths(p))) {
|
||||
ZVAL_NULL(retval);
|
||||
} else {
|
||||
ulong i;
|
||||
php_uint_t i;
|
||||
|
||||
array_init(retval);
|
||||
|
||||
@ -310,8 +310,8 @@ static zval *result_lengths_read(mysqli_object *obj, zval *retval TSRMLS_DC)
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu")
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), ulong, "%lu")
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(result_current_field_read, mysql_field_tell, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(result_field_count_read, mysql_num_fields, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(result_num_rows_read, mysql_num_rows, MYSQLI_GET_RESULT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
|
||||
|
||||
/* statement properties */
|
||||
@ -354,8 +354,8 @@ static zval *stmt_affected_rows_read(mysqli_object *obj, zval *retval TSRMLS_DC)
|
||||
return retval;
|
||||
}
|
||||
|
||||
if (rc < LONG_MAX) {
|
||||
ZVAL_INT(retval, (long) rc);
|
||||
if (rc < PHP_INT_MAX) {
|
||||
ZVAL_INT(retval, (php_int_t) rc);
|
||||
} else {
|
||||
ZVAL_STR(retval, strpprintf(0, MYSQLI_LLU_SPEC, rc));
|
||||
}
|
||||
@ -407,9 +407,9 @@ static zval *stmt_error_list_read(mysqli_object *obj, zval *retval TSRMLS_DC)
|
||||
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_insert_id_read, mysql_stmt_insert_id, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_num_rows_read, mysql_stmt_num_rows, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), my_ulonglong, MYSQLI_LLU_SPEC)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu")
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), ulong, "%lu")
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), ulong, "%lu")
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_param_count_read, mysql_stmt_param_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_field_count_read, mysql_stmt_field_count, MYSQLI_GET_STMT(MYSQLI_STATUS_VALID), php_uint_t, ZEND_UINT_FMT)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_INT(stmt_errno_read, mysql_stmt_errno, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED), php_uint_t, ZEND_UINT_FMT)
|
||||
MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_error_read, mysql_stmt_error, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
|
||||
MYSQLI_MAP_PROPERTY_FUNC_STRING(stmt_sqlstate_read, mysql_stmt_sqlstate, MYSQLI_GET_STMT(MYSQLI_STATUS_INITIALIZED))
|
||||
|
||||
|
@ -33,10 +33,10 @@ extern void php_mysqli_throw_sql_exception(char *sqlstate, int errorno TSRMLS_DC
|
||||
sets report level */
|
||||
PHP_FUNCTION(mysqli_report)
|
||||
{
|
||||
long flags;
|
||||
php_int_t flags;
|
||||
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &flags) == FAILURE) {
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "i", &flags) == FAILURE) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -99,9 +99,9 @@ enum mysqli_status {
|
||||
|
||||
typedef struct {
|
||||
char *val;
|
||||
ulong buflen;
|
||||
ulong output_len;
|
||||
ulong type;
|
||||
php_uint_t buflen;
|
||||
php_uint_t output_len;
|
||||
php_uint_t type;
|
||||
} VAR_BUFFER;
|
||||
|
||||
typedef struct {
|
||||
@ -214,7 +214,7 @@ extern void php_mysqli_close(MY_MYSQL * mysql, int close_type, int resource_stat
|
||||
extern zend_object_iterator_funcs php_mysqli_result_iterator_funcs;
|
||||
extern zend_object_iterator *php_mysqli_result_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC);
|
||||
|
||||
extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, long fetchtype TSRMLS_DC);
|
||||
extern void php_mysqli_fetch_into_hash_aux(zval *return_value, MYSQL_RES * result, php_int_t fetchtype TSRMLS_DC);
|
||||
|
||||
#ifdef HAVE_SPL
|
||||
extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
|
||||
@ -318,27 +318,27 @@ extern PHPAPI zend_class_entry *spl_ce_RuntimeException;
|
||||
|
||||
|
||||
ZEND_BEGIN_MODULE_GLOBALS(mysqli)
|
||||
long default_link;
|
||||
long num_links;
|
||||
long max_links;
|
||||
long num_active_persistent;
|
||||
long num_inactive_persistent;
|
||||
long max_persistent;
|
||||
long allow_persistent;
|
||||
unsigned long default_port;
|
||||
php_int_t default_link;
|
||||
php_int_t num_links;
|
||||
php_int_t max_links;
|
||||
php_int_t num_active_persistent;
|
||||
php_int_t num_inactive_persistent;
|
||||
php_int_t max_persistent;
|
||||
php_int_t allow_persistent;
|
||||
php_uint_t default_port;
|
||||
char *default_host;
|
||||
char *default_user;
|
||||
char *default_socket;
|
||||
char *default_pw;
|
||||
long reconnect;
|
||||
long allow_local_infile;
|
||||
long strict;
|
||||
long error_no;
|
||||
php_int_t reconnect;
|
||||
php_int_t allow_local_infile;
|
||||
php_int_t strict;
|
||||
php_int_t error_no;
|
||||
char *error_msg;
|
||||
long report_mode;
|
||||
php_int_t report_mode;
|
||||
HashTable *report_ht;
|
||||
unsigned long multi_query;
|
||||
unsigned long embedded;
|
||||
php_uint_t multi_query;
|
||||
php_uint_t embedded;
|
||||
zend_bool rollback_on_cached_plink;
|
||||
ZEND_END_MODULE_GLOBALS(mysqli)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user