aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boost/README6
-rw-r--r--boost/makefile2
-rw-r--r--c++11/README10
-rw-r--r--c++11/employee.hxx4
-rw-r--r--composite/person.hxx7
-rw-r--r--inverse/README7
-rw-r--r--inverse/makefile2
-rw-r--r--qt/README8
-rw-r--r--qt/makefile2
-rw-r--r--relationship/README7
-rw-r--r--relationship/makefile2
-rw-r--r--schema/custom/README15
-rw-r--r--schema/custom/makefile2
13 files changed, 38 insertions, 36 deletions
diff --git a/boost/README b/boost/README
index 8e9f18f..848e40a 100644
--- a/boost/README
+++ b/boost/README
@@ -25,13 +25,15 @@ employee.sql
These files are generated by the ODB compiler from employee.hxx using the
following command line:
- odb -d <database> -p boost --generate-schema --generate-query employee.hxx
+ odb -d <database> -p boost --generate-schema --generate-query \
+ --generate-session employee.hxx
Where <database> stands for the database system we are using, for example,
'mysql'.
The -p option is used to instruct the ODB compiler to load the Boost
- profile.
+ profile. The --generate-session option is used to enable session support
+ for all the persistent classes in employee.hxx.
database.hxx
Contains the create_database() function which instantiates the concrete
diff --git a/boost/makefile b/boost/makefile
index aff6de1..aeb4f5f 100644
--- a/boost/makefile
+++ b/boost/makefile
@@ -59,7 +59,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database $(db_id) --profile boost \
---generate-query --generate-schema --table-prefix boost_
+--generate-query --generate-schema --generate-session --table-prefix boost_
$(gen): cpp_options := -I$(src_base)
$(gen): $(odb.l.cpp-options) $(odb_boost.l.cpp-options) $(boost.l.cpp-options)
diff --git a/c++11/README b/c++11/README
index 86c0efe..72ed07e 100644
--- a/c++11/README
+++ b/c++11/README
@@ -10,10 +10,12 @@ employee.hxx
Header file defining the 'employee', 'employer', and 'pension_fund'
persistent classes. We use the standard std::shared_ptr/weak_ptr smart
pointers as well as their lazy versions provided by ODB to establish a
- bidirectional employee-employer relationship. Because we don't share the
- 'pension_fund' objects, we use std::unique_ptr as an object pointer for
- this persistent class. We also use the std::unordered_set container to
- keep track of the employee's email addresses.
+ bidirectional employee-employer relationship. We also enable session
+ support for these two classes using the 'db session' pragma. Because
+ we don't share the 'pension_fund' objects, we use std::unique_ptr
+ as an object pointer for this persistent class. We also use the
+ std::unordered_set container to keep track of the employee's email
+ addresses.
employee-odb.hxx
employee-odb.ixx
diff --git a/c++11/employee.hxx b/c++11/employee.hxx
index 3750ca0..0c2abc7 100644
--- a/c++11/employee.hxx
+++ b/c++11/employee.hxx
@@ -17,7 +17,7 @@
class employer;
class employee;
-#pragma db object pointer(std::shared_ptr)
+#pragma db object pointer(std::shared_ptr) session
class employer
{
public:
@@ -60,7 +60,7 @@ private:
employees_type employees_;
};
-#pragma db object pointer(std::shared_ptr)
+#pragma db object pointer(std::shared_ptr) session
class employee
{
public:
diff --git a/composite/person.hxx b/composite/person.hxx
index c80e2d8..f0626e5 100644
--- a/composite/person.hxx
+++ b/composite/person.hxx
@@ -168,13 +168,6 @@ private:
std::string domain_;
};
-inline bool
-operator< (const email_address& x, const email_address& y)
-{
- return x.recipient () < y.recipient () ||
- (x.recipient () == y.recipient () && x.domain() < y.domain ());
-}
-
#pragma db object
class person
{
diff --git a/inverse/README b/inverse/README
index 94b01a6..9b31fb7 100644
--- a/inverse/README
+++ b/inverse/README
@@ -26,14 +26,15 @@ employee.sql
These files are generated by the ODB compiler from employee.hxx using the
following command line:
- odb -d <database> --generate-schema --generate-query \
+ odb -d <database> --generate-schema --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
diff --git a/inverse/makefile b/inverse/makefile
index 9eb0735..81af551 100644
--- a/inverse/makefile
+++ b/inverse/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 \
---generate-schema --default-pointer std::tr1::shared_ptr \
+--generate-schema --generate-session --default-pointer std::tr1::shared_ptr \
--table-prefix inverse_
$(gen): cpp_options := -I$(src_base)
$(gen): $(odb.l.cpp-options)
diff --git a/qt/README b/qt/README
index 99ec974..077edba 100644
--- a/qt/README
+++ b/qt/README
@@ -25,13 +25,15 @@ employee.sql
These files are generated by the ODB compiler from employee.hxx using the
following command line:
- odb -d <database> -p qt --generate-schema --generate-query employee.hxx
+ odb -d <database> -p qt --generate-schema --generate-query \
+ --generate-session employee.hxx
Where <database> stands for the database system we are using, for example,
'mysql'.
- The -p option is used to instruct the ODB compiler to load the Qt
- profile.
+ The -p option is used to instruct the ODB compiler to load the Qt profile.
+ The --generate-session option is used to enable session support for all
+ the persistent classes in employee.hxx.
database.hxx
Contains the createDatabase() function which instantiates the concrete
diff --git a/qt/makefile b/qt/makefile
index b798489..d7c6fef 100644
--- a/qt/makefile
+++ b/qt/makefile
@@ -55,7 +55,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
$(gen) $(dist): export odb_options += --database $(db_id) --profile qt \
---generate-query --generate-schema --table-prefix Qt
+--generate-query --generate-schema --generate-session --table-prefix Qt
$(gen): cpp_options := -I$(src_base)
$(gen): $(odb.l.cpp-options) $(odb_qt.l.cpp-options) $(qt_core.l.cpp-options)
diff --git a/relationship/README b/relationship/README
index f3e4e9c..dd9f085 100644
--- a/relationship/README
+++ b/relationship/README
@@ -22,14 +22,15 @@ employee.sql
These files are generated by the ODB compiler from employee.hxx using the
following command line:
- odb -d <database> --generate-schema --generate-query \
+ odb -d <database> --generate-schema --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
diff --git a/relationship/makefile b/relationship/makefile
index 1ef0722..3e41f1d 100644
--- a/relationship/makefile
+++ b/relationship/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 \
---generate-schema --default-pointer std::tr1::shared_ptr \
+--generate-schema --generate-session --default-pointer std::tr1::shared_ptr \
--table-prefix relation_
$(gen): cpp_options := -I$(src_base)
$(gen): $(odb.l.cpp-options)
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)