-
Notifications
You must be signed in to change notification settings - Fork 7.8k
/
Copy pathmysql_db_query.phpt
65 lines (50 loc) · 1.79 KB
/
mysql_db_query.phpt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--TEST--
mysql_db_query()
--SKIPIF--
<?php
require_once('skipif.inc');
require_once('skipifconnectfailure.inc');
?>
--FILE--
<?php
include "connect.inc";
// NOTE: this function is deprecated. We do only the most necessary
// to test it. We don't test all aspects of the documented behaviour.
$tmp = NULL;
$link = NULL;
if (NULL !== ($tmp = @mysql_db_query()))
printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_db_query($link)))
printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
if (NULL !== ($tmp = @mysql_db_query($link)))
printf("[003] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp);
require('table.inc');
if (!$res = @mysql_db_query($db, 'SELECT id, label FROM test ORDER BY id LIMIT 1', $link))
printf("[004] [%d] %s\n", mysql_errno($link), mysql_error($link));
$row = mysql_fetch_assoc($res);
if (1 != $row['id'])
printf("[005] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($row['label'])) {
printf("[006] No unicode returned! [%d] %s\n", mysql_errno($link), mysql_error($link));
var_inspect($row);
}
mysql_free_result($res);
if (!$res = @mysql_db_query($db, 'SELECT id, label FROM test ORDER BY id LIMIT 1'))
printf("[007] [%d] %s\n", mysql_errno(), mysql_error());
$row = mysql_fetch_assoc($res);
if (1 != $row['id'])
printf("[008] Expecting record 1/a, got record %s/%s\n", $row['id'], $row['label']);
if ((version_compare(PHP_VERSION, '5.9.9', '>') == 1) && !is_unicode($row['label'])) {
printf("[009] No unicode returned! [%d] %s\n", mysql_errno(), mysql_error());
var_inspect($row);
}
mysql_free_result($res);
mysql_close($link);
print "done!\n";
?>
--CLEAN--
<?php
require_once("clean_table.inc");
?>
--EXPECTF--
done!