jimymodi / php-sql-parser Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/php-sql-parser
Automatically exported from code.google.com/p/php-sql-parser
If I try :
$parser = new PHPSQLParser('SELECT
name, 1, test;');
PHP is giving me error (see method process_select_expr):
- Warning: E_WARNING array_pop() expects parameter 1 to be array, string given
- Fatal error: Cannot use string offset as an array
A newline after between SELECT and field list makes the parser to fail.
Original issue reported on code.google.com by [email protected]
on 14 Dec 2010 at 4:06
if(count($processed) == 1) {
...
}
produces errors on some sql-statments.
i added:
if(is_array($processed)) {
if(count($processed) == 1) {
...
}
}
Original issue reported on code.google.com by [email protected]
on 2 Mar 2011 at 1:28
SELECT NOW();
or
SELECT test1
FROM table1
WHERE test_date < NOW();
I get a blank page showing this error :
Fatal error: Cannot use string offset as an array in
H:\Project\Openflyers30\classes\PHPSQLParser.php on line 1145
For any SQL queries where I've "NOW()", the parser always fails.
Original issue reported on code.google.com by [email protected]
on 5 Jan 2011 at 9:40
What steps will reproduce the problem?
select * from test where value<>"brainstorm"
Suggestion
i removed the "|([^ ,]+)" from the preg_split(),
fixed this problem for me, but don't know if it is breaking somthing.
What is the expected output?
[WHERE] => Array
(
[0] => Array
(
[expr_type] => colref
[base_expr] => value
[sub_tree] =>
)
[1] => Array
(
[expr_type] => operator
[base_expr] => <>
[sub_tree] =>
)
[2] => Array
(
[expr_type] => const
[base_expr] => "brainstorm"
[sub_tree] =>
)
)
What do you see instead?
[WHERE] => Array
(
[0] => Array
(
[expr_type] => colref
[base_expr] => value
[sub_tree] =>
)
[1] => Array
(
[expr_type] => colref
[base_expr] => <>"brainstorm"
[sub_tree] =>
)
)
Original issue reported on code.google.com by [email protected]
on 2 Mar 2011 at 1:20
What steps will reproduce the problem?
1. use the parser to parse a query like Select table.`field` from table
2.
3.
What is the expected output? What do you see instead?
if you look at the 'Select' statement generated you will get
Array
(
[0] => Array
(
[expr_type] => colref
[alias] => `prj_seq_key`
[base_expr] => aje.
[sub_tree] =>
)
)
where you sould get
Array
(
[0] => Array
(
[expr_type] => colref
[alias] => aje.`prj_seq_key`
[base_expr] => aje.prj_seq_key`
[sub_tree] =>
)
What version of the product are you using? On what operating system?
Please provide any additional information below.
Original issue reported on code.google.com by [email protected]
on 13 Jan 2011 at 12:40
What steps will reproduce the problem?
1. Try an parse the following query:
2. UPDATE table1 SET field1='foo' WHERE field2='bar' AND id=(SELECT if FROM
test1 t where t.field1=(SELECT id from test2 t2 where t2.field = 'foo'))
Granted, its my own typo ("if" should be "id" in the first subselect) but I
dont think php-sql-parser should be throwing an undefined offset exception.
What is the expected output? What do you see instead?
Expected: Blank screen.
See instead: Notice: Undefined offset: 1 in /var/www/php-sql-parser.php on line
1102
Can be fixed by changing line 1102 of php-sql-parser.php from:
$sub_expr = $tokens[$key+1];
to:
if(!empty($tokens[$key+1])) $sub_expr = $tokens[$key+1];
Original issue reported on code.google.com by [email protected]
on 2 Jan 2011 at 2:50
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.