From 6ae5df8a85cd0344cc12effe788f7e09d06df372 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 26 Apr 2011 09:17:15 +0200 Subject: Add note on embedded schemas --- container/README | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'container/README') diff --git a/container/README b/container/README index c82e85d..5496047 100644 --- a/container/README +++ b/container/README @@ -8,7 +8,7 @@ person.hxx person-odb.hxx person-odb.ixx -person-odb.cxx +person-odb.cxx person.sql The first three files contain the database support code and the last file contains the database schema for the person.hxx header. @@ -17,7 +17,7 @@ person.sql following command line: odb -d --generate-schema person.hxx - + Where stands for the database system we are using, for example, 'mysql'. @@ -30,16 +30,18 @@ driver.cxx headers to gain access to the persistent classes and their database support code. It also includes database.hxx for the create_database() function declaration. - + In main() the driver first calls create_database() to obtain the database instance. It then persists a 'person' object, loads it back, and prints the contents of its members. Finally, the driver modifies the object by adding, removing, and updating elements in its container members, stores the changes in the database, then re-loads and prints the object to verify that the - changes have been made persistent. + changes have been made persistent. -To run the example we first need to create the database schema. Using MySQL -as an example, this can be achieved with the following command: +To run the example we may first need to create the database schema (for some +database systems, such as SQLite, the schema is embedded into the generated +code which makes this step unnecessary). Using MySQL as an example, this +can be achieved with the following command: mysql --user=odb_test --database=odb_test < person.sql -- cgit v1.1