Annotation of embedaddon/php/ext/mysqli/tests/036.phpt, revision 1.1.1.1
1.1 misho 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');
11: ?>
12: --FILE--
13: <?php
14: require_once("connect.inc");
15:
16: /*** test mysqli_connect 127.0.0.1 ***/
17: $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
18:
19: mysqli_select_db($link, $db);
20:
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);
23:
24: mysqli_query($link, "INSERT INTO t036 (b) VALUES ('foo1')");
25: $test[] = mysqli_insert_id($link);
26:
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: */
31:
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);
38:
39: var_dump($test);
40:
41: mysqli_query($link, "DROP TABLE IF EXISTS t036");
42: mysqli_close($link);
43: print "done!";
44: ?>
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());
50:
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));
53:
54: mysqli_close($link);
55: ?>
56: --EXPECT--
57: array(2) {
58: [0]=>
59: int(1)
60: [1]=>
61: bool(true)
62: }
63: done!
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>