uw                                       Thu, 02 Sep 2010 14:57:38 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=303009

Log:
Fix test failure. Add new test for MYSQLI_OPT_INT_AND_FLOAT_NATIVE mysqlnd 
feature.

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options.phpt
    A   
php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
    U   php/php-src/trunk/ext/mysqli/tests/mysqli_options.phpt
    A   
php/php-src/trunk/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt

Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options.phpt	2010-09-02 13:49:45 UTC (rev 303008)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options.phpt	2010-09-02 14:57:38 UTC (rev 303009)
@@ -10,31 +10,16 @@
 <?php
 	require_once("connect.inc");

-/*
-TODO: ext/mysqli might lack support for those options which are available
-with the libmysql C call mysql_options(). Not sure which of them make
-sense to have in PHP and not even sure which of them might be available
-already through other measures.
+	$valid_options = array(
+		MYSQLI_READ_DEFAULT_GROUP 			=> "MYSQLI_READ_DEFAULT_GROUP",
+		MYSQLI_READ_DEFAULT_FILE 			=> "MYSQLI_READ_DEFAUTL_FILE",
+		MYSQLI_OPT_CONNECT_TIMEOUT			=> "MYSQLI_OPT_CONNECT_TIMEOUT",
+		MYSQLI_OPT_LOCAL_INFILE				=> "MYSQLI_OPT_LOCAL_INFILE",
+		MYSQLI_INIT_COMMAND					=> "MYSQLI_INIT_COMMAND",
+		MYSQLI_SET_CHARSET_NAME				=> "MYSQLI_SET_CHARSET_NAME",
+		MYSQLI_OPT_SSL_VERIFY_SERVER_CERT 	=> "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT",
+	);

-	MYSQL_OPT_COMPRESS (argument: not used) --> Andrey/Ulf: bug, should be added
-	? MYSQL_OPT_NAMED_PIPE (argument: not used) ?
-	MYSQL_OPT_READ_TIMEOUT (argument type: unsigned int *) --> Andrey/Ulf: bug, should be added
-	MYSQL_OPT_RECONNECT (argument type: my_bool *) -->  Andrey/Ulf: might be security risk to have
-	MYSQL_OPT_SSL_VERIFY_SERVER_CERT (argument type: my_bool *) --> Andrey/Ulf: might be security risk to have
-	MYSQL_OPT_WRITE_TIMEOUT (argument type: unsigned int *) --> Andrey/Ulf: bug, should be added
-	MYSQL_REPORT_DATA_TRUNCATION (argument type: my_bool *) --> Andrey: bug, although truncation might only happen with libmysql not with mysqlnd
-	MYSQL_SECURE_AUTH (argument type: my_bool *) --> Ulf: let's say deprecated, no bug
-	? MYSQL_SET_CHARSET_DIR (argument type: char *) ?
-	MYSQL_SHARED_MEMORY_BASE_NAME (argument type: char *)
-*/
-
-	$valid_options = array(  MYSQLI_READ_DEFAULT_GROUP, MYSQLI_READ_DEFAULT_FILE,
-		MYSQLI_OPT_CONNECT_TIMEOUT, MYSQLI_OPT_LOCAL_INFILE,
-		MYSQLI_INIT_COMMAND, MYSQLI_READ_DEFAULT_GROUP,
-		MYSQLI_READ_DEFAULT_FILE, MYSQLI_OPT_CONNECT_TIMEOUT,
-		MYSQLI_OPT_LOCAL_INFILE, MYSQLI_INIT_COMMAND,
-		MYSQLI_SET_CHARSET_NAME);
-
 	if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'))
 		$valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE');
 	if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE'))
