diff options
author | Dennis Oberst <[email protected]> | 2024-06-26 14:51:53 +0200 |
---|---|---|
committer | Dennis Oberst <[email protected]> | 2024-06-28 15:54:22 +0200 |
commit | d7a70f5ac887d46fbc82a60c2db074083d448126 (patch) | |
tree | 3f5e76736d5160ba29c2eeea60e4c1ddfde3c124 | |
parent | ff26a209eaac9a9013a0cc41185a38d448af97e2 (diff) |
OCI: misc code tidies and fixes
In it's current state the plugin is not buildable. This patch
tries to address that by fixing those issues. They include:
- Drag QOCIResultPrivate into the namespace and forward declare as
class. It is defined as class and this should stay in sync.
- Mark the overwritten members with 'override'.
- add missing declaration for 'fetchNext'
- Make the pimpl a proper Qt-dPtr by using Q_DECLARE_PRIVATE and rename
it into 'd_ptr' so that we can use the 'Q_D' macro.
- Remove the function call to 'isCursor'. This bool is member variable
of the class.
- Remove a '+' in front of 'internal_prepare' definition.
- Remove the 'QOCIDriverPrivate' argument to the ctor. The initial one
didn't had it and no other definition was provided.
Amends: 82681fd8a2af1113da5bd13875ba71c1efd45afb
Change-Id: I5b5042730b0decb440795bbb627c2cacc098594e
Reviewed-by: Christian Ehrlicher <[email protected]>
-rw-r--r-- | src/plugins/sqldrivers/oci/qsql_oci.cpp | 7 | ||||
-rw-r--r-- | src/plugins/sqldrivers/oci/qsql_oci_p.h | 35 |
2 files changed, 23 insertions, 19 deletions
diff --git a/src/plugins/sqldrivers/oci/qsql_oci.cpp b/src/plugins/sqldrivers/oci/qsql_oci.cpp index 9af1342e5b6..a800e0f3c7b 100644 --- a/src/plugins/sqldrivers/oci/qsql_oci.cpp +++ b/src/plugins/sqldrivers/oci/qsql_oci.cpp @@ -418,7 +418,7 @@ int QOCIResultPrivate::bindValue(OCIStmt *sql, OCIBind **hbnd, OCIError *err, in if (res->internal_prepare()) { r = OCIBindByPos(sql, hbnd, err, pos + 1, - const_cast<OCIStmt **>(&res->d->sql), + const_cast<OCIStmt **>(&res->d_ptr->sql), (sb4)0, SQLT_RSET, indPtr, 0, 0, 0, 0, OCI_DEFAULT); @@ -1913,7 +1913,7 @@ int QOCIResult::numRowsAffected() return rowCount; } -+bool QOCIResult::internal_prepare() +bool QOCIResult::internal_prepare() { Q_D(QOCIResult); int r = 0; @@ -1958,6 +1958,7 @@ bool QOCIResult::prepare(const QString& query) int r; const OraText *txt = reinterpret_cast<const OraText *>(query.utf16()); const int len = query.length() * sizeof(QChar); + Q_D(QOCIResult); r = OCIStmtPrepare(d->sql, d->err, txt, @@ -2016,7 +2017,7 @@ bool QOCIResult::exec() return false; } - if (!isCursor()) { + if (!isCursor) { // execute r = OCIStmtExecute(d->svc, d->sql, diff --git a/src/plugins/sqldrivers/oci/qsql_oci_p.h b/src/plugins/sqldrivers/oci/qsql_oci_p.h index feb037c20d9..d5756c64fc6 100644 --- a/src/plugins/sqldrivers/oci/qsql_oci_p.h +++ b/src/plugins/sqldrivers/oci/qsql_oci_p.h @@ -26,12 +26,12 @@ typedef struct OCIEnv OCIEnv; typedef struct OCISvcCtx OCISvcCtx; -struct QOCIResultPrivate; QT_BEGIN_NAMESPACE class QSqlResult; class QOCIDriverPrivate; +class QOCIResultPrivate; class Q_EXPORT_SQLDRIVER_OCI QOCIDriver : public QSqlDriver { @@ -71,29 +71,32 @@ protected: class Q_EXPORT_SQLDRIVER_OCI QOCIResult : public QSqlCachedResult { friend class QOCIDriver; - friend struct QOCIResultPrivate; + friend class QOCIResultPrivate; friend class QOCICols; public: - QOCIResult(const QOCIDriver * db, const QOCIDriverPrivate* p); - ~QOCIResult(); - bool prepare(const QString& query); - bool exec(); - QVariant handle() const; + explicit QOCIResult(const QOCIDriver * db); + ~QOCIResult() override; + bool prepare(const QString& query) override; + bool exec() override; + QVariant handle() const override; protected: - bool gotoNext(ValueCache &values, int index); - bool reset (const QString& query); - int size(); - int numRowsAffected(); - QSqlRecord record() const; - QVariant lastInsertId() const; - bool execBatch(bool arrayBind = false); - void virtual_hook(int id, void *data); bool isCursor; + + bool gotoNext(ValueCache &values, int index) override; + bool reset(const QString& query) override; + int size() override; + int numRowsAffected() override; + QSqlRecord record() const override; + QVariant lastInsertId() const override; + bool execBatch(bool arrayBind = false) override; + void virtual_hook(int id, void *data) override; + bool fetchNext() override; bool internal_prepare(); private: - QOCIResultPrivate *d; + QOCIResultPrivate *d_ptr; + Q_DECLARE_PRIVATE(QOCIResult) }; QT_END_NAMESPACE |