summaryrefslogtreecommitdiff
path: root/ext/mysqli/mysqli_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mysqli/mysqli_api.c')
-rw-r--r--ext/mysqli/mysqli_api.c40
1 files changed, 21 insertions, 19 deletions
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 9a731f3948..c4ed1bf543 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -16,8 +16,6 @@
| Andrey Hristov <andrey@php.net> |
| Ulf Wendel <uw@php.net> |
+----------------------------------------------------------------------+
-
- $Id$
*/
#ifdef HAVE_CONFIG_H
@@ -544,7 +542,7 @@ mysqli_stmt_bind_result_do_bind(MY_STMT *stmt, zval *args, unsigned int argc)
MYSQLI_REPORT_STMT_ERROR(stmt->stmt);
if (rc) {
- /* dont close the statement or subsequent usage (for example ->execute()) will lead to crash */
+ /* don't close the statement or subsequent usage (for example ->execute()) will lead to crash */
for (i=0; i < var_cnt ; i++) {
if (stmt->result.buf[i].val) {
efree(stmt->result.buf[i].val);
@@ -880,9 +878,11 @@ PHP_FUNCTION(mysqli_stmt_execute)
}
for (j = i + 1; j < stmt->param.var_cnt; j++) {
/* Oops, someone binding the same variable - clone */
- if (Z_TYPE(stmt->param.vars[j]) == Z_TYPE(stmt->param.vars[i]) &&
+ if (Z_ISREF(stmt->param.vars[j]) &&
Z_REFVAL(stmt->param.vars[j]) == Z_REFVAL(stmt->param.vars[i])) {
- SEPARATE_ZVAL(&stmt->param.vars[j]);
+ /*SEPARATE_ZVAL(&stmt->param.vars[j]);*/
+ Z_DELREF_P(&stmt->param.vars[j]);
+ ZVAL_COPY(&stmt->param.vars[j], Z_REFVAL(stmt->param.vars[j]));
break;
}
}
@@ -1179,7 +1179,7 @@ static void php_add_field_properties(zval *value, const MYSQL_FIELD *field)
}
/* }}} */
-/* {{{ proto mixed mysqli_fetch_field (object result)
+/* {{{ proto mixed mysqli_fetch_field(object result)
Get column information from a result and return as an object */
PHP_FUNCTION(mysqli_fetch_field)
{
@@ -1202,7 +1202,7 @@ PHP_FUNCTION(mysqli_fetch_field)
}
/* }}} */
-/* {{{ proto mixed mysqli_fetch_fields (object result)
+/* {{{ proto mixed mysqli_fetch_fields(object result)
Return array of objects containing field meta-data */
PHP_FUNCTION(mysqli_fetch_fields)
{
@@ -1232,7 +1232,7 @@ PHP_FUNCTION(mysqli_fetch_fields)
}
/* }}} */
-/* {{{ proto mixed mysqli_fetch_field_direct (object result, int offset)
+/* {{{ proto mixed mysqli_fetch_field_direct(object result, int offset)
Fetch meta-data for a single field */
PHP_FUNCTION(mysqli_fetch_field_direct)
{
@@ -1261,7 +1261,7 @@ PHP_FUNCTION(mysqli_fetch_field_direct)
}
/* }}} */
-/* {{{ proto mixed mysqli_fetch_lengths (object result)
+/* {{{ proto mixed mysqli_fetch_lengths(object result)
Get the length of each output in a result */
PHP_FUNCTION(mysqli_fetch_lengths)
{
@@ -1293,7 +1293,7 @@ PHP_FUNCTION(mysqli_fetch_lengths)
}
/* }}} */
-/* {{{ proto array mysqli_fetch_row (object result)
+/* {{{ proto array mysqli_fetch_row(object result)
Get a result row as an enumerated array */
PHP_FUNCTION(mysqli_fetch_row)
{
@@ -1394,7 +1394,7 @@ PHP_FUNCTION(mysqli_get_client_version)
}
/* }}} */
-/* {{{ proto string mysqli_get_host_info (object link)
+/* {{{ proto string mysqli_get_host_info(object link)
Get MySQL host info */
PHP_FUNCTION(mysqli_get_host_info)
{
@@ -1714,14 +1714,12 @@ static int mysqli_options_get_option_zval_type(int option)
#ifdef MYSQL_OPT_PROTOCOL
case MYSQL_OPT_PROTOCOL:
#endif /* MySQL 4.1.0 */
-#if MYSQL_VERSION_ID > 40101 || defined(MYSQLI_USE_MYSQLND)
case MYSQL_OPT_READ_TIMEOUT:
case MYSQL_OPT_WRITE_TIMEOUT:
case MYSQL_OPT_GUESS_CONNECTION:
case MYSQL_OPT_USE_EMBEDDED_CONNECTION:
case MYSQL_OPT_USE_REMOTE_CONNECTION:
case MYSQL_SECURE_AUTH:
-#endif
#ifdef MYSQL_OPT_RECONNECT
case MYSQL_OPT_RECONNECT:
#endif /* MySQL 5.0.13 */
@@ -1872,6 +1870,9 @@ PHP_FUNCTION(mysqli_prepare)
memcpy(sqlstate, mysql->mysql->net.sqlstate, SQLSTATE_LENGTH+1);
#else
MYSQLND_ERROR_INFO error_info = *mysql->mysql->data->error_info;
+ mysql->mysql->data->error_info->error_list.head = NULL;
+ mysql->mysql->data->error_info->error_list.tail = NULL;
+ mysql->mysql->data->error_info->error_list.count = 0;
#endif
mysqli_stmt_close(stmt->stmt, FALSE);
stmt->stmt = NULL;
@@ -1882,6 +1883,7 @@ PHP_FUNCTION(mysqli_prepare)
memcpy(mysql->mysql->net.last_error, last_error, MYSQL_ERRMSG_SIZE);
memcpy(mysql->mysql->net.sqlstate, sqlstate, SQLSTATE_LENGTH+1);
#else
+ zend_llist_clean(&mysql->mysql->data->error_info->error_list);
*mysql->mysql->data->error_info = error_info;
#endif
}
@@ -2027,8 +2029,8 @@ PHP_FUNCTION(mysqli_stmt_send_long_data)
}
/* }}} */
-/* {{{ proto mixed mysqli_stmt_affected_rows(object stmt)
- Return the number of rows affected in the last query for the given link */
+/* {{{ proto string|int|false mysqli_stmt_affected_rows(object stmt)
+ Return the number of rows affected in the last query for the given link. */
PHP_FUNCTION(mysqli_stmt_affected_rows)
{
MY_STMT *stmt;
@@ -2295,7 +2297,7 @@ PHP_FUNCTION(mysqli_stat)
/* }}} */
-/* {{{ proto bool mysqli_refresh(object link, long options)
+/* {{{ proto bool mysqli_refresh(object link, int options)
Flush tables or caches, or reset replication server information */
PHP_FUNCTION(mysqli_refresh)
{
@@ -2315,7 +2317,7 @@ PHP_FUNCTION(mysqli_refresh)
}
/* }}} */
-/* {{{ proto int mysqli_stmt_attr_set(object stmt, long attr, long mode)
+/* {{{ proto int mysqli_stmt_attr_set(object stmt, int attr, int mode)
*/
PHP_FUNCTION(mysqli_stmt_attr_set)
{
@@ -2362,7 +2364,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
}
/* }}} */
-/* {{{ proto int mysqli_stmt_attr_get(object stmt, long attr)
+/* {{{ proto int mysqli_stmt_attr_get(object stmt, int attr)
*/
PHP_FUNCTION(mysqli_stmt_attr_get)
{
@@ -2665,7 +2667,7 @@ PHP_FUNCTION(mysqli_use_result)
}
/* }}} */
-/* {{{ proto int mysqli_warning_count (object link)
+/* {{{ proto int mysqli_warning_count(object link)
Return number of warnings from the last query for the given link */
PHP_FUNCTION(mysqli_warning_count)
{