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
mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
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
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()
 
Using Result, Query::store, Query::store_next and Connection::opt_multi_statemen

Using Result, Query::store, Query::store_next and Connection::opt_multi_statemen

2007-08-09       - By James Vanns

 Back
OK, so with the latest version of MySQL++ 2.3.2 and MySQL 5.0.27 I don't seem
to get the correct return code from Query::success() when using multi
-statements that don't return a result set. This used to work with 2.1 and
according to the MySQL page referenced in you developer documentation/reference
manuals:

http://dev.mysql.com/doc/mysql/en/c-api-multiple-queries.html

Is referenced from file:///usr/share/doc/mysql++-manuals-2 (See http://als-2.ora-code.com).3.2/html/refman
/classmysqlpp_1_1Query.html#a34

The MySQL example on that former page gives an example:

/* execute multiple statements */
status = mysql_query(mysql,
                    "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");

And they appear to use mysql_store_result(). I have a similar multi-query:

USE my_db;
UPDATE foobar () VALUES ();

And then this algorithm:

              bool done = false;
              Query query = con->query ();
              query << "USE my_db;UPDATE foobar () VALUES ();"

              std::cerr  << query.preview () << endl;
                 
                 for (Result result = query.store () ; !done ; result = query
.store_next ()) {
                    if (query.success ()) {
                       results += con->affected_rows ();
                       remove = success = true;
                    }

                    done = !query.more_results ();
                 }

Here, with version 2.3.2 query.success () always returns false - even if the
command succeeded! Why? Am I doing something wrong? Has something this major
changed? It also appears the affected_rows() sometimes doesn't return the
correct value for say, DELETES.

Cheers,

Jim

--
James Vanns
Systems Programmer
Framestore CFC Ltd.


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