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:
parent
dc9ff73693
commit
b10b310d11
|
@ -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());
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user