From 061a16256eef2c2df53e2e145d16f17270c2de82 Mon Sep 17 00:00:00 2001
From: Boris Kolpackov
Date: Fri, 26 Aug 2011 13:40:20 +0200
Subject: Add support for specifying client character set for MySQL database
---
NEWS | 4 ++++
doc/manual.xhtml | 36 +++++++++++++++++++++++++++++-------
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/NEWS b/NEWS
index 82a89fb..29f3c40 100644
--- a/NEWS
+++ b/NEWS
@@ -49,6 +49,10 @@ Version 1.6.0
more information, refer to Section 3.4, "Transactions" in the ODB
manual.
+ * Support for specifying the client character set for the MySQL database.
+ For more information, refer to Section 11.2, "MySQL Database Class" in
+ the ODB manual.
+
Version 1.5.0
* Support for the PostgreSQL database. The provided connection factories
diff --git a/doc/manual.xhtml b/doc/manual.xhtml
index 4c0686e..44bfc8b 100644
--- a/doc/manual.xhtml
+++ b/doc/manual.xhtml
@@ -8213,6 +8213,7 @@ namespace odb
const char* host = 0,
unsigned int port = 0,
const char* socket = 0,
+ const char* charset = 0,
unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = 0);
@@ -8222,6 +8223,7 @@ namespace odb
const std::string& host = "",
unsigned int port = 0,
const std::string* socket = 0,
+ const std::string& charset = "",
unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = 0);
@@ -8231,6 +8233,7 @@ namespace odb
const std::string& host = "",
unsigned int port = 0,
const std::string* socket = 0,
+ const std::string& charset = "",
unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = 0);
@@ -8240,6 +8243,7 @@ namespace odb
const std::string& host,
unsigned int port,
const std::string& socket,
+ const std::string& charset = "",
unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = 0);
@@ -8249,12 +8253,14 @@ namespace odb
const std::string& host,
unsigned int port,
const std::string& socket,
+ const std::string& charset = "",
unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = 0);
database (int& argc,
char* argv[],
bool erase = false,
+ const std::string& charset = "",
unsigned long client_flags = 0,
std::auto_ptr<connection_factory> = 0);
@@ -8281,6 +8287,9 @@ namespace odb
const char*
socket () const;
+ const char*
+ charset () const;
+
unsigned long
client_flags () const;
@@ -8300,11 +8309,24 @@ namespace odb
connecting to the database. In MySQL NULL
and an
empty string are treated as the same values for all the
string parameters except password
and
- socket
. The client_flags
argument
- allows us to specify various MySQL client library flags. For more
- information on the possible values, refer to the MySQL C API
- documentation. The CLIENT_FOUND_ROWS
flag is always set
- by the MySQL ODB runtime regardless of whether it was passed in the
+ socket
.
+
+ The charset
argument allows us to specify the client
+ character set, that is, the character set in which the application
+ will encode its text data. Note that this can be different from
+ the MySQL server character set. If this argument is not specified or
+ is empty, then the default MySQL client character set is used, normally
+ latin1
. Commonly used values for this argument are
+ latin1
(equivalent to Windows cp1252 and similar to
+ ISO-8859-1) and utf8
. For other possible values
+ as well as more information on character set support in MySQL,
+ refer to the MySQL documentation.
+
+ The client_flags
argument allows us to specify various
+ MySQL client library flags. For more information on the possible
+ values, refer to the MySQL C API documentation. The
+ CLIENT_FOUND_ROWS
flag is always set by the MySQL ODB
+ runtime regardless of whether it was passed in the
client_flags
argument.
The last constructor extracts the database parameters
@@ -8321,8 +8343,8 @@ namespace odb
The --options-file
option allows us to specify some
- or all of the database options in a file with each option appearing
- on a separate line followed by a space and an option value.
+ or all of the database options in a file with each option appearing
+ on a separate line followed by a space and an option value.
If the erase
argument to this constructor is true,
then the above options are removed from the argv
--
cgit v1.1