[odb-users] Re: Pagination and "join","groupby" in odb

Boris Kolpackov boris at codesynthesis.com
Wed Sep 12 07:53:18 EDT 2012


Hi Scott,

Scott Zhang <macromarship at gmail.com> writes:

>    Actually, I would suggest odb  borrow some implementation from
> codeigniter because it support msql/mysql/oracle/sqlite/pgsql. Most of
> table mapping are dynamic but that's ok. I just mean the pagination it
> implements can be used on all databases. if it can, so should odb. Just
> generate the correct sql then problem solved.

ODB, being a C++ ORM, has very different goals compared to CodeIgniter,
which targets PHP. Specifically, ODB's goal is to deliver high 
performance and using dynamically-generated queries is a non-starter.
Pagination can be implemented quite easily (as shown on the page you
found) for databases that provide support for it. For other databases,
things are a bit more complex but also doable.


> And I see "view" can be a wrapper for any customized sql to map result
> into a static class. That works.

Yes, that's what you can use to implement custom joins, aggregate queries,
etc.


> But if you create the database first, especially coding with a php front
> end done, then code with c++ and odb to fit your existing tables relation
> with your class, that would be a big headache (for relations, container,
> inheritance ....).

I disagree. ODB uses what we call "canonical" relational techniques to
implement object relations, containers, and inheritance. In other words,
if you create a database schema manually and follow good relational
database design, then mapping that schema to C++ classes with ODB should
be a fairly straightforward matter.

Now if the schema is produced by another ORM that you are using and it
doesn't follow good relational database design, then there is nothing
ODB can do. But that's really the problem with another ORM, not ODB.

Boris



More information about the odb-users mailing list