changed tests (ysqli_bind_param and mysql_bind_result changes)

This commit is contained in:
Georg Richter 2003-06-28 21:30:58 +00:00
parent f38bd95002
commit 192fb9095e
28 changed files with 51 additions and 52 deletions

View File

@ -21,7 +21,7 @@ mysqli bind_result 1
$rc = mysqli_query($link,"INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
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_fetch($stmt);

View File

@ -24,9 +24,9 @@ mysqli connect
'2010-07-10',
'2020','1999-12-29')");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -15,7 +15,7 @@ mysqli fetch char/text
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', 'this is a test')");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2);
mysqli_bind_result($stmt, $c1, $c2);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -17,7 +17,7 @@ mysqli fetch char/text long
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES ('1234567890', '$a')");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2);
mysqli_bind_result($stmt, $c1, $c2);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -21,7 +21,7 @@ mysqli fetch long values
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,-0,0)");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -21,7 +21,7 @@ mysqli fetch short values
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,35999,NULL,-500,-9999999,+30,0)");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -20,10 +20,8 @@ mysqli fetch tinyint values
mysqli_query($link, "INSERT INTO test_bind_fetch VALUES (-23,300,0,-100,-127,+30,0)");
$c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -21,7 +21,7 @@ mysqli fetch bigint values
mysqli_query($link, "INSERT INTO test_bind_fetch (c2,c3,c4,c5,c6,c7) VALUES (-23,4.0,33333333333333,0,-333333333333,99.9)");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -26,7 +26,7 @@ precision=12
sin(0.6), 1.00000000000001, 888888888888888)");
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -23,7 +23,7 @@ precision=12
2345.6,5678.89563,
'foobar','mysql rulez')");
$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_fetch($stmt);

View File

@ -24,7 +24,7 @@ precision=12
'206','6.7')");
$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_fetch($stmt);

View File

@ -23,7 +23,7 @@ mysqli fetch mixed / mysql_query
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
$c = array(0,0,0,0,0,0,0,0);
mysqli_bind_result($stmt, &$c[0], &$c[1], &$c[2], &$c[3], &$c[4], &$c[5], &$c[6], &$c[7]);
mysqli_bind_result($stmt, $c[0], $c[1], $c[2], $c[3], $c[4], $c[5], $c[6], $c[7]);
mysqli_execute($stmt);
mysqli_fetch($stmt);
mysqli_fetch($stmt);

View File

@ -12,7 +12,7 @@ mysqli fetch user variable
mysqli_query($link, "SET @dummy='foobar'");
$stmt = mysqli_prepare($link, "SELECT @dummy");
mysqli_bind_result($stmt, &$dummy);
mysqli_bind_result($stmt, $dummy);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -10,7 +10,7 @@ mysqli fetch functions
mysqli_select_db($link, "test");
$stmt = mysqli_prepare($link, "SELECT current_user(), database()");
mysqli_bind_result($stmt, &$c0, &$c1);
mysqli_bind_result($stmt, $c0, $c1);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -12,7 +12,7 @@ mysqli fetch system variables
mysqli_query($link, "SET AUTOCOMMIT=0");
$stmt = mysqli_prepare($link, "SELECT @@autocommit");
mysqli_bind_result($stmt, &$c0);
mysqli_bind_result($stmt, $c0);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -19,7 +19,7 @@ mysqli fetch (bind_param + bind_result)
col11 char(20))");
$stmt= mysqli_prepare($link,"INSERT INTO insert_read(col1,col10, col11) VALUES(?,?,?)");
mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT, &$c2, MYSQLI_BIND_STRING, &$c3, MYSQLI_BIND_STRING);
mysqli_bind_param($stmt, array(MYSQLI_BIND_INT, MYSQLI_BIND_STRING, MYSQLI_BIND_STRING), $c1, $c2, $c3);
$c1 = 1;
$c2 = "foo";
@ -29,7 +29,7 @@ mysqli fetch (bind_param + bind_result)
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from insert_read");
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_fetch($stmt);

