Updates to Tomato RAF including NGINX && PHP
[tomato.git] / release / src / router / php / ext / mysqli / tests / 036.phpt
blobb0d259c3f4a03c02649a19f034eb6e5c20824ed1
1 --TEST--
2 function test: mysqli_insert_id()
3 --SKIPIF--
4 <?php
5         if (PHP_INT_SIZE == 8) {
6                 echo 'skip test valid only for 32bit systems';
7                 exit;
8         }
9         require_once('skipif.inc');
10         require_once('skipifconnectfailure.inc');
12 --FILE--
13 <?php
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
29            be type string)
30         */
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);
39         var_dump($test);
41         mysqli_query($link, "DROP TABLE IF EXISTS t036");
42         mysqli_close($link);
43         print "done!";
45 --CLEAN--
46 <?php
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));
54 mysqli_close($link);
56 --EXPECT--
57 array(2) {
58   [0]=>
59   int(1)
60   [1]=>
61   bool(true)
63 done!