Author: wyoung
Date: Wed Jul 2 18:35:19 2008
New Revision: 2302
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2302&view=rev
Log:
Clarified the difference between count of bytes and count of characters
in String::size() and ::length().
Modified:
trunk/Wishlist
trunk/doc/userman/unicode.dbx
trunk/lib/mystring.h
Modified: trunk/Wishlist
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=2302&r1=2301&r2=2302&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Wed Jul 2 18:35:19 2008
@@ -96,10 +96,6 @@
wstring, C++/CLI native strings, etc. Then convert examples that
do this conversion to use this new mechanism.
- o Document the fact that mysqlpp::String doesn't automatically widen
- UTF-8 data received from the database: need it in refman (size()
- member) and userman's Unicode chapter.
-
v4.0 or Later
-------------
Modified: trunk/doc/userman/unicode.dbx
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/doc/userman/unicode.dbx?rev=2302&r1=2301&r2=2302&view=diff
==============================================================================
--- trunk/doc/userman/unicode.dbx (original)
+++ trunk/doc/userman/unicode.dbx Wed Jul 2 18:35:19 2008
@@ -35,13 +35,14 @@
per character, so most Unicode-aware programs deal in 2-byte
characters, for efficiency.</para>
- <para>Unfortunately, Unicode was invented about two decades too late
- for Unix and C. Those decades of legacy created an immense inertia
- preventing a widespread move away from 8-bit characters. MySQL and
- C++ come out of these older traditions, and so they share the same
- practical limitations. MySQL++ doesn’t have a reason to do
- anything more than just pass data along unchanged, so you still need
- to be aware of these underlying issues.</para>
+ <para>Unfortunately, Unicode was invented about two decades
+ too late for Unix and C. Those decades of legacy created an
+ immense inertia preventing a widespread move away from 8-bit
+ characters. MySQL and C++ come out of these older traditions, and
+ so they share the same practical limitations. MySQL++ currently
+ doesn't have any code in it for Unicode conversions; it just
+ passes data along unchanged from the underlying MySQL C API,
+ so you still need to be aware of these underlying issues.</para>
<para>During the development of the <ulink
url="http://en.wikipedia.org/wiki/Plan_9_from_Bell_Labs">Plan
Modified: trunk/lib/mystring.h
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/mystring.h?rev=2302&r1=2301&r2=2302&view=diff
==============================================================================
--- trunk/lib/mystring.h (original)
+++ trunk/lib/mystring.h Wed Jul 2 18:35:19 2008
@@ -386,7 +386,14 @@
/// \brief Set a flag indicating that this object is a SQL null.
void it_is_null();
- /// \brief Return number of characters in the string
+ /// \brief Return number of bytes in the string
+ ///
+ /// Note that this doesn't count the number of \b characters in the
+ /// string. If your database is configured to use an 8-bit character
+ /// set, this is a distinction without a difference. But, if you're
+ /// using UTF-8 in the database, you will need to "widen" the UTF-8
+ /// data to use a fixed-size character set like UCS-2 and count the
+ /// characters that way. You might use std::wstring, for example.
size_type length() const;
/// \brief Return the maximum number of characters in the string.
@@ -400,7 +407,10 @@
/// otherwise.
bool quote_q() const;
- /// \brief Return number of characters in string
+ /// \brief Return number of bytes in string
+ ///
+ /// See commentary for length() about the difference between bytes
+ /// and characters.
size_type size() const { return length(); }
/// \brief Returns a copy of our internal string without leading
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits