This fixes the alias part of the bug 618272. I submit it as a patch to get some feedback.
Logged In: YES user_id=210714
Version 2 of the patch finds tables, columns and their aliases.
Version 2: diff for sqlparser.lib.php3, display_tbl.lib.php3 and sql.php3
Logged In: YES user_id=30201
This patch is good, baring one serious bug I have found. It totally doesn't handle the database being mentioned in the query.
Eg, I might have two databases: bar, foo
each with a table named mysql
say I wanted to query them both SELECT * FROM bar.mysql, foo.mysql;
This gets even more compex if the two tables have identical column names: SELECT bar.mysql.columnA, foo.mysql.columnB FROM bar.mysql, foo.mysql;
Your code currently dies horribly with this, could you fix that? I'd consider this a nessecity for the patch to be accepted.
I'll do all the optimization needed for the code, but that bit of functionality comes first.
Yes I will work on this.
Please have a look at sugg1.txt.
Suggestions 2 for analyzer
Version 3:diff for sqlparser.lib.php3, display_tbl.lib.php3 and sql.php3
Version 3 of the patch analyzes correctly dbs, tables, columns, select expression aliases and table-ref table aliases.
v4: Unified diff for sqlparser.lib.php3, display_tbl.lib.php3 and sql.php3
Unified updated diff attached. Performance improvements incorporated.
Merged.
Logged In: YES
user_id=210714
Version 2 of the patch finds tables, columns and their aliases.
Version 2: diff for sqlparser.lib.php3, display_tbl.lib.php3 and sql.php3
Logged In: YES
user_id=30201
This patch is good, baring one serious bug I have found.
It totally doesn't handle the database being mentioned in the
query.
Eg,
I might have two databases:
bar, foo
each with a table named mysql
say I wanted to query them both
SELECT * FROM bar.mysql, foo.mysql;
This gets even more compex if the two tables have identical
column names:
SELECT bar.mysql.columnA, foo.mysql.columnB FROM
bar.mysql, foo.mysql;
Your code currently dies horribly with this, could you fix that?
I'd consider this a nessecity for the patch to be accepted.
I'll do all the optimization needed for the code, but that bit of
functionality comes first.
Logged In: YES
user_id=210714
Yes I will work on this.
Logged In: YES
user_id=210714
Please have a look at sugg1.txt.
Suggestions 2 for analyzer
Version 3:diff for sqlparser.lib.php3, display_tbl.lib.php3 and sql.php3
Logged In: YES
user_id=210714
Version 3 of the patch analyzes correctly dbs, tables,
columns, select expression aliases and table-ref table aliases.
v4: Unified diff for sqlparser.lib.php3, display_tbl.lib.php3 and sql.php3
Logged In: YES
user_id=30201
Unified updated diff attached.
Performance improvements incorporated.
Logged In: YES
user_id=210714
Merged.