aboutsummaryrefslogtreecommitdiff
path: root/schema
diff options
context:
space:
mode:
Diffstat (limited to 'schema')
-rw-r--r--schema/custom/README15
-rw-r--r--schema/custom/makefile2
2 files changed, 9 insertions, 8 deletions
diff --git a/schema/custom/README b/schema/custom/README
index 373169f..77febef 100644
--- a/schema/custom/README
+++ b/schema/custom/README
@@ -2,7 +2,7 @@ This example shows how to map persistent C++ classes to a custom database
schema. In particular, it shows how to map all the commonly-used constructs,
including containers, object relationships, and composite value types.
-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.
@@ -16,19 +16,20 @@ employee.hxx
employee-odb.hxx
employee-odb.ixx
-employee-odb.cxx
+employee-odb.cxx
These files contain the database support code for the employee.hxx header
and are generated by the ODB compiler from employee.hxx using the following
command line:
- odb -d <database> --generate-query --default-pointer std::tr1::shared_ptr \
- employee.hxx
+ odb -d <database> --generate-query --generate-session \
+ --default-pointer std::tr1::shared_ptr employee.hxx
Where <database> stands for the database system we are using, for example,
'mysql'.
- The --default-pointer option is used to make TR1 shared_ptr the default
- object pointer.
+ The --generate-session option is used to enable session support for all
+ the persistent classes in employee.hxx. The --default-pointer option is
+ used to make TR1 shared_ptr the default object pointer.
database.hxx
Contains the create_database() function which instantiates the concrete
@@ -39,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 programmatically creates the database schema by executing
a series of SQL statements. After that the driver creates a number of
diff --git a/schema/custom/makefile b/schema/custom/makefile
index 3a8c69c..44b57a5 100644
--- a/schema/custom/makefile
+++ b/schema/custom/makefile
@@ -46,7 +46,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database $(db_id) --generate-query \
---default-pointer std::tr1::shared_ptr
+--generate-session --default-pointer std::tr1::shared_ptr
$(gen): cpp_options := -I$(src_base)
$(gen): $(odb.l.cpp-options)