aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-01-12 14:16:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-01-20 15:43:46 +0200
commit557d156ec9c45ed105f7213e1748dc4aad78ebb2 (patch)
tree0b8082b8548bdc1ee261833dcd052cb0a8c30b5a
parent06b889850144910f1f908fc87f78114bde920596 (diff)
Customize generated pointer column wrapper ctor
For SQL Server we need to be able to pass precision/scale.
-rw-r--r--odb/relational/common.cxx20
-rw-r--r--odb/relational/common.hxx3
-rw-r--r--odb/relational/mssql/common.cxx12
3 files changed, 29 insertions, 6 deletions
diff --git a/odb/relational/common.cxx b/odb/relational/common.cxx
index 2d8f8d6..1ee8449 100644
--- a/odb/relational/common.cxx
+++ b/odb/relational/common.cxx
@@ -208,6 +208,15 @@ namespace relational
}
}
+ void query_columns::
+ column_ctor (string const& type, string const& base)
+ {
+ os << type << " (const char* t, const char* c)" << endl
+ << " : " << base << " (t, c)"
+ << "{"
+ << "}";
+ }
+
bool query_columns::
traverse_column (semantics::data_member& m, string const& column, bool)
{
@@ -276,12 +285,11 @@ namespace relational
//
os << "struct " << name << "_type_: " <<
name << "_pointer_type_, " << name << "_column_type_"
- << "{"
- << name << "_type_ (const char* t, const char* c)" << endl
- << " : " << name << "_column_type_ (t, c)"
- << "{"
- << "}"
- << "};";
+ << "{";
+
+ column_ctor (name + "_type_", name + "_column_type_");
+
+ os << "};";
}
os << "static const " << name << "_type_ " << name << ";"
diff --git a/odb/relational/common.hxx b/odb/relational/common.hxx
index e7400c7..a259604 100644
--- a/odb/relational/common.hxx
+++ b/odb/relational/common.hxx
@@ -91,6 +91,9 @@ namespace relational
}
virtual void
+ column_ctor (string const& type, string const& base);
+
+ virtual void
column_ctor_extra (semantics::data_member&)
{
}
diff --git a/odb/relational/mssql/common.cxx b/odb/relational/mssql/common.cxx
index 3112c2d..3f5cf74 100644
--- a/odb/relational/mssql/common.cxx
+++ b/odb/relational/mssql/common.cxx
@@ -551,6 +551,18 @@ namespace relational
}
virtual void
+ column_ctor (string const& type, string const& base)
+ {
+ os << type << " (const char* t," << endl
+ << "const char* c," << endl
+ << "unsigned short p = 0," << endl
+ << "unsigned short s = 0xFFFF)" << endl
+ << " : " << base << " (t, c, p, s)"
+ << "{"
+ << "}";
+ }
+
+ virtual void
column_ctor_extra (semantics::data_member& m)
{
// For some types we need to pass precision and scale.