From b038ab0cd6335f3e4ec075d1e21f5d7bb89e3ffb 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). --- pgsql/types/test.hxx | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'pgsql') 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 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 -- cgit v1.1