At the moment we have a lot of simple but hardcoded queries that need rewriting because of the introduction of mysql (reserved words and the need for the backtick/quotes or simple for adjusting the top/first/limit or 'emulating' *ci_ai collation on db's that dont fully
support a collation system like postgreSQL). It would be so much more elegant than hardcoded queries.
Before trying to build such ourselves (which would be a rather big undertaking) are there any SQL builders/toolboxes available that (partly) take care of writing SQL statements at runtime for multiple database systems and taking into account the optional schema and
escaping/quoting system of that particular database?
I know UniDac does not contain a query builder (runtime), but perhaps somebody knows something that is suitable for our needs (instead of building from scratch)?
BTW; We are running Delphi XE, with the following databases: Firebird, MsSql, MySql and PostgreSQL (and perhaps Oracle in a far future)
Thanks,
Marius
Any generic query builder available?
Re: Any generic query builder available?
Sigh, solved after finally catching up reading on my unidac help documents (yeah yeah, RTFM, i know). Its a bit more typing but completely worthwhile in the long end..
/*--http://www.devart.com/unidac/docs/#unisql.htm*/
select
{if InterBase} first 1 {ENDIF}
{if PostgreSQL} top 1 {ENDIF}
{if SQL Server} top 1 {ENDIF}
{fn YEAR("date_in")} as date_inyear,
{fn MONTH("date_in")} as date_inmonth,
{fn DAY("date_in")} as date_inday
from "action"
{if MySql} limit 1 {ENDIF}
/*--http://www.devart.com/unidac/docs/#unisql.htm*/
select
{if InterBase} first 1 {ENDIF}
{if PostgreSQL} top 1 {ENDIF}
{if SQL Server} top 1 {ENDIF}
{fn YEAR("date_in")} as date_inyear,
{fn MONTH("date_in")} as date_inmonth,
{fn DAY("date_in")} as date_inday
from "action"
{if MySql} limit 1 {ENDIF}
Re: Any generic query builder available?
It is a pleasure to see that you have found the answers in our documentation. Please contact us if you have any questions regarding UniDAC.