aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-19 13:42:18 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-19 13:42:18 +0200
commitb038ab0cd6335f3e4ec075d1e21f5d7bb89e3ffb (patch)
treecb79dc28903ba238b180b8687d4cdb2f879afc49 /common
parent533539cd0a445bb38ac574024361552188efa8e6 (diff)
New design for NULL semantics
Now, instead of being specified as part of the SQL type with the type pragma, there are separate null and not_null pragmas. The not_null pragma was used to control NULL-ness of object pointers. Now the two pragmas are used consistently for object pointers and simple values (and in the future will work for composite values and containers).
Diffstat (limited to 'common')
-rw-r--r--common/lazy-ptr/test.hxx4
-rw-r--r--common/query/test.hxx2
-rw-r--r--common/relationship/driver.cxx5
3 files changed, 6 insertions, 5 deletions
diff --git a/common/lazy-ptr/test.hxx b/common/lazy-ptr/test.hxx
index b530316..32f6a43 100644
--- a/common/lazy-ptr/test.hxx
+++ b/common/lazy-ptr/test.hxx
@@ -38,7 +38,7 @@ public:
typedef std::vector<lazy_ptr<obj1> > obj_list;
- #pragma db not_null
+ #pragma db value_not_null
obj_list o;
};
@@ -122,7 +122,7 @@ namespace tr1
typedef std::vector<lazy_weak_ptr<obj> > obj_list;
- #pragma db inverse(c) not_null
+ #pragma db inverse(c) value_not_null
obj_list o;
};
diff --git a/common/query/test.hxx b/common/query/test.hxx
index 124ee72..21acb84 100644
--- a/common/query/test.hxx
+++ b/common/query/test.hxx
@@ -38,7 +38,7 @@ struct person
#pragma db column ("first")
std::string first_name_;
- #pragma db column ("middle") type ("TEXT")
+ #pragma db column ("middle") type ("TEXT") null
std::auto_ptr<std::string> middle_name_;
#pragma db column ("last")
diff --git a/common/relationship/driver.cxx b/common/relationship/driver.cxx
index abbae29..3ce7e8c 100644
--- a/common/relationship/driver.cxx
+++ b/common/relationship/driver.cxx
@@ -46,8 +46,9 @@ main (int argc, char* argv[])
a.v1.push_back (0);
a.v1.push_back (new obj1 ("v1 2", "v1 2"));
+ // Set cannot contain NULL pointers.
+ //
a.s1.insert (new obj1 ("s1 0", "s1 0"));
- a.s1.insert (static_cast<obj1*> (0)); // VC 10
a.s1.insert (new obj1 ("s1 2", "s1 2"));
a.m1[0] = new obj1 ("m1 0", "m1 0");
@@ -112,7 +113,7 @@ main (int argc, char* argv[])
t.commit ();
}
- // test NULL pointer
+ // Test NULL pointer.
//
delete a.o1;
a.o1 = 0;