View File

@ -18,13 +18,9 @@ mysqli bind_param/bind_result date
c7 timestamp(6))");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_result VALUES (?,?,?,?,?,?,?)");
mysqli_bind_param($stmt, &$d1, MYSQLI_BIND_STRING,
&$d2, MYSQLI_BIND_STRING,
&$d3, MYSQLI_BIND_STRING,
&$d4, MYSQLI_BIND_STRING,
&$d5, MYSQLI_BIND_STRING,
&$d6, MYSQLI_BIND_STRING,
&$d7, MYSQLI_BIND_STRING);
mysqli_bind_param($stmt, array(MYSQLI_BIND_STRING, MYSQLI_BIND_STRING, MYSQLI_BIND_STRING, MYSQLI_BIND_STRING,
MYSQLI_BIND_STRING, MYSQLI_BIND_STRING, MYSQLI_BIND_STRING),
$d1, $d2, $d3, $d4, $d5, $d6, $d7);
$d1 = '2002-01-02';
$d2 = '12:49:00';
@ -39,7 +35,7 @@ mysqli bind_param/bind_result date
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_result");
mysqli_bind_result($stmt,&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt,$c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -13,14 +13,14 @@ mysqli bind_param+bind_result char/text
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 char(10), c2 text)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_bind_param($stmt, &$q1, MYSQLI_BIND_STRING, &$q2, MYSQLI_BIND_STRING);
mysqli_bind_param($stmt, array(MYSQLI_BIND_STRING, MYSQLI_BIND_STRING), $q1, $q2);
$q1 = "1234567890";
$q2 = "this is a test";
mysqli_execute($stmt);
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2);
mysqli_bind_result($stmt, $c1, $c2);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -14,7 +14,7 @@ mysqli bind_param/bind_result char/text long
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_bind_param($stmt, &$a1, MYSQLI_BIND_STRING, &$a2, MYSQLI_BIND_STRING);
mysqli_bind_param($stmt, array(MYSQLI_BIND_STRING, MYSQLI_BIND_STRING), $a1, $a2);
$a1 = "1234567890";
$a2 = str_repeat("A1", 32000);
@ -23,7 +23,7 @@ mysqli bind_param/bind_result char/text long
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2);
mysqli_bind_result($stmt, $c1, $c2);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -19,9 +19,10 @@ mysqli bind_param/bind_prepare fetch long values
c7 int)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
&$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
&$c7, MYSQLI_BIND_INT);
mysqli_bind_param($stmt, array(MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT),
$c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 35999;
$c3 = NULL;
@ -34,7 +35,7 @@ mysqli bind_param/bind_prepare fetch long values
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -19,9 +19,10 @@ mysqli bind_param/bind_result short values
c7 smallint)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
&$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
&$c7, MYSQLI_BIND_INT);
mysqli_bind_param($stmt, array(MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT),
$c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 35999;
@ -35,7 +36,7 @@ mysqli bind_param/bind_result short values
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -19,8 +19,10 @@ mysqli bind_param/bind_result tinyint values
c7 tinyint)");
$stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES(?,?,?,?,?,?,?)");
mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_INT,&$c2, MYSQLI_BIND_INT,&$c3, MYSQLI_BIND_INT,&$c4, MYSQLI_BIND_INT,
&$c5, MYSQLI_BIND_INT,&$c6, MYSQLI_BIND_INT,&$c7, MYSQLI_BIND_INT);
mysqli_bind_param($stmt, array(MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT),
$c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 300;
@ -38,7 +40,7 @@ mysqli bind_param/bind_result tinyint values
$c1 = $c2 = $c3 = $c4 = $c5 = $c6 = $c7 = NULL;
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7);
mysqli_bind_result($stmt, $c1, $c2, $c3, $c4, $c5, $c6, $c7);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -15,7 +15,7 @@ mysqli bind_param/bind_result with send_long_data
mysqli_query($link,"CREATE TABLE test_bind_fetch(c1 varchar(10), c2 text)");
$stmt = mysqli_prepare ($link, "INSERT INTO test_bind_fetch VALUES (?,?)");
mysqli_bind_param($stmt,&$c1, MYSQLI_BIND_STRING, &$c2, MYSQLI_BIND_SEND_DATA);
mysqli_bind_param($stmt, array(MYSQLI_BIND_STRING, MYSQLI_BIND_SEND_DATA), $c1, $c2);
$c1 = "Hello World";
@ -27,7 +27,7 @@ mysqli bind_param/bind_result with send_long_data
mysqli_stmt_close($stmt);
$stmt = mysqli_prepare($link, "SELECT * FROM test_bind_fetch");
mysqli_bind_result($stmt, &$d1, &$d2);
mysqli_bind_result($stmt, $d1, $d2);
mysqli_execute($stmt);
mysqli_fetch($stmt);

