List:Commits« Previous MessageNext Message »
From:ahristov Date:March 16 2007 3:44pm
Subject:PHP mysqlnd svn commit: r177 - in trunk: ext/mysqli ext/mysqli/mysqlnd ext/mysqli/tests php5/ext/mysqli
View as plain text  
Author: ahristov
Date: 2007-03-16 15:44:50 +0100 (Fri, 16 Mar 2007)
New Revision: 177

Modified:
   trunk/ext/mysqli/mysqli_api.c
   trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c
   trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
   trunk/php5/ext/mysqli/mysqli_api.c
Log:
Fix two tests, make three pass.


Modified: trunk/ext/mysqli/mysqli_api.c
===================================================================
--- trunk/ext/mysqli/mysqli_api.c	2007-03-16 13:44:53 UTC (rev 176)
+++ trunk/ext/mysqli/mysqli_api.c	2007-03-16 14:44:50 UTC (rev 177)
@@ -2052,15 +2052,22 @@
 {
 	MY_STMT	*stmt;
 	zval 	*mysql_stmt;
+	long    mode_in;
 	ulong   mode;
 	ulong	attr;
 	int		rc;
 
-	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll",
&mysql_stmt, mysqli_stmt_class_entry, &attr, &mode) == FAILURE) {
+	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll",
&mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
 		return;
 	}
 	MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt",
MYSQLI_STATUS_VALID);
 
+	if (mode_in < 0) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "mode should be non-negative, %ld passed",
mode_in);
+		RETURN_FALSE;
+	}
+
+	mode = mode_in;
 	if ((rc = mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode))) {
 		RETURN_FALSE;
 	}

Modified: trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c
===================================================================
--- trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c	2007-03-16 13:44:53 UTC (rev 176)
+++ trunk/ext/mysqli/mysqlnd/mysqlnd_ps.c	2007-03-16 14:44:50 UTC (rev 177)
@@ -1258,11 +1258,9 @@
 		case STMT_ATTR_CURSOR_TYPE:
 			*(unsigned long *) value= stmt->flags;
 			break;
-/* Unsupported for now
 		case STMT_ATTR_PREFETCH_ROWS:
 			*(unsigned long *) value= stmt->prefetch_rows;
 			break;
-*/
 		default:
 			return FAIL;
 	}

Modified: trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt
===================================================================
--- trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt	2007-03-16 13:44:53 UTC (rev 176)
+++ trunk/ext/mysqli/tests/mysqli_stmt_attr_set.phpt	2007-03-16 14:44:50 UTC (rev 177)
@@ -206,8 +206,8 @@
         // strange - but allowed !?
         $stmt = mysqli_stmt_init($link);    
         $stmt->prepare("SELECT label FROM test");
-        if (true !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
-            printf("[022] Expecting boolean/true, got %s/%s\n", gettype($tmp), $tmp);
+        if (false !== ($tmp = $stmt->attr_set(MYSQLI_STMT_ATTR_PREFETCH_ROWS, -1)))
+            printf("[022] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp);
         $stmt->close();
         
         $stmt = mysqli_stmt_init($link);    
@@ -239,4 +239,5 @@
     print "done!";
 ?>
 --EXPECTF--
-done!
\ No newline at end of file
+Warning: mysqli_stmt::attr_set(): mode should be non-negative, -1 passed in
/home/andrey/dev/php-mysqlnd/trunk/ext/mysqli/tests/mysqli_stmt_attr_set.php on line 203
+done!

Modified: trunk/php5/ext/mysqli/mysqli_api.c
===================================================================
--- trunk/php5/ext/mysqli/mysqli_api.c	2007-03-16 13:44:53 UTC (rev 176)
+++ trunk/php5/ext/mysqli/mysqli_api.c	2007-03-16 14:44:50 UTC (rev 177)
@@ -2029,15 +2029,22 @@
 {
 	MY_STMT	*stmt;
 	zval 	*mysql_stmt;
+	long    mode_in;
 	ulong   mode;
 	ulong	attr;
 	int		rc;
 
-	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll",
&mysql_stmt, mysqli_stmt_class_entry, &attr, &mode) == FAILURE) {
+	if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Oll",
&mysql_stmt, mysqli_stmt_class_entry, &attr, &mode_in) == FAILURE) {
 		return;
 	}
 	MYSQLI_FETCH_RESOURCE(stmt, MY_STMT *, &mysql_stmt, "mysqli_stmt",
MYSQLI_STATUS_VALID);
 
+	if (mode_in < 0) {
+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "mode should be non-negative, %ld passed",
mode_in);
+		RETURN_FALSE;
+	}
+
+	mode = mode_in;
 	if ((rc = mysql_stmt_attr_set(stmt->stmt, attr, (void *)&mode))) {
 		RETURN_FALSE;
 	}

Thread
PHP mysqlnd svn commit: r177 - in trunk: ext/mysqli ext/mysqli/mysqlnd ext/mysqli/tests php5/ext/mysqliahristov16 Mar