Annotation of embedaddon/php/ext/mysql/tests/bug53649.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Bug #53649 (mysql_query with "load data" unable to save result set)
3: --SKIPIF--
4: <?php
5: require_once('skipif.inc');
6: require_once('skipifconnectfailure.inc');
7:
8: if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
9: die(sprintf("skip Connect failed, [%d] %s\n", mysqlerrno(), mysqli_error()));
10: }
11:
12: if (!mysql_query("DROP TABLE IF EXISTS test", $link) ||
13: !mysql_query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine, $link))
14: die(sprintf("skip [%d] %s\n", mysql_errno($link), mysql_error($link)));
15:
16: if (false === file_put_contents('bug53649.data', "1\n2\n3\n"))
17: die(sprintf("skip Failed to create data file\n"));
18:
19: if (!mysql_query("LOAD DATA LOCAL INFILE 'bug53649.data' INTO TABLE test", $link) &&
20: 1148 == mysql_errno($link))
21: die("skip LOAD DATA LOAD INFILE not allowed\n");
22: ?>
23: --FILE--
24: <?php
25: require_once("connect.inc");
26:
27: if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
28: printf("[001] Connect failed, [%d] %s\n", mysqlerrno(), mysqli_error());
29: }
30:
31: if (!mysql_query("DROP TABLE IF EXISTS test", $link)) {
32: printf("[002] [%d] %s\n", mysql_errno($link), mysql_error($link));
33: }
34:
35: if (!mysql_query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine, $link)) {
36: printf("[003] [%d] %s\n", mysql_errno($link), mysql_error($link));
37: }
38:
39: if (false === file_put_contents('bug53649.data', "1\n2\n3\n"))
40: printf("[004] Failed to create data file\n");
41:
42: if (!mysql_query("SELECT 1 FROM DUAL", $link))
43: printf("[005] [%d] %s\n", mysql_errno($link), mysql_error($link));
44:
45: if (!mysql_query("LOAD DATA LOCAL INFILE 'bug53649.data' INTO TABLE test", $link)) {
46: printf("[006] [%d] %s\n", mysql_errno($link), mysql_error($link));
47: echo "bug";
48: } else {
49: echo "done";
50: }
51: mysql_close($link);
52: ?>
53: --CLEAN--
54: <?php
55: require_once('connect.inc');
56:
57: if (!$link = my_mysql_connect($host, $user, $passwd, $db, $port, $socket)) {
58: printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
59: $host, $user, $db, $port, $socket);
60: }
61:
62: if (!mysql_query($link, 'DROP TABLE IF EXISTS test', $link)) {
63: printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
64: }
65:
66: mysql_close($link);
67:
68: unlink('bug53649.data');
69: ?>
70: --EXPECT--
71: done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>