[odb-users] ODB compiler for oracle, double qoutes SQL?statements

Tony Rietwyk tony at rightsoft.com.au
Tue Nov 20 16:35:13 EST 2012

Hi Boris, 

I believe Firebird database may be in the same boat - the server uppercases
non-quoted names.   Quoted names should only be generated if required.  Qt
uses the 'QString QSqlDriver.escapeIdentifier' function in its driver
interface to quote each name only if necessary.  Maybe ODB needs something
similar - possibly even just a regex for valid id's, and only quote the id
if that doesn't match?   Looks like this would save a lot of ugly quoting in
the generated code.  



> Sent: Wednesday, 21 November 2012 12:49 AM
> Hi Magnus,
> Magnus Granqvist <magnus.granqvist at tailormade.se> writes:
> > But I think I see why this is happening now, the table must be created
> > with quotes to support the SQL.
> Yes, in other words, the tables were created without quoting and Oracle
> uppercased them.
> > This could be a problem developing for existing production databases
> > that is not created with qoutes
> >
> > CREATE TABLE "dagsmproduct" (
> >   "oidval" RAW(16),
> >   "msisdn" VARCHAR2(512) NOT NULL PRIMARY KEY);
> In this case it is probably best to assign custom table/column names that
> correspond exactly to the existing names. This way, also, you can use more
> descriptive C++ names that follow your naming convention.
> For example:
> #pragma db object table("DAGSMPRODUCT")
> class DagSmProduct
> {
>   ...
>   #pragma db type("RAW(16)") column("OIDVAL")
>   char oid_val[16];
>   #pragma db id column("MSISDN")
>   std::string ms_isdn;
> };
> Boris

More information about the odb-users mailing list