diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-04-18 18:50:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-04-18 18:50:04 +0200 |
commit | e305857bd0bd406ab91d31aaea0c1491d6e36b50 (patch) | |
tree | 6110c686f0baa08ddc970d18903d91de595aa475 /mysql/types/test.hxx | |
parent | 2f0038a2aed44ce04200c09229921ae21861ccaa (diff) |
Implement automatic mapping for C++ enums
Diffstat (limited to 'mysql/types/test.hxx')
-rw-r--r-- | mysql/types/test.hxx | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/mysql/types/test.hxx b/mysql/types/test.hxx index 207d8b3..3039a88 100644 --- a/mysql/types/test.hxx +++ b/mysql/types/test.hxx @@ -82,6 +82,8 @@ operator== (bitfield x, bitfield y) typedef std::set<std::string> set; typedef std::auto_ptr<std::string> string_ptr; +enum color {red, green, blue}; + #pragma db object struct object { @@ -203,10 +205,14 @@ struct object // #pragma db type ("BIT(4) NOT NULL") - assigned by #pragma db value bitfield bit_; - #pragma db type ("ENUM('red', 'green', 'blue') NOT NULL") - std::string enum_; + // Test ENUM representations (integer and string). + // + color enum_; + + #pragma db type ("ENUM ('red', 'green', 'blue') NOT NULL") + std::string enum_str_; - #pragma db type ("SET('red', 'green', 'blue') NOT NULL") + #pragma db type ("SET ('red', 'green', 'blue') NOT NULL") set set_; // Test NULL value. @@ -252,6 +258,7 @@ struct object longblob_ == y.longblob_ && bit_ == y.bit_ && enum_ == y.enum_ && + enum_str_ == y.enum_str_ && set_ == y.set_ && ((null_.get () == 0 && y.null_.get () == 0) || *null_ == *y.null_); } |