Author: wyoung
Date: Wed Aug 27 20:24:29 2008
New Revision: 2357

URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2357&view=rev
Log:
Fixed bug where initting a Query with a query string and then appending
more to it with operator <<() would start overwriting the beginning of
the buffer.  query.cpp patch by Chris Frey, changes to examples to
verify it by me.

Modified:
    trunk/CREDITS.txt
    trunk/Wishlist
    trunk/examples/multiquery.cpp
    trunk/examples/ssqls3.cpp
    trunk/lib/query.cpp

Modified: trunk/CREDITS.txt
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/CREDITS.txt?rev=2357&r1=2356&r2=2357&view=diff
==============================================================================
--- trunk/CREDITS.txt (original)
+++ trunk/CREDITS.txt Wed Aug 27 20:24:29 2008
@@ -1,9 +1,9 @@
-MySQL++ was created by Kevin Atkinson during 1998. From version 1.0
-(released in June 1999) through 1.7.9 (May 2001), the primary maintainer
-was Sinisa Milivojevic <[EMAIL PROTECTED]>. Neither Kevin nor Sinisa
-are currently involved in MySQL++ development. The current maintainer
-is Warren Young <[EMAIL PROTECTED]>, starting with version 1.7.10 in
-August of 2004.
+MySQL++ was created by Kevin Atkinson during 1998.  From version
+1.0 (released in June 1999) through 1.7.9 (May 2001), the primary
+maintainer was Sinisa Milivojevic <[EMAIL PROTECTED]>.  Neither Kevin
+nor Sinisa are currently involved in MySQL++ development.  The current
+maintainer is Warren Young <[EMAIL PROTECTED]>, starting with
+version 1.7.10 in August of 2004.
 
 For a fuller account of the library's history, see the first chapter
 of the user manual.  For the nitty-gritty details, see the ChangeLog
@@ -13,8 +13,9 @@
 
 Other contributors of note since 1.7.10:
 
-    Chris Frey <[EMAIL PROTECTED]>: Lots of GCC warning fixes for the
-    bleeding-edge compiler versions, and Gentoo ebuild support.
+    Chris Frey <[EMAIL PROTECTED]>: Lots of GCC warning fixes
+    for the bleeding-edge compiler versions, Gentoo ebuild support,
+    and misc other fixes.
 
     Mark Meredino <[EMAIL PROTECTED]>: Several fixes and
     additions, including a lot of work on Microsoft Visual C++
@@ -46,8 +47,8 @@
     supposed to.
 
     Jonathan Wakely <[EMAIL PROTECTED]> rebuilt my original versions
-       of ConnectionPool, RefCountedPointer, and RefCountedBuffer.
-       They're now simpler and safer.  He also created the numeric
+    of ConnectionPool, RefCountedPointer, and RefCountedBuffer.
+    They're now simpler and safer.  He also created the numeric
     conversion logic in lib/mystring.h introduced in v3.0.
 
 

Modified: trunk/Wishlist
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/Wishlist?rev=2357&r1=2356&r2=2357&view=diff
==============================================================================
--- trunk/Wishlist (original)
+++ trunk/Wishlist Wed Aug 27 20:24:29 2008
@@ -15,18 +15,6 @@
     o Any time you must hand-roll some SQL code in your program,
       consider whether it could be generalized to a widely-useful
       API feature.
-
-    o Possible bug in combined use of stream and init-by-string
-      cases:
-
-          Query q = c.query("Initial bit of SQL here");
-          q << "more appended";
-
-      results in:
-
-          "more appendedf SQL here"
-
-      The stream insertion is overwriting the initial fragment.
 
 
 v3.1 Tentative Plan

Modified: trunk/examples/multiquery.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/multiquery.cpp?rev=2357&r1=2356&r2=2357&view=diff
==============================================================================
--- trunk/examples/multiquery.cpp (original)
+++ trunk/examples/multiquery.cpp Wed Aug 27 20:24:29 2008
@@ -154,13 +154,12 @@
                }
 
                // Set up query with multiple queries.
-               Query query = con.query();
-               query << "DROP TABLE IF EXISTS test_table; " <<
-                               "CREATE TABLE test_table(id INT); " <<
-                               "INSERT INTO test_table VALUES(10); " <<
-                               "UPDATE test_table SET id=20 WHERE id=10; " <<
-                               "SELECT * FROM test_table; " <<
-                               "DROP TABLE test_table";
+               Query query = con.query("DROP TABLE IF EXISTS test_table; "
+                               "CREATE TABLE test_table(id INT); "
+                               "INSERT INTO test_table VALUES(10); "
+                               "UPDATE test_table SET id=20 WHERE id=10; "
+                               "SELECT * FROM test_table; "
+                               "DROP TABLE test_table");
                cout << "Multi-query: " << endl << query << endl;
 
                // Execute statement and display all result sets.

Modified: trunk/examples/ssqls3.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/examples/ssqls3.cpp?rev=2357&r1=2356&r2=2357&view=diff
==============================================================================
--- trunk/examples/ssqls3.cpp (original)
+++ trunk/examples/ssqls3.cpp Wed Aug 27 20:24:29 2008
@@ -48,8 +48,8 @@
 
                // Build a query to retrieve the stock item that has Unicode
                // characters encoded in UTF-8 form.
-               mysqlpp::Query query = con.query(
-                               "select * from stock where item = \"Nürnberger 
Brats\"");
+               mysqlpp::Query query = con.query("select * from stock ");
+               query << "where item = " << mysqlpp::quote << "Nürnberger 
Brats";
 
                // Retrieve the row, throwing an exception if it fails.
                mysqlpp::StoreQueryResult res = query.store();

Modified: trunk/lib/query.cpp
URL: 
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/query.cpp?rev=2357&r1=2356&r2=2357&view=diff
==============================================================================
--- trunk/lib/query.cpp (original)
+++ trunk/lib/query.cpp Wed Aug 27 20:24:29 2008
@@ -47,6 +47,7 @@
        init(&sbuffer_);
        if (qstr) {
                sbuffer_.str(qstr);
+               seekp(0, std::ios::end);        // allow more insertions at end
        }
 }
 


_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits

Reply via email to