[odb-users] Using query members while also renaming class members

Fabian Fritz fabianfuture at web.de
Sat Apr 21 04:42:53 EDT 2018


That's the thing though:

If I put this above my class attributes
#pragma db member("MYCOLUMN")
int mycolumn

The SELECT I get looks alright: SELECT "MYCOLUMN" FROM MYTABLE //...

However when I use the query<MyClass>::mycolumn, I get WHERE "mycolumn" =
123 //...
and that's where the database complains, because it doesn't know the column
in lowercase.

So is it possible to map my class attributes to different column names
while still being able to use the query:: interface?


Thanks,
Fabian

Javier Gutierrez <javier.gutierrez at web.de> schrieb am Do., 19. Apr. 2018,
08:18:

> Hello there, try column("MYCOLUMN")
>
>
> -------- Original Message --------
> Subject: [odb-users] Using query members while also renaming class members
> From: Fabian Fritz <fabianfuture at web.de>
> To: odb-users at codesynthesis.com
> Date: 4/18/2018 9:16 PM
> > Hi,
> >
> > I have created a class MyClass from an existing table and used #pragma
> > db member("MYCOLUMN") above a member mycolumn, so I don't have to use
> > the uppercase name all the time. Now if I use
> > query<MyClass>::mycolumn, I get errors, because the query puts
> > "mycolumn" instead of MYCOLUMN in the sql.
> >
> > So my question is: can you use member("MYCOLUMN") to rename class
> > members (i.e. map them to the actual column names) while still using
> > the query interface?
> >
> > Thanks,
> > Fabian
> >
>
>


More information about the odb-users mailing list