Author: wyoung
Date: Fri Dec 12 13:52:33 2008
New Revision: 2434
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2434&view=rev
Log:
Forcing Query streams to use C locale instead of the default one, in
case someone has set it to one that causes weirdness like thousands
separators in inserted integers, causing SQL errors. Diagnosis and
fix by Tomaz Solc <[email protected]>
Modified:
trunk/lib/query.cpp
Modified: trunk/lib/query.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=2434&r1=2433&r2=2434&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Fri Dec 12 13:52:33 2008
@@ -44,11 +44,19 @@
conn_(c),
copacetic_(true)
{
+ // Set up our internal IOStreams string buffer
init(&sbuffer_);
+
+ // Insert passed query string into our string buffer, if given
if (qstr) {
sbuffer_.str(qstr);
seekp(0, std::ios::end); // allow more insertions at end
- }
+ }
+
+ // Override any global locale setting; we want to use the classic C
+ // locale so we don't get weird things like thousands separators in
+ // integers inserted into the query stream.
+ imbue(std::locale::classic());
}
Query::Query(const Query& q) :
@@ -67,6 +75,9 @@
// Query on purpose. This isn't a copy ctor so much as a way to
// ensure that "Query q(conn.query());" works correctly.
init(&sbuffer_);
+
+ // See above for reason we override locale for Query streams.
+ imbue(std::locale::classic());
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits