List:MySQL++« Previous MessageNext Message »
From:asokodesuka Date:August 20 2010 1:19am
Subject:execute() and store() discrepancy
View as plain text  
Hi,

I have a simple query :

SELECT client_number FROM clients WHERE client_number = 100

+---------------+
| client_number |
+---------------+
|           100 |
+---------------+
1 row in set (0.00 sec)



If I use execute()

mysqlpp::Query query = db_connexion.query();
query << "SELECT client_number FROM clients WHERE client_number = 100";

if (mysqlpp::SimpleResult res = query.execute())
{
	mysqlpp::ulonglong rows = res.rows();
}

rows is 18446744073709551615. Subsequent new queries to db_connexion
will return the following query.error() :
Commands out of sync; you can't run this command now.




If I use store() with the same query

if (mysqlpp::StoreQueryResult res = query.store())
{
	size_t rows = res.num_rows();
}

rows is 1 and subsequent queries work normally.

My System:

Windows 7 32bits
Visual C++ 2010 Express Debug/Release
mysql++-3.1.0
MySQL Server 5.1

So the question. Am I misusing execute() ? Or is it a bug ?

--
Catherine
Thread
execute() and store() discrepancyasokodesuka20 Aug
  • Re: execute() and store() discrepancyWarren Young20 Aug
    • Re: execute() and store() discrepancyasokodesuka20 Aug
      • Re: execute() and store() discrepancyWarren Young20 Aug
        • Re: execute() and store() discrepancyasokodesuka20 Aug