mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Next 10 in row to be tweaked:
- take connection parameter from connect.inc - use proper UEXPECTF - have 'print "done!"' or similar at the end to detect crashes - whitespace changes where needed - take care of portability: PHP 5 vs. PHP 5, MySQL 4.1 - 6.0 - understand return value checking as sometime that makes you type more when you write but makes you happy when you debug
This commit is contained in:
parent
472e0c78d1
commit
202ba6c5fe
10 changed files with 306 additions and 131 deletions
|
@ -9,20 +9,23 @@ precision=12
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_query($link, "SET sql_mode=''"))
|
||||||
mysqli_query($link, "SET sql_mode=''");
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_fetch");
|
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
|
||||||
|
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 float(3),
|
$rc = mysqli_query($link, "CREATE TABLE test_bind_fetch(c1 float(3),
|
||||||
c2 float,
|
c2 float,
|
||||||
c3 float unsigned,
|
c3 float unsigned,
|
||||||
c4 float,
|
c4 float,
|
||||||
c5 float,
|
c5 float,
|
||||||
c6 float,
|
c6 float,
|
||||||
c7 float(10) unsigned)");
|
c7 float(10) unsigned) ENGINE=" . $engine);
|
||||||
|
if (!$rc)
|
||||||
|
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
|
||||||
mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
|
mysqli_query($link, "INSERT INTO test_bind_fetch (c1,c2,c3,c4,c5,c6,c7) VALUES (3.1415926535,-0.000001, -5, 999999999999,
|
||||||
|
@ -39,6 +42,7 @@ precision=12
|
||||||
|
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
array(7) {
|
array(7) {
|
||||||
|
@ -57,3 +61,4 @@ array(7) {
|
||||||
[6]=>
|
[6]=>
|
||||||
float(888888914608000)
|
float(888888914608000)
|
||||||
}
|
}
|
||||||
|
done!
|
|
@ -9,21 +9,25 @@ precision=12
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
|
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
|
||||||
|
c3 int, c4 bigint,
|
||||||
|
c5 float, c6 double,
|
||||||
|
c7 varbinary(10),
|
||||||
|
c8 varchar(50)) ENGINE=" . $engine);
|
||||||
|
if (!$rc)
|
||||||
|
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
|
$rc = mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
|
||||||
c3 int, c4 bigint,
|
2345.6,5678.89563,
|
||||||
c5 float, c6 double,
|
'foobar','mysql rulez')");
|
||||||
c7 varbinary(10),
|
if (!$rc)
|
||||||
c8 varchar(50))");
|
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"INSERT INTO test_bind_result VALUES(19,2999,3999,4999999,
|
|
||||||
2345.6,5678.89563,
|
|
||||||
'foobar','mysql rulez')");
|
|
||||||
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
|
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
|
||||||
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
|
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
|
||||||
mysqli_execute($stmt);
|
mysqli_execute($stmt);
|
||||||
|
@ -35,6 +39,7 @@ precision=12
|
||||||
|
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
array(8) {
|
array(8) {
|
||||||
|
@ -51,7 +56,28 @@ array(8) {
|
||||||
[5]=>
|
[5]=>
|
||||||
float(5678.89563)
|
float(5678.89563)
|
||||||
[6]=>
|
[6]=>
|
||||||
%s(6) "foobar"
|
string(6) "foobar"
|
||||||
[7]=>
|
[7]=>
|
||||||
%s(11) "mysql rulez"
|
string(11) "mysql rulez"
|
||||||
}
|
}
|
||||||
|
done!
|
||||||
|
--UEXPECTF--
|
||||||
|
array(8) {
|
||||||
|
[0]=>
|
||||||
|
int(19)
|
||||||
|
[1]=>
|
||||||
|
int(2999)
|
||||||
|
[2]=>
|
||||||
|
int(3999)
|
||||||
|
[3]=>
|
||||||
|
int(4999999)
|
||||||
|
[4]=>
|
||||||
|
float(2345.60009766)
|
||||||
|
[5]=>
|
||||||
|
float(5678.89563)
|
||||||
|
[6]=>
|
||||||
|
string(6) "foobar"
|
||||||
|
[7]=>
|
||||||
|
unicode(11) "mysql rulez"
|
||||||
|
}
|
||||||
|
done!
|
|
@ -9,21 +9,23 @@ precision=12
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
|
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
|
||||||
|
c3 int, c4 bigint,
|
||||||
|
c5 float, c6 double,
|
||||||
|
c7 varbinary(10),
|
||||||
|
c8 varchar(10)) ENGINE=" . $engine);
|
||||||
|
if (!$rc)
|
||||||
|
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
|
if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
|
||||||
c3 int, c4 bigint,
|
2.6,58.89,
|
||||||
c5 float, c6 double,
|
'206','6.7')"))
|
||||||
c7 varbinary(10),
|
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
c8 varchar(10))");
|
|
||||||
|
|
||||||
mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,
|
|
||||||
2.6,58.89,
|
|
||||||
'206','6.7')");
|
|
||||||
|
|
||||||
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
|
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
|
||||||
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
|
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8);
|
||||||
|
@ -36,6 +38,7 @@ precision=12
|
||||||
|
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
array(8) {
|
array(8) {
|
||||||
|
@ -52,7 +55,28 @@ array(8) {
|
||||||
[5]=>
|
[5]=>
|
||||||
float(58.89)
|
float(58.89)
|
||||||
[6]=>
|
[6]=>
|
||||||
%s(3) "206"
|
string(3) "206"
|
||||||
[7]=>
|
[7]=>
|
||||||
%s(3) "6.7"
|
string(3) "6.7"
|
||||||
}
|
}
|
||||||
|
done!
|
||||||
|
--UEXPECTF--
|
||||||
|
array(8) {
|
||||||
|
[0]=>
|
||||||
|
int(120)
|
||||||
|
[1]=>
|
||||||
|
int(2999)
|
||||||
|
[2]=>
|
||||||
|
int(3999)
|
||||||
|
[3]=>
|
||||||
|
int(54)
|
||||||
|
[4]=>
|
||||||
|
float(2.59999990463)
|
||||||
|
[5]=>
|
||||||
|
float(58.89)
|
||||||
|
[6]=>
|
||||||
|
string(3) "206"
|
||||||
|
[7]=>
|
||||||
|
unicode(3) "6.7"
|
||||||
|
}
|
||||||
|
done!
|
|
@ -7,21 +7,24 @@ mysqli fetch mixed / mysql_query (may fail when using 4.1 library with 5.x serve
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"DROP TABLE IF EXISTS test_bind_result");
|
$rc = mysqli_query($link, "CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
|
||||||
|
c3 int, c4 bigint,
|
||||||
|
c5 decimal(4,2), c6 double,
|
||||||
|
c7 varbinary(10),
|
||||||
|
c8 varchar(10)) ENGINE=" . $engine);
|
||||||
|
if (!$rc)
|
||||||
|
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"CREATE TABLE test_bind_result(c1 tinyint, c2 smallint,
|
if (!mysqli_query($link, "INSERT INTO test_bind_result VALUES(120,2999,3999,54,
|
||||||
c3 int, c4 bigint,
|
2.6,58.89,
|
||||||
c5 decimal(4,2), c6 double,
|
'206','6.7')"))
|
||||||
c7 varbinary(10),
|
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
c8 varchar(10))");
|
|
||||||
|
|
||||||
mysqli_query($link,"INSERT INTO test_bind_result VALUES(120,2999,3999,54,
|
|
||||||
2.6,58.89,
|
|
||||||
'206','6.7')");
|
|
||||||
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
|
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
|
||||||
|
|
||||||
$c = array(0,0,0,0,0,0,0,0);
|
$c = array(0,0,0,0,0,0,0,0);
|
||||||
|
@ -37,16 +40,18 @@ mysqli fetch mixed / mysql_query (may fail when using 4.1 library with 5.x serve
|
||||||
|
|
||||||
$test = "";
|
$test = "";
|
||||||
for ($i=0; $i < count($c); $i++)
|
for ($i=0; $i < count($c); $i++)
|
||||||
$test .= ($c[0] == $d[0]) ? "1" : "0";
|
$test .= ($c[$i] == $d[$i]) ? "1" : "0";
|
||||||
if ($test == "11111111")
|
if ($test == "11111111")
|
||||||
echo "ok";
|
echo "ok\n";
|
||||||
else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
|
else if ($b_res == FALSE && mysqli_get_client_version() > 40100 && mysqli_get_client_version() < 50000 &&
|
||||||
mysqli_get_server_version($link) > 50000)
|
mysqli_get_server_version($link) > 50000)
|
||||||
echo "error (4.1 library with 5.x server)";
|
echo "error (4.1 library with 5.x server)";
|
||||||
else
|
else
|
||||||
echo "error";
|
echo "error";
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
ok
|
ok
|
||||||
|
done!
|
|
@ -4,9 +4,13 @@ mysqli autocommit/commit/rollback
|
||||||
<?php
|
<?php
|
||||||
require_once('skipif.inc');
|
require_once('skipif.inc');
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
$result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'");
|
if (!$result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'")) {
|
||||||
$row = mysqli_fetch_row($result);
|
die("skip Cannot check for required InnoDB suppot");
|
||||||
|
}
|
||||||
|
if (!$row = mysqli_fetch_row($result))
|
||||||
|
die("skip Cannot check for required InnoDB suppot");
|
||||||
|
|
||||||
mysqli_free_result($result);
|
mysqli_free_result($result);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
if ($row[1] == "DISABLED" || $row[1] == "NO") {
|
if ($row[1] == "DISABLED" || $row[1] == "NO") {
|
||||||
|
@ -17,53 +21,92 @@ mysqli autocommit/commit/rollback
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_autocommit($link, TRUE))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_autocommit($link, TRUE);
|
if (!mysqli_query($link, "DROP TABLE IF EXISTS ac_01"))
|
||||||
|
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"DROP TABLE IF EXISTS ac_01");
|
if (!mysqli_query($link, "CREATE TABLE ac_01(a int, b varchar(10)) type=InnoDB"))
|
||||||
|
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10)) type=InnoDB");
|
if (!mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')"))
|
||||||
|
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')");
|
if (!mysqli_autocommit($link, FALSE))
|
||||||
mysqli_autocommit($link, FALSE);
|
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
mysqli_query($link, "DELETE FROM ac_01");
|
|
||||||
mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
|
|
||||||
|
|
||||||
mysqli_rollback($link);
|
if (!mysqli_query($link, "DELETE FROM ac_01"))
|
||||||
|
printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
if (!mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"))
|
||||||
|
printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
if (!mysqli_rollback($link))
|
||||||
|
printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
if (!$result = mysqli_query($link, "SELECT * FROM ac_01"))
|
||||||
|
printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
$result = mysqli_query($link, "SELECT * FROM ac_01");
|
|
||||||
printf("Num_of_rows=%d\n", mysqli_num_rows($result));
|
printf("Num_of_rows=%d\n", mysqli_num_rows($result));
|
||||||
$row = mysqli_fetch_row($result);
|
if (!$row = mysqli_fetch_row($result))
|
||||||
|
printf("[010] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_free_result($result);
|
mysqli_free_result($result);
|
||||||
|
|
||||||
var_dump($row);
|
var_dump($row);
|
||||||
|
|
||||||
mysqli_query($link, "DELETE FROM ac_01");
|
if (!mysqli_query($link, "DELETE FROM ac_01"))
|
||||||
mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')");
|
printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
mysqli_commit($link);
|
|
||||||
|
if (!mysqli_query($link, "INSERT INTO ac_01 VALUES (2, 'egon')"))
|
||||||
|
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
if (!mysqli_commit($link))
|
||||||
|
printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
if (!$result = mysqli_query($link, "SELECT * FROM ac_01"))
|
||||||
|
printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
if (!$row = mysqli_fetch_row($result))
|
||||||
|
printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
$result = mysqli_query($link, "SELECT * FROM ac_01");
|
|
||||||
$row = mysqli_fetch_row($result);
|
|
||||||
mysqli_free_result($result);
|
mysqli_free_result($result);
|
||||||
|
|
||||||
var_dump($row);
|
var_dump($row);
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
Num_of_rows=1
|
Num_of_rows=1
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
%s(1) "1"
|
string(1) "1"
|
||||||
[1]=>
|
[1]=>
|
||||||
%s(6) "foobar"
|
string(6) "foobar"
|
||||||
}
|
}
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
%s(1) "2"
|
string(1) "2"
|
||||||
[1]=>
|
[1]=>
|
||||||
%s(4) "egon"
|
string(4) "egon"
|
||||||
}
|
}
|
||||||
|
done!
|
||||||
|
--UEXPECTF--
|
||||||
|
Num_of_rows=1
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
unicode(1) "1"
|
||||||
|
[1]=>
|
||||||
|
unicode(6) "foobar"
|
||||||
|
}
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
unicode(1) "2"
|
||||||
|
[1]=>
|
||||||
|
unicode(4) "egon"
|
||||||
|
}
|
||||||
|
done!
|
|
@ -1,10 +1,10 @@
|
||||||
--TEST--
|
--TEST--
|
||||||
mysqli autocommit/commit/rollback with myisam
|
mysqli autocommit/commit/rollback with innodb
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php
|
<?php
|
||||||
require_once('skipif.inc');
|
require_once('skipif.inc');
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
$result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'");
|
$result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'");
|
||||||
$row = mysqli_fetch_row($result);
|
$row = mysqli_fetch_row($result);
|
||||||
mysqli_free_result($result);
|
mysqli_free_result($result);
|
||||||
|
@ -18,15 +18,15 @@ mysqli autocommit/commit/rollback with myisam
|
||||||
<?php
|
<?php
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
mysqli_select_db($link, $db);
|
||||||
|
|
||||||
mysqli_autocommit($link, TRUE);
|
mysqli_autocommit($link, TRUE);
|
||||||
|
|
||||||
mysqli_query($link,"DROP TABLE IF EXISTS ac_01");
|
mysqli_query($link,"DROP TABLE IF EXISTS ac_01");
|
||||||
|
|
||||||
mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10))");
|
mysqli_query($link,"CREATE TABLE ac_01(a int, b varchar(10)) Engine=InnoDB");
|
||||||
|
|
||||||
mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')");
|
mysqli_query($link, "INSERT INTO ac_01 VALUES (1, 'foobar')");
|
||||||
mysqli_autocommit($link, FALSE);
|
mysqli_autocommit($link, FALSE);
|
||||||
|
@ -36,7 +36,7 @@ mysqli autocommit/commit/rollback with myisam
|
||||||
|
|
||||||
mysqli_rollback($link);
|
mysqli_rollback($link);
|
||||||
|
|
||||||
$result = mysqli_query($link, "SELECT * FROM ac_01");
|
$result = mysqli_query($link, "SELECT SQL_NO_CACHE * FROM ac_01");
|
||||||
$row = mysqli_fetch_row($result);
|
$row = mysqli_fetch_row($result);
|
||||||
mysqli_free_result($result);
|
mysqli_free_result($result);
|
||||||
|
|
||||||
|
@ -53,17 +53,33 @@ mysqli autocommit/commit/rollback with myisam
|
||||||
var_dump($row);
|
var_dump($row);
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
%s(1) "2"
|
string(1) "1"
|
||||||
[1]=>
|
[1]=>
|
||||||
%s(4) "egon"
|
string(6) "foobar"
|
||||||
}
|
}
|
||||||
array(2) {
|
array(2) {
|
||||||
[0]=>
|
[0]=>
|
||||||
%s(1) "2"
|
string(1) "2"
|
||||||
[1]=>
|
[1]=>
|
||||||
%s(4) "egon"
|
string(4) "egon"
|
||||||
}
|
}
|
||||||
|
done!
|
||||||
|
--UEXPECTF--
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
unicode(1) "1"
|
||||||
|
[1]=>
|
||||||
|
unicode(6) "foobar"
|
||||||
|
}
|
||||||
|
array(2) {
|
||||||
|
[0]=>
|
||||||
|
unicode(1) "2"
|
||||||
|
[1]=>
|
||||||
|
unicode(4) "egon"
|
||||||
|
}
|
||||||
|
done!
|
|
@ -7,13 +7,14 @@ mysqli fetch user variable
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_query($link, "SET @dummy='foobar'"))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link, "SET @dummy='foobar'");
|
if (!$stmt = mysqli_prepare($link, "SELECT @dummy"))
|
||||||
|
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
$stmt = mysqli_prepare($link, "SELECT @dummy");
|
|
||||||
mysqli_bind_result($stmt, $dummy);
|
mysqli_bind_result($stmt, $dummy);
|
||||||
mysqli_execute($stmt);
|
mysqli_execute($stmt);
|
||||||
mysqli_fetch($stmt);
|
mysqli_fetch($stmt);
|
||||||
|
@ -22,6 +23,11 @@ mysqli fetch user variable
|
||||||
|
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
%s(6) "foobar"
|
string(6) "foobar"
|
||||||
|
done!
|
||||||
|
--UEXPECTF--
|
||||||
|
unicode(6) "foobar"
|
||||||
|
done!
|
||||||
|
|
|
@ -8,11 +8,11 @@ mysqli fetch functions
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'"))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
$stmt = mysqli_prepare($link, "SELECT md5('bar'), database(), 'foo'");
|
|
||||||
mysqli_bind_result($stmt, $c0, $c1, $c2);
|
mysqli_bind_result($stmt, $c0, $c1, $c2);
|
||||||
mysqli_execute($stmt);
|
mysqli_execute($stmt);
|
||||||
|
|
||||||
|
@ -20,16 +20,31 @@ mysqli fetch functions
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
|
|
||||||
$test = array($c0, $c1, $c2);
|
$test = array($c0, $c1, $c2);
|
||||||
|
if ($c1 !== $db) {
|
||||||
|
echo "Different data\n";
|
||||||
|
}
|
||||||
|
|
||||||
var_dump($test);
|
var_dump($test);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
array(3) {
|
array(3) {
|
||||||
[0]=>
|
[0]=>
|
||||||
%s(32) "37b51d194a7513e45b56f6524f2d51f2"
|
string(32) "37b51d194a7513e45b56f6524f2d51f2"
|
||||||
[1]=>
|
[1]=>
|
||||||
%s(4) "test"
|
string(%d) "%s"
|
||||||
[2]=>
|
[2]=>
|
||||||
%s(3) "foo"
|
string(3) "foo"
|
||||||
}
|
}
|
||||||
|
done!
|
||||||
|
--UEXPECTF--
|
||||||
|
array(3) {
|
||||||
|
[0]=>
|
||||||
|
string(32) "37b51d194a7513e45b56f6524f2d51f2"
|
||||||
|
[1]=>
|
||||||
|
unicode(%d) "%s"
|
||||||
|
[2]=>
|
||||||
|
unicode(3) "foo"
|
||||||
|
}
|
||||||
|
done!
|
||||||
|
|
|
@ -7,13 +7,14 @@ mysqli fetch system variables
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_query($link, "SET AUTOCOMMIT=0"))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_query($link, "SET AUTOCOMMIT=0");
|
if (!$stmt = mysqli_prepare($link, "SELECT @@autocommit"))
|
||||||
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
$stmt = mysqli_prepare($link, "SELECT @@autocommit");
|
|
||||||
mysqli_bind_result($stmt, $c0);
|
mysqli_bind_result($stmt, $c0);
|
||||||
mysqli_execute($stmt);
|
mysqli_execute($stmt);
|
||||||
|
|
||||||
|
@ -22,6 +23,8 @@ mysqli fetch system variables
|
||||||
var_dump($c0);
|
var_dump($c0);
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
int(0)
|
int(0)
|
||||||
|
done!
|
|
@ -2,27 +2,29 @@
|
||||||
mysqli fetch (bind_param + bind_result)
|
mysqli fetch (bind_param + bind_result)
|
||||||
--SKIPIF--
|
--SKIPIF--
|
||||||
<?php require_once('skipif.inc'); ?>
|
<?php require_once('skipif.inc'); ?>
|
||||||
--INI--
|
|
||||||
precision=14
|
|
||||||
--FILE--
|
--FILE--
|
||||||
<?php
|
<?php
|
||||||
include "connect.inc";
|
include "connect.inc";
|
||||||
|
|
||||||
/*** test mysqli_connect 127.0.0.1 ***/
|
/*** test mysqli_connect 127.0.0.1 ***/
|
||||||
$link = mysqli_connect($host, $user, $passwd);
|
$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
|
||||||
|
|
||||||
mysqli_select_db($link, "test");
|
if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
|
||||||
$rc = mysqli_query($link,"DROP TABLE IF EXISTS insert_read");
|
printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
$rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
|
$rc = mysqli_query($link,"CREATE TABLE insert_read(col1 tinyint, col2 smallint,
|
||||||
col3 int, col4 bigint,
|
col3 int, col4 bigint,
|
||||||
col5 float, col6 double,
|
col5 float, col6 double,
|
||||||
col7 date, col8 time,
|
col7 date, col8 time,
|
||||||
col9 varbinary(10),
|
col9 varbinary(10),
|
||||||
col10 varchar(50),
|
col10 varchar(50),
|
||||||
col11 char(20))");
|
col11 char(20)) ENGINE=" . $engine);
|
||||||
|
if (!$rc)
|
||||||
|
printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
|
if (!$stmt = mysqli_prepare($link, "INSERT INTO insert_read(col1,col10, col11, col6) VALUES(?,?,?,?)"))
|
||||||
|
printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
$stmt= mysqli_prepare($link,"INSERT INTO insert_read(col1,col10, col11, col6) VALUES(?,?,?,?)");
|
|
||||||
mysqli_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
|
mysqli_bind_param($stmt, "issd", $c1, $c2, $c3, $c4);
|
||||||
|
|
||||||
$c1 = 1;
|
$c1 = 1;
|
||||||
|
@ -33,7 +35,9 @@ precision=14
|
||||||
mysqli_execute($stmt);
|
mysqli_execute($stmt);
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
|
|
||||||
$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read");
|
if (!$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read"))
|
||||||
|
printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
|
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
|
||||||
mysqli_execute($stmt);
|
mysqli_execute($stmt);
|
||||||
|
|
||||||
|
@ -45,6 +49,7 @@ precision=14
|
||||||
|
|
||||||
mysqli_stmt_close($stmt);
|
mysqli_stmt_close($stmt);
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
print "done!";
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
array(11) {
|
array(11) {
|
||||||
|
@ -67,7 +72,34 @@ array(11) {
|
||||||
[8]=>
|
[8]=>
|
||||||
NULL
|
NULL
|
||||||
[9]=>
|
[9]=>
|
||||||
%s(3) "foo"
|
string(3) "foo"
|
||||||
[10]=>
|
[10]=>
|
||||||
%s(6) "foobar"
|
string(6) "foobar"
|
||||||
}
|
}
|
||||||
|
done!
|
||||||
|
--UEXPECTF--
|
||||||
|
array(11) {
|
||||||
|
[0]=>
|
||||||
|
int(1)
|
||||||
|
[1]=>
|
||||||
|
NULL
|
||||||
|
[2]=>
|
||||||
|
NULL
|
||||||
|
[3]=>
|
||||||
|
NULL
|
||||||
|
[4]=>
|
||||||
|
NULL
|
||||||
|
[5]=>
|
||||||
|
float(3.14)
|
||||||
|
[6]=>
|
||||||
|
NULL
|
||||||
|
[7]=>
|
||||||
|
NULL
|
||||||
|
[8]=>
|
||||||
|
NULL
|
||||||
|
[9]=>
|
||||||
|
unicode(3) "foo"
|
||||||
|
[10]=>
|
||||||
|
unicode(6) "foobar"
|
||||||
|
}
|
||||||
|
done!
|
Loading…
Add table
Add a link
Reference in a new issue