cvs: pear /SQL_Parser/tests delete.php select.php select.sql

From: Date: Wed, 18 Dec 2002 06:40:24 +0000
Subject: cvs: pear /SQL_Parser/tests delete.php select.php select.sql
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-7924@lists.php.net to get a copy of this message
busterb Wed Dec 18 01:40:24 2002 EDT Modified files: /pear/SQL_Parser/tests delete.php select.php select.sql Log: updated tests to handle new 'is' operator Index: pear/SQL_Parser/tests/delete.php diff -u pear/SQL_Parser/tests/delete.php:1.1 pear/SQL_Parser/tests/delete.php:1.2 --- pear/SQL_Parser/tests/delete.php:1.1 Tue Sep 24 13:06:58 2002 +++ pear/SQL_Parser/tests/delete.php Wed Dec 18 01:40:22 2002 @@ -1,4 +1,4 @@ -<?php +2<?php $tests = array( array( 'sql' => 'delete from dog where cat = 4 and horse <> "dead meat" or mouse = \'furry\'', @@ -69,7 +69,7 @@ ), array( 'sql' => 'delete from dog where mouse is happy', -'expect' => 'Parse error: Expected an operator on line 1 +'expect' => 'Parse error: Expected "null" on line 1 delete from dog where mouse is happy ^ found: happy' Index: pear/SQL_Parser/tests/select.php diff -u pear/SQL_Parser/tests/select.php:1.2 pear/SQL_Parser/tests/select.php:1.3 --- pear/SQL_Parser/tests/select.php:1.2 Tue Dec 17 22:19:50 2002 +++ pear/SQL_Parser/tests/select.php Wed Dec 18 01:40:23 2002 @@ -304,5 +304,112 @@ ) ) ), +array( +'sql' => 'SELECT * FROM PERSON WHERE SURNAME IS not NULL AND FIRSTNAME = \'Jason\'', +'expect' => array( + 'command' => 'select', + 'column_names' => array( + 0 => '*' + ), + 'table_names' => array( + 0 => 'PERSON' + ), + 'table_aliases' => array( + 0 => '' + ), + 'where_clause' => array( + 'arg_1' => array( + 'arg_1' => array( + 'value' => 'SURNAME', + 'type' => 'ident' + ), + 'op' => 'is', + 'neg' => true, + 'arg_2' => array( + 'value' => '', + 'type' => 'null' + ) + ), + 'op' => 'and', + 'arg_2' => array( + 'arg_1' => array( + 'value' => 'FIRSTNAME', + 'type' => 'ident' + ), + 'op' => '=', + 'arg_2' => array( + 'value' => 'Jason', + 'type' => 'text_val' + ) + ) + ) + ) +), +array( +'sql' => 'SELECT * FROM PERSON WHERE SURNAME IS NULL', +'expect' => array( + 'command' => 'select', + 'column_names' => array( + 0 => '*' + ), + 'table_names' => array( + 0 => 'PERSON' + ), + 'table_aliases' => array( + 0 => '' + ), + 'where_clause' => array( + 'arg_1' => array( + 'value' => 'SURNAME', + 'type' => 'ident' + ), + 'op' => 'is', + 'arg_2' => array( + 'value' => '', + 'type' => 'null' + ) + ) + ) +), +array( +'sql' => 'SELECT * FROM PERSON WHERE SURNAME = \'\' AND FIRSTNAME = \'Jason\'', +'expect' => array( + 'command' => 'select', + 'column_names' => array( + 0 => '*' + ), + 'table_names' => array( + 0 => 'PERSON' + ), + 'table_aliases' => array( + 0 => '' + ), + 'where_clause' => array( + 'arg_1' => array( + 'arg_1' => array( + 'value' => 'SURNAME', + 'type' => 'ident' + ), + 'op' => '=', + 'arg_2' => array( + 'value' => '', + 'type' => 'text_val' + ) + ), + 'op' => 'and', + 'arg_2' => array( + 'arg_1' => array( + 'value' => 'FIRSTNAME', + 'type' => 'ident' + ), + 'op' => '=', + 'arg_2' => array( + 'value' => 'Jason', + 'type' => 'text_val' + ) + ) + ) + ) +), ); ?> Index: pear/SQL_Parser/tests/select.sql diff -u pear/SQL_Parser/tests/select.sql:1.2 pear/SQL_Parser/tests/select.sql:1.3 --- pear/SQL_Parser/tests/select.sql:1.2 Mon Dec 9 22:58:54 2002 +++ pear/SQL_Parser/tests/select.sql Wed Dec 18 01:40:23 2002 @@ -8,3 +8,6 @@ select foo.a from foo; select a as b from foo; select a from foo as bar; +SELECT * FROM PERSON WHERE SURNAME IS not NULL AND FIRSTNAME = 'Jason'; +SELECT * FROM PERSON WHERE SURNAME IS NULL; +SELECT * FROM PERSON WHERE SURNAME = '' AND FIRSTNAME = 'Jason';

« previous php.pear.cvs (#7924) next »