i have a delphi application which uses database interbase / firebird. To consult and write data I use the InterBase components palette (IBTable, IBQuery, IBDataset). I'm performing the conversion of my system to sqlserver / Oracle but i have thousands of queries that are assembled at runtime with SQL Instructions Specific of database InterBase/Firebird. Anyone know any component or tool that makes Parse commands Interbase -> SQL Server or Interbase-> Oracle ?
what i need its something like:
Var
Parser: TParser;
OutputSql: String;
Begin
Parser := TParser.Create();
Parser.Text := 'SELECT FIRST 10 CITYNAME FROM TBCITY';
if Firebird then
OutPutSql := Parser.ParseTo('SQLSERVER');
if Oracle then
OutPutSql := Parser.ParseTo('ORACLE');
ComponentAccess.Sql.Text := OutPutSql;
...
The Result Of:
Parser.ParseTo('SQLSERVER');
Will Be
'SELECT TOP 10 CITYNAME FROM TBCITY'
And
Parser.ParseTo('ORACLE');
Will Be
'SELECT CITYNAME FROM TBCITY WHERE ROWNUM <= 10'
1) AFAIK, libraries like AnyDAC, have SQL abstraction syntax. May be you can use this feature in your SQL command text.
2) If you are assembling your SQL at runtime, then why not just code like that:
if Firebird then
SQL.Add(...)
else if Oracle then
SQL.Add(...)
...
We have implemented that in AnyDAC. You may use LIMIT escape function:
ADQuery1.Sql.Text := 'SELECT {LIMIT(10)} CITYNAME FROM TBCITY';
AnyDAC will automatically translate that into target DBMS syntax.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With