aboutsummaryrefslogtreecommitdiff
path: root/mysql
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-07-22 14:06:22 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-07-22 17:57:00 +0200
commitaa82673655e7aecd7cf2e7e9b5fd407eee2b01f2 (patch)
treedc9565b669b8715152dbaf9b34a8a3929d72f634 /mysql
parent6b224b9b316fd3c3d7642ba7ace2dd6b2cdcf953 (diff)
Test automatic and custom ENUM mappings
Diffstat (limited to 'mysql')
-rw-r--r--mysql/types/driver.cxx3
-rw-r--r--mysql/types/test.hxx14
2 files changed, 12 insertions, 5 deletions
diff --git a/mysql/types/driver.cxx b/mysql/types/driver.cxx
index 31ccde1..6625adf 100644
--- a/mysql/types/driver.cxx
+++ b/mysql/types/driver.cxx
@@ -78,7 +78,8 @@ main (int argc, char* argv[])
o.bit_.c = 0;
o.bit_.d = 1;
- o.enum_ = green;
+ o.enum_def_ = green;
+ o.enum_cst_ = blue;
o.enum_str_ = "green";
o.set_.insert ("green");
o.set_.insert ("red");
diff --git a/mysql/types/test.hxx b/mysql/types/test.hxx
index fa1d7b3..209782e 100644
--- a/mysql/types/test.hxx
+++ b/mysql/types/test.hxx
@@ -210,12 +210,17 @@ struct object
// Test ENUM representations (integer and string).
//
- color enum_;
+ color enum_def_;
- #pragma db type ("ENUM ('red', 'green', 'blue')")
+ // Map to a custom MySQL ENUM type.
+ //
+ #pragma db type ("ENUM('R', 'G', 'B')")
+ color enum_cst_;
+
+ #pragma db type ("ENUM('red', 'green', 'blue')")
std::string enum_str_;
- #pragma db type ("SET ('red', 'green', 'blue')")
+ #pragma db type ("SET('red', 'green', 'blue')")
set set_;
// Test NULL value.
@@ -261,7 +266,8 @@ struct object
longtext_ == y.longtext_ &&
longblob_ == y.longblob_ &&
bit_ == y.bit_ &&
- enum_ == y.enum_ &&
+ enum_def_ == y.enum_def_ &&
+ enum_cst_ == y.enum_cst_ &&
enum_str_ == y.enum_str_ &&
set_ == y.set_ &&
((null_.get () == 0 && y.null_.get () == 0) || *null_ == *y.null_);