[odb-users] Re: ODB

Boris Kolpackov boris at codesynthesis.com
Fri May 11 04:37:58 EDT 2012


Gennadiy,

Please keep your replies CC'ed to the odb-users mailing list so that
others who may have similar questions in the future can benefit from
the answers.

Pochtar, Gennadiy (FIT) <itpochg at freudenberg.de> writes:

> > Which database are you using?
>
> Our future product must support MS SQL (2005 and later), Oracle and
> SQLite (for test cases). Now I am looking for some "good" ORM, ideally
> something like Hibernate, although must not be so powerful. Doesn't
> matter what kind of product: open source or commercial one. UNICODE
> and dynamic queries support are key issues.
> 
> > result r = db->query<person> (query::first_name == name);
>
> And what should I do with (first like N'John%'), where first is UNICODE?

You can do something like this:

std::wstring pattern (L"John%");

result r = db->query<person> ("first_name LIKE" + query::_val (pattern));

The general idea here is that for constructs that are not part of the
C++-integrated query language you can always drop down to the database
native query language. The good news is that at this level ODB still
takes care of converting query parameters from C++ to the database
system format using the query::_val() and query::_ref() functions.
In the above example we use this to make ODB pass a UNICODE string
to the database. See Chapter 4, "Querying the Database" for more
information:

http://www.codesynthesis.com/products/odb/doc/manual.xhtml#4

Boris



More information about the odb-users mailing list