johannes Fri Nov 28 20:21:35 2008 UTC
Modified files:
/php-src/ext/mysql php_mysql.c
/php-src/ext/mysql/tests mysql_affected_rows.phpt mysql_close.phpt
mysql_data_seek.phpt mysql_db_name.phpt
mysql_errno.phpt mysql_error.phpt
mysql_fetch_field.phpt
mysql_fetch_lengths.phpt
mysql_field_flags.phpt
mysql_field_len.phpt mysql_field_name.phpt
mysql_field_table.phpt
mysql_field_type.phpt
mysql_free_result.phpt
mysql_get_host_info.phpt
mysql_get_proto_info.phpt
mysql_get_server_info.phpt
mysql_insert_id.phpt mysql_list_dbs.phpt
mysql_list_tables.phpt
mysql_num_fields.phpt mysql_num_rows.phpt
mysql_tablename.phpt
Log:
New param parsing for ext/mysql
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/php_mysql.c?r1=1.269&r2=1.270&diff_format=u
Index: php-src/ext/mysql/php_mysql.c
diff -u php-src/ext/mysql/php_mysql.c:1.269 php-src/ext/mysql/php_mysql.c:1.270
--- php-src/ext/mysql/php_mysql.c:1.269 Thu Nov 27 19:02:44 2008
+++ php-src/ext/mysql/php_mysql.c Fri Nov 28 20:21:35 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_mysql.c,v 1.269 2008/11/27 19:02:44 dmitry Exp $ */
+/* $Id: php_mysql.c,v 1.270 2008/11/28 20:21:35 johannes Exp $ */
/* TODO:
*
@@ -1011,34 +1011,26 @@
Close a MySQL connection */
PHP_FUNCTION(mysql_close)
{
- zval **mysql_link=NULL;
- int id;
+ zval *mysql_link=NULL;
php_mysql_conn *mysql;
- switch (ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
}
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
- if (id==-1) { /* explicit resource number */
+ if (mysql_link) {
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, -1,
"MySQL-Link", le_link, le_plink);
+ } else {
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, NULL,
MySG(default_link), "MySQL-Link", le_link, le_plink);
+ }
+
+ if (mysql_link) { /* explicit resource number */
PHPMY_UNBUFFERED_QUERY_CHECK();
- zend_list_delete(Z_RESVAL_PP(mysql_link));
+ zend_list_delete(Z_RESVAL_P(mysql_link));
}
- if (id!=-1
- || (mysql_link && Z_RESVAL_PP(mysql_link)==MySG(default_link)))
{
+ if (!mysql_link
+ || (mysql_link && Z_RESVAL_P(mysql_link)==MySG(default_link))) {
PHPMY_UNBUFFERED_QUERY_CHECK();
zend_list_delete(MySG(default_link));
MySG(default_link) = -1;
@@ -1094,27 +1086,20 @@
Returns a string describing the type of connection in use, including the
server host name */
PHP_FUNCTION(mysql_get_host_info)
{
- zval **mysql_link;
- int id;
+ zval *mysql_link = NULL;
+ int id = -1;
php_mysql_conn *mysql;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+ if (!mysql_link) {
+ id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ CHECK_LINK(id);
+ }
+
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
RETURN_UTF8_STRING((char *)mysql_get_host_info(mysql->conn),
ZSTR_DUPLICATE);
}
@@ -1124,27 +1109,20 @@
Returns the protocol version used by current connection */
PHP_FUNCTION(mysql_get_proto_info)
{
- zval **mysql_link;
- int id;
+ zval *mysql_link = NULL;
+ int id = -1;
php_mysql_conn *mysql;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
+ }
+
+ if (!mysql_link) {
+ id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ CHECK_LINK(id);
}
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
RETURN_LONG(mysql_get_proto_info(mysql->conn));
}
@@ -1154,27 +1132,20 @@
Returns a string that represents the server version number */
PHP_FUNCTION(mysql_get_server_info)
{
- zval **mysql_link;
- int id;
+ zval *mysql_link = NULL;
+ int id = -1;
php_mysql_conn *mysql;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1,&mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+ if (!mysql_link) {
+ id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ CHECK_LINK(id);
+ }
+
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
RETURN_UTF8_STRING((char *)mysql_get_server_info(mysql->conn),
ZSTR_DUPLICATE);
}
@@ -1548,28 +1519,21 @@
List databases available on a MySQL server */
PHP_FUNCTION(mysql_list_dbs)
{
- zval **mysql_link;
- int id;
+ zval *mysql_link = NULL;
+ int id = -1;
php_mysql_conn *mysql;
MYSQL_RES *mysql_result;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
+ }
+
+ if (!mysql_link) {
+ id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ CHECK_LINK(id);
}
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
PHPMY_UNBUFFERED_QUERY_CHECK();
@@ -1699,33 +1663,26 @@
Returns the text of the error message from previous MySQL operation */
PHP_FUNCTION(mysql_error)
{
- zval **mysql_link;
+ zval *mysql_link = NULL;
int id = -1;
php_mysql_conn *mysql;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- if (id==-1) {
- if (MySG(connect_error)!=NULL){
- RETURN_UTF8_STRING(MySG(connect_error),
ZSTR_DUPLICATE);
- } else {
- RETURN_FALSE;
- }
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
+ }
+
+ if (!mysql_link) {
+ id = MySG(default_link);
+ if (id==-1) {
+ if (MySG(connect_error)!=NULL){
+ RETURN_STRING(MySG(connect_error),1);
+ } else {
RETURN_FALSE;
}
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ }
}
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
RETURN_UTF8_STRING((char *)mysql_error(mysql->conn), ZSTR_DUPLICATE);
}
@@ -1737,33 +1694,26 @@
#ifdef HAVE_MYSQL_ERRNO
PHP_FUNCTION(mysql_errno)
{
- zval **mysql_link;
- int id;
+ zval *mysql_link = NULL;
+ int id = -1;
php_mysql_conn *mysql;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- if (id==-1) {
- if (MySG(connect_errno)!=0){
- RETURN_LONG(MySG(connect_errno));
- } else {
- RETURN_FALSE;
- }
- }
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
+ }
+
+ if (!mysql_link) {
+ id = MySG(default_link);
+ if (id==-1) {
+ if (MySG(connect_errno)!=0){
+ RETURN_LONG(MySG(connect_errno));
+ } else {
RETURN_FALSE;
}
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ }
}
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
RETURN_LONG(mysql_errno(mysql->conn));
}
@@ -1775,27 +1725,20 @@
Gets number of affected rows in previous MySQL operation */
PHP_FUNCTION(mysql_affected_rows)
{
- zval **mysql_link;
- int id;
+ zval *mysql_link = NULL;
+ int id = -1;
php_mysql_conn *mysql;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
}
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+
+ if (!mysql_link) {
+ id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ CHECK_LINK(id);
+ }
+
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
/* conversion from int64 to long happing here */
Z_LVAL_P(return_value) = (long) mysql_affected_rows(mysql->conn);
@@ -1861,27 +1804,20 @@
Gets the ID generated from the previous INSERT operation */
PHP_FUNCTION(mysql_insert_id)
{
- zval **mysql_link;
- int id;
+ zval *mysql_link = NULL;
+ int id = -1;
php_mysql_conn *mysql;
- switch(ZEND_NUM_ARGS()) {
- case 0:
- id = MySG(default_link);
- CHECK_LINK(id);
- break;
- case 1:
- if (zend_get_parameters_ex(1, &mysql_link)==FAILURE) {
- RETURN_FALSE;
- }
- id = -1;
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|r", &mysql_link)
== FAILURE) {
+ return;
}
-
- ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, mysql_link, id,
"MySQL-Link", le_link, le_plink);
+
+ if (!mysql_link) {
+ id =
php_mysql_get_default_link(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ CHECK_LINK(id);
+ }
+
+ ZEND_FETCH_RESOURCE2(mysql, php_mysql_conn *, &mysql_link, id,
"MySQL-Link", le_link, le_plink);
/* conversion from int64 to long happing here */
Z_LVAL_P(return_value) = (long) mysql_insert_id(mysql->conn);
@@ -1894,7 +1830,8 @@
Gets result data */
PHP_FUNCTION(mysql_result)
{
- zval **result, **row, **field=NULL;
+ zval *result, *field=NULL;
+ long row;
MYSQL_RES *mysql_result;
#ifndef MYSQL_USE_MYSQLND
MYSQL_ROW sql_row;
@@ -1902,45 +1839,33 @@
#endif
int field_offset=0;
- switch (ZEND_NUM_ARGS()) {
- case 2:
- if (zend_get_parameters_ex(2, &result, &row)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 3:
- if (zend_get_parameters_ex(3, &result, &row,
&field)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &result,
&row, &field) == FAILURE) {
+ return;
}
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
- convert_to_long_ex(row);
- if (Z_LVAL_PP(row)<0 ||
Z_LVAL_PP(row)>=(int)mysql_num_rows(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to
row %ld on MySQL result index %ld", Z_LVAL_PP(row), Z_LVAL_PP(result));
+ if (row<0 || row>=(long)mysql_num_rows(mysql_result)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to jump to
row %ld on MySQL result index %ld", row, Z_LVAL_P(result));
RETURN_FALSE;
}
- mysql_data_seek(mysql_result, Z_LVAL_PP(row));
+ mysql_data_seek(mysql_result, row);
if (field) {
/* XXX: What about unicode type ??? Please test :) */
- switch(Z_TYPE_PP(field)) {
+ switch(Z_TYPE_P(field)) {
case IS_STRING: {
int i=0;
const MYSQL_FIELD *tmp_field;
char *table_name, *field_name, *tmp;
- if ((tmp=strchr(Z_STRVAL_PP(field),
'.'))) {
- table_name =
estrndup(Z_STRVAL_PP(field), tmp-Z_STRVAL_PP(field));
+ if ((tmp=strchr(Z_STRVAL_P(field),
'.'))) {
+ table_name =
estrndup(Z_STRVAL_P(field), tmp-Z_STRVAL_P(field));
field_name = estrdup(tmp+1);
} else {
table_name = NULL;
- field_name =
estrndup(Z_STRVAL_PP(field),Z_STRLEN_PP(field));
+ field_name =
estrndup(Z_STRVAL_P(field),Z_STRLEN_P(field));
}
mysql_field_seek(mysql_result, 0);
while
((tmp_field=mysql_fetch_field(mysql_result))) {
@@ -1952,7 +1877,7 @@
}
if (!tmp_field) { /* no match found */
php_error_docref(NULL
TSRMLS_CC, E_WARNING, "%s%s%s not found in MySQL result index %ld",
-
(table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_PP(result));
+
(table_name?table_name:""), (table_name?".":""), field_name, Z_LVAL_P(result));
efree(field_name);
if (table_name) {
efree(table_name);
@@ -1966,8 +1891,8 @@
}
break;
default:
- convert_to_long_ex(field);
- field_offset = Z_LVAL_PP(field);
+ convert_to_long_ex(&field);
+ field_offset = Z_LVAL_P(field);
if (field_offset<0 ||
field_offset>=(int)mysql_num_fields(mysql_result)) {
php_error_docref(NULL TSRMLS_CC,
E_WARNING, "Bad column offset specified");
RETURN_FALSE;
@@ -1998,14 +1923,14 @@
Gets number of rows in a result */
PHP_FUNCTION(mysql_num_rows)
{
- zval **result;
+ zval *result;
MYSQL_RES *mysql_result;
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) ==
FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
/* conversion from int64 to long happing here */
Z_LVAL_P(return_value) = (long) mysql_num_rows(mysql_result);
@@ -2017,14 +1942,14 @@
Gets number of fields in a result */
PHP_FUNCTION(mysql_num_fields)
{
- zval **result;
+ zval *result;
MYSQL_RES *mysql_result;
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) ==
FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
Z_LVAL_P(return_value) = mysql_num_fields(mysql_result);
Z_TYPE_P(return_value) = IS_LONG;
@@ -2052,7 +1977,6 @@
*/
static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int
result_type, int expected_args, int into_object)
{
- zval **result, **arg2;
MYSQL_RES *mysql_result;
zval *res, *ctor_params = NULL;
zend_class_entry *ce = NULL;
@@ -2070,7 +1994,7 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s&z",
&res, &class_name, &class_name_len, UG(utf8_conv), &ctor_params) == FAILURE) {
return;
}
- result = &res;
+
if (ZEND_NUM_ARGS() < 2) {
ce = zend_standard_class_def;
} else {
@@ -2082,29 +2006,14 @@
}
result_type = MYSQL_ASSOC;
} else {
- if (ZEND_NUM_ARGS() > expected_args) {
- WRONG_PARAM_COUNT;
+ result_type = MYSQL_BOTH;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l",
&res, &result_type) == FAILURE) {
+ return;
}
-
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1,
&result)==FAILURE) {
- RETURN_FALSE;
- }
- if (!result_type) {
- result_type = MYSQL_BOTH;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result,
&arg2)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(arg2);
- result_type = Z_LVAL_PP(arg2);
- break;
- default:
- WRONG_PARAM_COUNT;
- break;
+ if (!result_type) {
+ /* result_type might have been set outside, so only
overwrite when not set */
+ result_type = MYSQL_BOTH;
}
}
@@ -2113,7 +2022,7 @@
result_type = MYSQL_BOTH;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &res, -1, "MySQL
result", le_result);
#ifndef MYSQL_USE_MYSQLND
if ((mysql_row = mysql_fetch_row(mysql_result)) == NULL ||
@@ -2333,21 +2242,21 @@
Move internal result pointer */
PHP_FUNCTION(mysql_data_seek)
{
- zval **result, **offset;
+ zval *result;
+ long offset;
MYSQL_RES *mysql_result;
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result,
&offset)==FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result,
&offset)) {
+ return;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
- convert_to_long_ex(offset);
- if (Z_LVAL_PP(offset)<0 ||
Z_LVAL_PP(offset)>=(int)mysql_num_rows(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset %ld is
invalid for MySQL result index %ld (or the query data is unbuffered)",
Z_LVAL_PP(offset), Z_LVAL_PP(result));
+ if (offset<0 || offset>=(long)mysql_num_rows(mysql_result)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Offset %ld is
invalid for MySQL result index %ld (or the query data is unbuffered)", offset,
Z_LVAL_P(result));
RETURN_FALSE;
}
- mysql_data_seek(mysql_result, Z_LVAL_PP(offset));
+ mysql_data_seek(mysql_result, offset);
RETURN_TRUE;
}
/* }}} */
@@ -2357,17 +2266,17 @@
Gets max data size of each column in a result */
PHP_FUNCTION(mysql_fetch_lengths)
{
- zval **result;
+ zval *result;
MYSQL_RES *mysql_result;
mysql_row_length_type *lengths;
int num_fields;
int i;
-
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) ==
FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
if ((lengths=mysql_fetch_lengths(mysql_result))==NULL) {
RETURN_FALSE;
@@ -2461,34 +2370,23 @@
Gets column information from a result and return as an object */
PHP_FUNCTION(mysql_fetch_field)
{
- zval **result, **field=NULL;
+ zval *result;
+ long field=0;
MYSQL_RES *mysql_result;
const MYSQL_FIELD *mysql_field;
- switch (ZEND_NUM_ARGS()) {
- case 1:
- if (zend_get_parameters_ex(1, &result)==FAILURE) {
- RETURN_FALSE;
- }
- break;
- case 2:
- if (zend_get_parameters_ex(2, &result,
&field)==FAILURE) {
- RETURN_FALSE;
- }
- convert_to_long_ex(field);
- break;
- default:
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &result,
&field) == FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
if (field) {
- if (Z_LVAL_PP(field)<0 ||
Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) {
+ if (field<0 || field>=(int)mysql_num_fields(mysql_result)) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad field
offset");
RETURN_FALSE;
}
- mysql_field_seek(mysql_result, Z_LVAL_PP(field));
+ mysql_field_seek(mysql_result, field);
}
if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
RETURN_FALSE;
@@ -2516,21 +2414,20 @@
Sets result pointer to a specific field offset */
PHP_FUNCTION(mysql_field_seek)
{
- zval **result, **offset;
+ zval *result;
+ long offset;
MYSQL_RES *mysql_result;
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result,
&offset)==FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result,
&offset) == FAILURE) {
+ return;
+ }
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
- convert_to_long_ex(offset);
- if (Z_LVAL_PP(offset)<0 ||
Z_LVAL_PP(offset)>=(int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %ld is
invalid for MySQL result index %ld", Z_LVAL_PP(offset), Z_LVAL_PP(result));
+ if (offset<0 || offset>=(int)mysql_num_fields(mysql_result)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %ld is
invalid for MySQL result index %ld", offset, Z_LVAL_P(result));
RETURN_FALSE;
}
- mysql_field_seek(mysql_result, Z_LVAL_PP(offset));
+ mysql_field_seek(mysql_result, offset);
RETURN_TRUE;
}
/* }}} */
@@ -2546,24 +2443,24 @@
*/
static void php_mysql_field_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
{
- zval **result, **field;
+ zval *result;
+ long field;
MYSQL_RES *mysql_result;
const MYSQL_FIELD *mysql_field = {0};
char buf[512];
int len;
- if (ZEND_NUM_ARGS()!=2 || zend_get_parameters_ex(2, &result,
&field)==FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result,
&field) == FAILURE) {
+ return;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
- convert_to_long_ex(field);
- if (Z_LVAL_PP(field)<0 ||
Z_LVAL_PP(field)>=(int)mysql_num_fields(mysql_result)) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %ld is
invalid for MySQL result index %ld", Z_LVAL_PP(field), Z_LVAL_PP(result));
+ if (field<0 || field>=(int)mysql_num_fields(mysql_result)) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Field %ld is
invalid for MySQL result index %ld", field, Z_LVAL_P(result));
RETURN_FALSE;
}
- mysql_field_seek(mysql_result, Z_LVAL_PP(field));
+ mysql_field_seek(mysql_result, field);
if ((mysql_field=mysql_fetch_field(mysql_result))==NULL) {
RETURN_FALSE;
}
@@ -2709,20 +2606,20 @@
Free result memory */
PHP_FUNCTION(mysql_free_result)
{
- zval **result;
+ zval *result;
MYSQL_RES *mysql_result;
- if (ZEND_NUM_ARGS()!=1 || zend_get_parameters_ex(1, &result)==FAILURE) {
- WRONG_PARAM_COUNT;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &result) ==
FAILURE) {
+ return;
}
- if (Z_TYPE_PP(result)==IS_RESOURCE && Z_LVAL_PP(result)==0) {
+ if (Z_LVAL_P(result)==0) {
RETURN_FALSE;
}
- ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, result, -1, "MySQL
result", le_result);
+ ZEND_FETCH_RESOURCE(mysql_result, MYSQL_RES *, &result, -1, "MySQL
result", le_result);
- zend_list_delete(Z_LVAL_PP(result));
+ zend_list_delete(Z_LVAL_P(result));
RETURN_TRUE;
}
/* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_affected_rows.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/mysql/tests/mysql_affected_rows.phpt
diff -u php-src/ext/mysql/tests/mysql_affected_rows.phpt:1.4
php-src/ext/mysql/tests/mysql_affected_rows.phpt:1.5
--- php-src/ext/mysql/tests/mysql_affected_rows.phpt:1.4 Fri Oct 12
12:32:39 2007
+++ php-src/ext/mysql/tests/mysql_affected_rows.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (false !== ($tmp = @mysql_affected_rows()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-if (false !== ($tmp = @mysql_affected_rows($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (null !== ($tmp = @mysql_affected_rows($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_affected_rows($link, $link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_close.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_close.phpt
diff -u php-src/ext/mysql/tests/mysql_close.phpt:1.3
php-src/ext/mysql/tests/mysql_close.phpt:1.4
--- php-src/ext/mysql/tests/mysql_close.phpt:1.3 Fri Oct 12 12:32:39 2007
+++ php-src/ext/mysql/tests/mysql_close.phpt Fri Nov 28 20:21:35 2008
@@ -23,8 +23,8 @@
$host, $user, $db, $port, $socket);
$tmp = @mysql_close(NULL);
-if (false !== $tmp)
- printf("[004] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (null !== $tmp)
+ printf("[004] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
$tmp = mysql_close($link);
if (true !== $tmp)
@@ -36,4 +36,4 @@
print "done!\n";
?>
--EXPECTF--
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_data_seek.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_data_seek.phpt
diff -u php-src/ext/mysql/tests/mysql_data_seek.phpt:1.3
php-src/ext/mysql/tests/mysql_data_seek.phpt:1.4
--- php-src/ext/mysql/tests/mysql_data_seek.phpt:1.3 Fri Oct 12 12:32:39 2007
+++ php-src/ext/mysql/tests/mysql_data_seek.phpt Fri Nov 28 20:21:35 2008
@@ -18,8 +18,8 @@
if (NULL !== ($tmp = @mysql_data_seek($link)))
printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-if (false !== ($tmp = @mysql_data_seek($link, $link)))
- printf("[003] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_data_seek($link, $link)))
+ printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$res = mysql_query('SELECT * FROM test ORDER BY id LIMIT 4', $link))
@@ -70,4 +70,4 @@
Warning: mysql_data_seek(): Offset 3 is invalid for MySQL result index %d (or
the query data is unbuffered) in %s on line %d
Warning: mysql_data_seek(): %d is not a valid MySQL result resource in %s on
line %d
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_db_name.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_db_name.phpt
diff -u php-src/ext/mysql/tests/mysql_db_name.phpt:1.3
php-src/ext/mysql/tests/mysql_db_name.phpt:1.4
--- php-src/ext/mysql/tests/mysql_db_name.phpt:1.3 Fri Oct 12 12:32:39 2007
+++ php-src/ext/mysql/tests/mysql_db_name.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (NULL !== ($tmp = @mysql_db_name()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-if (false !== ($tmp = @mysql_db_name($link, $link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_db_name($link, $link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
@@ -63,4 +63,4 @@
Warning: mysql_db_name(): Unable to jump to row %d on MySQL result index %d in
%s on line %d
Warning: mysql_db_name(): %d is not a valid MySQL result resource in %s on
line %d
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_errno.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/mysql/tests/mysql_errno.phpt
diff -u php-src/ext/mysql/tests/mysql_errno.phpt:1.4
php-src/ext/mysql/tests/mysql_errno.phpt:1.5
--- php-src/ext/mysql/tests/mysql_errno.phpt:1.4 Fri Oct 12 12:32:39 2007
+++ php-src/ext/mysql/tests/mysql_errno.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (false !== ($tmp = @mysql_errno()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-if (false !== ($tmp = @mysql_errno($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (null !== ($tmp = @mysql_errno($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_errno($link, 'too many args')))
printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@@ -56,4 +56,4 @@
Warning: mysql_errno(): %d is not a valid MySQL-Link resource in %s on line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_error.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_error.phpt
diff -u php-src/ext/mysql/tests/mysql_error.phpt:1.3
php-src/ext/mysql/tests/mysql_error.phpt:1.4
--- php-src/ext/mysql/tests/mysql_error.phpt:1.3 Fri Oct 12 12:32:39 2007
+++ php-src/ext/mysql/tests/mysql_error.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (false !== ($tmp = @mysql_error()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-if (false !== ($tmp = @mysql_error($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_error($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_error($link, 'too many args')))
printf("[002b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@@ -60,4 +60,4 @@
--EXPECTF--
Warning: mysql_error(): %d is not a valid MySQL-Link resource in %s on line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_fetch_field.phpt?r1=1.5&r2=1.6&diff_format=u
Index: php-src/ext/mysql/tests/mysql_fetch_field.phpt
diff -u php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.5
php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.6
--- php-src/ext/mysql/tests/mysql_fetch_field.phpt:1.5 Wed Oct 10 10:56:33 2007
+++ php-src/ext/mysql/tests/mysql_fetch_field.phpt Fri Nov 28 20:21:35 2008
@@ -16,8 +16,8 @@
if (!is_null($tmp = @mysql_fetch_field()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
- if (false !== ($tmp = @mysql_fetch_field($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n",
gettype($tmp), $tmp);
+ if (NULL !== ($tmp = @mysql_fetch_field($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
require('table.inc');
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_fetch_lengths.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_fetch_lengths.phpt
diff -u php-src/ext/mysql/tests/mysql_fetch_lengths.phpt:1.3
php-src/ext/mysql/tests/mysql_fetch_lengths.phpt:1.4
--- php-src/ext/mysql/tests/mysql_fetch_lengths.phpt:1.3 Thu Aug 9
11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_fetch_lengths.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (!is_null($tmp = @mysql_fetch_lengths()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-if (false !== ($tmp = @mysql_fetch_lengths($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_fetch_lengths($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$res = mysql_query("SELECT id, label FROM test ORDER BY id LIMIT 1",
$link)) {
@@ -45,4 +45,4 @@
Warning: mysql_fetch_lengths(): %d is not a valid MySQL result resource in %s
on line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_field_flags.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_field_flags.phpt
diff -u php-src/ext/mysql/tests/mysql_field_flags.phpt:1.3
php-src/ext/mysql/tests/mysql_field_flags.phpt:1.4
--- php-src/ext/mysql/tests/mysql_field_flags.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_field_flags.phpt Fri Nov 28 20:21:35 2008
@@ -136,7 +136,7 @@
print "done!";
?>
--EXPECTF--
-Warning: Wrong parameter count for mysql_field_flags() in %s on line %d
+Warning: mysql_field_flags() expects exactly 2 parameters, 1 given in %s on
line %d
Warning: mysql_field_flags(): Field -1 is invalid for MySQL result index %d in
%s on line %d
@@ -144,4 +144,4 @@
Warning: mysql_field_flags(): %d is not a valid MySQL result resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_field_len.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_field_len.phpt
diff -u php-src/ext/mysql/tests/mysql_field_len.phpt:1.3
php-src/ext/mysql/tests/mysql_field_len.phpt:1.4
--- php-src/ext/mysql/tests/mysql_field_len.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_field_len.phpt Fri Nov 28 20:21:35 2008
@@ -43,7 +43,7 @@
print "done!";
?>
--EXPECTF--
-Warning: Wrong parameter count for mysql_field_len() in %s on line %d
+Warning: mysql_field_len() expects exactly 2 parameters, 1 given in %s on line
%d
Warning: mysql_field_len(): Field -1 is invalid for MySQL result index %d in
%s on line %d
@@ -51,4 +51,4 @@
Warning: mysql_field_len(): %d is not a valid MySQL result resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_field_name.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_field_name.phpt
diff -u php-src/ext/mysql/tests/mysql_field_name.phpt:1.3
php-src/ext/mysql/tests/mysql_field_name.phpt:1.4
--- php-src/ext/mysql/tests/mysql_field_name.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_field_name.phpt Fri Nov 28 20:21:35 2008
@@ -42,7 +42,7 @@
print "done!";
?>
--EXPECTF--
-Warning: Wrong parameter count for mysql_field_name() in %s on line %d
+Warning: mysql_field_name() expects exactly 2 parameters, 1 given in %s on
line %d
Warning: mysql_field_name(): Field -1 is invalid for MySQL result index %d in
%s on line %d
string(2) "id"
@@ -62,4 +62,4 @@
Warning: mysql_field_name(): %d is not a valid MySQL result resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_field_table.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_field_table.phpt
diff -u php-src/ext/mysql/tests/mysql_field_table.phpt:1.3
php-src/ext/mysql/tests/mysql_field_table.phpt:1.4
--- php-src/ext/mysql/tests/mysql_field_table.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_field_table.phpt Fri Nov 28 20:21:35 2008
@@ -42,7 +42,7 @@
print "done!";
?>
--EXPECTF--
-Warning: Wrong parameter count for mysql_field_table() in %s on line %d
+Warning: mysql_field_table() expects exactly 2 parameters, 1 given in %s on
line %d
Warning: mysql_field_table(): Field -1 is invalid for MySQL result index %d in
%s on line %d
string(4) "test"
@@ -62,4 +62,4 @@
Warning: mysql_field_table(): %d is not a valid MySQL result resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_field_type.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_field_type.phpt
diff -u php-src/ext/mysql/tests/mysql_field_type.phpt:1.3
php-src/ext/mysql/tests/mysql_field_type.phpt:1.4
--- php-src/ext/mysql/tests/mysql_field_type.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_field_type.phpt Fri Nov 28 20:21:35 2008
@@ -42,7 +42,7 @@
print "done!";
?>
--EXPECTF--
-Warning: Wrong parameter count for mysql_field_type() in %s on line %d
+Warning: mysql_field_type() expects exactly 2 parameters, 1 given in %s on
line %d
Warning: mysql_field_type(): Field -1 is invalid for MySQL result index %d in
%s on line %d
string(3) "int"
@@ -62,4 +62,4 @@
Warning: mysql_field_type(): %d is not a valid MySQL result resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_free_result.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_free_result.phpt
diff -u php-src/ext/mysql/tests/mysql_free_result.phpt:1.3
php-src/ext/mysql/tests/mysql_free_result.phpt:1.4
--- php-src/ext/mysql/tests/mysql_free_result.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_free_result.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (!is_null($tmp = @mysql_free_result()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-if (false !== ($tmp = @mysql_free_result($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (null !== ($tmp = @mysql_free_result($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$res = mysql_query("SELECT id FROM test ORDER BY id LIMIT 1", $link)) {
@@ -44,4 +44,4 @@
Warning: mysql_free_result(): %d is not a valid MySQL result resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_get_host_info.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_get_host_info.phpt
diff -u php-src/ext/mysql/tests/mysql_get_host_info.phpt:1.3
php-src/ext/mysql/tests/mysql_get_host_info.phpt:1.4
--- php-src/ext/mysql/tests/mysql_get_host_info.phpt:1.3 Thu Aug 9
11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_get_host_info.phpt Fri Nov 28 20:21:35 2008
@@ -9,8 +9,8 @@
<?php
include_once "connect.inc";
-if (false !== ($tmp = @mysql_get_host_info(NULL)))
- printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_get_host_info(NULL)))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require "table.inc";
if (!is_string($info = mysql_get_host_info($link)) || ('' === $info))
@@ -37,4 +37,4 @@
print "done!";
?>
--EXPECTF--
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_get_proto_info.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_get_proto_info.phpt
diff -u php-src/ext/mysql/tests/mysql_get_proto_info.phpt:1.3
php-src/ext/mysql/tests/mysql_get_proto_info.phpt:1.4
--- php-src/ext/mysql/tests/mysql_get_proto_info.phpt:1.3 Thu Aug 9
11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_get_proto_info.phpt Fri Nov 28 20:21:35 2008
@@ -9,8 +9,8 @@
<?php
include_once "connect.inc";
-if (false !== ($tmp = @mysql_get_proto_info(NULL)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_get_proto_info(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require "table.inc";
if (!is_int($info = mysql_get_proto_info($link)) || (0 === $info))
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_get_server_info.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_get_server_info.phpt
diff -u php-src/ext/mysql/tests/mysql_get_server_info.phpt:1.3
php-src/ext/mysql/tests/mysql_get_server_info.phpt:1.4
--- php-src/ext/mysql/tests/mysql_get_server_info.phpt:1.3 Thu Aug 9
11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_get_server_info.phpt Fri Nov 28 20:21:35 2008
@@ -9,8 +9,8 @@
<?php
include "connect.inc";
-if (false !== ($tmp = @mysql_get_server_info(NULL)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (null !== ($tmp = @mysql_get_server_info(NULL)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require "table.inc";
if (!is_string($info = mysql_get_server_info($link)) || ('' === $info))
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_insert_id.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_insert_id.phpt
diff -u php-src/ext/mysql/tests/mysql_insert_id.phpt:1.3
php-src/ext/mysql/tests/mysql_insert_id.phpt:1.4
--- php-src/ext/mysql/tests/mysql_insert_id.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_insert_id.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (false !== ($tmp = @mysql_insert_id()))
printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
-if (false !== ($tmp = @mysql_insert_id($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_insert_id($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (!is_null($tmp = @mysql_insert_id($link, 'too many args')))
printf("[002a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
@@ -63,4 +63,4 @@
--EXPECTF--
Warning: mysql_insert_id(): %d is not a valid MySQL-Link resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_dbs.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_list_dbs.phpt
diff -u php-src/ext/mysql/tests/mysql_list_dbs.phpt:1.3
php-src/ext/mysql/tests/mysql_list_dbs.phpt:1.4
--- php-src/ext/mysql/tests/mysql_list_dbs.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_list_dbs.phpt Fri Nov 28 20:21:35 2008
@@ -12,8 +12,8 @@
$tmp = NULL;
$link = NULL;
-if (false !== ($tmp = @mysql_list_dbs(NULL)))
- printf("[001] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_list_dbs(NULL)))
+ printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_list_dbs($link, $link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_list_tables.phpt?r1=1.2&r2=1.3&diff_format=u
Index: php-src/ext/mysql/tests/mysql_list_tables.phpt
diff -u php-src/ext/mysql/tests/mysql_list_tables.phpt:1.2
php-src/ext/mysql/tests/mysql_list_tables.phpt:1.3
--- php-src/ext/mysql/tests/mysql_list_tables.phpt:1.2 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_list_tables.phpt Fri Nov 28 20:21:35 2008
@@ -21,8 +21,8 @@
if (false !== ($tmp = @mysql_list_tables(NULL)))
printf("[003] Expecting boolean/false got %s/%s\n", gettype($tmp),
$tmp);
-if (false !== ($tmp = @mysql_list_tables($db, NULL)))
- printf("[004] Expecting boolean/false got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_list_tables($db, NULL)))
+ printf("[004] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
require_once('table.inc');
@@ -78,4 +78,4 @@
print "done!\n";
?>
--EXPECTF--
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_num_fields.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_num_fields.phpt
diff -u php-src/ext/mysql/tests/mysql_num_fields.phpt:1.3
php-src/ext/mysql/tests/mysql_num_fields.phpt:1.4
--- php-src/ext/mysql/tests/mysql_num_fields.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_num_fields.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (!is_null($tmp = @mysql_num_fields()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-if (false !== ($tmp = @mysql_num_fields($link)))
- printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp),
$tmp);
+if (NULL !== ($tmp = @mysql_num_fields($link)))
+ printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
@@ -49,4 +49,4 @@
?>
--EXPECTF--
Warning: mysql_num_fields(): %d is not a valid MySQL result resource in %s on
line %d
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_num_rows.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/mysql/tests/mysql_num_rows.phpt
diff -u php-src/ext/mysql/tests/mysql_num_rows.phpt:1.3
php-src/ext/mysql/tests/mysql_num_rows.phpt:1.4
--- php-src/ext/mysql/tests/mysql_num_rows.phpt:1.3 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_num_rows.phpt Fri Nov 28 20:21:35 2008
@@ -15,8 +15,8 @@
if (!is_null($tmp = @mysql_num_rows()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-if (false !== ($tmp = @mysql_num_rows($link)))
-printf("[002] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
+if (NULL !== ($tmp = @mysql_num_rows($link)))
+printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
@@ -40,7 +40,7 @@
func_test_mysql_num_rows($link, "SELECT 1 AS a", 1, 5);
func_test_mysql_num_rows($link, "SHOW VARIABLES LIKE '%nixnutz%'", 0, 10);
-func_test_mysql_num_rows($link, "INSERT INTO test(id, label) VALUES (100,
'z')", false, 15);
+func_test_mysql_num_rows($link, "INSERT INTO test(id, label) VALUES (100,
'z')", NULL, 15);
func_test_mysql_num_rows($link, "SELECT id FROM test LIMIT 2", 2, 20, true);
if ($res = mysql_query('SELECT COUNT(id) AS num FROM test', $link)) {
@@ -58,9 +58,9 @@
print "done!";
?>
--EXPECTF--
-Warning: mysql_num_rows(): supplied argument is not a valid MySQL result
resource in %s on line %d
+Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in
%s on line %d
-Warning: mysql_free_result(): supplied argument is not a valid MySQL result
resource in %s on line %d
+Warning: mysql_free_result() expects parameter 1 to be resource, boolean given
in %s on line %d
Warning: mysql_num_rows(): %d is not a valid MySQL result resource in %s on
line %d
-done!
\ No newline at end of file
+done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysql/tests/mysql_tablename.phpt?r1=1.4&r2=1.5&diff_format=u
Index: php-src/ext/mysql/tests/mysql_tablename.phpt
diff -u php-src/ext/mysql/tests/mysql_tablename.phpt:1.4
php-src/ext/mysql/tests/mysql_tablename.phpt:1.5
--- php-src/ext/mysql/tests/mysql_tablename.phpt:1.4 Thu Aug 9 11:53:17 2007
+++ php-src/ext/mysql/tests/mysql_tablename.phpt Fri Nov 28 20:21:35 2008
@@ -42,7 +42,7 @@
print "done!";
?>
--EXPECTF--
-Warning: Wrong parameter count for mysql_tablename() in %s on line %d
+Warning: mysql_tablename() expects at least 2 parameters, 1 given in %s on
line %d
Warning: mysql_tablename(): Unable to jump to row -1 on MySQL result index %d
in %s on line %d
string(1) "1"
@@ -62,4 +62,4 @@
Warning: mysql_tablename(): %d is not a valid MySQL result resource in %s on
line %d
bool(false)
-done!
\ No newline at end of file
+done!
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php