Project

General

Profile

Comparison of Dbo with other C++ libs

Added by Dave Far about 6 years ago

Searching for the best ORM fit for our company, I came across the comparison with other C libs on https://github.com/fnc12/sqlite_orm.

Can anyone tell me which aspects are covered by Dbo?


Replies (2)

RE: Comparison of Dbo with other C++ libs - Added by lm at about 6 years ago

I guess you're looking for a feature list for Wt::Dbo. I'm not sure I can furnish one except that it has met my needs admirably. The mapping of database tables is very intuitive using templates so that everything is done at runtime. There is one place for each table where you describe your schema, and this same code is used to save your data and retrieve it. Wt::Dbo supports natural primary keys and composite primary keys, foreign key relationships, etc.

In my mind, the strongest point of Wt::Dbo is that it stays out of the way. It doesn't support, for instance, indexes, but since it is written in a transparent, straight forward fashion, indexes can be added the normal way outside Wt and they just work.

This tutorial is rather comprehensive: https://www.webtoolkit.eu/wt/doc/tutorial/dbo.html

RE: Comparison of Dbo with other C++ libs - Added by Roel Standaert about 6 years ago

That table doesn't go into much detail beyond "yes" or "no". I believe these answers to be more nuanced.

  • Schema sync: Not sure what the intended meaning is here. If this means: is it an ORM framework? Then yes, Dbo is an ORM framework.
  • Single responsibility principle: I'd say yes. Whether something follows the single responsibility principle tends to be a bit subjective.
  • STL compatible: Some types are supported, others can be implemented using custom traits. Results are not returned as a vector, though, but rather as a Dbo::collection (which you can iterate over with a forward iterator once), for efficiency reasons.
  • No raw string queries: I'd say yes: for most standard SQL queries this is not needed, and Dbo uses prepared statements by default
  • Transactions: Yes, always by default. (Can be circumvented if necessary, but that's not recommended.)
  • Custom types binding: Yes (dbo_traits)
  • Doesn't use macros and/or external codegen scripts: Yes
  • Aggregate functions: you can either write queries with aggregates in them, and there are some implemented by default, e.g. (Dbo::collection::size()) executes a count query

Of course, the big benefit of Dbo is also that it supports most commonly used RDBMSs: PostgreSQL, Sqlite3, MySQL, Microsoft SQL Server, and Firebird. Also, we've got an Oracle backend that's only available under a proprietary license. Oracle's licensing terms don't make it possible to make that one open source.

There's also an older video about Dbo (but still pretty relevant): https://www.youtube.com/watch?v=gmFdAISBzmk

    (1-2/2)