7 Star 0 Fork 1

src-anolis-dde/qt5-qtbase-5.15

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
mysql_free_results_when_qsqlquery_finished_is_called.patch 1.40 KB
一键复制 编辑 原始数据 按行查看 历史
xingwei-liu 提交于 2022-07-18 06:50 . !3add patch gnukfreebsd.diff
From 97d8be10cd97cf997286ed0ca0a5d8b360fa942e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
Date: Sat, 1 Dec 2018 17:56:41 +0100
Subject: [PATCH] MySQL: Free the results when QSqlQuery::finished() is called
Calling mysql_stmt_free_result() frees the results of the last
executed query while keeping the prepared statement valid. This
allows one to keep around prepared QSqlQueries without the overhead
of keeping all the results in memory.
Change-Id: I4589e90857cc4e9a6f9612799bfca967a67e2ab2
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
---
src/plugins/sqldrivers/mysql/qsql_mysql.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
--- a/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
+++ b/src/plugins/sqldrivers/mysql/qsql_mysql.cpp
@@ -193,6 +193,7 @@ protected:
QSqlRecord record() const override;
void virtual_hook(int id, void *data) override;
bool nextResult() override;
+ void detachFromResultSet() override;
#if MYSQL_VERSION_ID >= 40108
bool prepare(const QString &stmt) override;
@@ -798,6 +799,15 @@ int QMYSQLResult::numRowsAffected()
return d->rowsAffected;
}
+void QMYSQLResult::detachFromResultSet()
+{
+ Q_D(QMYSQLResult);
+
+ if (d->preparedQuery) {
+ mysql_stmt_free_result(d->stmt);
+ }
+}
+
QVariant QMYSQLResult::lastInsertId() const
{
Q_D(const QMYSQLResult);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-dde/qt5-qtbase-5.15.git
git@gitee.com:src-anolis-dde/qt5-qtbase-5.15.git
src-anolis-dde
qt5-qtbase-5.15
qt5-qtbase-5.15
a8.6

搜索帮助