  | | | 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)
|
|
 |