2 function test: mysqli_insert_id()
5 if (PHP_INT_SIZE == 8) {
6 echo 'skip test valid only for 32bit systems';
9 require_once('skipif.inc');
10 require_once('skipifconnectfailure.inc');
14 require_once("connect.inc");
16 /*** test mysqli_connect 127.0.0.1 ***/
17 $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
19 mysqli_select_db($link, $db);
21 mysqli_query($link, "DROP TABLE IF EXISTS t036");
22 mysqli_query($link, "CREATE TABLE t036 (a bigint not null auto_increment primary key, b varchar(10)) ENGINE = " . $engine);
24 mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
25 $test[] = mysqli_insert_id($link);
27 /* we have to insert more values, cause lexer sets auto_increment to max_int
28 see mysql bug #54. So we don't check for the value, only for type (which must
32 mysqli_query($link, "ALTER TABLE t036 AUTO_INCREMENT=9999999999999998");
33 mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo2')");
34 mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo3')");
35 mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo4')");
36 $x = mysqli_insert_id($link);
37 $test[] = is_string($x);
41 mysqli_query($link, "DROP TABLE IF EXISTS t036");
47 require_once("connect.inc");
48 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
49 printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
51 if (!mysqli_query($link, "DROP TABLE IF EXISTS t036"))
52 printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));