aboutsummaryrefslogtreecommitdiff
path: root/odb/mysql/connection.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-26 13:40:20 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-26 13:40:20 +0200
commit4ea19dd03241a940a4194ac3bdea89bf7cca8f42 (patch)
tree45b42f0e5adb5f6f676e0f501926c2bceea38c85 /odb/mysql/connection.cxx
parentce69b47672cab339994828e0ff5e28b058a517f0 (diff)
Add support for specifying client character set for MySQL database
Diffstat (limited to 'odb/mysql/connection.cxx')
-rw-r--r--odb/mysql/connection.cxx5
1 files changed, 5 insertions, 0 deletions
diff --git a/odb/mysql/connection.cxx b/odb/mysql/connection.cxx
index b783f69..f8e88a0 100644
--- a/odb/mysql/connection.cxx
+++ b/odb/mysql/connection.cxx
@@ -32,6 +32,11 @@ namespace odb
if (mysql_init (handle_) == 0)
throw bad_alloc ();
+ if (*db_.charset () != '\0')
+ // Can only fail if we pass an unknown option.
+ //
+ mysql_options (handle_, MYSQL_SET_CHARSET_NAME, db_.charset ());
+
// Force the CLIENT_FOUND_ROWS flag so that UPDATE returns the
// number of found rows, not the number of changed rows. This
// is necessary to distinguish between the object-not-persistent