xref: /PHP-5.4/ext/mysqli/tests/066.phpt (revision 8b9719d8)
1--TEST--
2function test: mysqli_warning object
3--SKIPIF--
4<?php
5require_once('skipif.inc');
6require_once('skipifconnectfailure.inc');
7?>
8--FILE--
9<?php
10	require_once("connect.inc");
11
12	/*** test mysqli_connect 127.0.0.1 ***/
13	$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
14
15	if (!mysqli_query($mysql, "SET sql_mode=''"))
16		printf("[002] Cannot set SQL-Mode, [%d] %s\n", mysqli_errno($mysql), mysqli_error($mysql));
17
18	$mysql->query("DROP TABLE IF EXISTS test_warnings");
19
20	$mysql->query("CREATE TABLE test_warnings (a int not null) ENGINE=myisam");
21
22	$mysql->query("INSERT INTO test_warnings VALUES (1),(2),(NULL)");
23
24	if (($warning = $mysql->get_warnings())) {
25		do {
26			printf("Warning\n");
27		} while ($warning->next());
28	}
29
30	$mysql->close();
31	print "done!";
32?>
33--CLEAN--
34<?php
35require_once("connect.inc");
36if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
37   printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
38
39if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
40	printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
41
42mysqli_close($link);
43?>
44--EXPECT--
45Warning
46done!
47