aboutsummaryrefslogtreecommitdiff
path: root/pgsql
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 /pgsql
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 'pgsql')
-rw-r--r--pgsql/types/test.hxx40
1 files changed, 20 insertions, 20 deletions
diff --git a/pgsql/types/test.hxx b/pgsql/types/test.hxx
index 8b42aa1..ac1ed11 100644
--- a/pgsql/types/test.hxx
+++ b/pgsql/types/test.hxx
@@ -70,7 +70,7 @@ operator== (const varbit& x, const varbit& y)
return x.compare (y);
}
-#pragma db value(bitfield) type ("BIT(4) NOT NULL")
+#pragma db value(bitfield) type ("BIT(4)")
typedef std::auto_ptr<std::string> string_ptr;
@@ -93,66 +93,66 @@ struct object
// Integral types.
//
- #pragma db type ("BOOL NOT NULL")
+ #pragma db type ("BOOL")
bool bool_;
- #pragma db type ("SMALLINT NOT NULL")
+ #pragma db type ("SMALLINT")
short short_;
- #pragma db type ("INT NOT NULL")
+ #pragma db type ("INT")
int int_;
- #pragma db type ("BIGINT NOT NULL")
+ #pragma db type ("BIGINT")
long long long_long_;
// Float types.
//
- #pragma db type ("REAL NOT NULL")
+ #pragma db type ("REAL")
float float_;
- #pragma db type ("FLOAT(32) NOT NULL")
+ #pragma db type ("FLOAT(32)")
double float8_;
- #pragma db type ("DOUBLE PRECISION NOT NULL")
+ #pragma db type ("DOUBLE PRECISION")
double double_;
- // #pragma db type ("NUMERIC(6,3) NOT NULL")
+ // #pragma db type ("NUMERIC(6,3)")
// std::string numeric_;
// Data-time types.
//
- #pragma db type ("DATE NOT NULL")
+ #pragma db type ("DATE")
int date_;
- #pragma db type ("TIME NOT NULL")
+ #pragma db type ("TIME")
long long time_;
- #pragma db type ("TIMESTAMP NOT NULL")
+ #pragma db type ("TIMESTAMP")
long long timestamp_;
// String and binary types.
//
- #pragma db type ("CHAR(128) NOT NULL")
+ #pragma db type ("CHAR(128)")
std::string char_;
- #pragma db type ("VARCHAR(256) NOT NULL")
+ #pragma db type ("VARCHAR(256)")
std::string varchar_;
- #pragma db type ("TEXT NOT NULL")
+ #pragma db type ("TEXT")
std::string text_;
- #pragma db type ("BYTEA NOT NULL")
+ #pragma db type ("BYTEA")
buffer bytea_;
- #pragma db type ("VARBIT(1024) NOT NULL")
+ #pragma db type ("VARBIT(1024)")
varbit varbit_;
- // #pragma db type ("BIT(4) NOT NULL") - assigned by #pragma db value
+ // #pragma db type ("BIT(4)") - assigned by #pragma db value
bitfield bit_;
// Other types.
//
- #pragma db type ("UUID NOT NULL")
+ #pragma db type ("UUID")
unsigned char uuid_[16];
// Test ENUM representation.
@@ -161,7 +161,7 @@ struct object
// Test NULL value.
//
- #pragma db type ("TEXT")
+ #pragma db type ("TEXT") null
string_ptr null_;
bool