Comments (3)
Original comment by [email protected]
on 30 Apr 2011 at 4:47
- Changed state: Accepted
- Added labels: Priority-Critical
- Removed labels: Priority-Medium
from php-sql-parser.
$sql = 'SELECT a.field1, b.field1, c.field1
FROM tablea a
LEFT OUTER JOIN tableb b ON b.ida = a.id
RIGHT JOIN tablec c ON c.idb = b.id
JOIN tabled d USING (d_id)
right outer join e on e.id = a.e_id;
left join e e2 using (e_id)
join e e3 on (e3.e_id = e2.e_id)';
echo $sql . "\n";
$parser->parse($sql);
$p = $parser->parsed;
print_r($p);
-- output --
Array
(
[SELECT] => Array
(
[0] => Array
(
[expr_type] => colref
[alias] => `a.field1`
[base_expr] => a.field1
[sub_tree] =>
)
[1] => Array
(
[expr_type] => colref
[alias] => `b.field1`
[base_expr] => b.field1
[sub_tree] =>
)
[2] => Array
(
[expr_type] => colref
[alias] => `c.field1`
[base_expr] => c.field1
[sub_tree] =>
)
)
[FROM] => Array
(
[0] => Array
(
[table] => tablea
[alias] => a
[join_type] => JOIN
[ref_type] =>
[ref_clause] =>
[base_expr] =>
[sub_tree] =>
)
[1] => Array
(
[table] => tableb
[alias] => b
[join_type] => LEFT
[ref_type] => ON
[ref_clause] => b.ida = a.id
[base_expr] =>
[sub_tree] =>
)
[2] => Array
(
[table] => tablec
[alias] => c
[join_type] => RIGHT
[ref_type] => ON
[ref_clause] => c.idb = b.id
[base_expr] =>
[sub_tree] =>
)
[3] => Array
(
[table] => tabled
[alias] => d
[join_type] => JOIN
[ref_type] => USING
[ref_clause] => d_id
[base_expr] =>
[sub_tree] =>
)
[4] => Array
(
[table] => e
[alias] => e
[join_type] => RIGHT
[ref_type] => ON
[ref_clause] => e.id = a.e_id
[base_expr] =>
[sub_tree] =>
)
[5] => Array
(
[table] => e
[alias] => e2
[join_type] => LEFT
[ref_type] => USING
[ref_clause] => e_id
[base_expr] =>
[sub_tree] =>
)
[6] => Array
(
[table] => e
[alias] => e3
[join_type] => JOIN
[ref_type] => ON
[ref_clause] => e3.e_id = e2.e_id
[base_expr] =>
[sub_tree] =>
)
)
)
Original comment by [email protected]
on 2 May 2011 at 4:30
- Changed state: Verified
from php-sql-parser.
Verified fixed in R41.
Original comment by [email protected]
on 2 May 2011 at 4:34
from php-sql-parser.
Related Issues (20)
- Support for expressions in ORDER BY clause HOT 1
- Unable to install using composer without svn binary HOT 4
- Use semantic versioning for tags/releases HOT 1
- Missing commas in reference builder HOT 4
- Upper case for AliasBuilder HOT 1
- Fails on comments HOT 3
- Creator can't handle SubQuery in Where clause HOT 2
- PHP Error when parsing SQL containing the REPLACE function HOT 6
- IFNULL(<Column Name>,<Value>) doesn't parsed properly HOT 1
- Can not calculate position of query exception HOT 8
- Position for CLAUSES HOT 8
- Unable to parse large complicated query (parenthesis problem)
- UNION Issues
- Fatal Error, undefined method HOT 1
- Alias for a function without parameters forgotten
- Parser throws uninitialized offsets warning when "REPLACE" MySQL function used in SELECT clause
- join with to_number in on clause HOT 1
- Keywords problem
- Problem with parser and datatables
- Export project to Github HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-sql-parser.