mirror of
https://github.com/silverqx/TinyORM.git
synced 2025-12-20 09:59:53 -06:00
drivers optimized cleanup before query execution
Don't cleanup on the newly created instance.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user