diff --git a/src/dsql/pass1.cpp b/src/dsql/pass1.cpp index 4465d9fe97..e755f5a56e 100644 --- a/src/dsql/pass1.cpp +++ b/src/dsql/pass1.cpp @@ -1786,15 +1786,16 @@ dsql_nod* PASS1_statement(CompiledStatement* statement, dsql_nod* input) // process various optional arguments if (input->nod_arg[e_exec_stmt_options]) { - dsql_nod *list = input->nod_arg[e_exec_stmt_options]; + dsql_nod* list = input->nod_arg[e_exec_stmt_options]; fb_assert(list->nod_type == nod_list); - dsql_nod **ptr = list->nod_arg; - const dsql_nod *const *end = list->nod_arg + list->nod_count; - for (; ptr < end; ptr++) + const dsql_nod* const* end = list->nod_arg + list->nod_count; + + for (dsql_nod** ptr = list->nod_arg;; ptr < end; ptr++) { - char *dupClause = NULL; - dsql_nod *opt = *ptr; + char* dupClause = NULL; + dsql_nod* opt = *ptr; + switch (opt->nod_type) { case nod_exec_stmt_datasrc: diff --git a/src/jrd/cmp.cpp b/src/jrd/cmp.cpp index d9c5ccabd1..b2e726f457 100644 --- a/src/jrd/cmp.cpp +++ b/src/jrd/cmp.cpp @@ -453,9 +453,9 @@ void CMP_verify_access(thread_db* tdbb, jrd_req* request) // When external SP's will be introduced we need to decide if they also can // inherit caller's privileges jrd_tra* transaction = tdbb->getTransaction(); - const jrd_req *exec_stmt_caller = + const jrd_req* exec_stmt_caller = (transaction && transaction->tra_callback_count && !request->req_caller) ? - transaction->tra_callback_caller : NULL; + transaction->tra_callback_caller : NULL; for (const AccessItem* access = request->req_access.begin(); access < request->req_access.end(); access++) diff --git a/src/jrd/extds/ExtDS.cpp b/src/jrd/extds/ExtDS.cpp index 4212823140..1e46d443c2 100644 --- a/src/jrd/extds/ExtDS.cpp +++ b/src/jrd/extds/ExtDS.cpp @@ -672,7 +672,9 @@ void Statement::prepare(thread_db *tdbb, Transaction *tran, const string& sql, b // already prepared the same non-empty statement if (isAllocated() && (m_sql == sql) && (m_sql != "") && m_preparedByReq == (m_callerPrivileges ? tdbb->getRequest() : NULL)) + { return; + } m_error = false; m_transaction = tran; diff --git a/src/jrd/extds/InternalDS.cpp b/src/jrd/extds/InternalDS.cpp index c4f4a1d0a9..d7deb7fe0e 100644 --- a/src/jrd/extds/InternalDS.cpp +++ b/src/jrd/extds/InternalDS.cpp @@ -159,7 +159,7 @@ void InternalConnection::detach(thread_db *tdbb) { ISC_STATUS_ARRAY status = {0}; - { + { // scope Attachment* att = m_attachment; m_attachment = NULL; @@ -168,6 +168,7 @@ void InternalConnection::detach(thread_db *tdbb) m_attachment = att; } + if (status[1]) { raise(status, tdbb, "dettach"); } @@ -182,7 +183,7 @@ void InternalConnection::detach(thread_db *tdbb) bool InternalConnection::isAvailable(thread_db *tdbb, TraScope traScope) const { return !m_isCurrent || - m_isCurrent && (tdbb->getAttachment() == m_attachment); + (m_isCurrent && (tdbb->getAttachment() == m_attachment)); } bool InternalConnection::isSameDatabase(thread_db *tdbb, const Firebird::string &dbName, @@ -309,7 +310,7 @@ void InternalStatement::doPrepare(thread_db *tdbb, const string &sql) { EngineCallbackGuard guard(tdbb, *this); - + jrd_req* save_caller = tran->tra_callback_caller; tran->tra_callback_caller = m_callerPrivileges ? tdbb->getRequest() : NULL; diff --git a/src/jrd/extds/IscDS.h b/src/jrd/extds/IscDS.h index 1a0ded1c0a..4ba10079da 100644 --- a/src/jrd/extds/IscDS.h +++ b/src/jrd/extds/IscDS.h @@ -522,7 +522,7 @@ protected: virtual Transaction* doCreateTransaction(); virtual Statement* doCreateStatement(); - IscProvider &m_iscProvider; + IscProvider& m_iscProvider; FB_API_HANDLE m_handle; }; diff --git a/src/lock/lock_proto.h b/src/lock/lock_proto.h index db245bb4cd..e3aea01b26 100644 --- a/src/lock/lock_proto.h +++ b/src/lock/lock_proto.h @@ -52,7 +52,7 @@ class LockManager : public Firebird::RefCounted, public Firebird::GlobalStorage public: static LockManager* create(const Firebird::PathName&); - bool initializeOwner(thread_db*, LOCK_OWNER_T, UCHAR, SLONG *); + bool initializeOwner(thread_db*, LOCK_OWNER_T, UCHAR, SLONG*); void shutdownOwner(thread_db*, SLONG *); bool setOwnerHandle(SLONG, SLONG);