Any generic query builder available?

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Marius2
Posts: 22
Joined: Thu 19 Nov 2009 12:17

Any generic query builder available?

Post by Marius2 » Mon 11 May 2015 12:47

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

Marius2
Posts: 22
Joined: Thu 19 Nov 2009 12:17

Re: Any generic query builder available?

Post by Marius2 » Mon 11 May 2015 19:06

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}

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Any generic query builder available?

Post by ViktorV » Tue 12 May 2015 13:06

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.

Post Reply