PDA

View Full Version : QtSql: Maximum number of PREPARE statements



kayssun
24th April 2010, 22:26
Hi
I am heavily using QSqlQuery::prepare() in my application and since I have to process a lot of data, mysql throws an error: ERROR 1461 (42000): Can't create more than max_prepared_stmt_count statements (current value: 16382)
Can I somehow free these prepared statements? It is nice to use them, because I don't need to care how to escape variables when switching from MySQL to SQLite for example.
I know I could optimize my code to do less queries, but this would make it less readable? Do you have any ideas?

wysota
24th April 2010, 23:56
The limit deals with concurrent queries. If you don't forget to release the queries (i.e. by iterating to the end of their results and destroying all references to the query object) the database should release the resource as well.

kayssun
25th April 2010, 09:51
Thank you, I found a memory leak. That's probably it.