aboutsummaryrefslogtreecommitdiff
path: root/mysql
diff options
context:
space:
mode:
Diffstat (limited to 'mysql')
-rw-r--r--mysql/types/driver.cxx3
-rw-r--r--mysql/types/test.hxx13
2 files changed, 12 insertions, 4 deletions
diff --git a/mysql/types/driver.cxx b/mysql/types/driver.cxx
index b675655..8a51dea 100644
--- a/mysql/types/driver.cxx
+++ b/mysql/types/driver.cxx
@@ -77,7 +77,8 @@ main (int argc, char* argv[])
o.bit_.c = 0;
o.bit_.d = 1;
- o.enum_ = "green";
+ o.enum_ = green;
+ o.enum_str_ = "green";
o.set_.insert ("green");
o.set_.insert ("red");
o.set_.insert ("blue");
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_);
}