Diffusion KDb d7e1200a543c

API change to 3.0.91: improve memory management of raw SQL execution and…

Authored by staniek on May 8 2017, 6:05 PM.

Description

API change to 3.0.91: improve memory management of raw SQL execution and preparing

Summary:

  • Change KDbSqlResult* KDbConnection::executeSQL to QSharedPointer<KDbSqlResult> KDbConnection::prepareSql (fixes risks of memory leaks and unfinished execution when resulting object is ignored)
  • Change bool KDbConnection::executeVoidSQL to bool KDbConnection::executeSql (also in Kexi)
  • Change KDbConnection::insertRecord to return QSharedPointer<KDbSqlResult> (fixes risks of memory leaks and unfinished execution when resulting object is ignored)
  • Change KDbConnection::recentSQLString() to recentSqlString()
  • Change KDbSqlRecord* KDbSqlResult::fetchRecord() to QSharedPointer<KDbSqlRecord> fetchRecord()
  • Change KDbSqlResult* KDbPreparedStatementInterface::execute() to QSharedPointer<KDbSqlResult> KDbPreparedStatementInterface::execute()
  • Change KDb::lastInsertedAutoIncValue(KDbSqlResult *result, ...) to KDb::lastInsertedAutoIncValue(QSharedPointer<KDbSqlResult>, ...)
  • Update drivers accordingly
  • KDb & Kexi: Replace KDbConnection::executeVoidSQL uses with KDbConnection::executeSql and Replace KDbConnection::executeSQL uses with KDbConnection::prepareSql where needed (fix memory leak and unfinished execution)

Test Plan: Run all autotests of KDb, build and try Kexi with sqlite/pgsql/mysql projects.

Reviewers: piggz

Subscribers: anthonyfieroni

Tags: KDb

Maniphest Tasks: T5992

Differential Revision: https://phabricator.kde.org/D5771