Author: wyoung
Date: Tue Feb 20 13:07:33 2007
New Revision: 1422
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=1422&view=rev
Log:
Removed explicit insertion of null character into query string when
building return value for Query::preview() and Query::preview_char().
Because the library is now aware of null characters in query strings,
this causes code that calls preview*() before executing the query to
fail. The new code should avoid that without breaking code that expects
to see null-terminated strings, particularly those that call
preview_char(), rather than preview().
Modified:
trunk/lib/query.cpp
Modified: trunk/lib/query.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=1422&r1=1421&r2=1422&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Tue Feb 20 13:07:33 2007
@@ -349,10 +349,9 @@
char*
Query::preview_char()
{
- *this << std::ends;
size_t length = sbuffer_.str().size();
char* s = new char[length + 1];
- strncpy(s, sbuffer_.str().c_str(), length);
+ memcpy(s, sbuffer_.str().c_str(), length);
s[length] = '\0';
return s;
}
@@ -546,8 +545,6 @@
proc(p);
}
- *this << std::ends;
-
return sbuffer_.str();
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits