1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 09:32:12 +01:00

Add numRowsAffected support to SqlQueryJob

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2022-08-07 00:32:49 +02:00
parent dc9ff73693
commit b10b310d11
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
2 changed files with 10 additions and 0 deletions

View File

@ -58,6 +58,11 @@ QVariant SqlQueryJob::lastInsertId() const
return m_lastInsertId;
}
int SqlQueryJob::numRowsAffected() const
{
return m_numRowsAffected;
}
QVector<QSqlRecord> SqlQueryJob::records() const
{
return m_records;
@ -68,6 +73,7 @@ void SqlQueryJob::start()
struct Result {
QSqlError error;
QVariant lastInsertId;
int numRowsAffected;
QVector<QSqlRecord> records;
};
@ -82,6 +88,7 @@ void SqlQueryJob::start()
const auto result = watcher->result();
m_error = result.error;
m_lastInsertId = result.lastInsertId;
m_numRowsAffected = result.numRowsAffected;
m_records = result.records;
Q_EMIT finished(this);
});
@ -96,6 +103,7 @@ void SqlQueryJob::start()
Result res;
res.error = q.lastError();
res.lastInsertId = q.lastInsertId();
res.numRowsAffected = q.numRowsAffected();
while (q.next()) {
res.records.append(q.record());
}

View File

@ -37,6 +37,7 @@ public:
QSqlError error() const;
QVariant lastInsertId() const;
int numRowsAffected() const;
QVector<QSqlRecord> records() const;
void start();
@ -49,6 +50,7 @@ private:
QVector<QVariant> m_boundValues;
QSqlError m_error;
QVariant m_lastInsertId;
int m_numRowsAffected;
QVector<QSqlRecord> m_records;
};