diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-15 11:46:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-08-15 11:46:00 +0200 |
commit | eacf52a9a4f3832274fdefc909ab23c13413e128 (patch) | |
tree | f1f754b6149797315f91d6f872363555201d5a65 /odb/relational/oracle | |
parent | 396cad633b6f0559a39e5111827f9b1125c67506 (diff) |
Add support for member accessors/modifiers
New pragmas: get, set, access. New test: common/access.
Diffstat (limited to 'odb/relational/oracle')
-rw-r--r-- | odb/relational/oracle/source.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/odb/relational/oracle/source.cxx b/odb/relational/oracle/source.cxx index 780dc06..85be6cc 100644 --- a/odb/relational/oracle/source.cxx +++ b/odb/relational/oracle/source.cxx @@ -217,6 +217,26 @@ namespace relational } virtual void + check_accessor (member_info& mi, member_access& ma) + { + // We cannot use accessors that return by-value for LOB + // members. + // + if ((mi.st->type == sql_type::BLOB || + mi.st->type == sql_type::CLOB || + mi.st->type == sql_type::NCLOB) && + ma.by_value) + { + error (ma.loc) << "accessor returning a value cannot be used " + << "for a data member of Oracle LOB type" << endl; + info (ma.loc) << "accessor returning a const reference is required" + << endl; + info (mi.m.location ()) << "data member is defined here" << endl; + throw operation_failed (); + } + } + + virtual void set_null (member_info& mi) { os << "i." << mi.var << "indicator = -1;"; @@ -363,6 +383,25 @@ namespace relational } virtual void + check_modifier (member_info& mi, member_access& ma) + { + // We cannot use by-value modifier for LOB members. + // + if ((mi.st->type == sql_type::BLOB || + mi.st->type == sql_type::CLOB || + mi.st->type == sql_type::NCLOB) && + ma.placeholder ()) + { + error (ma.loc) << "modifier accepting a value cannot be used " + << "for a data member of Oracle LOB type" << endl; + info (ma.loc) << "modifier returning a non-const reference is " + << "required" << endl; + info (mi.m.location ()) << "data member is defined here" << endl; + throw operation_failed (); + } + } + + virtual void traverse_int32 (member_info& mi) { os << traits << "::set_value (" << endl |