aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2014-11-19 11:51:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2014-11-19 11:51:17 +0200
commit7e09329a81a1859d049a0fe16ef5b879fd83b72d (patch)
treeb4d1ffe4fea024afe4cf4bef4d2ff68eaa17de23
parente895ea3badaba507d26d4fd8c8f95395b3c6ea01 (diff)
Implement bulk API code generation
-rw-r--r--bulk/driver.cxx3
-rw-r--r--bulk/makefile2
-rw-r--r--bulk/person.hxx3
3 files changed, 5 insertions, 3 deletions
diff --git a/bulk/driver.cxx b/bulk/driver.cxx
index b88f614..b8dee4f 100644
--- a/bulk/driver.cxx
+++ b/bulk/driver.cxx
@@ -96,7 +96,7 @@ main (int argc, char* argv[])
try
{
p[0].num += 200;
- p[1].num += 200;
+ //p[1].num += 200;
db->persist (p.begin (), p.begin () + 2);
}
catch (const odb::multiple_exceptions& e)
@@ -173,6 +173,7 @@ main (int argc, char* argv[])
#if 1
{
transaction t (db->begin ());
+ t.tracer (stderr_tracer);
unsigned long ids[] = {
pp[0]->id,
diff --git a/bulk/makefile b/bulk/makefile
index 66c704e..5bbc677 100644
--- a/bulk/makefile
+++ b/bulk/makefile
@@ -45,7 +45,7 @@ gen := $(addprefix $(out_base)/,$(genf))
$(gen): $(odb)
$(gen): odb := $(odb)
-$(gen) $(dist): export odb_options += --generate-schema --disabled
+$(gen) $(dist): export odb_options += --generate-schema
$(gen): cpp_options := -I$(src_base)
$(gen): $(odb.l.cpp-options)
diff --git a/bulk/person.hxx b/bulk/person.hxx
index ac7a66b..177d4ce 100644
--- a/bulk/person.hxx
+++ b/bulk/person.hxx
@@ -8,13 +8,14 @@
#include <odb/core.hxx>
-#pragma db object
+#pragma db object bulk(3)
class person
{
public:
#pragma db id auto
unsigned long id;
+ #pragma db unique
unsigned int num;
#ifdef ODB_DATABASE_MSSQL