List:MySQL++« Previous MessageNext Message »
From:Muller Gael Date:August 13 2006 9:29pm
Subject:Problem with DELETE
View as plain text  
Hello everyone.

I'm just starting with mysql++ and I have a problem with a DELETE query:

-------------------------------------------------------------------------------------------------------------------------
mysqlpp::Connection db("CycomT", "localhost", "root", "");

mysqlpp::Query query = db.query();
query << "SELECT * FROM actions";
mysqlpp::Result result = query.store();
if (result) {
       if (result.num_rows() != 0) {
           try {
                 mysqlpp::Row row;
                 while (row = result.fetch_row()) {
                     std::cout << row["type"];
                 }
           }
           catch (mysqlpp::EndOfResults& er) {
                //on ne fait rien
          }
          query.reset();
          query << "DELETE FROM actions";
          query.execute();
   }
}


-----------------------------------------------------------------------------------------------------------------------------

The DELETE query seems to be executed before the SELECT query. Indeed my 
table is'nt empty before, but my program doesn't print anything. Then, 
my table is empty as expected. I don't understand why. Without the 
DELETE query, my program prints the content correctly.

Sorry for my English,
Thanks for help

-- 
Muller Gael
Thread
Problem with DELETEMuller Gael13 Aug
  • Re: Problem with DELETEWarren Young14 Aug