uw Thu Jul 12 20:20:57 2007 UTC
Added files:
/php-src/ext/mysqli/tests mysqli_affected_rows.phpt
mysqli_affected_rows_oo.phpt
mysqli_autocommit.phpt
mysqli_autocommit_oo.phpt
Log:
Adding tests for mysqli_affected_rows() and mysqli_autocommit()
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_affected_rows.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_affected_rows.phpt
+++ php-src/ext/mysqli/tests/mysqli_affected_rows.phpt
--TEST--
mysqli_affected_rows()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysqli_affected_rows()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!is_null($tmp = @mysqli_affected_rows($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!is_null($tmp = @mysqli_affected_rows($link, $link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
printf("[004] Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
if (0 !== ($tmp = mysqli_affected_rows($link)))
printf("[005] Expecting int/0, got %s/%s. [%d] %s\n",
gettype($tmp), $tmp, mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
printf("[006] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1),
PRIMARY KEY(id)) ENGINE = ' . $engine))
printf("[007] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'INSERT INTO test(id, label) VALUES (1, "a")'))
printf("[008] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (1 !== ($tmp = mysqli_affected_rows($link)))
printf("[010] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
// ignore INSERT error, NOTE: command line returns 0, affected_rows
returns -1 as documented
mysqli_query($link, 'INSERT INTO test(id, label) VALUES (1, "a")');
if (-1 !== ($tmp = mysqli_affected_rows($link)))
printf("[011] Expecting int/-1, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, 'INSERT INTO test(id, label) VALUES (1, "a")
ON DUPLICATE KEY UPDATE id = 4'))
printf("[012] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (2 !== ($tmp = mysqli_affected_rows($link)))
printf("[013] Expecting int/2, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (2, 'b'),
(3, 'c')"))
printf("[014] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (2 !== ($tmp = mysqli_affected_rows($link)))
printf("[015] Expecting int/2, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, "INSERT IGNORE INTO test(id, label) VALUES (1,
'a')")) {
printf("[016] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (1 !== ($tmp = mysqli_affected_rows($link)))
printf("[017] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, "INSERT INTO test(id, label) SELECT id + 10,
label FROM test"))
printf("[018] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (4 !== ($tmp = mysqli_affected_rows($link)))
printf("[019] Expecting int/4, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, "REPLACE INTO test(id, label) values (4,
'd')"))
printf("[020] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (2 !== ($tmp = mysqli_affected_rows($link)))
printf("[021] Expecting int/2, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, "REPLACE INTO test(id, label) values (5,
'e')"))
printf("[022] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (1 !== ($tmp = mysqli_affected_rows($link)))
printf("[023] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2"))
printf("[024] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (1 !== ($tmp = mysqli_affected_rows($link)))
printf("[025] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
$charsets = array('utf8');
foreach ($charsets as $k => $charset) {
if (!($res = mysqli_query($link, sprintf('SHOW CHARACTER SET
LIKE "%s"', $charset))))
continue;
mysqli_free_result($res);
if (true !== ($tmp = mysqli_set_charset($link, $charset)))
printf("[026] Expecting boolean/true got %s/%s\n",
gettype($tmp), $tmp);
if (0 !== ($tmp = mysqli_affected_rows($link)))
printf("[027] Expecting int/0 got %s/%s\n",
gettype($tmp), $tmp);
}
if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 2")) {
printf("[028] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (0 !== ($tmp = mysqli_affected_rows($link)))
printf("[029] Expecting int/0, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, "UPDATE test SET label = 'a' WHERE id = 100"))
{
printf("[030] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
}
if (0 !== ($tmp = mysqli_affected_rows($link)))
printf("[031] Expecting int/0, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
printf("[032] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
mysqli_close($link);
if (NULL !== ($tmp = @mysqli_affected_rows($link)))
printf("[033] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
print "done!";
?>
--EXPECTF--
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_affected_rows_oo.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
+++ php-src/ext/mysqli/tests/mysqli_affected_rows_oo.phpt
--TEST--
mysqli->affected_rows
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
--FILE--
<?php
include "connect.inc";
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (0 !== ($tmp = $mysqli->affected_rows))
printf("[002] Expecting int/0, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query('DROP TABLE IF EXISTS test'))
printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$mysqli->query('CREATE TABLE test(id INT, label CHAR(1), PRIMARY
KEY(id)) ENGINE = ' . $engine))
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$mysqli->query('INSERT INTO test(id, label) VALUES (1, "a")'))
printf("[005] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (1 !== ($tmp = $mysqli->affected_rows))
printf("[006] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
// ignore INSERT error, NOTE: command line returns 0, affected_rows
returns -1 as documented
$mysqli->query('INSERT INTO test(id, label) VALUES (1, "a")');
if (-1 !== ($tmp = $mysqli->affected_rows))
printf("[007] Expecting int/-1, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query('INSERT INTO test(id, label) VALUES (1, "a") ON
DUPLICATE KEY UPDATE id = 4'))
printf("[008] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (2 !== ($tmp = $mysqli->affected_rows))
printf("[009] Expecting int/2, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("INSERT INTO test(id, label) VALUES (2, 'b'), (3,
'c')"))
printf("[010] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (2 !== ($tmp = $mysqli->affected_rows))
printf("[011] Expecting int/2, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("INSERT IGNORE INTO test(id, label) VALUES (1,
'a')")) {
printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
}
if (1 !== ($tmp = $mysqli->affected_rows))
printf("[013] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("INSERT INTO test(id, label) SELECT id + 10, label
FROM test"))
printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (4 !== ($tmp = $mysqli->affected_rows))
printf("[015] Expecting int/4, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("REPLACE INTO test(id, label) values (4, 'd')"))
printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (2 !== ($tmp = $mysqli->affected_rows))
printf("[016] Expecting int/2, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("REPLACE INTO test(id, label) values (5, 'e')"))
printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (1 !== ($tmp = $mysqli->affected_rows))
printf("[018] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2"))
printf("[019] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (1 !== ($tmp = $mysqli->affected_rows))
printf("[020] Expecting int/1, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 2")) {
printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
}
if (0 !== ($tmp = $mysqli->affected_rows))
printf("[022] Expecting int/0, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query("UPDATE test SET label = 'a' WHERE id = 100")) {
printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
}
if (0 !== ($tmp = $mysqli->affected_rows))
printf("[024] Expecting int/0, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query('DROP TABLE IF EXISTS test'))
printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
$mysqli->close();
if (NULL !== ($tmp = @$mysqli->affected_rows))
printf("[026] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
print "done!";
?>
--EXPECTF--
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_autocommit.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_autocommit.phpt
+++ php-src/ext/mysqli/tests/mysqli_autocommit.phpt
--TEST--
mysqli_autocommit()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
<?PHP
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port,
$socket)) {
printf("skip Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
exit(1);
}
if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'")) {
printf("skip Cannot fetch have_innodb variable\n");
exit(1);
}
$row = mysqli_fetch_row($res);
mysqli_free_result($res);
mysqli_close($link);
if ($row[1] == "DISABLED" || $row[1] == "NO") {
printf ("skip Innodb support is not installed or enabled.");
exit(1);
}
?>
--FILE--
<?php
include "connect.inc";
$tmp = NULL;
$link = NULL;
if (!is_null($tmp = @mysqli_autocommit()))
printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!is_null($tmp = @mysqli_autocommit($link)))
printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!is_null($tmp = @mysqli_autocommit($link, $link, $link)))
printf("[003] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
if (!$link = mysqli_connect($host, $user, $passwd, $db, $port,
$socket)) {
printf("[004] Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (!is_bool($tmp = mysqli_autocommit($link, true)))
printf("[005] Expecting boolean/any, got %s/%s\n",
gettype($tmp), $tmp);
if (!mysqli_query($link, 'SET AUTOCOMMIT = 0'))
printf("[006] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
printf("[007] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$tmp = mysqli_fetch_assoc($res);
mysqli_free_result($res);
if ($tmp['auto_commit'])
printf("[008] Cannot turn off autocommit\n");
if (true !== ($tmp = mysqli_autocommit($link, true)))
printf("[009] Expecting true, got %s/%s\n", gettype($tmp),
$tmp);
if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
printf("[010] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$tmp = mysqli_fetch_assoc($res);
mysqli_free_result($res);
if (!$tmp['auto_commit'])
printf("[011] Cannot turn on autocommit\n");
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
printf("[012] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
printf("[013] Cannot create test table, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
}
if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
printf("[014] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'ROLLBACK'))
printf("[015] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
printf("[016] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
printf("[17] Expecting 1 row in table test, found %d rows. [%d]
%s\n",
$tmp['num'], mysqli_errno($link), mysqli_error($link));
mysqli_free_result($res);
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
printf("[018] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'SET AUTOCOMMIT = 1'))
printf("[019] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!$res = mysqli_query($link, 'SELECT @@autocommit as auto_commit'))
printf("[020] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$tmp = mysqli_fetch_assoc($res);
mysqli_free_result($res);
if (!$tmp['auto_commit'])
printf("[021] Cannot turn on autocommit\n");
if (true !== ($tmp = mysqli_autocommit($link, false)))
printf("[022] Expecting true, got %s/%s\n", gettype($tmp),
$tmp);
if (!mysqli_query($link, 'CREATE TABLE test(id INT) ENGINE = InnoDB')) {
printf("[023] Cannot create test table, [%d] %s\n",
mysqli_errno($link), mysqli_error($link));
}
if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
printf("[024] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'ROLLBACK'))
printf("[025] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
printf("[026] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
$tmp = mysqli_fetch_assoc($res);
if (0 != $tmp['num'])
printf("[27] Expecting 0 rows in table test, found %d rows\n",
$tmp['num']);
mysqli_free_result($res);
if (!mysqli_query($link, 'INSERT INTO test(id) VALUES (1)'))
printf("[028] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!mysqli_query($link, 'COMMIT'))
printf("[029] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS num FROM test'))
printf("[030] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
if ((!$tmp = mysqli_fetch_assoc($res)) || (1 != $tmp['num']))
printf("[31] Expecting 1 row in table test, found %d rows. [%d]
%s\n",
$tmp['num'], mysqli_errno($link), mysqli_error($link));
mysqli_free_result($res);
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test'))
printf("[032] [%d] %s\n", mysqli_errno($link),
mysqli_error($link));
mysqli_close($link);
if (NULL !== ($tmp = @mysqli_autocommit($link, false)))
printf("[033] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
print "done!\n";
?>
--EXPECTF--
done!
http://cvs.php.net/viewvc.cgi/php-src/ext/mysqli/tests/mysqli_autocommit_oo.phpt?view=markup&rev=1.1
Index: php-src/ext/mysqli/tests/mysqli_autocommit_oo.phpt
+++ php-src/ext/mysqli/tests/mysqli_autocommit_oo.phpt
--TEST--
mysqli->autocommit()
--SKIPIF--
<?php require_once('skipif.inc'); ?>
<?php require_once('skipifemb.inc'); ?>
<?PHP
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) {
printf("skip Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
exit(1);
}
if (!$res = $mysqli->query("SHOW VARIABLES LIKE 'have_innodb'")) {
printf("skip Cannot fetch have_innodb variable\n");
exit(1);
}
$row = $res->fetch_row();
$res->free_result();
$mysqli->close();
if ($row[1] == "DISABLED" || $row[1] == "NO") {
printf ("skip Innodb support is not installed or enabled.");
exit(1);
}
?>
--FILE--
<?php
include "connect.inc";
if (!$mysqli = new mysqli($host, $user, $passwd, $db, $port, $socket)) {
printf("[001] Cannot connect to the server using host=%s,
user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
$host, $user, $db, $port, $socket);
}
if (!is_bool($tmp = $mysqli->autocommit(true)))
printf("[002] Expecting boolean/any, got %s/%s\n",
gettype($tmp), $tmp);
if (!$mysqli->query('SET AUTOCOMMIT = 0'))
printf("[003] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
printf("[004] [%d] %s\n", $mysqli->errno, $mysqli->error);
$tmp = $res->fetch_assoc();
$res->free_result();
if ($tmp['auto_commit'])
printf("[005] Cannot turn off autocommit\n");
if (true !== ($tmp = $mysqli->autocommit( true)))
printf("[006] Expecting true, got %s/%s\n", gettype($tmp),
$tmp);
if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
printf("[007] [%d] %s\n", $mysqli->errno, $mysqli->error);
$tmp = $res->fetch_assoc();
$res->free_result();
if (!$tmp['auto_commit'])
printf("[008] Cannot turn on autocommit\n");
if (!$mysqli->query('DROP TABLE IF EXISTS test'))
printf("[009] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
printf("[010] Cannot create test table, [%d] %s\n",
$mysqli->errno, $mysqli->error);
}
if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
printf("[011] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$mysqli->query('ROLLBACK'))
printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error);
if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
printf("[014] Expecting 1 row in table test, found %d rows.
[%d] %s\n",
$tmp['num'], $mysqli->errno, $mysqli->error);
$res->free_result();
if (!$mysqli->query('DROP TABLE IF EXISTS test'))
printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$mysqli->query('SET AUTOCOMMIT = 1'))
printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$res = $mysqli->query('SELECT @@autocommit as auto_commit'))
printf("[017] [%d] %s\n", $mysqli->errno, $mysqli->error);
$tmp = $res->fetch_assoc();
$res->free_result();
if (!$tmp['auto_commit'])
printf("[018] Cannot turn on autocommit\n");
if (true !== ($tmp = $mysqli->autocommit( false)))
printf("[019] Expecting true, got %s/%s\n", gettype($tmp),
$tmp);
if (!$mysqli->query('CREATE TABLE test(id INT) ENGINE = InnoDB')) {
printf("[020] Cannot create test table, [%d] %s\n",
$mysqli->errno, $mysqli->error);
}
if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
printf("[021] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$mysqli->query('ROLLBACK'))
printf("[022] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
printf("[023] [%d] %s\n", $mysqli->errno, $mysqli->error);
$tmp = $res->fetch_assoc();
if (0 != $tmp['num'])
printf("[24] Expecting 0 rows in table test, found %d rows\n",
$tmp['num']);
$res->free_result();
if (!$mysqli->query('INSERT INTO test(id) VALUES (1)'))
printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$mysqli->query('COMMIT'))
printf("[025] [%d] %s\n", $mysqli->errno, $mysqli->error);
if (!$res = $mysqli->query('SELECT COUNT(*) AS num FROM test'))
printf("[027] [%d] %s\n", $mysqli->errno, $mysqli->error);
if ((!$tmp = $res->fetch_assoc()) || (1 != $tmp['num']))
printf("[028] Expecting 1 row in table test, found %d rows.
[%d] %s\n",
$tmp['num'], $mysqli->errno, $mysqli->error);
$res->free_result();
if (!$mysqli->query('DROP TABLE IF EXISTS test'))
printf("[029] [%d] %s\n", $mysqli->errno, $mysqli->error);
$mysqli->close();
if (NULL !== ($tmp = @$mysqli->autocommit( false)))
printf("[030] Expecting NULL, got %s/%s\n", gettype($tmp),
$tmp);
print "done!\n";
?>
--EXPECTF--
done!
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php