Author: ahristov
Date: 2007-07-11 20:17:47 +0200 (Wed, 11 Jul 2007)
New Revision: 721
Modified:
trunk/php5/ext/mysqli/mysqli_api.c
trunk/php6/ext/mysqli/mysqli_api.c
Log:
Exclusively only WS fixes
Modified: trunk/php5/ext/mysqli/mysqli_api.c
- trunk/php5/ext/mysqli/mysqli_api.c 2007-07-11 17:26:03 UTC (rev 720)
+++ trunk/php5/ext/mysqli/mysqli_api.c 2007-07-11 18:17:47 UTC (rev 721)
@@ -56,12 +56,12 @@
Turn auto commit on or of */
PHP_FUNCTION(mysqli_autocommit)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
zend_bool automode;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) {
- return;
+ return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
@@ -78,7 +78,7 @@
int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned int num_vars,
zval ***args, unsigned int start, const char * const types TSRMLS_DC)
{
- int i, ofs;
+ int i, ofs;
MYSQL_BIND *bind;
unsigned long rc;
@@ -151,9 +151,9 @@
int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned int num_vars,
zval ***args, unsigned int start, const char * const types TSRMLS_DC)
{
- int i;
+ int i;
MYSQLND_PARAM_BIND *params;
- enum_func_status ret = FAIL;
+ enum_func_status ret = FAIL;
/* If no params -> skip binding and return directly */
if (argc == start) {
@@ -167,7 +167,7 @@
type = MYSQL_TYPE_DOUBLE;
break;
case 'i': /* Integer */
-#if SIZEOF_LONG==8
+#if SIZEOF_LONG==8
type = MYSQL_TYPE_LONGLONG;
#elif SIZEOF_LONG==4
type = MYSQL_TYPE_LONG;
@@ -201,12 +201,12 @@
Bind variables to a prepared statement as parameters */
PHP_FUNCTION(mysqli_stmt_bind_param)
{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
+ zval ***args;
+ int argc = ZEND_NUM_ARGS();
int num_vars;
int start = 2;
MY_STMT *stmt;
- zval *mysql_stmt;
+ zval *mysql_stmt;
char *types;
int types_len;
unsigned long rc;
@@ -254,7 +254,7 @@
rc = 1;
} else {
rc = mysqli_stmt_bind_param_do_bind(stmt, argc, num_vars, args, start, types TSRMLS_CC);
- MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
+ MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
}
efree(args);
@@ -271,8 +271,8 @@
static int
mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc, unsigned int start TSRMLS_DC)
{
- MYSQL_BIND *bind;
- int i, ofs;
+ MYSQL_BIND *bind;
+ int i, ofs;
int var_cnt = argc - start;
long col_type;
ulong rc;
@@ -301,7 +301,7 @@
convert_to_double_ex(args[i]);
stmt->result.buf[ofs].type = IS_DOUBLE;
stmt->result.buf[ofs].buflen = sizeof(double);
-
+
/* allocate buffer for double */
stmt->result.buf[ofs].val = (char *)emalloc(sizeof(double));
bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE;
@@ -451,12 +451,12 @@
Bind variables to a prepared statement for result storage */
PHP_FUNCTION(mysqli_stmt_bind_result)
{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
+ zval ***args;
+ int argc = ZEND_NUM_ARGS();
int start = 1;
ulong rc;
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
if (getThis()) {
start = 0;
@@ -468,7 +468,7 @@
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
- if (argc < (getThis() ? 1 : 2)) {
+ if (argc < (getThis() ? 1 : 2)) {
WRONG_PARAM_COUNT;
}
@@ -499,9 +499,9 @@
PHP_FUNCTION(mysqli_change_user)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
- char *user, *password, *dbname;
- int user_len, password_len, dbname_len;
+ zval *mysql_link = NULL;
+ char *user, *password, *dbname;
+ int user_len, password_len, dbname_len;
ulong rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osss", &mysql_link, mysqli_link_class_entry, &user, &user_len, &password, &password_len, &dbname, &dbname_len) == FAILURE) {
@@ -524,8 +524,8 @@
Returns the name of the character set used for this connection */
PHP_FUNCTION(mysqli_character_set_name)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -541,8 +541,8 @@
Close connection */
PHP_FUNCTION(mysqli_close)
{
- zval *mysql_link;
- MY_MYSQL *mysql;
+ zval *mysql_link;
+ MY_MYSQL *mysql;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -556,7 +556,7 @@
mysqli_close(mysql->mysql, MYSQLI_CLOSE_EXPLICIT);
}
- MYSQLI_CLEAR_RESOURCE(&mysql_link);
+ MYSQLI_CLEAR_RESOURCE(&mysql_link);
efree(mysql);
RETURN_TRUE;
}
@@ -566,8 +566,8 @@
Commit outstanding actions and close transaction */
PHP_FUNCTION(mysqli_commit)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -585,8 +585,8 @@
PHP_FUNCTION(mysqli_data_seek)
{
MYSQL_RES *result;
- zval *mysql_result;
- long offset;
+ zval *mysql_result;
+ long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
return;
@@ -600,7 +600,7 @@
}
if (offset < 0 || offset >= mysql_num_rows(result)) {
- RETURN_FALSE;
+ RETURN_FALSE;
}
mysql_data_seek(result, offset);
@@ -629,8 +629,8 @@
*/
PHP_FUNCTION(mysqli_dump_debug_info)
{
- MY_MYSQL *mysql;- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -645,8 +645,8 @@
Returns the numerical value of the error message from previous MySQL operation */
PHP_FUNCTION(mysqli_errno)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -660,8 +660,8 @@
Returns the text of the error message from previous MySQL operation */
PHP_FUNCTION(mysqli_error)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -675,10 +675,10 @@
Execute a prepared statement */
PHP_FUNCTION(mysqli_stmt_execute)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
#ifndef HAVE_MYSQLND
- unsigned int i;
+ unsigned int i;
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
@@ -730,10 +730,10 @@
Fetch results from a prepared statement into the bound variables */
void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
- unsigned int i;
- ulong ret;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
+ unsigned int i;
+ ulong ret;
unsigned int uval;
my_ulonglong llval;
@@ -803,7 +803,7 @@
if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_LONGLONG) {
my_bool uns= (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? 1:0;
llval= *(my_ulonglong *) stmt->result.buf[i].val;
-#if SIZEOF_LONG==8
+#if SIZEOF_LONG==8
if (uns && llval > 9223372036854775807L) {
#elif SIZEOF_LONG==4
if ((uns && llval > L64(2147483647)) ||
@@ -878,18 +878,16 @@
/* {{{ mixed mysqli_stmt_fetch_mysqlnd */
void mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAMETERS)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
- zend_bool fetched_anything;
- enum_func_status ret;
-
+ MY_STMT *stmt;
+ zval *mysql_stmt;
+ zend_bool fetched_anything;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
- if (FAIL == (ret = mysqlnd_stmt_fetch(stmt->stmt, &fetched_anything))) {
+ if (FAIL == mysqlnd_stmt_fetch(stmt->stmt, &fetched_anything)) {
RETURN_BOOL(FALSE);
} else if (fetched_anything == TRUE) {
RETURN_BOOL(TRUE);
@@ -910,7 +908,6 @@
#else
mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAM_PASSTHRU);
#endif
-
}
/* }}} */
@@ -936,9 +933,9 @@
Get column information from a result and return as an object */
PHP_FUNCTION(mysqli_fetch_field)
{
- MYSQL_RES *result;
- zval *mysql_result;
- MYSQL_FIELD *field;
+ MYSQL_RES *result;
+ zval *mysql_result;
+ MYSQL_FIELD *field;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
return;
@@ -961,9 +958,9 @@
PHP_FUNCTION(mysqli_fetch_fields)
{
MYSQL_RES *result;
- zval *mysql_result;
+ zval *mysql_result;
MYSQL_FIELD *field;
- zval *obj;
+ zval *obj;
unsigned int i;
@@ -993,8 +990,8 @@
{
MYSQL_RES *result;
zval *mysql_result;
- MYSQL_FIELD *field;
- long offset;
+ MYSQL_FIELD *field;
+ long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
return;
@@ -1024,7 +1021,7 @@
zval *mysql_result;
unsigned int i;
unsigned long *ret;
-
+
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
return;
}
@@ -1038,7 +1035,7 @@
array_init(return_value);
for (i = 0; i < mysql_num_fields(result); i++) {
- add_index_long(return_value, i, ret[i]);
+ add_index_long(return_value, i, ret[i]);
}
}
/* }}} */
@@ -1050,9 +1047,8 @@
#if !defined(HAVE_MYSQLND)
php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_NUM, 0);
#else
- MYSQL_RES *result;
- zval *mysql_result;
-
+ MYSQL_RES *result;
+ zval *mysql_result;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
return;
@@ -1066,10 +1062,10 @@
/* {{{ proto int mysqli_field_count(object link)
Fetch the number of fields returned by the last query for the given link
*/
-PHP_FUNCTION(mysqli_field_count)
+PHP_FUNCTION(mysqli_field_count)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1098,7 +1094,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid field offset");
RETURN_FALSE;
}
-
+
mysql_field_seek(result, fieldnr);
RETURN_TRUE;
}
@@ -1115,7 +1111,7 @@
return;
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
-
+
RETURN_LONG(mysql_field_tell(result));
}
/* }}} */
@@ -1133,11 +1129,11 @@
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
mysqli_free_result(result, FALSE);
- MYSQLI_CLEAR_RESOURCE(&mysql_result);
+ MYSQLI_CLEAR_RESOURCE(&mysql_result);
}
/* }}} */
-/* {{{ proto string mysqli_get_client_info(void)
+/* {{{ proto string mysqli_get_client_info(void)
Get MySQL client info */
PHP_FUNCTION(mysqli_get_client_info)
{
@@ -1145,7 +1141,7 @@
}
/* }}} */
-/* {{{ proto int mysqli_get_client_version(void)
+/* {{{ proto int mysqli_get_client_version(void)
Get MySQL client info */
PHP_FUNCTION(mysqli_get_client_version)
{
@@ -1158,7 +1154,7 @@
PHP_FUNCTION(mysqli_get_host_info)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1173,8 +1169,8 @@
Get MySQL protocol information */
PHP_FUNCTION(mysqli_get_proto_info)
{
- MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ MY_MYSQL *mysql;
+ zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1185,12 +1181,12 @@
}
/* }}} */
-/* {{{ proto string mysqli_get_server_info(object link)
+/* {{{ proto string mysqli_get_server_info(object link)
Get MySQL server info */
PHP_FUNCTION(mysqli_get_server_info)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1223,7 +1219,7 @@
PHP_FUNCTION(mysqli_info)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ zval *mysql_link = NULL;
const char *info;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
@@ -1270,8 +1266,8 @@
PHP_FUNCTION(mysqli_insert_id)
{
MY_MYSQL *mysql;
- my_ulonglong rc;
- zval *mysql_link;
+ my_ulonglong rc;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1286,9 +1282,9 @@
Kill a mysql process on the server */
PHP_FUNCTION(mysqli_kill)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
- long processid;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
+ long processid;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
return;
@@ -1338,7 +1334,7 @@
PHP_FUNCTION(mysqli_set_local_infile_handler)
{
MY_MYSQL *mysql;
- zval *mysql_link;
+ zval *mysql_link;
char *callback_name;
zval *callback_func;
@@ -1353,7 +1349,7 @@
if (!zend_is_callable(callback_func, 0, &callback_name)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %s", callback_name);
efree(callback_name);
- RETURN_FALSE;
+ RETURN_FALSE;
}
efree(callback_name);
@@ -1377,8 +1373,8 @@
check if there any more query results from a multi query */
PHP_FUNCTION(mysqli_more_results)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1392,8 +1388,8 @@
/* {{{ proto bool mysqli_next_result(object link)
read next result from multi_query */
PHP_FUNCTION(mysqli_next_result) {
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1451,11 +1447,11 @@
Set options */
PHP_FUNCTION(mysqli_options)
{
- MY_MYSQL *mysql;
- zval *mysql_link = NULL;
- zval *mysql_value;
- long mysql_option;
- unsigned int l_value;
+ MY_MYSQL *mysql;
+ zval *mysql_link = NULL;
+ zval *mysql_value;
+ long mysql_option;
+ unsigned int l_value;
long ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
@@ -1481,7 +1477,7 @@
}
RETURN_BOOL(!ret);
-}
+}
/* }}} */
@@ -1489,8 +1485,8 @@
Ping a server connection or reconnect if there is no connection */
PHP_FUNCTION(mysqli_ping)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
long rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
@@ -1509,11 +1505,11 @@
PHP_FUNCTION(mysqli_prepare)
{
MY_MYSQL *mysql;
- MY_STMT *stmt;
+ MY_STMT *stmt;
char *query = NULL;
unsigned int query_len;
zval *mysql_link;
- MYSQLI_RESOURCE *mysqli_resource;
+ MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os",&mysql_link, mysqli_link_class_entry, &query, &query_len) == FAILURE) {
return;
@@ -1557,7 +1553,6 @@
}
}
-
/* don't join to the previous if because it won't work if mysql_stmt_prepare_fails */
if (!stmt->stmt) {
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
@@ -1575,7 +1570,6 @@
stmt->query[query_len] = '\0';
}
-
/* change status */
mysqli_resource->status = MYSQLI_STATUS_VALID;
MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_stmt_class_entry);
@@ -1586,10 +1580,10 @@
Open a connection to a mysql server */
PHP_FUNCTION(mysqli_real_connect)
{
- MY_MYSQL *mysql;
- char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
- unsigned int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0;
- unsigned long port=0, flags=0;
+ MY_MYSQL *mysql;
+ char *hostname = NULL, *username=NULL, *passwd=NULL, *dbname=NULL, *socket=NULL;
+ unsigned int hostname_len = 0, username_len = 0, passwd_len = 0, dbname_len = 0, socket_len = 0;
+ unsigned long port=0, flags=0;
zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O|sssslsl", &mysql_link, mysqli_link_class_entry,
@@ -1711,7 +1705,7 @@
PHP_FUNCTION(mysqli_rollback)
{
MY_MYSQL *mysql;
- zval *mysql_link;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1730,7 +1724,7 @@
PHP_FUNCTION(mysqli_stmt_send_long_data)
{
MY_STMT *stmt;
- zval *mysql_stmt;
+ zval *mysql_stmt;
char *data;
long param_nr;
int data_len;
@@ -1756,8 +1750,8 @@
Return the number of rows affected in the last query for the given link */
PHP_FUNCTION(mysqli_stmt_affected_rows)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
my_ulonglong rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
@@ -1773,12 +1767,12 @@
}
/* }}} */
-/* {{{ proto bool mysqli_stmt_close(object stmt)
+/* {{{ proto bool mysqli_stmt_close(object stmt)
Close statement */
PHP_FUNCTION(mysqli_stmt_close)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
@@ -1787,7 +1781,7 @@
mysqli_stmt_close(stmt->stmt, FALSE);
stmt->stmt = NULL;
- php_clear_stmt_bind(stmt TSRMLS_CC);
+ php_clear_stmt_bind(stmt TSRMLS_CC);
MYSQLI_CLEAR_RESOURCE(&mysql_stmt);
RETURN_TRUE;
}
@@ -1798,8 +1792,8 @@
PHP_FUNCTION(mysqli_stmt_data_seek)
{
MY_STMT *stmt;
- zval *mysql_stmt;
- long offset;
+ zval *mysql_stmt;
+ long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_stmt, mysqli_stmt_class_entry, &offset) == FAILURE) {
return;
@@ -1819,7 +1813,7 @@
Return the number of result columns for the given statement */
PHP_FUNCTION(mysqli_stmt_field_count)
{
- MY_STMT *stmt;
+ MY_STMT *stmt;
zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
@@ -1835,8 +1829,8 @@
Free stored result memory for the given statement handle */
PHP_FUNCTION(mysqli_stmt_free_result)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
@@ -1852,9 +1846,9 @@
Get the ID generated from the previous INSERT operation */
PHP_FUNCTION(mysqli_stmt_insert_id)
{
- MY_STMT *stmt;
- my_ulonglong rc;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ my_ulonglong rc;
+ zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
@@ -1869,9 +1863,9 @@
Return the number of parameter for the given statement */
PHP_FUNCTION(mysqli_stmt_param_count)
{
- MY_STMT *stmt;
+ MY_STMT *stmt;
zval *mysql_stmt;
-
+
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
}
@@ -1883,7 +1877,7 @@
/* {{{ proto bool mysqli_stmt_reset(object stmt)
reset a prepared statement */
-PHP_FUNCTION(mysqli_stmt_reset)
+PHP_FUNCTION(mysqli_stmt_reset)
{
MY_STMT *stmt;
zval *mysql_stmt;
@@ -1905,8 +1899,8 @@
Return the number of rows in statements result set */
PHP_FUNCTION(mysqli_stmt_num_rows)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
my_ulonglong rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
@@ -1925,15 +1919,15 @@
PHP_FUNCTION(mysqli_select_db)
{
MY_MYSQL *mysql;
- zval *mysql_link;
- char *dbname;
- int dbname_len;
+ zval *mysql_link;
+ char *dbname;
+ int dbname_len;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os", &mysql_link, mysqli_link_class_entry, &dbname, &dbname_len) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
-
+
if (mysql_select_db(mysql->mysql, dbname)) {
MYSQLI_REPORT_MYSQL_ERROR(mysql->mysql);
RETURN_FALSE;
@@ -1946,8 +1940,8 @@
Returns the SQLSTATE error from previous MySQL operation */
PHP_FUNCTION(mysqli_sqlstate)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1963,8 +1957,8 @@
PHP_FUNCTION(mysqli_ssl_set)
{
MY_MYSQL *mysql;
- zval *mysql_link;
- char *ssl_parm[5];
+ zval *mysql_link;
+ char *ssl_parm[5];
int ssl_parm_len[5], i;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Osssss", &mysql_link, mysqli_link_class_entry, &ssl_parm[0], &ssl_parm_len[0], &ssl_parm[1], &ssl_parm_len[1], &ssl_parm[2], &ssl_parm_len[2], &ssl_parm[3], &ssl_parm_len[3], &ssl_parm[4], &ssl_parm_len[4]) == FAILURE) {
@@ -1989,7 +1983,7 @@
Get current system status */
PHP_FUNCTION(mysqli_stat)
{
- MY_MYSQL *mysql;
+ MY_MYSQL *mysql;
zval *mysql_link;
char *stat;
#if defined(HAVE_MYSQLND)
@@ -2022,9 +2016,9 @@
PHP_FUNCTION(mysqli_stmt_attr_set)
{
MY_STMT *stmt;
- zval *mysql_stmt;
- long mode_in;
- ulong mode;
+ zval *mysql_stmt;
+ long mode_in;
+ ulong mode;
ulong attr;
int rc;
@@ -2051,7 +2045,7 @@
PHP_FUNCTION(mysqli_stmt_attr_get)
{
MY_STMT *stmt;
- zval *mysql_stmt;
+ zval *mysql_stmt;
#if !defined(HAVE_MYSQLND) && MYSQL_VERSION_ID > 50099
my_bool value;
#else
@@ -2077,7 +2071,7 @@
PHP_FUNCTION(mysqli_stmt_errno)
{
MY_STMT *stmt;
- zval *mysql_stmt;
+ zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
@@ -2093,7 +2087,7 @@
PHP_FUNCTION(mysqli_stmt_error)
{
MY_STMT *stmt;
- zval *mysql_stmt;
+ zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
@@ -2110,9 +2104,9 @@
PHP_FUNCTION(mysqli_stmt_init)
{
MY_MYSQL *mysql;
- MY_STMT *stmt;
+ MY_STMT *stmt;
zval *mysql_link;
- MYSQLI_RESOURCE *mysqli_resource;
+ MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O",&mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -2139,7 +2133,7 @@
PHP_FUNCTION(mysqli_stmt_prepare)
{
MY_STMT *stmt;
- zval *mysql_stmt;
+ zval *mysql_stmt;
char *query;
int query_len;
@@ -2162,9 +2156,9 @@
return result set from statement */
PHP_FUNCTION(mysqli_stmt_result_metadata)
{
- MY_STMT *stmt;
+ MY_STMT *stmt;
MYSQL_RES *result;
- zval *mysql_stmt;
+ zval *mysql_stmt;
MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
@@ -2180,7 +2174,7 @@
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->ptr = (void *)result;
mysqli_resource->status = MYSQLI_STATUS_VALID;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
+ MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
}
/* }}} */
@@ -2188,8 +2182,8 @@
*/
PHP_FUNCTION(mysqli_stmt_store_result)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
@@ -2227,16 +2221,16 @@
/* {{{ proto string mysqli_stmt_sqlstate(object stmt)
*/
-PHP_FUNCTION(mysqli_stmt_sqlstate)
+PHP_FUNCTION(mysqli_stmt_sqlstate)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
-
+
RETURN_STRING((char *)mysql_stmt_sqlstate(stmt->stmt),1);
}
/* }}} */
@@ -2245,9 +2239,9 @@
Buffer result set on client */
PHP_FUNCTION(mysqli_store_result)
{
- MY_MYSQL *mysql;
- MYSQL_RES *result;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ MYSQL_RES *result;
+ zval *mysql_link;
MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
@@ -2266,7 +2260,7 @@
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->ptr = (void *)result;
mysqli_resource->status = MYSQLI_STATUS_VALID;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
+ MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
}
/* }}} */
@@ -2275,8 +2269,8 @@
Return the current thread ID */
PHP_FUNCTION(mysqli_thread_id)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -2300,10 +2294,10 @@
Directly retrieve query results - do not buffer results on client side */
PHP_FUNCTION(mysqli_use_result)
{
- MY_MYSQL *mysql;
- MYSQL_RES *result;
- zval *mysql_link;
- MYSQLI_RESOURCE *mysqli_resource;
+ MY_MYSQL *mysql;
+ MYSQL_RES *result;
+ zval *mysql_link;
+ MYSQLI_RESOURCE *mysqli_resource;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -2321,7 +2315,7 @@
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->ptr = (void *)result;
mysqli_resource->status = MYSQLI_STATUS_VALID;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
+ MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_result_class_entry);
}
/* }}} */
@@ -2329,8 +2323,8 @@
Return number of warnings from the last query for the given link */
PHP_FUNCTION(mysqli_warning_count)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
Modified: trunk/php6/ext/mysqli/mysqli_api.c
- trunk/php6/ext/mysqli/mysqli_api.c 2007-07-11 17:26:03 UTC (rev 720)
+++ trunk/php6/ext/mysqli/mysqli_api.c 2007-07-11 18:17:47 UTC (rev 721)
@@ -58,12 +58,12 @@
Turn auto commit on or of */
PHP_FUNCTION(mysqli_autocommit)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
- zend_bool automode;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
+ zend_bool automode;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ob", &mysql_link, mysqli_link_class_entry, &automode) == FAILURE) {
- return;
+ return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
@@ -80,7 +80,7 @@
int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned int num_vars,
zval ***args, unsigned int start, const char * const types TSRMLS_DC)
{
- int i, ofs;
+ int i, ofs;
MYSQL_BIND *bind;
unsigned long rc;
@@ -153,9 +153,9 @@
int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int argc, unsigned int num_vars,
zval ***args, unsigned int start, const char * const types TSRMLS_DC)
{
- int i;
+ int i;
MYSQLND_PARAM_BIND *params;
- enum_func_status ret = FAIL;
+ enum_func_status ret = FAIL;
/* If no params -> skip binding and return directly */
if (argc == start) {
@@ -169,7 +169,7 @@
type = MYSQL_TYPE_DOUBLE;
break;
case 'i': /* Integer */
-#if SIZEOF_LONG==8
+#if SIZEOF_LONG==8
type = MYSQL_TYPE_LONGLONG;
#elif SIZEOF_LONG==4
type = MYSQL_TYPE_LONG;
@@ -203,12 +203,12 @@
Bind variables to a prepared statement as parameters */
PHP_FUNCTION(mysqli_stmt_bind_param)
{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
+ zval ***args;
+ int argc = ZEND_NUM_ARGS();
int num_vars;
int start = 2;
MY_STMT *stmt;
- zval *mysql_stmt;
+ zval *mysql_stmt;
char *types;
int types_len;
unsigned long rc;
@@ -221,7 +221,7 @@
if (zend_parse_method_parameters((getThis()) ? 1:2 TSRMLS_CC, getThis(), "Os&", &mysql_stmt, mysqli_stmt_class_entry,
&types, &types_len, UG(utf8_conv)) == FAILURE) {
- return;
+ return;
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
@@ -256,7 +256,7 @@
rc = 1;
} else {
rc = mysqli_stmt_bind_param_do_bind(stmt, argc, num_vars, args, start, types TSRMLS_CC);
- MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
+ MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
}
efree(args);
@@ -273,8 +273,8 @@
static int
mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval ***args, unsigned int argc, unsigned int start TSRMLS_DC)
{
- MYSQL_BIND *bind;- int i, ofs;
+ MYSQL_BIND *bind;
+ int i, ofs;
int var_cnt = argc - start;
long col_type;
ulong rc;
@@ -303,7 +303,7 @@
convert_to_double_ex(args[i]);
stmt->result.buf[ofs].type = IS_DOUBLE;
stmt->result.buf[ofs].buflen = sizeof(double);
-
+
/* allocate buffer for double */
stmt->result.buf[ofs].val = (char *)emalloc(sizeof(double));
bind[ofs].buffer_type = MYSQL_TYPE_DOUBLE;
@@ -453,12 +453,12 @@
Bind variables to a prepared statement for result storage */
PHP_FUNCTION(mysqli_stmt_bind_result)
{
- zval ***args;
- int argc = ZEND_NUM_ARGS();
+ zval ***args;
+ int argc = ZEND_NUM_ARGS();
int start = 1;
ulong rc;
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
if (getThis()) {
start = 0;
@@ -470,7 +470,7 @@
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
- if (argc < (getThis() ? 1 : 2)) {
+ if (argc < (getThis() ? 1 : 2)) {
WRONG_PARAM_COUNT;
}
@@ -501,9 +501,9 @@
PHP_FUNCTION(mysqli_change_user)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
- char *user, *password, *dbname;
- int user_len, password_len, dbname_len;
+ zval *mysql_link = NULL;
+ char *user, *password, *dbname;
+ int user_len, password_len, dbname_len;
ulong rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Os&s&s&", &mysql_link, mysqli_link_class_entry,
@@ -528,8 +528,8 @@
Returns the name of the character set used for this connection */
PHP_FUNCTION(mysqli_character_set_name)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -545,8 +545,8 @@
Close connection */
PHP_FUNCTION(mysqli_close)
{
- zval *mysql_link;
- MY_MYSQL *mysql;
+ zval *mysql_link;
+ MY_MYSQL *mysql;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -570,8 +570,8 @@
Commit outstanding actions and close transaction */
PHP_FUNCTION(mysqli_commit)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -589,8 +589,8 @@
PHP_FUNCTION(mysqli_data_seek)
{
MYSQL_RES *result;
- zval *mysql_result;
- long offset;
+ zval *mysql_result;
+ long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
return;
@@ -604,7 +604,7 @@
}
if (offset < 0 || offset >= mysql_num_rows(result)) {
- RETURN_FALSE;
+ RETURN_FALSE;
}
mysql_data_seek(result, offset);
@@ -633,8 +633,8 @@
*/
PHP_FUNCTION(mysqli_dump_debug_info)
{
- MY_MYSQL *mysql;- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -649,8 +649,8 @@
Returns the numerical value of the error message from previous MySQL operation */
PHP_FUNCTION(mysqli_errno)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -665,16 +665,14 @@
PHP_FUNCTION(mysqli_error)
{
MY_MYSQL *mysql;
- zval *mysql_link;
- char *strerr;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(mysql, MY_MYSQL *, &mysql_link, "mysqli_link", MYSQLI_STATUS_VALID);
- strerr = (char *)mysql_error(mysql->mysql);
- RETURN_UTF8_STRING(strerr, ZSTR_DUPLICATE);
+ RETURN_UTF8_STRING((char *)mysql_error(mysql->mysql), ZSTR_DUPLICATE);
}
/* }}} */
@@ -682,10 +680,10 @@
Execute a prepared statement */
PHP_FUNCTION(mysqli_stmt_execute)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
#ifndef HAVE_MYSQLND
- unsigned int i;
+ unsigned int i;
#endif
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
@@ -739,7 +737,7 @@
#ifndef HAVE_MYSQLND
/* free converted utf8 strings */
- if (UG(unicode)) {
+ if (UG(unicode)) {
for (i = 0; i < stmt->param.var_cnt; i++) {
if (stmt->stmt->params[i].buffer_type == MYSQL_TYPE_VAR_STRING && Z_TYPE_P(stmt->param.vars[i]) == IS_UNICODE) {
efree(stmt->stmt->params[i].buffer);
@@ -774,9 +772,9 @@
Fetch results from a prepared statement into the bound variables */
void mysqli_stmt_fetch_libmysql(INTERNAL_FUNCTION_PARAMETERS)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
- unsigned int i;
+ MY_STMT *stmt;
+ zval *mysql_stmt;
+ unsigned int i;
ulong ret;
unsigned int uval;
my_ulonglong llval;
@@ -788,7 +786,7 @@
return;
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
-
+
/* reset buffers */
for (i = 0; i < stmt->result.var_cnt; i++) {
if (stmt->result.buf[i].type == IS_STRING) {
@@ -820,7 +818,7 @@
switch (stmt->result.buf[i].type) {
case IS_LONG:
if ((stmt->stmt->fields[i].type == MYSQL_TYPE_LONG)
- && (stmt->stmt->fields[i].flags & UNSIGNED_FLAG))
+ && (stmt->stmt->fields[i].flags & UNSIGNED_FLAG))
{
/* unsigned int (11) */
uval= *(unsigned int *) stmt->result.buf[i].val;
@@ -857,7 +855,7 @@
if (stmt->stmt->bind[i].buffer_type == MYSQL_TYPE_LONGLONG) {
my_bool uns= (stmt->stmt->fields[i].flags & UNSIGNED_FLAG)? 1:0;
llval= *(my_ulonglong *) stmt->result.buf[i].val;
-#if SIZEOF_LONG==8
+#if SIZEOF_LONG==8
if (uns && llval > 9223372036854775807L) {
#elif SIZEOF_LONG==4
if ((uns && llval > L64(2147483647)) ||
@@ -898,7 +896,7 @@
copy_len, ZSTR_DUPLICATE);
} else {
ZVAL_STRINGL(stmt->result.vars[i], stmt->result.buf[i].val,
- copy_len, 1);
+ copy_len, 1);
}
}
break;
@@ -941,18 +939,16 @@
/* {{{ mixed mysqli_stmt_fetch_mysqlnd */
void mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAMETERS)
{
- MY_STMT *stmt;
- zval *mysql_stmt;
- zend_bool fetched_anything;
- enum_func_status ret;
-
+ MY_STMT *stmt;
+ zval *mysql_stmt;
+ zend_bool fetched_anything;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_stmt, mysqli_stmt_class_entry) == FAILURE) {
return;
}
MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt", MYSQLI_STATUS_VALID);
- if (FAIL == (ret = mysqlnd_stmt_fetch(stmt->stmt, &fetched_anything))) {
+ if (FAIL == mysqlnd_stmt_fetch(stmt->stmt, &fetched_anything)) {
RETURN_BOOL(FALSE);
} else if (fetched_anything == TRUE) {
RETURN_BOOL(TRUE);
@@ -973,7 +969,6 @@
#else
mysqli_stmt_fetch_mysqlnd(INTERNAL_FUNCTION_PARAM_PASSTHRU);
#endif
-
}
/* }}} */
@@ -999,9 +994,9 @@
Get column information from a result and return as an object */
PHP_FUNCTION(mysqli_fetch_field)
{
- MYSQL_RES *result;
- zval *mysql_result;
- MYSQL_FIELD *field;
+ MYSQL_RES *result;
+ zval *mysql_result;
+ MYSQL_FIELD *field;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
return;
@@ -1055,8 +1050,8 @@
{
MYSQL_RES *result;
zval *mysql_result;
- MYSQL_FIELD *field;
- long offset;
+ MYSQL_FIELD *field;
+ long offset;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_result, mysqli_result_class_entry, &offset) == FAILURE) {
return;
@@ -1086,7 +1081,7 @@
zval *mysql_result;
unsigned int i;
unsigned long *ret;
-
+
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
return;
}
@@ -1100,7 +1095,7 @@
array_init(return_value);
for (i = 0; i < mysql_num_fields(result); i++) {
- add_index_long(return_value, i, ret[i]);
+ add_index_long(return_value, i, ret[i]);
}
}
/* }}} */
@@ -1112,9 +1107,8 @@
#if !defined(HAVE_MYSQLND)
php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, MYSQLI_NUM, 0);
#else
- MYSQL_RES *result;
- zval *mysql_result;
-
+ MYSQL_RES *result;
+ zval *mysql_result;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_result, mysqli_result_class_entry) == FAILURE) {
return;
@@ -1128,10 +1122,10 @@
/* {{{ proto int mysqli_field_count(object link) U
Fetch the number of fields returned by the last query for the given link
*/
-PHP_FUNCTION(mysqli_field_count)
+PHP_FUNCTION(mysqli_field_count)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1160,7 +1154,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid field offset");
RETURN_FALSE;
}
-
+
mysql_field_seek(result, fieldnr);
RETURN_TRUE;
}
@@ -1177,7 +1171,7 @@
return;
}
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
-
+
RETURN_LONG(mysql_field_tell(result));
}
/* }}} */
@@ -1195,7 +1189,7 @@
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, &mysql_result, "mysqli_result", MYSQLI_STATUS_VALID);
mysqli_free_result(result, FALSE);
- MYSQLI_CLEAR_RESOURCE(&mysql_result);
+ MYSQLI_CLEAR_RESOURCE(&mysql_result);
}
/* }}} */
@@ -1222,7 +1216,7 @@
PHP_FUNCTION(mysqli_get_host_info)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1237,8 +1231,8 @@
Get MySQL protocol information */
PHP_FUNCTION(mysqli_get_proto_info)
{
- MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ MY_MYSQL *mysql;
+ zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1253,7 +1247,7 @@
PHP_FUNCTION(mysqli_get_server_info)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ zval *mysql_link = NULL;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1286,7 +1280,7 @@
PHP_FUNCTION(mysqli_info)
{
MY_MYSQL *mysql;
- zval *mysql_link = NULL;
+ zval *mysql_link = NULL;
const char *info;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
@@ -1333,8 +1327,8 @@
PHP_FUNCTION(mysqli_insert_id)
{
MY_MYSQL *mysql;
- my_ulonglong rc;
- zval *mysql_link;
+ my_ulonglong rc;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1349,9 +1343,9 @@
Kill a mysql process on the server */
PHP_FUNCTION(mysqli_kill)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
- long processid;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
+ long processid;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Ol", &mysql_link, mysqli_link_class_entry, &processid) == FAILURE) {
return;
@@ -1401,7 +1395,7 @@
PHP_FUNCTION(mysqli_set_local_infile_handler)
{
MY_MYSQL *mysql;
- zval *mysql_link;
+ zval *mysql_link;
zval callback_name;
zval *callback_func;
@@ -1420,7 +1414,7 @@
if (!zend_is_callable(callback_func, 0, &callback_name)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a valid callback function %R", Z_TYPE(callback_name), Z_UNIVAL(callback_name));
zval_dtor(&callback_name);
- RETURN_FALSE;
+ RETURN_FALSE;
}
zval_dtor(&callback_name);
@@ -1444,8 +1438,8 @@
check if there any more query results from a multi query */
PHP_FUNCTION(mysqli_more_results)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1459,8 +1453,8 @@
/* {{{ proto bool mysqli_next_result(object link) U
read next result from multi_query */
PHP_FUNCTION(mysqli_next_result) {
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
return;
@@ -1518,12 +1512,12 @@
Set options */
PHP_FUNCTION(mysqli_options)
{
- MY_MYSQL *mysql;
- zval *mysql_link = NULL;
- zval *mysql_value;
- long mysql_option;
- unsigned int l_value;
- long ret;
+ MY_MYSQL *mysql;
+ zval *mysql_link = NULL;
+ zval *mysql_value;
+ long mysql_option;
+ unsigned int l_value;
+ long ret;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Olz", &mysql_link, mysqli_link_class_entry, &mysql_option, &mysql_value) == FAILURE) {
return;
@@ -1544,7 +1538,7 @@
}
RETURN_BOOL(!ret);
-}
+}
/* }}} */
@@ -1552,8 +1546,8 @@
Ping a server connection or reconnect if there is no connection */
PHP_FUNCTION(mysqli_ping)
{
- MY_MYSQL *mysql;
- zval *mysql_link;
+ MY_MYSQL *mysql;
+ zval *mysql_link;
long rc;
if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "O", &mysql_link, mysqli_link_class_entry) == FAILURE) {
@@ -1572,11 +1566,11 @@
PHP_FUNCTION(mysqli_prepare)
{
MY_MYSQL *mysql;
- MY_STMT *stmt;
+ MY_STMT *stmt;
char *query = NULL;
unsigned int query_len;
zval *mysql_link;