philgoetz has asked for the wisdom of the Perl Monks concerning the following question:
I know the module SQL::Statement can parse an SQL statement. But I need to automatically convert statements back and forth between Sybase and SQLite, so I need to parse a statement, then CHANGE parts of it (e.g., change column names to avoid reserved words or to emulate Sybase functions), and then construct a new SQL statement for the other database type to execute.
For instance, I would want to convert
"SELECT len(ec#), getdate(), user_name() FROM ident"
into
"SELECT length(ec_num), date(), $ENV{USER} FROM identity"
(SQLite does not allow the column names 'ec#' or 'ident'.)
As far as I can tell, SQL::Statement doesn't let you construct a new statement out of constituent parts. Any idea what can?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Parse and change an SQL statement
by chrestomanci (Priest) on Mar 19, 2012 at 22:09 UTC | |
Re: Parse and change an SQL statement
by clueless newbie (Curate) on Mar 19, 2012 at 22:20 UTC | |
Re: Parse and change an SQL statement
by philgoetz (Acolyte) on Mar 19, 2012 at 20:53 UTC | |
by CountZero (Bishop) on Mar 20, 2012 at 15:59 UTC | |
Re: Parse and change an SQL statement
by jandrew (Chaplain) on Mar 19, 2012 at 21:24 UTC | |
Re: Parse and change an SQL statement
by bdo (Pilgrim) on Mar 19, 2012 at 21:29 UTC | |
by GrandFather (Saint) on Mar 19, 2012 at 22:06 UTC | |
by bdo (Pilgrim) on Mar 19, 2012 at 23:13 UTC |