@@ -72,28 +57,54 @@
 	var_dump("MYSQLI_OPT_CONNECT_TIMEOUT",	mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
 	var_dump("MYSQLI_OPT_LOCAL_INFILE",		mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
 	var_dump("MYSQLI_INIT_COMMAND",			mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
+
+
+	if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+		printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+			$host, $user, $db, $port, $socket);
+
+	if (!$res = mysqli_query($link2, 'SELECT version() AS server_version'))
+		printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+	$tmp = mysqli_fetch_assoc($res);
+	mysqli_free_result($res);
+	$version = explode('.', $tmp['server_version']);
+	if (empty($version))
+		printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+	if ($version[0] <= 4 && $version[1] < 1)
+		printf("[009] Need MySQL Server 4.1+ for the test!\n");
+
+	if (!$res = mysqli_query($link2, "SHOW CHARACTER SET"))
+		printf("[010] Cannot get list of available character sets, [%d] %s\n",
+			mysqli_errno($link2), mysqli_error($link2));
+
+	$charsets = array();
+	while ($row = mysqli_fetch_assoc($res))
+		$charsets[] = $row;
+	mysqli_free_result($res);
+	mysqli_close($link2);
+
+	foreach ($charsets as $charset) {
+		$k = $charset['Charset'];
+		/* The server currently 17.07.2007 can't handle data sent in ucs2 */
+		/* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
+		if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') {
+			continue;
+		}
+		if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) {
+			printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']);
+		}
+	}
+
 	var_dump("MYSQLI_READ_DEFAULT_GROUP",	mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
 	var_dump("MYSQLI_READ_DEFAULT_FILE",	mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
 	var_dump("MYSQLI_OPT_CONNECT_TIMEOUT",	mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
 	var_dump("MYSQLI_OPT_LOCAL_INFILE",		mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
 	var_dump("MYSQLI_INIT_COMMAND",			mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
-	var_dump("MYSQLI_CLIENT_SSL",			mysqli_options($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option'));

-	if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_YEARS_AS_INT') &&
-		!($tmp = mysqli_options($link, constant('MYSQLI_OPT_INT_AND_YEARS_AS_INT'), true)))
-		printf("[006] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
-
-	if ($IS_MYSQLND) {
-		/* Don't do this with libmysql. You may hit options not exported to PHP and cause false positives */
-		for ($flag = -10000; $flag < 10000; $flag++) {
-			if (in_array($flag, $valid_options))
-				continue;
-			if (FALSE !== ($tmp = mysqli_options($link, $flag, 'definetely not an mysqli_option'))) {
-				var_dump(array("SOME_FLAG" => $flag, "ret" => $tmp));
-			}
-		}
-	}
-
+	/* mysqli_real_connect() */
+	var_dump("MYSQLI_CLIENT_SSL",			mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option'));
+
 	mysqli_close($link);

 	echo "Link closed";

Added: php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt	                        (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt	2010-09-02 14:57:38 UTC (rev 303009)
@@ -0,0 +1,109 @@
+--TEST--
+mysqli_options() - MYSQLI_OPT_INT_AND_FLOAT_NATIVE
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+
+require_once('connect.inc');
+if (!$IS_MYSQLND)
+	die("skip mysqlnd only test");
+?>
+--FILE--
+<?php
+	require_once("connect.inc");
+
+
+	$types = array(
+		'BIT' 			=> array('BIT(8)', 0),
+		'TINYINT'		=> array('TINYINT', 120),
+		'BOOL'			=> array('BOOL', 0),
+		'BOOLEAN'		=> array('BOOLEAN', 1),
+		'SMALLINT'		=> array('SMALLINT', 32000),
+		'MEDIUMINT'		=> array('MEDIUMINT', 999),
+		'INT'			=> array('INT', 999),
+		'BIGINT'		=> array('BIGINT', 999),
+		'FLOAT'			=> array('FLOAT', 1.3),
+		'DOUBLE'		=> array('DOUBLE', -1.3),
+	);
+
+	foreach ($types as $name => $data) {
+		$link = mysqli_init();
+		if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) {
+			printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+			printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+			continue;
+		}
+
+
+		if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+			printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) {
+			printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) {
+			printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+			printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		$row = mysqli_fetch_assoc($res);
+		mysqli_free_result($res);
+
+		if ($row['id'] !== $data[1]) {
+			printf("[007] Expecting %s - %s/%s got %s/%s\n",
+				$name,
+				$data[1], gettype($data[1]), $row['id'], gettype($row['id']));
+		}
+		mysqli_close($link);
+
+		$link = mysqli_init();
+		if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) {
+			printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+			printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+			continue;
+		}
+
+		if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+			printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		$row = mysqli_fetch_assoc($res);
+		mysqli_free_result($res);
+
+		if (!is_string($row['id']) || ($row['id'] != $data[1])) {
+			printf("[011] Expecting %s - %s/string got %s/%s\n",
+				$name,
+				$data[1], $row['id'], gettype($row['id']));
+		}
+		mysqli_close($link);
+
+	}
+
+	print "done!";
+?>
+--CLEAN--
+<?php
+	require_once("clean_table.inc");
+?>
+--EXPECTF--
+done!
\ No newline at end of file

Modified: php/php-src/trunk/ext/mysqli/tests/mysqli_options.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_options.phpt	2010-09-02 13:49:45 UTC (rev 303008)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_options.phpt	2010-09-02 14:57:38 UTC (rev 303009)
@@ -10,31 +10,16 @@
 <?php
 	require_once("connect.inc");

-/*
-TODO: ext/mysqli might lack support for those options which are available
-with the libmysql C call mysql_options(). Not sure which of them make
-sense to have in PHP and not even sure which of them might be available
-already through other measures.
+	$valid_options = array(
+		MYSQLI_READ_DEFAULT_GROUP 			=> "MYSQLI_READ_DEFAULT_GROUP",
+		MYSQLI_READ_DEFAULT_FILE 			=> "MYSQLI_READ_DEFAUTL_FILE",
+		MYSQLI_OPT_CONNECT_TIMEOUT			=> "MYSQLI_OPT_CONNECT_TIMEOUT",
+		MYSQLI_OPT_LOCAL_INFILE				=> "MYSQLI_OPT_LOCAL_INFILE",
+		MYSQLI_INIT_COMMAND					=> "MYSQLI_INIT_COMMAND",
+		MYSQLI_SET_CHARSET_NAME				=> "MYSQLI_SET_CHARSET_NAME",
+		MYSQLI_OPT_SSL_VERIFY_SERVER_CERT 	=> "MYSQLI_OPT_SSL_VERIFY_SERVER_CERT",
+	);

-	MYSQL_OPT_COMPRESS (argument: not used) --> Andrey/Ulf: bug, should be added
-	? MYSQL_OPT_NAMED_PIPE (argument: not used) ?
-	MYSQL_OPT_READ_TIMEOUT (argument type: unsigned int *) --> Andrey/Ulf: bug, should be added
-	MYSQL_OPT_RECONNECT (argument type: my_bool *) -->  Andrey/Ulf: might be security risk to have
-	MYSQL_OPT_SSL_VERIFY_SERVER_CERT (argument type: my_bool *) --> Andrey/Ulf: might be security risk to have
-	MYSQL_OPT_WRITE_TIMEOUT (argument type: unsigned int *) --> Andrey/Ulf: bug, should be added
-	MYSQL_REPORT_DATA_TRUNCATION (argument type: my_bool *) --> Andrey: bug, although truncation might only happen with libmysql not with mysqlnd
-	MYSQL_SECURE_AUTH (argument type: my_bool *) --> Ulf: let's say deprecated, no bug
-	? MYSQL_SET_CHARSET_DIR (argument type: char *) ?
-	MYSQL_SHARED_MEMORY_BASE_NAME (argument type: char *)
-*/
-
-	$valid_options = array(  MYSQLI_READ_DEFAULT_GROUP, MYSQLI_READ_DEFAULT_FILE,
-		MYSQLI_OPT_CONNECT_TIMEOUT, MYSQLI_OPT_LOCAL_INFILE,
-		MYSQLI_INIT_COMMAND, MYSQLI_READ_DEFAULT_GROUP,
-		MYSQLI_READ_DEFAULT_FILE, MYSQLI_OPT_CONNECT_TIMEOUT,
-		MYSQLI_OPT_LOCAL_INFILE, MYSQLI_INIT_COMMAND,
-		MYSQLI_SET_CHARSET_NAME);
-
 	if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_CMD_BUFFER_SIZE'))
 		$valid_options[] = constant('MYSQLI_OPT_NET_CMD_BUFFER_SIZE');
 	if ($IS_MYSQLND && defined('MYSQLI_OPT_NET_READ_BUFFER_SIZE'))
@@ -72,28 +57,54 @@
 	var_dump("MYSQLI_OPT_CONNECT_TIMEOUT",	mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
 	var_dump("MYSQLI_OPT_LOCAL_INFILE",		mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
 	var_dump("MYSQLI_INIT_COMMAND",			mysqli_options($link, MYSQLI_INIT_COMMAND, array('SET AUTOCOMMIT=0', 'SET AUTOCOMMIT=1')));
+
+
+	if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+		printf("[006] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+			$host, $user, $db, $port, $socket);
+
+	if (!$res = mysqli_query($link2, 'SELECT version() AS server_version'))
+		printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+	$tmp = mysqli_fetch_assoc($res);
+	mysqli_free_result($res);
+	$version = explode('.', $tmp['server_version']);
+	if (empty($version))
+		printf("[008] Cannot determine server version, need MySQL Server 4.1+ for the test!\n");
+
+	if ($version[0] <= 4 && $version[1] < 1)
+		printf("[009] Need MySQL Server 4.1+ for the test!\n");
+
+	if (!$res = mysqli_query($link2, "SHOW CHARACTER SET"))
+		printf("[010] Cannot get list of available character sets, [%d] %s\n",
+			mysqli_errno($link2), mysqli_error($link2));
+
+	$charsets = array();
+	while ($row = mysqli_fetch_assoc($res))
+		$charsets[] = $row;
+	mysqli_free_result($res);
+	mysqli_close($link2);
+
+	foreach ($charsets as $charset) {
+		$k = $charset['Charset'];
+		/* The server currently 17.07.2007 can't handle data sent in ucs2 */
+		/* The server currently 16.08.2010 can't handle data sent in utf16 and utf32 */
+		if ($charset['Charset'] == 'ucs2' || $charset['Charset'] == 'utf16' || $charset['Charset'] == 'utf32') {
+			continue;
+		}
+		if (true !== mysqli_options($link, MYSQLI_SET_CHARSET_NAME, $charset['Charset'])) {
+			printf("[009] Setting charset name '%s' has failed\n", $charset['Charset']);
+		}
+	}
+
 	var_dump("MYSQLI_READ_DEFAULT_GROUP",	mysqli_options($link, MYSQLI_READ_DEFAULT_GROUP, 'extra_my.cnf'));
 	var_dump("MYSQLI_READ_DEFAULT_FILE",	mysqli_options($link, MYSQLI_READ_DEFAULT_FILE, 'extra_my.cnf'));
 	var_dump("MYSQLI_OPT_CONNECT_TIMEOUT",	mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 10));
 	var_dump("MYSQLI_OPT_LOCAL_INFILE",		mysqli_options($link, MYSQLI_OPT_LOCAL_INFILE, 1));
 	var_dump("MYSQLI_INIT_COMMAND",			mysqli_options($link, MYSQLI_INIT_COMMAND, 'SET AUTOCOMMIT=0'));
-	var_dump("MYSQLI_CLIENT_SSL",			mysqli_options($link, MYSQLI_CLIENT_SSL, 'not an mysqli_option'));

-	if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_YEARS_AS_INT') &&
-		!($tmp = mysqli_options($link, constant('MYSQLI_OPT_INT_AND_YEARS_AS_INT'), true)))
-		printf("[006] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
-
-	if ($IS_MYSQLND) {
-		/* Don't do this with libmysql. You may hit options not exported to PHP and cause false positives */
-		for ($flag = -10000; $flag < 10000; $flag++) {
-			if (in_array($flag, $valid_options))
-				continue;
-			if (FALSE !== ($tmp = mysqli_options($link, $flag, 'definetely not an mysqli_option'))) {
-				var_dump(array("SOME_FLAG" => $flag, "ret" => $tmp));
-			}
-		}
-	}
-
+	/* mysqli_real_connect() */
+	var_dump("MYSQLI_CLIENT_SSL",			mysqli_options($link, MYSQLI_CLIENT_SSL, 'not a mysqli_option'));
+
 	mysqli_close($link);

 	echo "Link closed";

Added: php/php-src/trunk/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt	                        (rev 0)
+++ php/php-src/trunk/ext/mysqli/tests/mysqli_options_int_and_float_native.phpt	2010-09-02 14:57:38 UTC (rev 303009)
@@ -0,0 +1,109 @@
+--TEST--
+mysqli_options() - MYSQLI_OPT_INT_AND_FLOAT_NATIVE
+--SKIPIF--
+<?php
+require_once('skipif.inc');
+require_once('skipifemb.inc');
+require_once('skipifconnectfailure.inc');
+
+require_once('connect.inc');
+if (!$IS_MYSQLND)
+	die("skip mysqlnd only test");
+?>
+--FILE--
+<?php
+	require_once("connect.inc");
+
+
+	$types = array(
+		'BIT' 			=> array('BIT(8)', 0),
+		'TINYINT'		=> array('TINYINT', 120),
+		'BOOL'			=> array('BOOL', 0),
+		'BOOLEAN'		=> array('BOOLEAN', 1),
+		'SMALLINT'		=> array('SMALLINT', 32000),
+		'MEDIUMINT'		=> array('MEDIUMINT', 999),
+		'INT'			=> array('INT', 999),
+		'BIGINT'		=> array('BIGINT', 999),
+		'FLOAT'			=> array('FLOAT', 1.3),
+		'DOUBLE'		=> array('DOUBLE', -1.3),
+	);
+
+	foreach ($types as $name => $data) {
+		$link = mysqli_init();
+		if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 1)) {
+			printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+			printf("[002] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+			continue;
+		}
+
+
+		if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+			printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!mysqli_query($link, sprintf("CREATE TABLE test (id %s)", $data[0]))) {
+			printf("[004] TODO [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!mysqli_query($link, sprintf("INSERT INTO test(id) VALUES (%f)", $data[1]))) {
+			printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+			printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		$row = mysqli_fetch_assoc($res);
+		mysqli_free_result($res);
+
+		if ($row['id'] !== $data[1]) {
+			printf("[007] Expecting %s - %s/%s got %s/%s\n",
+				$name,
+				$data[1], gettype($data[1]), $row['id'], gettype($row['id']));
+		}
+		mysqli_close($link);
+
+		$link = mysqli_init();
+		if (!mysqli_options($link, MYSQLI_OPT_INT_AND_FLOAT_NATIVE, 0)) {
+			printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+			printf("[009] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+			continue;
+		}
+
+		if (!$res = mysqli_query($link, "SELECT id FROM test")) {
+			printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+			continue;
+		}
+
+		$row = mysqli_fetch_assoc($res);
+		mysqli_free_result($res);
+
+		if (!is_string($row['id']) || ($row['id'] != $data[1])) {
+			printf("[011] Expecting %s - %s/string got %s/%s\n",
+				$name,
+				$data[1], $row['id'], gettype($row['id']));
+		}
+		mysqli_close($link);
+
+	}
+
+	print "done!";
+?>
+--CLEAN--
+<?php
+	require_once("clean_table.inc");
+?>
+--EXPECTF--
+done!
\ No newline at end of file
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to