drivers optimized cleanup before query execution

Don't cleanup on the newly created instance.
This commit is contained in:
silverqx
2024-07-26 21:51:05 +02:00
parent 709ac28178
commit eba49776c1
2 changed files with 17 additions and 0 deletions

View File

@@ -64,6 +64,9 @@ namespace Orm::Drivers
bool isActive = false;
/*! Is this result from the SELECT statement? */
bool isSelect = false;
/*! Determine if the instance needs cleanup before executing the query. It's
always true after the first query is executed. */
bool needsCleanup = false;
};
} // namespace Orm::Drivers

View File

@@ -527,6 +527,13 @@ void MySqlResult::cleanupForNormal()
{
Q_D(MySqlResult);
/* Helps to avoid cleanup on the newly created instance, it's only false on the newly
created instance. */
if (!d->needsCleanup) {
d->needsCleanup = true;
return;
}
d->recordCache.clear();
// Normal queries
@@ -540,6 +547,13 @@ void MySqlResult::cleanupForPrepared()
{
Q_D(MySqlResult);
/* Helps to avoid cleanup on the newly created instance, it's only false on the newly
created instance. */
if (!d->needsCleanup) {
d->needsCleanup = true;
return;
}
d->recordCache.clear();
// Prepared queries