Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
Subject: mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Subject: Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
Subject: MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Subject: Re: Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
Subject: Re: Issues with multi-queries

Subject: Re: Issues with multi-queries

2007-11-09       - By Paul Martin

 Back
The store_next() change did it.  The queries seem to take the time they
should now and everything is hunky dory for the next call.  I read through
the comments in query.h as well and that restated it.  Thanks a mil... next
time I'll RTFM a little more closely.

With that in mind, if I am calling query.execute() instead of store() how do
I consume the rest of the results?

Paul


-- -- Original Message -- --
From: "Warren Young" <mysqlpp@(protected)>
To: "MySQL++ Mailing List" <plusplus@(protected)>
Sent: Friday, November 09, 2007 6:03 PM
Subject: Re: Issues with multi-queries


> Paul Martin wrote:
>> 1. Comment out 4 lines starting with 'print_result' in the
>> 'print_multiple_results' function (to kill screen printing)
>
> You also commented out the Query::more_results() call.  That's why it dies
> the second time around: you must consume all results on a MySQL DB
> connection before you make another one.  Hard limit of the underlying C
> API, no option to change it.  You must consume the results.
>
> I made my own changes to multiquery.cpp, and it works here on both Linux
> and Windows, built against MySQL 5.0 and MySQL++ svn.
>
> Index: examples/multiquery.cpp
> ===================================================================
> --- examples/multiquery.cpp (revision 1814)
> +++ examples/multiquery.cpp (working copy)
> @@ -123,10 +123,10 @@
>     try {
>         // Execute query and print all result sets
>         Result res = query.store();
> -       print_result(res, 0);
> -       for (int i = 1; query.more_results(); ++i) {
> +       cout << '.' << flush;
> +       while (query.more_results()) {
>             res = query.store_next();
> -           print_result(res, i);
> +           cout << '.' << flush;
>         }
>     }
>     catch (Exception& err) {
> @@ -163,16 +163,18 @@
>
>         // Set up query with multiple queries.
>         Query query = con.query();
> -       query << "DROP TABLE IF EXISTS test_table;" << endl <<
> -               "CREATE TABLE test_table(id INT);" << endl <<
> -               "INSERT INTO test_table VALUES(10);" << endl <<
> -               "UPDATE test_table SET id=20 WHERE id=10;" << endl <<
> -               "SELECT * FROM test_table;" << endl <<
> -               "DROP TABLE test_table" << endl;
> -       cout << "Multi-query: " << endl << query.preview() << endl;
> +       while (1) {
> +           query.reset();
> +           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";
>
> -       // Execute statement and display all result sets.
> -       print_multiple_results(query);
> +           // Execute statement and display all result sets.
> +           print_multiple_results(query);
> +       }
>
>  #if MYSQL_VERSION_ID >= 50000
>         // If it's MySQL v5.0 or higher, also test stored procedures,
> which
>
>
> It'll sit there spitting dots out at you until you get quite bored.
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
> http://lists.mysql.com/plusplus?unsub=pmartin@(protected)
>
>


--
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe:    http://lists.mysql.com/plusplus?unsub=mysql@(protected)