aboutsummaryrefslogtreecommitdiff
path: root/odb/relational/source.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2013-01-14 16:01:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2013-01-14 16:01:06 +0200
commit0e6be616e40c86ff03df7c0806bcbd0cc3c4489f (patch)
tree410e7ab2e10bb3dd0df30aab2135ed4544555157 /odb/relational/source.hxx
parent604517928701b3ef2783ede9a0b3b2f80c92ec92 (diff)
Add support for MSSQL ROWVERSION
ODB can now use ROWVERSION column as an optimistic concurrency version.
Diffstat (limited to 'odb/relational/source.hxx')
-rw-r--r--odb/relational/source.hxx40
1 files changed, 32 insertions, 8 deletions
diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx
index 1e223af..dfa6ebf 100644
--- a/odb/relational/source.hxx
+++ b/odb/relational/source.hxx
@@ -220,12 +220,10 @@ namespace relational
sk_ == statement_update)
return false;
- column (m, table_name_, quote_id (name));
-
- return true;
+ return column (m, table_name_, quote_id (name));
}
- virtual void
+ virtual bool
column (semantics::data_member& m,
string const& table,
string const& column)
@@ -259,6 +257,7 @@ namespace relational
r = convert_from (r, sqlt, m);
sc_.push_back (statement_column (table, r, sqlt, m, key_prefix_));
+ return true;
}
protected:
@@ -426,14 +425,13 @@ namespace relational
throw operation_failed ();
}
- column (m, tbl, col);
- return true;
+ return column (m, tbl, col);
}
// The column argument is a qualified and quoted column or
// expression.
//
- virtual void
+ virtual bool
column (semantics::data_member& m,
string const& table,
string const& column)
@@ -442,6 +440,7 @@ namespace relational
sc_.push_back (
statement_column (
table, convert_from (column, sqlt, m), sqlt, m));
+ return true;
}
protected:
@@ -3262,7 +3261,7 @@ namespace relational
string p;
if (version (m))
- p = "1";
+ p = version_value (m);
else if (context::id (m) && auto_ (m)) // Only simple id can be auto.
p = qp_.auto_id ();
else
@@ -3279,6 +3278,12 @@ namespace relational
return !p.empty ();
}
+ virtual string
+ version_value (semantics::data_member&)
+ {
+ return "1";
+ }
+
private:
string& params_;
query_parameters& qp_;
@@ -3406,6 +3411,11 @@ namespace relational
{
}
+ virtual void
+ update_statement_extra (type&)
+ {
+ }
+
//
// common
//
@@ -3448,6 +3458,20 @@ namespace relational
<< "q.parameters_binding ()";
}
+ virtual string
+ optimimistic_version_init (semantics::data_member&)
+ {
+ return "1";
+ }
+
+ // Returning "1" means incremenet by one.
+ //
+ virtual string
+ optimimistic_version_increment (semantics::data_member&)
+ {
+ return "1";
+ }
+
virtual void
traverse_object (type& c);