YB.ORM tool is developed to simplify writing C++ code dealing with SQL
databases. The goal is to provide a convenient interface like SQLAlchemy
(Python) or Hibernate (Java). Available ports to Linux and Windows (MinGW, VC).
SQL dialects supported: MySQL, Postgres, Oracle, Firebird. You can use YB.ORM
with your favorite toolkit: Boost, Qt4, or wxWidgets.
Warning! The software is under development, so it may behave unstable.
Many interesting features are still to be implemented.
Typical usage scenario is the following:
- Describe your database schema i.e. the tables with their columns and
the relationships between tables in a simple XML-based format.
- Optionally, use the SQL DDL generator for initial DDL statements.
Perform this step to populate your empty database schema with tables.
- Use the code generation tool provided to produce C++ classes for each table.
This code hides the details of how objects are being loaded and stored
from/to the corresponding database tables, as well it represents
the relationships between objects in a convenient way.
- Add your application-specific logic to the classes, etc.
- Should you make changes to the database schema, you then use
the code generation tool to synchronize the schema description
with the previously generated C++ classes.
- Now you can use these generated classes in cooperation with Session object
to automate the following tasks:
- query objects from database,
- create new objects or
- load and modify existing objects and save them to the database,
- link and unlink objects to/from each other using relations,
- delete objects from the database.
This tool employs many ideas explained in the book
"Patterns of Enterprise Application Architecture" by Martin Fawler.
Such patterns as "Data Mapper", "Unit of Work" etc.
Also I was inspired by the power of frameworks like
Hibernate (http://www.hibernate.org/) for Java programming language and
SQLAlchemy (http://www.sqlalchemy.org/) for Python.
Project was once started as part of a billing system for on-line ads
at Yandex company (http://www.yandex.com/).
YB stands for Yandex.Balance, that was the name for the billing system.
Today YB.ORM project is not affiliated with Yandex company.
This piece of software is developed entirely in C++ and should be easily
portable across different platforms, although the development is done
primarily on GNU/Linux, using GNU C++. GNU Autotools are used as building
system in Linux, CMake is used in Windows.
You can build YB.ORM library against Boost, Qt4, or wxWidgets toolkits,
to use their native datatypes, such as strings, datetime, etc.
For example, to build it with Boost in Linux, the following prerequisites
should be met:
- boost-thread >= 1.31.0
- boost-date-time >= 1.31.0
- libxml2 >= 2.6.16
- xsltproc >= 1.1.24
- cppunit >= 1.10.2 (if you're going to run the test suite)
- autotools >= 2.61, automake >= 1.10.1
- unixODBC >= 2.2.11 (to make Oracle ODBC driver work
under GNU/Linux x86_64 I have used unixODBC = 2.3.0)
The library aims to be database independent. At the time of this writing
it is tested to work with Oracle, Postgres, MySQL and Firebird via
corresponding ODBC drivers.
Also, to access some database you will need one of the following:
- myodbc >= 3.51.15 (MySQL ODBC driver)
- instantclient >= 10.2 (ODBC driver for Oracle)
- odbc-postgresql (ODBC driver for Postgres)
- OdbcFb >= 2.0 (ODBC driver for Firebird)
- Viacheslav Naydenov, vaclav at yandex dot ru - main developer.
- Sergey Chmelev, halty at yandex dash team dot ru - early contributor.
- SqUe, squarious at gmail dot com - tiodbc code.
Also, I would like to appreciate feedback from several students
of Moscow State Open University (MSOU):
- Nikita Buyvich, buyvich at gmail dot com.
- Viacheslav Fedorov, funny dash story at yandex dot ru.
- Andrey Skobenkov, andrey dot skobenkov at gmail dot com.
Any feedback, patches or comments are welcome!
07 jun 2012