View File

@ -19,9 +19,10 @@ mysqli_fetch_object
c7 smallint)");
$stmt = mysqli_prepare($link, "INSERT INTO test_bind_fetch VALUES (?,?,?,?,?,?,?)");
mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_INT,&$c2,MYSQLI_BIND_INT,&$c3,MYSQLI_BIND_INT,
&$c4,MYSQLI_BIND_INT,&$c5,MYSQLI_BIND_INT,&$c6,MYSQLI_BIND_INT,
&$c7, MYSQLI_BIND_INT);
mysqli_bind_param($stmt, array(MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT,MYSQLI_BIND_INT,MYSQLI_BIND_INT,
MYSQLI_BIND_INT),
$c1,$c2,$c3,$c4,$c5,$c6,$c7);
$c1 = -23;
$c2 = 35999;

View File

@ -16,7 +16,7 @@ mysqli_bind_param (UPDATE)
mysqli_query($link, "INSERT INTO test_update VALUES ('foo', 2)");
$stmt = mysqli_prepare($link, "UPDATE test_update SET a=?,b=? WHERE b=?");
mysqli_bind_param($stmt, &$c1,MYSQLI_BIND_STRING,&$c2,MYSQLI_BIND_INT, &$c3, MYSQLI_BIND_INT);
mysqli_bind_param($stmt, array(MYSQLI_BIND_STRING,MYSQLI_BIND_INT, MYSQLI_BIND_INT), $c1, $c2, $c3);
$c1 = "Rasmus";
$c2 = 1;

View File

@ -10,7 +10,7 @@ mysqli_bind_result (SHOW)
$stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
mysqli_execute($stmt);
mysqli_bind_result($stmt, &$c1, &$c2);
mysqli_bind_result($stmt, $c1, $c2);
mysqli_fetch($stmt);
mysqli_stmt_close($stmt);
$test = array ($c1,$c2);

View File

@ -15,7 +15,7 @@ mysqli_stmt_affected_rows (delete)
mysqli_query($link, "INSERT INTO test_affected VALUES (1),(2),(3),(4),(5)");
$stmt = mysqli_prepare($link, "DELETE FROM test_affected WHERE foo=?");
mysqli_bind_param($stmt, &$c1, MYSQLI_BIND_INT);
mysqli_bind_param($stmt, array(MYSQLI_BIND_INT), $c1);
$c1 = 2;

View File

@ -21,7 +21,7 @@ mysqli bind_result (OO-Style)
$mysql->query("INSERT INTO test_fetch_null(col1,col10, col11) VALUES(1,'foo1', 1000),(2,'foo2', 88),(3,'foo3', 389789)");
$stmt = $mysql->prepare("SELECT col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11 from test_fetch_null");
$stmt->bind_result(&$c1, &$c2, &$c3, &$c4, &$c5, &$c6, &$c7, &$c8, &$c9, &$c10, &$c11);
$stmt->bind_result($c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $c10, $c11);
$stmt->execute();
$stmt->fetch();