File: db_ismanip.phpt

package info (click to toggle)
php-db 1.7.13-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny, squeeze
  • size: 872 kB
  • ctags: 1,600
  • sloc: php: 6,913; pascal: 1,001; xml: 198; makefile: 55; sh: 24
file content (61 lines) | stat: -rw-r--r-- 1,309 bytes parent folder | download
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
--TEST--
DB::isManip
--SKIPIF--
<?php chdir(dirname(__FILE__)); require_once './skipif.inc'; ?>
--FILE--
<?php // -*- C++ -*-
require_once './include.inc';
require_once 'DB.php';

function test($query) {
    printf("%s : %d\n", preg_replace('/\s+.*/', '', $query),
           DB::isManip($query));
}

print "testing DB::isManip...\n";

test("SELECT * FROM table");
test("Select * from table");
test("select * From table");
test("sElECt * frOm table");
test("SELECT DISTINCT name FROM table");
test("SELECT a, b INTO table2 FROM table1");
test("SELECT a, b FROM table WHERE b = ' INTO '");
test("UPDATE table SET foo = 'bar'");
test("DELETE FROM table");
test("delete from table where id is null");
test("create table (id integer, name varchar(100))");
test("CREATE SEQUENCE foo");
test("\"CREATE PROCEDURE foo\"");
test("GRANT SELECT ON table TO user");
test("REVOKE SELECT ON table FROM user");
test("SHOW OPTIONS");
test("DROP TABLE foo");
test("ALTER TABLE foo ADD COLUMN (bar INTEGER)");
test("  SELECT * FROM table");
test("  DELETE FROM table");
?>
--GET--
--POST--
--EXPECT--
testing DB::isManip...
SELECT : 0
Select : 0
select : 0
sElECt : 0
SELECT : 0
SELECT : 1
SELECT : 0
UPDATE : 1
DELETE : 1
delete : 1
create : 1
CREATE : 1
"CREATE : 1
GRANT : 1
REVOKE : 1
SHOW : 0
DROP : 1
ALTER : 1
 : 0
 : 1