aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-04-26 09:17:15 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-04-26 09:17:15 +0200
commit6ae5df8a85cd0344cc12effe788f7e09d06df372 (patch)
treefef101ef0ab4c83dff84370e12640f900101e806
parente159da71e25aa50fc73479f9aa7aef7185c28a1c (diff)
Add note on embedded schemas
-rw-r--r--boost/README12
-rw-r--r--composite/README14
-rw-r--r--container/README14
-rw-r--r--hello/README13
-rw-r--r--inverse/README14
-rw-r--r--mapping/README6
-rw-r--r--qt/README6
-rw-r--r--query/README13
-rw-r--r--relationship/README14
9 files changed, 61 insertions, 45 deletions
diff --git a/boost/README b/boost/README
index c731bad..021d601 100644
--- a/boost/README
+++ b/boost/README
@@ -15,7 +15,7 @@ employee.hxx
employee-odb.hxx
employee-odb.ixx
-employee-odb.cxx
+employee-odb.cxx
employee.sql
The first three files contain the database support code and the last file
contains the database schema for the employee.hxx header.
@@ -40,16 +40,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 creates a number of 'employee' and 'employer' objects and
persists them in the database. The next transaction loads all the employees
of a particular employer using the employee-employer relationship. Finally,
- the driver performs a database query which uses a data member of the Boost
+ the driver performs a database query which uses a data member of the Boost
gregorian::date type in its criterion.
-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 < employee.sql
diff --git a/composite/README b/composite/README
index b73fa15..bf9e745 100644
--- a/composite/README
+++ b/composite/README
@@ -12,7 +12,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.
@@ -21,7 +21,7 @@ person.sql
following command line:
odb -d <database> --generate-schema --generate-query person.hxx
-
+
Where <database> stands for the database system we are using, for example,
'mysql'.
@@ -34,16 +34,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 and updates its
nickname and aliases which reside in a composite value type, then re-loads
the object and prints its name to verify that the changes have been made
persistent. Finally, the driver performs a database query which uses a
- data member from the composite value type in its criterion.
+ data member from the composite value type in its criterion.
-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
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 <database> --generate-schema person.hxx
-
+
Where <database> 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
diff --git a/hello/README b/hello/README
index 1eb36be..5929f52 100644
--- a/hello/README
+++ b/hello/README
@@ -10,7 +10,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.
@@ -19,7 +19,7 @@ person.sql
following command line:
odb -d <database> --generate-query --generate-schema person.hxx
-
+
Where <database> stands for the database system we are using, for example,
'mysql'.
@@ -32,13 +32,15 @@ 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. Then it executes a number of database transactions on persistent
objects.
-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
@@ -49,4 +51,3 @@ Once the database schema is ready, we can run the example (using MySQL as
the database):
./driver --user odb_test --database odb_test
-
diff --git a/inverse/README b/inverse/README
index a1c1a64..94b01a6 100644
--- a/inverse/README
+++ b/inverse/README
@@ -4,7 +4,7 @@ shows how to work with lazy pointers. All the relationships presented in
this example declare one side as inverse in order to produce canonical
database schema.
-The example uses the shared_ptr and weak_ptr smart pointers from TR1 and
+The example uses the shared_ptr and weak_ptr smart pointers from TR1 and
requires a C++ compiler with TR1 support or an external TR1 implementation,
such as the one provided by Boost.
@@ -12,13 +12,13 @@ The example consists of the following files:
employee.hxx
Header file defining the 'employee', 'employer', 'position', and 'project'
- persistent classes as well as the employer-employee (one-to-many),
+ persistent classes as well as the employer-employee (one-to-many),
employee-position (one-to-one), and employee-project (many-to-many)
bidirectional relationships between them.
employee-odb.hxx
employee-odb.ixx
-employee-odb.cxx
+employee-odb.cxx
employee.sql
The first three files contain the database support code and the last file
contains the database schema for the employee.hxx header.
@@ -44,7 +44,7 @@ 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 creates a number of 'employee', 'employer', 'position',
and 'project' objects, sets the relationships between them, and persists
@@ -53,8 +53,10 @@ driver.cxx
the driver performs a database query which uses a data member from a related
object in its criterion.
-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 < employee.sql
diff --git a/mapping/README b/mapping/README
index 2a06351..4c9c224 100644
--- a/mapping/README
+++ b/mapping/README
@@ -52,8 +52,10 @@ driver.cxx
instance. It then persists a number of 'person' objects in the database
and executes a query to find objects matching certain criteria.
-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
diff --git a/qt/README b/qt/README
index ac0f38c..99ec974 100644
--- a/qt/README
+++ b/qt/README
@@ -50,8 +50,10 @@ driver.cxx
the driver performs a database query which uses data member of the Qt
QString and QDate types in its criterion.
-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 < employee.sql
diff --git a/query/README b/query/README
index c7d8d7a..98b38f1 100644
--- a/query/README
+++ b/query/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 <database> --generate-query --generate-schema person.hxx
-
+
Where <database> stands for the database system we are using, for example,
'mysql'.
@@ -30,13 +30,15 @@ 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 number of 'person' objects in the database
and executes a number of queries to find objects matching various criteria.
-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
@@ -47,4 +49,3 @@ Once the database schema is ready, we can run the example (using MySQL as
the database):
./driver --user odb_test --database odb_test
-
diff --git a/relationship/README b/relationship/README
index 6400960..f3e4e9c 100644
--- a/relationship/README
+++ b/relationship/README
@@ -1,7 +1,7 @@
This example shows how to declare and use unidirectional to-one and to-many
-relationships between persistent objects.
+relationships between persistent objects.
-The example uses the shared_ptr smart pointer from TR1 and requires a C++
+The example uses the shared_ptr smart pointer from TR1 and requires a C++
compiler with TR1 support or an external TR1 implementation, such as the
one provided by Boost.
@@ -14,7 +14,7 @@ employee.hxx
employee-odb.hxx
employee-odb.ixx
-employee-odb.cxx
+employee-odb.cxx
employee.sql
The first three files contain the database support code and the last file
contains the database schema for the employee.hxx header.
@@ -40,7 +40,7 @@ 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 creates a number of 'employee', 'employer', and 'project'
objects, sets the relationships between them, and persists them in the
@@ -49,8 +49,10 @@ driver.cxx
driver performs a database query which uses a data member from a related
object in its criterion.
-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 < employee.sql