From 72951cb80852683bdd2707031471580620733e2f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 19 Jul 2011 13:42:18 +0200 Subject: 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). --- boost/employee.hxx | 2 +- inverse/employee.hxx | 6 +++--- mapping/person.hxx | 4 ++-- qt/employee.hxx | 2 +- relationship/employee.hxx | 2 +- schema/custom/employee.hxx | 10 +++++----- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/boost/employee.hxx b/boost/employee.hxx index 93b1027..ffa017e 100644 --- a/boost/employee.hxx +++ b/boost/employee.hxx @@ -72,7 +72,7 @@ private: #pragma db id std::string name_; - #pragma db not_null inverse(employer_) + #pragma db value_not_null inverse(employer_) employees_type employees_; }; diff --git a/inverse/employee.hxx b/inverse/employee.hxx index 915b561..8c10e34 100644 --- a/inverse/employee.hxx +++ b/inverse/employee.hxx @@ -84,7 +84,7 @@ private: #pragma db id std::string name_; - #pragma db not_null inverse(employer_) + #pragma db value_not_null inverse(employer_) employees_type employees_; }; @@ -172,7 +172,7 @@ private: #pragma db id std::string name_; - #pragma db not_null inverse(projects_) + #pragma db value_not_null inverse(projects_) employees_type employees_; }; @@ -268,7 +268,7 @@ private: #pragma db not_null lazy_shared_ptr position_; - #pragma db not_null unordered + #pragma db value_not_null unordered projects_type projects_; }; diff --git a/mapping/person.hxx b/mapping/person.hxx index ba07ef5..1638ff5 100644 --- a/mapping/person.hxx +++ b/mapping/person.hxx @@ -13,9 +13,9 @@ // In our database boolean values are stored as strings with valid // values being "true" and "false". // -#pragma db value(bool) type("VARCHAR(5) NOT NULL") +#pragma db value(bool) type("VARCHAR(5)") -#pragma db value type("DATE NOT NULL") +#pragma db value type("DATE") class date { public: diff --git a/qt/employee.hxx b/qt/employee.hxx index 58f43cc..33eb46f 100644 --- a/qt/employee.hxx +++ b/qt/employee.hxx @@ -59,7 +59,7 @@ private: #pragma db id QString name_; - #pragma db not_null inverse(employer_) + #pragma db value_not_null inverse(employer_) Employees employees_; }; diff --git a/relationship/employee.hxx b/relationship/employee.hxx index e89e704..86fe82d 100644 --- a/relationship/employee.hxx +++ b/relationship/employee.hxx @@ -154,7 +154,7 @@ private: #pragma db not_null shared_ptr employer_; - #pragma db not_null unordered + #pragma db value_not_null unordered projects_type projects_; }; diff --git a/schema/custom/employee.hxx b/schema/custom/employee.hxx index 742ad42..651f8c3 100644 --- a/schema/custom/employee.hxx +++ b/schema/custom/employee.hxx @@ -43,10 +43,10 @@ public: private: friend class odb::access; - #pragma db type("VARCHAR(255) NOT NULL") column("first_name") + #pragma db type("VARCHAR(255)") column("first_name") std::string first_; - #pragma db type("VARCHAR(255) NOT NULL") column("last_name") + #pragma db type("VARCHAR(255)") column("last_name") std::string last_; }; @@ -70,7 +70,7 @@ private: employer () {} - #pragma db id type("VARCHAR(255) NOT NULL") column("name") + #pragma db id type("VARCHAR(255)") column("name") std::string name_; }; @@ -133,14 +133,14 @@ private: employee (): name_ ("", "") {} - #pragma db id type("INTEGER UNSIGNED NOT NULL") column("ssn") + #pragma db id type("INTEGER UNSIGNED") column("ssn") unsigned long id_; #pragma db column("") // No column prefix. name_type name_; #pragma db unordered table("EmployeeDegree") id_column("ssn") \ - value_type("VARCHAR(255) NOT NULL") value_column("degree") + value_type("VARCHAR(255)") value_column("degree") degrees_type degrees_; #pragma db not_null column("employer") -- cgit v1.1