![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I'm trying to code a small app that optimizes my tables every once every day. If I give "optimize table xx " commands to the simple mysql client in a row, everything is ok. Here is a part of my my source, I think it should do the same: // analyze and optimize tables list<string> tableNames; tableNames.push_back("fileok"); tableNames.push_back("gep_beallitasok"); tableNames.push_back("gep_login"); tableNames.push_back("gep_login_rootdir"); tableNames.push_back("gepek"); tableNames.push_back("konyvtar_alkonyvtar"); tableNames.push_back("konyvtarak"); tableNames.push_back("loginok"); for (list<string>::const_iterator i = tableNames.begin(); i != tableNames.end(); i++) { Query query = con.query(); query << "optimize table " << *i; cout << query.preview() << endl; try { query.execute(); } catch (BadQuery e) { cout << "BadQuery" << endl; cout << e.error << endl; } catch (BadConversion e) { cout << "BadConversion" << endl; } catch (BadNullConversion e) { cout << "BadNullConversion" << endl; } } But it doesn't. It gives me this error message: Commands out of sync; you can't run this command now A little googling gave me the meaning of this error message: "If you get Commands out of sync; you can't run this command now in your client code, you are calling client functions in the wrong order! This can happen, for example, if you are using mysql_use_result() and try to execute a new query before you have called mysql_free_result(). It can also happen if you try to execute two queries that return data without a mysql_use_result() or mysql_store_result() in between." But I don't see what am I doing in the wrong order. My queries don't even have results! What could be the problem? Thanks for your kind help in advance, Peter -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsu...h (DOT) bme.hu |
![]() |
| Thread Tools | |
| Display Modes | |
| |