From: <ale...@us...> - 2015-02-17 11:42:53
|
Revision: 60705 http://sourceforge.net/p/firebird/code/60705 Author: alexpeshkoff Date: 2015-02-17 11:42:50 +0000 (Tue, 17 Feb 2015) Log Message: ----------- Unlink JResultSet from DsqlCursor when cursor is closed due to end of transaction - this fixes AV in tcs/BLOB.0.DSQL Modified Paths: -------------- firebird/trunk/src/dsql/DsqlCursor.cpp firebird/trunk/src/dsql/DsqlCursor.h firebird/trunk/src/jrd/EngineInterface.h firebird/trunk/src/jrd/jrd.cpp Modified: firebird/trunk/src/dsql/DsqlCursor.cpp =================================================================== --- firebird/trunk/src/dsql/DsqlCursor.cpp 2015-02-17 00:14:17 UTC (rev 60704) +++ firebird/trunk/src/dsql/DsqlCursor.cpp 2015-02-17 11:42:50 UTC (rev 60705) @@ -34,7 +34,7 @@ static const ULONG PREFETCH_SIZE = 65536; // 64 KB DsqlCursor::DsqlCursor(dsql_req* req, ULONG flags) - : m_request(req), m_flags(flags), + : m_request(req), m_resultSet(NULL), m_flags(flags), m_space(req->getPool(), SCRATCH), m_state(BOS), m_eof(false), m_position(0), m_cachedCount(0), m_messageSize(req->getStatement()->getReceiveMsg()->msg_length) @@ -42,6 +42,12 @@ TRA_link_cursor(m_request->req_transaction, this); } +DsqlCursor::~DsqlCursor() +{ + if (m_resultSet) + m_resultSet->resetHandle(); +} + jrd_tra* DsqlCursor::getTransaction() const { return m_request->req_transaction; @@ -52,6 +58,12 @@ return m_request->req_dbb->dbb_attachment; } +void DsqlCursor::setInterfacePtr(JResultSet* interfacePtr) throw() +{ + fb_assert(!m_resultSet); + m_resultSet = interfacePtr; +} + void DsqlCursor::close(thread_db* tdbb, DsqlCursor* cursor) { if (!cursor) Modified: firebird/trunk/src/dsql/DsqlCursor.h =================================================================== --- firebird/trunk/src/dsql/DsqlCursor.h 2015-02-17 00:14:17 UTC (rev 60704) +++ firebird/trunk/src/dsql/DsqlCursor.h 2015-02-17 11:42:50 UTC (rev 60705) @@ -28,16 +28,19 @@ namespace Jrd { class dsql_req; +class JResultSet; class DsqlCursor { enum State { BOS, POSITIONED, EOS }; public: - explicit DsqlCursor(dsql_req* req, ULONG flags); + DsqlCursor(dsql_req* req, ULONG flags); + ~DsqlCursor(); jrd_tra* getTransaction() const; Attachment* getAttachment() const; + void setInterfacePtr(JResultSet* interfacePtr) throw(); static void close(thread_db* tdbb, DsqlCursor* cursor); @@ -63,6 +66,7 @@ bool cacheInput(thread_db* tdbb, FB_UINT64 position = MAX_UINT64); dsql_req* const m_request; + JResultSet* m_resultSet; const ULONG m_flags; TempSpace m_space; State m_state; Modified: firebird/trunk/src/jrd/EngineInterface.h =================================================================== --- firebird/trunk/src/jrd/EngineInterface.h 2015-02-17 00:14:17 UTC (rev 60704) +++ firebird/trunk/src/jrd/EngineInterface.h 2015-02-17 11:42:50 UTC (rev 60705) @@ -167,6 +167,11 @@ return cursor; } + void resetHandle() + { + cursor = NULL; + } + private: DsqlCursor* cursor; Firebird::RefPtr<JStatement> statement; Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-02-17 00:14:17 UTC (rev 60704) +++ firebird/trunk/src/jrd/jrd.cpp 2015-02-17 11:42:50 UTC (rev 60705) @@ -4500,6 +4500,7 @@ rs = new JResultSet(cursor, this); rs->addRef(); + cursor->setInterfacePtr(rs); } catch (const Exception& ex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-02-17 14:13:23
|
Revision: 60706 http://sourceforge.net/p/firebird/code/60706 Author: alexpeshkoff Date: 2015-02-17 14:13:16 +0000 (Tue, 17 Feb 2015) Log Message: ----------- Minor enhancement - added switch to avoid hangs when running TCS Modified Paths: -------------- firebird/trunk/src/msgs/facilities2.sql firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/qli/dtr.cpp firebird/trunk/src/qli/dtr.h firebird/trunk/src/qli/lex.cpp firebird/trunk/src/qli/qliswi.h Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2015-02-17 11:42:50 UTC (rev 60705) +++ firebird/trunk/src/msgs/facilities2.sql 2015-02-17 14:13:16 UTC (rev 60706) @@ -2,7 +2,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?); -- ('2015-02-02 12:30:00', 'JRD', 0, 783) -('2012-01-23 20:10:30', 'QLI', 1, 532) +('2012-01-23 20:10:30', 'QLI', 1, 533) ('2015-01-07 18:01:51', 'GFIX', 3, 134) ('1996-11-07 13:39:40', 'GPRE', 4, 1) ('2012-08-27 21:26:00', 'DSQL', 7, 33) Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2015-02-17 11:42:50 UTC (rev 60705) +++ firebird/trunk/src/msgs/messages2.sql 2015-02-17 14:13:16 UTC (rev 60706) @@ -1498,6 +1498,7 @@ (NULL, 'main', 'dtr.cpp', NULL, 1, 529, NULL, 'qli: ignoring unknown switch @1', NULL, NULL) (NULL, 'install', 'meta.epp', NULL, 1, 530, NULL, 'Warning: cannot issue DDL statements against database "@1"', NULL, NULL) (NULL, 'usage', 'dtr.cpp', NULL, 1, 531, NULL, ' -nod(btriggers) do not run database triggers', NULL, NULL) +(NULL, 'usage', 'dtr.cpp', NULL, 1, 532, NULL, ' -e(xit) exit after end of script instead going to command prompt', NULL, NULL) -- GFIX ('gfix_db_name', 'ALICE_gfix', 'alice.c', NULL, 3, 1, NULL, 'data base file name (@1) already given', NULL, NULL); ('gfix_invalid_sw', 'ALICE_gfix', 'alice.c', NULL, 3, 2, NULL, 'invalid switch @1', NULL, NULL); Modified: firebird/trunk/src/qli/dtr.cpp =================================================================== --- firebird/trunk/src/qli/dtr.cpp 2015-02-17 11:42:50 UTC (rev 60705) +++ firebird/trunk/src/qli/dtr.cpp 2015-02-17 14:13:16 UTC (rev 60706) @@ -139,6 +139,7 @@ QLI_default_user[0] = 0; QLI_default_password[0] = 0; QLI_charset[0] = 0; + QLI_quit_flag = false; bool help_flag = false; #ifdef DEV_BUILD @@ -184,6 +185,10 @@ sw_buffers = atoi(*argv++); break; + case IN_SW_QLI_EXIT: + QLI_quit_flag = true; + break; + case IN_SW_QLI_FETCH_PASSWORD: { if (argv >= arg_end || **argv == '-') @@ -283,6 +288,8 @@ if (application_file) LEX_push_file(application_file, true); + else + QLI_quit_flag = false; // Silently ignore -E switch when no script is given if (startup_file.length()) LEX_push_file(startup_file.c_str(), false); Modified: firebird/trunk/src/qli/dtr.h =================================================================== --- firebird/trunk/src/qli/dtr.h 2015-02-17 11:42:50 UTC (rev 60705) +++ firebird/trunk/src/qli/dtr.h 2015-02-17 14:13:16 UTC (rev 60706) @@ -516,6 +516,7 @@ EXTERN bool QLI_trusted; #endif EXTERN bool QLI_nodb_triggers; +EXTERN bool QLI_quit_flag; EXTERN const char* QLI_error; EXTERN bool sw_verify; Modified: firebird/trunk/src/qli/lex.cpp =================================================================== --- firebird/trunk/src/qli/lex.cpp 2015-02-17 11:42:50 UTC (rev 60705) +++ firebird/trunk/src/qli/lex.cpp 2015-02-17 14:13:16 UTC (rev 60706) @@ -437,6 +437,12 @@ **************************************/ // UNIX flavor + if (QLI_quit_flag) + { + buffer[0] = 0; + return false; + } + if (prompt) printf("%s", prompt); Modified: firebird/trunk/src/qli/qliswi.h =================================================================== --- firebird/trunk/src/qli/qliswi.h 2015-02-17 11:42:50 UTC (rev 60705) +++ firebird/trunk/src/qli/qliswi.h 2015-02-17 14:13:16 UTC (rev 60706) @@ -47,7 +47,8 @@ IN_SW_QLI_Y = 12, // Internal switch: do not present in help IN_SW_QLI_Z = 13, IN_SW_QLI_HELP = 14, - IN_SW_QLI_NODBTRIGGERS = 15 + IN_SW_QLI_NODBTRIGGERS = 15, + IN_SW_QLI_EXIT = 16 }; @@ -56,6 +57,7 @@ {IN_SW_QLI_APP_SCRIPT , 0, "APPSCRIPT" , 0, 0, 0, false, 0, 1, NULL}, {IN_SW_QLI_APP_SCRIPT , 0, "APP_SCRIPT" , 0, 0, 0, false, 516, 1, NULL}, {IN_SW_QLI_BUFFERS , 0, "BUFFERS" , 0, 0, 0, false, 517, 1, NULL}, + {IN_SW_QLI_EXIT , 0, "EXIT" , 0, 0, 0, false, 532, 1, NULL}, {IN_SW_QLI_FETCH_PASSWORD , 0, "FETCH_PASSWORD" , 0, 0, 0, false, 518, 1, NULL}, {IN_SW_QLI_INITIAL_SCRIPT , 0, "INITSCRIPT" , 0, 0, 0, false, 0, 1, NULL}, {IN_SW_QLI_INITIAL_SCRIPT , 0, "INIT_SCRIPT" , 0, 0, 0, false, 519, 1, NULL}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2015-02-18 12:44:36
|
Revision: 60713 http://sourceforge.net/p/firebird/code/60713 Author: hvlad Date: 2015-02-18 12:44:32 +0000 (Wed, 18 Feb 2015) Log Message: ----------- Attempt to implement thread cleanup for Windows (using DLL entry point). It is used in dispatcher (fbclient.dll) only for now. Fixed potential memory leak in StringsBuffer (it was possible to allocate few ThreadBuffer's for the same thread), see CORE-4683. Modified Paths: -------------- firebird/trunk/src/common/dllinst.cpp firebird/trunk/src/common/dllinst.h firebird/trunk/src/jrd/os/win32/ibinitdll.cpp firebird/trunk/src/yvalve/MasterImplementation.cpp firebird/trunk/src/yvalve/MasterImplementation.h Modified: firebird/trunk/src/common/dllinst.cpp =================================================================== --- firebird/trunk/src/common/dllinst.cpp 2015-02-18 00:16:57 UTC (rev 60712) +++ firebird/trunk/src/common/dllinst.cpp 2015-02-18 12:44:32 UTC (rev 60713) @@ -34,7 +34,6 @@ namespace Firebird { HINSTANCE hDllInst = 0; -bool bEmbedded = false; } // namespace Modified: firebird/trunk/src/common/dllinst.h =================================================================== --- firebird/trunk/src/common/dllinst.h 2015-02-18 00:16:57 UTC (rev 60712) +++ firebird/trunk/src/common/dllinst.h 2015-02-18 12:44:32 UTC (rev 60713) @@ -36,7 +36,6 @@ namespace Firebird { extern HINSTANCE hDllInst; -extern bool bEmbedded; } // namespace Modified: firebird/trunk/src/jrd/os/win32/ibinitdll.cpp =================================================================== --- firebird/trunk/src/jrd/os/win32/ibinitdll.cpp 2015-02-18 00:16:57 UTC (rev 60712) +++ firebird/trunk/src/jrd/os/win32/ibinitdll.cpp 2015-02-18 12:44:32 UTC (rev 60713) @@ -23,9 +23,10 @@ */ #include "firebird.h" +#include <windows.h> #include "../../../common/dllinst.h" +#include "../../../yvalve/MasterImplementation.h" -#include <windows.h> using namespace Firebird; @@ -36,10 +37,13 @@ { case DLL_PROCESS_ATTACH: hDllInst = h; -//#if defined(EMBEDDED) - bEmbedded = true; -//#endif break; + + case DLL_THREAD_DETACH: + { + Why::threadCleanup(); + break; + } } return TRUE; Modified: firebird/trunk/src/yvalve/MasterImplementation.cpp =================================================================== --- firebird/trunk/src/yvalve/MasterImplementation.cpp 2015-02-18 00:16:57 UTC (rev 60712) +++ firebird/trunk/src/yvalve/MasterImplementation.cpp 2015-02-18 12:44:32 UTC (rev 60713) @@ -147,7 +147,6 @@ #include <windows.h> #endif -#ifdef USE_POSIX_THREADS namespace { class ThreadCleanup @@ -162,12 +161,23 @@ void* argument; ThreadCleanup* next; + static ThreadCleanup* chain; + static GlobalPtr<Mutex> cleanupMutex; + ThreadCleanup(FPTR_VOID_PTR cleanup, void* arg, ThreadCleanup* chain) : function(cleanup), argument(arg), next(chain) { } + static void initThreadCleanup(); + static void finiThreadCleanup(); + static ThreadCleanup** findCleanup(FPTR_VOID_PTR cleanup, void* arg); }; +ThreadCleanup* ThreadCleanup::chain = NULL; +GlobalPtr<Mutex> ThreadCleanup::cleanupMutex; + +#ifdef USE_POSIX_THREADS + pthread_key_t key; pthread_once_t keyOnce = PTHREAD_ONCE_INIT; bool keySet = false; @@ -182,7 +192,7 @@ keySet = true; } -void initThreadCleanup() +void ThreadCleanup::initThreadCleanup() { int err = pthread_once(&keyOnce, makeKey); if (err) @@ -197,8 +207,12 @@ } } -ThreadCleanup* chain = NULL; +void ThreadCleanup::finiThreadCleanup() +{ + pthread_setspecific(key, NULL); +} + class FiniThreadCleanup { public: @@ -217,10 +231,20 @@ } }; -Firebird::GlobalPtr<Firebird::Mutex> cleanupMutex; Firebird::GlobalPtr<FiniThreadCleanup> thrCleanup; // needed to call dtor +#endif // USE_POSIX_THREADS +#ifdef WIN_NT +void ThreadCleanup::initThreadCleanup() +{ +} + +void ThreadCleanup::finiThreadCleanup() +{ +} +#endif // #ifdef WIN_NT + ThreadCleanup** ThreadCleanup::findCleanup(FPTR_VOID_PTR cleanup, void* arg) { for (ThreadCleanup** ptr = &chain; *ptr; ptr = &((*ptr)->next)) @@ -243,7 +267,7 @@ ptr->function(ptr->argument); } - pthread_setspecific(key, NULL); + finiThreadCleanup(); } void ThreadCleanup::add(FPTR_VOID_PTR cleanup, void* arg) @@ -276,8 +300,8 @@ } } // anonymous namespace -#endif // USE_POSIX_THREADS + namespace { class StringsBuffer @@ -294,6 +318,11 @@ public: explicit ThreadBuffer(ThreadId thr) : buffer_ptr(buffer), thread(thr) { } + static ThreadId generate(const ThreadBuffer* item) + { + return item->thread; + } + const char* alloc(const char* string, size_t length) { // if string is already in our buffer - return it @@ -345,7 +374,7 @@ } }; - typedef Firebird::Array<ThreadBuffer*> ProcessBuffer; + typedef Firebird::SortedArray<ThreadBuffer*, EmptyStorage<ThreadBuffer*>, ThreadId, ThreadBuffer> ProcessBuffer; ProcessBuffer processBuffer; Firebird::Mutex mutex; @@ -358,9 +387,7 @@ ~StringsBuffer() { -#ifdef USE_POSIX_THREADS ThreadCleanup::remove(cleanupAllStrings, this); -#endif } private: @@ -368,11 +395,12 @@ { fb_assert(mutex.locked()); - for (FB_SIZE_T i = 0; i < processBuffer.getCount(); ++i) + size_t pos; + if (processBuffer.find(thr, pos)) { - if (processBuffer[i]->thisThread(thr)) + if (processBuffer[pos]->thisThread(thr)) { - return i; + return pos; } } @@ -389,9 +417,8 @@ return processBuffer[p]; } -#ifdef USE_POSIX_THREADS ThreadCleanup::add(cleanupAllStrings, this); -#endif + ThreadBuffer* b = new ThreadBuffer(thr); processBuffer.add(b); return b; @@ -436,6 +463,11 @@ return allStrings->alloc(s, len, (ThreadId) thr); } +void threadCleanup() +{ + ThreadCleanup::destructor(NULL); +} + } // namespace Why Modified: firebird/trunk/src/yvalve/MasterImplementation.h =================================================================== --- firebird/trunk/src/yvalve/MasterImplementation.h 2015-02-18 00:16:57 UTC (rev 60712) +++ firebird/trunk/src/yvalve/MasterImplementation.h 2015-02-18 12:44:32 UTC (rev 60713) @@ -68,6 +68,7 @@ }; void shutdownTimers(); + void threadCleanup(); Firebird::Mutex& pauseTimer(); } // namespace Why This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <di...@us...> - 2015-02-19 14:15:10
|
Revision: 60730 http://sourceforge.net/p/firebird/code/60730 Author: dimitr Date: 2015-02-19 14:15:00 +0000 (Thu, 19 Feb 2015) Log Message: ----------- 1) Fixed CORE-4383: Index and BLOBs garbage collection doesn't work for update_in_place(). 2) Applied the same approach to temporary GC records. 3) Refactored the Record class to avoid reallocations, to improve encapsulation and to simplify the code. 4) Slightly refactored UndoItem to isolate its logic from the Record class. 5) Reduced the in-memory size of the undo log. 6) Slightly better alternative to the legacy NULL reporting for outer joins. 7) Minor fixes and adjustments in BufferedStream. Modified Paths: -------------- firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/jrd/Monitoring.cpp firebird/trunk/src/jrd/RecordBuffer.cpp firebird/trunk/src/jrd/Relation.h firebird/trunk/src/jrd/blb.cpp firebird/trunk/src/jrd/dpm.epp firebird/trunk/src/jrd/evl.cpp firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/ext.cpp firebird/trunk/src/jrd/idx.cpp firebird/trunk/src/jrd/recsrc/BufferedStream.cpp firebird/trunk/src/jrd/recsrc/ProcedureScan.cpp firebird/trunk/src/jrd/recsrc/RecordSource.cpp firebird/trunk/src/jrd/recsrc/RecursiveStream.cpp firebird/trunk/src/jrd/recsrc/SingularStream.cpp firebird/trunk/src/jrd/recsrc/SortedStream.cpp firebird/trunk/src/jrd/req.h firebird/trunk/src/jrd/tra.cpp firebird/trunk/src/jrd/tra.h firebird/trunk/src/jrd/vio.cpp Added Paths: ----------- firebird/trunk/src/jrd/Record.h Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -5579,7 +5579,7 @@ // ASF: CORE-1432 - If the record is not on the latest format, upgrade it. // AP: for fields that are missing in original format use record's one. if (format && - record->rec_format->fmt_version != format->fmt_version && + record->getFormat()->fmt_version != format->fmt_version && fieldId < format->fmt_desc.getCount() && !DSC_EQUIV(&impure->vlu_desc, &format->fmt_desc[fieldId], true)) { Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -2261,7 +2261,7 @@ const Format* format = MET_current(tdbb, rpb->rpb_relation); Record* record = VIO_record(tdbb, rpb, format, tdbb->getDefaultPool()); - rpb->rpb_address = record->rec_data; + rpb->rpb_address = record->getData(); rpb->rpb_length = format->fmt_length; rpb->rpb_format_number = format->fmt_version; @@ -5858,7 +5858,7 @@ impure->sta_state = 0; Record* orgRecord = orgRpb->rpb_record; const Record* newRecord = newRpb->rpb_record; - memcpy(orgRecord->rec_data, newRecord->rec_data, newRecord->rec_length); + orgRecord->copyDataFrom(newRecord, true); request->req_operation = jrd_req::req_evaluate; return statement; } @@ -5971,7 +5971,7 @@ const Format* newFormat = MET_current(tdbb, newRpb->rpb_relation); Record* newRecord = VIO_record(tdbb, newRpb, newFormat, tdbb->getDefaultPool()); - newRpb->rpb_address = newRecord->rec_data; + newRpb->rpb_address = newRecord->getData(); newRpb->rpb_length = newFormat->fmt_length; newRpb->rpb_format_number = newFormat->fmt_version; @@ -5980,8 +5980,8 @@ if (!orgRecord) { orgRecord = VIO_record(tdbb, orgRpb, newFormat, tdbb->getDefaultPool()); - const Format* const orgFormat = orgRecord->rec_format; - orgRpb->rpb_address = orgRecord->rec_data; + const Format* const orgFormat = orgRecord->getFormat(); + orgRpb->rpb_address = orgRecord->getData(); orgRpb->rpb_length = orgFormat->fmt_length; orgRpb->rpb_format_number = orgFormat->fmt_version; } @@ -6770,7 +6770,7 @@ const Format* format = MET_current(tdbb, relation); Record* record = VIO_record(tdbb, rpb, format, tdbb->getDefaultPool()); - rpb->rpb_address = record->rec_data; + rpb->rpb_address = record->getData(); rpb->rpb_length = format->fmt_length; rpb->rpb_format_number = format->fmt_version; @@ -8623,7 +8623,7 @@ static void cleanupRpb(thread_db* tdbb, record_param* rpb) { Record* const record = rpb->rpb_record; - const Format* const format = record->rec_format; + const Format* const format = record->getFormat(); SET_TDBB(tdbb); // Is it necessary? @@ -8644,7 +8644,7 @@ if (!desc->dsc_address) continue; - UCHAR* const p = record->rec_data + (IPTR) desc->dsc_address; + UCHAR* const p = record->getData() + (IPTR) desc->dsc_address; if (record->isNull(n)) { Modified: firebird/trunk/src/jrd/Monitoring.cpp =================================================================== --- firebird/trunk/src/jrd/Monitoring.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/Monitoring.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -595,7 +595,7 @@ { fb_assert(record); - const Format* const format = record->rec_format; + const Format* const format = record->getFormat(); fb_assert(format); dsc to_desc; @@ -606,7 +606,7 @@ if (to_desc.isUnknown()) return; - to_desc.dsc_address += (IPTR) record->rec_data; + to_desc.dsc_address += (IPTR) record->getData(); if (field.type == VALUE_GLOBAL_ID) { Added: firebird/trunk/src/jrd/Record.h =================================================================== --- firebird/trunk/src/jrd/Record.h (rev 0) +++ firebird/trunk/src/jrd/Record.h 2015-02-19 14:15:00 UTC (rev 60730) @@ -0,0 +1,238 @@ +/* + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. + * See the License for the specific language governing rights + * and limitations under the License. + * + * The Original Code was created by Dmitry Yemanov + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2015 Dmitry Yemanov <di...@fi...> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#ifndef JRD_RECORD_H +#define JRD_RECORD_H + +#include "../common/classes/array.h" +#include "../jrd/pag.h" +#include "../jrd/val.h" + +namespace Jrd +{ + // Record flags + const UCHAR REC_fake_nulls = 1; // all fields simulate being NULLs + const UCHAR REC_gc_active = 2; // relation garbage collect record block in use + const UCHAR REC_undo_active = 4; // record block in use for undo purposes + + class Record + { + template <UCHAR FLAG> friend class AutoTempRecord; + + public: + Record(MemoryPool& p, const Format* format, UCHAR flags = 0) + : m_precedence(p), m_data(p) + { + reset(format, flags); + } + + Record(MemoryPool& p, const Record* other) + : m_precedence(p), m_data(p, other->getLength()) + { + copyFrom(other); + } + + void reset(const Format* format = NULL, UCHAR flags = 0) + { + if (format && format != m_format) + { + m_data.resize(format->fmt_length); + m_format = format; + } + + m_flags = flags; + } + + void setNull(USHORT id) + { + fb_assert(!(m_flags & REC_fake_nulls)); + UCHAR* const data = m_data.begin(); + data[id >> 3] |= (1 << (id & 7)); + } + + void clearNull(USHORT id) + { + fb_assert(!(m_flags & REC_fake_nulls)); + UCHAR* const data = m_data.begin(); + data[id >> 3] &= ~(1 << (id & 7)); + } + + bool isNull(USHORT id) const + { + if (m_flags & REC_fake_nulls) + return true; + + const UCHAR* const data = m_data.begin(); + return ((data[id >> 3] & (1 << (id & 7))) != 0); + } + + void nullify() + { + UCHAR* const data = m_data.begin(); + + // Zero the record buffer and initialize all fields to NULLs + const size_t null_bytes = (m_format->fmt_count + 7) >> 3; + memset(data, 0xFF, null_bytes); + memset(data + null_bytes, 0, getLength() - null_bytes); + + // Record has real NULLs now, so clear the "fake-nulls" flag + m_flags &= ~REC_fake_nulls; + } + + PageStack& getPrecedence() + { + return m_precedence; + } + + void pushPrecedence(const PageNumber& page) + { + m_precedence.push(page); + } + + void copyFrom(const Record* other) + { + m_format = other->m_format; + m_flags = other->m_flags; + + copyDataFrom(other); + } + + void copyDataFrom(const Record* other, bool assertLength = false) + { + if (assertLength) + fb_assert(getLength() == other->getLength()); + + m_data.assign(other->m_data); + fb_assert(m_format->fmt_length == m_data.getCount()); + } + + void copyDataFrom(const UCHAR* data) + { + memcpy(m_data.begin(), data, m_data.getCount()); + } + + void copyDataTo(UCHAR* data) + { + memcpy(data, m_data.begin(), m_data.getCount()); + } + + const Format* getFormat() const + { + return m_format; + } + + void fakeNulls() + { + m_flags |= REC_fake_nulls; + } + + bool isNull() const + { + return (m_flags & REC_fake_nulls); + } + + ULONG getLength() const + { + return m_format->fmt_length; + } + + UCHAR* getData() + { + return m_data.begin(); + } + + const UCHAR* getData() const + { + return m_data.begin(); + } + + bool checkFlags(UCHAR mask) const + { + return (m_flags & mask != 0); + } + + private: + PageStack m_precedence; // stack of higher precedence pages/transactions + Firebird::Array<UCHAR> m_data; // space for record data + const Format* m_format; // what the data looks like + UCHAR m_flags; // misc record flags + }; + + // Wrapper for reusable temporary records + + template <UCHAR FLAG> + class AutoTempRecord + { + public: + AutoTempRecord(Record* record = NULL) + : m_record(record) + { + // validate record and its flag + fb_assert(!record || (record->m_flags & FLAG)); + } + + ~AutoTempRecord() + { + release(); + } + + Record* operator=(Record* record) + { + // class object can be initialized just once... + fb_assert(!m_record); + // ... and it must be a valid pointer to a properly flagged record + fb_assert(record && (record->m_flags & FLAG)); + + m_record = record; + return m_record; + } + + void release() + { + if (m_record) + { + m_record->m_flags &= ~FLAG; + m_record = NULL; + } + } + + operator Record*() + { + return m_record; + } + + Record* operator->() + { + return m_record; + } + + private: + Record* m_record; + }; + + typedef AutoTempRecord<REC_gc_active> AutoGCRecord; + typedef AutoTempRecord<REC_undo_active> AutoUndoRecord; + +} // namespace + +#endif // JRD_RECORD_H + Property changes on: firebird/trunk/src/jrd/Record.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: firebird/trunk/src/jrd/RecordBuffer.cpp =================================================================== --- firebird/trunk/src/jrd/RecordBuffer.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/RecordBuffer.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -35,11 +35,7 @@ : count(0) { space = FB_NEW(pool) TempSpace(pool, SCRATCH); - - const ULONG length = format->fmt_length; - record = FB_NEW_RPT(pool, length) Record(pool); - record->rec_format = format; - record->rec_length = length; + record = FB_NEW(pool) Record(pool, format); } RecordBuffer::~RecordBuffer() @@ -50,28 +46,28 @@ offset_t RecordBuffer::store(const Record* new_record) { - const ULONG length = record->rec_length; - fb_assert(new_record->rec_length == length); + const ULONG length = record->getLength(); + fb_assert(new_record->getLength() == length); - space->write(count * length, new_record->rec_data, length); + space->write(count * length, new_record->getData(), length); return count++; } bool RecordBuffer::fetch(offset_t position, Record* to_record) { - const ULONG length = record->rec_length; - fb_assert(to_record->rec_length == length); + const ULONG length = record->getLength(); + fb_assert(to_record->getLength() == length); if (position >= count) return false; - space->read(position * length, to_record->rec_data, length); + space->read(position * length, to_record->getData(), length); return true; } const Format* RecordBuffer::getFormat() const { - return record->rec_format; + return record->getFormat(); } Modified: firebird/trunk/src/jrd/Relation.h =================================================================== --- firebird/trunk/src/jrd/Relation.h 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/Relation.h 2015-02-19 14:15:00 UTC (rev 60730) @@ -138,6 +138,8 @@ class jrd_rel : public pool_alloc<type_rel> { + typedef Firebird::HalfStaticArray<Record*, 4> GCRecordList; + public: MemoryPool* rel_pool; USHORT rel_id; @@ -155,7 +157,7 @@ Firebird::MetaName rel_security_name; // security class name for relation ExternalFile* rel_file; // external file name - vec<Record*>* rel_gc_rec; // vector of records for garbage collection + GCRecordList rel_gc_records; // records for garbage collection USHORT rel_use_count; // requests compiled with relation USHORT rel_sweep_count; // sweep and/or garbage collector threads active @@ -235,12 +237,13 @@ RelationPages rel_pages_base; RelationPages* rel_pages_free; - RelationPages* getPagesInternal(thread_db* tdbb, TraNumber tran, bool allocPages); + RelationPages* getPagesInternal(thread_db* tdbb, TraNumber tran, bool allocPages); public: explicit jrd_rel(MemoryPool& p) - : rel_pool(&p), rel_name(p), rel_owner_name(p), rel_view_contexts(p), rel_security_name(p) - { } + : rel_pool(&p), rel_name(p), rel_owner_name(p), + rel_view_contexts(p), rel_security_name(p), rel_gc_records(p) + {} bool hasTriggers() const; }; Modified: firebird/trunk/src/jrd/blb.cpp =================================================================== --- firebird/trunk/src/jrd/blb.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/blb.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -411,7 +411,7 @@ continue; // Look for active blob records - const Format* format = rec->rec_format; + const Format* format = rec->getFormat(); for (USHORT id = 0; id < format->fmt_count; id++) { DSC desc; @@ -450,7 +450,7 @@ if (!rec) continue; - const Format* format = rec->rec_format; + const Format* format = rec->getFormat(); for (USHORT id = 0; id < format->fmt_count; id++) { DSC desc; Modified: firebird/trunk/src/jrd/dpm.epp =================================================================== --- firebird/trunk/src/jrd/dpm.epp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/dpm.epp 2015-02-19 14:15:00 UTC (rev 60730) @@ -2931,7 +2931,7 @@ rpb->rpb_number.setValue(((SINT64) page->dpg_sequence) * dbb->dbb_max_records + slot); if (record) { - record->rec_precedence.push(PageNumber(DB_PAGE_SPACE, rpb->rpb_page)); + record->pushPrecedence(PageNumber(DB_PAGE_SPACE, rpb->rpb_page)); } if (page->dpg_count == 1) @@ -3247,7 +3247,7 @@ } if (record) { - record->rec_precedence.push(PageNumber(DB_PAGE_SPACE, window->win_page.getPageNum())); + record->pushPrecedence(PageNumber(DB_PAGE_SPACE, window->win_page.getPageNum())); } #ifdef VIO_DEBUG Modified: firebird/trunk/src/jrd/evl.cpp =================================================================== --- firebird/trunk/src/jrd/evl.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/evl.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -322,40 +322,24 @@ return false; } - const Format* format = record->rec_format; + const Format* format = record->getFormat(); + fb_assert(format); - if (format && id < format->fmt_count) { + if (id < format->fmt_count) *desc = format->fmt_desc[id]; - } - /* - dimitr: fixed bug SF #562417 - - AFAIU, there was an assumption here that if a field descriptor is not - filled, then a field doesn't exist. This is not true, because in fact - an empty string has dsc_length = 0, and being part of an aggregate it - becomes FieldNode with zero length, hence we had NULL as a result. - - if (!format || id >= format->fmt_count || !desc->dsc_length) - */ - if (!format || id >= format->fmt_count || !desc->dsc_dtype) + if (id >= format->fmt_count || desc->isUnknown()) { - /* Map a non-existent field to a default value, if available. - * This enables automatic format upgrade for data rows. - * Handle Outer Joins and such specially! - * Reference: Bug 10424, 10116 - */ + // Map a non-existent field to a default value, if available. + // This enables automatic format upgrade for data rows. + // Reference: Bug 10424, 10116 - // rec_format == NULL indicates we're performing a - // join-to-null operation for outer joins - - if (record && record->rec_format && relation) + if (relation) { thread_db* tdbb = JRD_get_thread_data(); - while (format && - (id >= format->fmt_defaults.getCount() || - format->fmt_defaults[id].vlu_desc.isUnknown())) + while (id >= format->fmt_defaults.getCount() || + format->fmt_defaults[id].vlu_desc.isUnknown()) { if (format->fmt_version >= relation->rel_current_format->fmt_version) { @@ -364,9 +348,18 @@ } format = MET_format(tdbb, relation, format->fmt_version + 1); + fb_assert(format); } - return format && !(*desc = format->fmt_defaults[id].vlu_desc).isUnknown(); + if (format) + { + *desc = format->fmt_defaults[id].vlu_desc; + + if (record->isNull()) + desc->dsc_flags |= DSC_null; + + return !(desc->dsc_flags & DSC_null); + } } desc->makeText(1, ttype_ascii, (UCHAR*) " "); @@ -375,11 +368,10 @@ // If the offset of the field is 0, the field can't possible exist - if (!desc->dsc_address) { + if (!desc->dsc_address) return false; - } - desc->dsc_address = record->rec_data + (IPTR) desc->dsc_address; + desc->dsc_address = record->getData() + (IPTR) desc->dsc_address; if (record->isNull(id)) { Modified: firebird/trunk/src/jrd/exe.cpp =================================================================== --- firebird/trunk/src/jrd/exe.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/exe.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -1074,12 +1074,11 @@ if (!is_db_trigger && (!old_rec || !new_rec)) { - const Record* record = old_rec ? old_rec : new_rec; - fb_assert(record && record->rec_format); + const Record* const record = old_rec ? old_rec : new_rec; + fb_assert(record && record->getFormat()); // copy the record - null_rec = FB_NEW_RPT(record->rec_pool, record->rec_length) Record(record->rec_pool); - null_rec->rec_length = record->rec_length; - null_rec->rec_format = record->rec_format; + MemoryPool& pool = *tdbb->getDefaultPool(); + null_rec = FB_NEW(pool) Record(pool, record->getFormat()); // initialize all fields to missing null_rec->nullify(); } Modified: firebird/trunk/src/jrd/ext.cpp =================================================================== --- firebird/trunk/src/jrd/ext.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/ext.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -360,11 +360,11 @@ fb_assert(file->ext_ifi); Record* const record = rpb->rpb_record; - const Format* const format = record->rec_format; + const Format* const format = record->getFormat(); const USHORT offset = (USHORT) (IPTR) format->fmt_desc[0].dsc_address; - UCHAR* p = record->rec_data + offset; - const ULONG l = record->rec_length - offset; + UCHAR* p = record->getData() + offset; + const ULONG l = record->getLength() - offset; if (file->ext_ifi == NULL) { @@ -434,7 +434,7 @@ if (literal) { desc = *desc_ptr; - desc.dsc_address = record->rec_data + (IPTR) desc.dsc_address; + desc.dsc_address = record->getData() + (IPTR) desc.dsc_address; if (!MOV_compare(&literal->litDesc, &desc)) continue; @@ -497,7 +497,7 @@ jrd_rel* relation = rpb->rpb_relation; ExternalFile* file = relation->rel_file; Record* record = rpb->rpb_record; - const Format* format = record->rec_format; + const Format* const format = record->getFormat(); if (!file->ext_ifi) { ext_fopen(tdbb->getDatabase(), file); @@ -530,7 +530,7 @@ const jrd_fld* field = *field_ptr; if (field && !field->fld_computation && desc_ptr->dsc_length && record->isNull(i)) { - UCHAR* p = record->rec_data + (IPTR) desc_ptr->dsc_address; + UCHAR* p = record->getData() + (IPTR) desc_ptr->dsc_address; LiteralNode* literal = ExprNode::as<LiteralNode>(field->fld_missing_value); if (literal) @@ -548,8 +548,8 @@ } const USHORT offset = (USHORT) (IPTR) format->fmt_desc[0].dsc_address; - const UCHAR* p = record->rec_data + offset; - const ULONG l = record->rec_length - offset; + const UCHAR* p = record->getData() + offset; + const ULONG l = record->getLength() - offset; // hvlad: fseek will flush file buffer and degrade performance, so don't // call it if it is not necessary. Note that we must flush file buffer if we Modified: firebird/trunk/src/jrd/idx.cpp =================================================================== --- firebird/trunk/src/jrd/idx.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/idx.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -330,16 +330,16 @@ USHORT partner_index_id = 0; if (isForeign) { - if (!MET_lookup_partner(tdbb, relation, idx, index_name)) { + if (!MET_lookup_partner(tdbb, relation, idx, index_name)) BUGCHECK(173); // msg 173 referenced index description not found - } + partner_relation = MET_relation(tdbb, idx->idx_primary_relation); partner_index_id = idx->idx_primary_index; } // Checkout a garbage collect record block for fetching data. - Record* gc_record = VIO_gc_record(tdbb, relation); + AutoGCRecord gc_record = VIO_gc_record(tdbb, relation); // Unless this is the only attachment or a database restore, worry about // preserving the page working sets of other attachments. @@ -360,6 +360,7 @@ { if (!VIO_garbage_collect(tdbb, &primary, transaction)) continue; + if (primary.rpb_flags & rpb_deleted) CCH_RELEASE(tdbb, &primary.getWindow(tdbb)); else @@ -369,13 +370,16 @@ gc_record = primary.rpb_record; stack.push(primary.rpb_record); } + secondary.rpb_page = primary.rpb_b_page; secondary.rpb_line = primary.rpb_b_line; secondary.rpb_prior = primary.rpb_prior; + while (secondary.rpb_page) { if (!DPM_fetch(tdbb, &secondary, LCK_read)) break; // must be garbage collected + secondary.rpb_record = NULL; VIO_data(tdbb, &secondary, tdbb->getDefaultPool()); stack.push(secondary.rpb_record); @@ -418,7 +422,7 @@ if (record != gc_record) delete record; } while (stack.hasData() && (record = stack.pop())); - gc_record->rec_flags &= ~REC_gc_active; + if (primary.getWindow(tdbb).win_flags & WIN_large_scan) --relation->rel_scan_count; @@ -431,7 +435,7 @@ if (record != gc_record) delete record; } while (stack.hasData() && (record = stack.pop())); - gc_record->rec_flags &= ~REC_gc_active; + if (primary.getWindow(tdbb).win_flags & WIN_large_scan) --relation->rel_scan_count; @@ -487,7 +491,8 @@ JRD_reschedule(tdbb, 0, true); } - gc_record->rec_flags &= ~REC_gc_active; + gc_record.release(); + if (primary.getWindow(tdbb).win_flags & WIN_large_scan) --relation->rel_scan_count; Modified: firebird/trunk/src/jrd/recsrc/BufferedStream.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/BufferedStream.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/recsrc/BufferedStream.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -26,7 +26,9 @@ #include "../jrd/req.h" #include "../jrd/cmp_proto.h" #include "../jrd/evl_proto.h" +#include "../jrd/met_proto.h" #include "../jrd/mov_proto.h" +#include "../jrd/vio_proto.h" #include "RecordSource.h" @@ -147,6 +149,8 @@ if (!(impure->irsb_flags & irsb_open)) return false; + dsc from, to; + Record* const buffer_record = impure->irsb_buffer->getTempRecord(); if (impure->irsb_flags & irsb_mustread) @@ -160,31 +164,31 @@ return false; } + buffer_record->nullify(); + // Assign the fields to the record to be stored for (FB_SIZE_T i = 0; i < m_map.getCount(); i++) { const FieldMap& map = m_map[i]; record_param* const rpb = &request->req_rpb[map.map_stream]; + Record* const record = rpb->rpb_record; + if (map.map_type == FieldMap::REGULAR_FIELD) + { + if (!EVL_field(rpb->rpb_relation, record, map.map_id, &from)) + continue; + } + buffer_record->clearNull(i); - dsc to; - if (!EVL_field(NULL, buffer_record, (USHORT) i, &to)) + if (!EVL_field(rpb->rpb_relation, buffer_record, (USHORT) i, &to)) fb_assert(false); switch (map.map_type) { case FieldMap::REGULAR_FIELD: - { - Record* const record = rpb->rpb_record; - - dsc from; - if (EVL_field(NULL, record, map.map_id, &from)) - MOV_move(tdbb, &from, &to); - else - buffer_record->setNull(i); - } + MOV_move(tdbb, &from, &to); break; case FieldMap::TRANSACTION_ID: @@ -213,21 +217,33 @@ if (!impure->irsb_buffer->fetch(impure->irsb_position, buffer_record)) return false; + StreamType stream = INVALID_STREAM; + // Assign fields back to their original streams for (FB_SIZE_T i = 0; i < m_map.getCount(); i++) { const FieldMap& map = m_map[i]; record_param* const rpb = &request->req_rpb[map.map_stream]; + + if (map.map_stream != stream) + { + stream = map.map_stream; + + // See SortedStream::mapData() for explanations why we need + // to upgrade the record format + + if (rpb->rpb_relation && !rpb->rpb_number.isValid()) + VIO_record(tdbb, rpb, MET_current(tdbb, rpb->rpb_relation), tdbb->getDefaultPool()); + } + Record* const record = rpb->rpb_record; + record->reset(); - dsc from; - if (!EVL_field(NULL, buffer_record, (USHORT) i, &from)) + if (!EVL_field(rpb->rpb_relation, buffer_record, (USHORT) i, &from)) { fb_assert(map.map_type == FieldMap::REGULAR_FIELD); - fb_assert(record); - if (record) - record->setNull(map.map_id); + record->setNull(map.map_id); continue; } @@ -235,19 +251,9 @@ { case FieldMap::REGULAR_FIELD: { - if (record && !record->rec_format) - { - fb_assert(record->rec_fmt_bk); - record->rec_format = record->rec_fmt_bk; - } - + EVL_field(rpb->rpb_relation, record, map.map_id, &to); + MOV_move(tdbb, &from, &to); record->clearNull(map.map_id); - - dsc to; - if (!EVL_field(NULL, record, map.map_id, &to)) - fb_assert(false); - - MOV_move(tdbb, &from, &to); } break; Modified: firebird/trunk/src/jrd/recsrc/ProcedureScan.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/ProcedureScan.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/recsrc/ProcedureScan.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -168,7 +168,6 @@ return false; } - const Format* const rec_format = m_format; const Format* const msg_format = m_procedure->getOutputFormat(); const ULONG oml = msg_format->fmt_length; UCHAR* om = impure->irsb_message; @@ -176,17 +175,10 @@ if (!om) om = impure->irsb_message = FB_NEW(*tdbb->getDefaultPool()) UCHAR[oml]; - Record* record; + Record* record = rpb->rpb_record; - if (!rpb->rpb_record) - { - record = rpb->rpb_record = - FB_NEW_RPT(*tdbb->getDefaultPool(), rec_format->fmt_length) Record(*tdbb->getDefaultPool()); - record->rec_format = rec_format; - record->rec_length = rec_format->fmt_length; - } - else - record = rpb->rpb_record; + if (!record) + record = VIO_record(tdbb, rpb, m_format, tdbb->getDefaultPool()); jrd_req* const proc_request = impure->irsb_req_handle; @@ -219,10 +211,10 @@ trace.fetch(false, ITracePlugin::RESULT_SUCCESS); - for (unsigned i = 0; i < rec_format->fmt_count; i++) + for (USHORT i = 0; i < m_format->fmt_count; i++) { assignParams(tdbb, &msg_format->fmt_desc[2 * i], &msg_format->fmt_desc[2 * i + 1], - om, &rec_format->fmt_desc[i], i, record); + om, &m_format->fmt_desc[i], i, record); } rpb->rpb_number.setValid(true); @@ -280,7 +272,7 @@ { record->setNull(to_id); const USHORT len = to_desc->dsc_length; - UCHAR* const p = record->rec_data + (IPTR) to_desc->dsc_address; + UCHAR* const p = record->getData() + (IPTR) to_desc->dsc_address; switch (to_desc->dsc_dtype) { case dtype_text: @@ -321,7 +313,7 @@ desc1 = *from_desc; desc1.dsc_address = const_cast<UCHAR*>(msg) + (IPTR) desc1.dsc_address; desc2 = *to_desc; - desc2.dsc_address = record->rec_data + (IPTR) desc2.dsc_address; + desc2.dsc_address = record->getData() + (IPTR) desc2.dsc_address; if (!DSC_EQUIV(&desc1, &desc2, false)) { MOV_move(tdbb, &desc1, &desc2); Modified: firebird/trunk/src/jrd/recsrc/RecordSource.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/RecordSource.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/recsrc/RecordSource.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -262,16 +262,11 @@ rpb->rpb_number.setValid(false); - // Make sure a record block has been allocated. If there isn't - // one, first find the format, then allocate the record block. + // Make sure a record block has been allocated - Record* record = rpb->rpb_record; + Record* const record = VIO_record(tdbb, rpb, m_format, tdbb->getDefaultPool()); - if (!record) - record = VIO_record(tdbb, rpb, m_format, tdbb->getDefaultPool()); + // Mark the record to look like NULL - if (record->rec_format) - record->rec_fmt_bk = record->rec_format; - - record->rec_format = NULL; + record->fakeNulls(); } Modified: firebird/trunk/src/jrd/recsrc/RecursiveStream.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/RecursiveStream.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/recsrc/RecursiveStream.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -167,8 +167,8 @@ } impure->irsb_stack = tmp; - impure->irsb_data = FB_NEW(*request->req_pool) UCHAR[record->rec_length]; - memcpy(impure->irsb_data, record->rec_data, record->rec_length); + impure->irsb_data = FB_NEW(*request->req_pool) UCHAR[record->getLength()]; + record->copyDataTo(impure->irsb_data); const Impure r = *impure; memset(saveImpure, 0, m_saveSize); @@ -204,7 +204,7 @@ rsb = m_inner; // Reset our record data so that recursive WHERE clauses work - memcpy(record->rec_data, impure->irsb_data, record->rec_length); + record->copyDataFrom(impure->irsb_data); } else { @@ -227,7 +227,7 @@ } // copy target (next level) record into main (current level) record - memcpy(record->rec_data, mapRecord->rec_data, record->rec_length); + record->copyDataFrom(mapRecord, true); rpb->rpb_number.setValid(true); return true; Modified: firebird/trunk/src/jrd/recsrc/SingularStream.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/SingularStream.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/recsrc/SingularStream.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -107,13 +107,7 @@ Record* const orgRecord = rpb.rpb_record; if (orgRecord) - { - const ULONG recordSize = orgRecord->rec_length; - Record* const newRecord = FB_NEW_RPT(pool, recordSize) Record(pool); - memcpy(&newRecord->rec_format, &orgRecord->rec_format, - sizeof(Record) - offsetof(Record, rec_format) + recordSize); - rpb.rpb_record = newRecord; - } + rpb.rpb_record = FB_NEW(pool) Record(pool, orgRecord); } if (m_next->getRecord(tdbb)) @@ -132,17 +126,7 @@ BUGCHECK(284); // msg 284 cannot restore singleton select data rpb.rpb_record = orgRecord; - - const ULONG recordSize = newRecord->rec_length; - if (recordSize > orgRecord->rec_length) - { - // hvlad: saved copy of record has longer format, reallocate - // given record to make enough space for saved data - orgRecord = VIO_record(tdbb, &rpb, newRecord->rec_format, &pool); - } - - memcpy(&orgRecord->rec_format, &newRecord->rec_format, - sizeof(Record) - offsetof(Record, rec_format) + recordSize); + orgRecord->copyFrom(newRecord); } } Modified: firebird/trunk/src/jrd/recsrc/SortedStream.cpp =================================================================== --- firebird/trunk/src/jrd/recsrc/SortedStream.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/recsrc/SortedStream.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -283,6 +283,7 @@ void SortedStream::mapData(thread_db* tdbb, jrd_req* request, UCHAR* data) const { StreamType stream = INVALID_STREAM; + dsc from, to; const SortMap::Item* const end_item = m_map->items.begin() + m_map->items.getCount(); @@ -339,7 +340,7 @@ // For the sake of prudence, set all record parameter blocks to contain // the most recent format. This will guarantee that all fields mapped - // back to records by get_sort() have homes in the target record. + // back to records have homes in the target record. // dimitr: I've added the check for !isValid to ensure that we don't overwrite // the format for an active rpb (i.e. the one having some record fetched). @@ -349,19 +350,13 @@ } Record* const record = rpb->rpb_record; + record->reset(); - if (record && !flag && !record->rec_format) - { - fb_assert(record->rec_fmt_bk); - record->rec_format = record->rec_fmt_bk; - } - if (flag) record->setNull(id); else { EVL_field(rpb->rpb_relation, record, id, &to); - MOV_move(tdbb, &from, &to); record->clearNull(id); } Modified: firebird/trunk/src/jrd/req.h =================================================================== --- firebird/trunk/src/jrd/req.h 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/req.h 2015-02-19 14:15:00 UTC (rev 60730) @@ -28,14 +28,12 @@ #ifndef JRD_REQ_H #define JRD_REQ_H -#include "../include/fb_blk.h" - #include "../jrd/exe.h" #include "../jrd/sort.h" #include "../jrd/Attachment.h" #include "../jrd/JrdStatement.h" +#include "../jrd/Record.h" #include "../jrd/RecordNumber.h" -#include "../common/classes/stack.h" #include "../common/classes/timestamp.h" namespace EDS { @@ -45,15 +43,11 @@ namespace Jrd { class Lock; -class Format; class jrd_rel; class jrd_prc; -class Record; class ValueListNode; -template <typename T> class vec; class jrd_tra; class Savepoint; -class RecordSource; class Cursor; class thread_db; @@ -139,57 +133,6 @@ const unsigned int MAX_DIFFERENCES = 1024; // Max length of generated Differences string // between two records -// Record block (holds data, remember data?) - -class Record : public pool_alloc_rpt<SCHAR, type_rec> -{ -public: - explicit Record(MemoryPool& p) : rec_pool(p), rec_precedence(p) { } - // ASF: Record is memcopied in realloc_record (vio.cpp), starting at rec_format. - // rec_precedence has destructor, so don't move it to after rec_format. - MemoryPool& rec_pool; // pool where record to be expanded - PageStack rec_precedence; // stack of higher precedence pages/transactions - const Format* rec_format; // what the data looks like - ULONG rec_length; // how much there is - const Format* rec_fmt_bk; // backup format to cope with Borland's ill null signaling - UCHAR rec_flags; // misc record flags - RecordNumber rec_number; // original record_param number - used for undoing multiple updates - union - { - double rec_dummy; // this is to force next field to a double boundary - UCHAR rec_data[1]; // THIS VARIABLE MUST BE ALIGNED ON A DOUBLE BOUNDARY - }; - - void setNull(USHORT id) - { - rec_data[id >> 3] |= (1 << (id & 7)); - } - - void clearNull(USHORT id) - { - rec_data[id >> 3] &= ~(1 << (id & 7)); - } - - bool isNull(USHORT id) const - { - return ((rec_data[id >> 3] & (1 << (id & 7))) != 0); - } - - void nullify() - { - // Zero the record buffer and initialize all fields to NULLs - const size_t null_bytes = (rec_format->fmt_count + 7) >> 3; - memset(rec_data, 0xFF, null_bytes); - memset(rec_data + null_bytes, 0, rec_length - null_bytes); - } -}; - -// rec_flags - -const UCHAR REC_same_tx = 1; // record inserted/updated and deleted by same tx -const UCHAR REC_gc_active = 2; // relation garbage collect record block in use -const UCHAR REC_new_version = 4; // savepoint created new record version and deleted it - // List of active blobs controlled by request typedef Firebird::BePlusTree<ULONG, ULONG, MemoryPool> TempBlobIdTree; @@ -388,7 +331,6 @@ USHORT idl_count; // Use count }; - } //namespace Jrd #endif // JRD_REQ_H Modified: firebird/trunk/src/jrd/tra.cpp =================================================================== --- firebird/trunk/src/jrd/tra.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/tra.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -3313,9 +3313,7 @@ lock->lck_type = LCK_tra_pc; // note, LCK_tra_pc belongs to the same owner as LCK_tra lock->lck_data = 0; if (!LCK_lock(tdbb, lock, LCK_write, LCK_WAIT)) - { ERR_post(Arg::Gds(isc_lock_conflict)); - } trans->tra_flags |= TRA_precommitted; } @@ -3327,20 +3325,18 @@ jrd_tra::~jrd_tra() { - delete tra_undo_record; + while (tra_undo_records.hasData()) + delete tra_undo_records.pop(); + delete tra_undo_space; delete tra_user_management; delete tra_mapping_list; delete tra_gen_ids; if (!tra_outer) - { delete tra_blob_space; - } else - { fb_assert(!tra_arrays); - } DFW_delete_deferred(this, -1); @@ -3351,9 +3347,7 @@ } if (tra_autonomous_pool) - { MemoryPool::deletePool(tra_autonomous_pool); - } delete tra_sec_db_context; } @@ -3382,9 +3376,8 @@ UserManagement* jrd_tra::getUserManagement() { if (!tra_user_management) - { tra_user_management = FB_NEW(*tra_pool) UserManagement(this); - } + return tra_user_management; } @@ -3392,18 +3385,16 @@ MappingList* jrd_tra::getMappingList() { if (!tra_mapping_list) - { tra_mapping_list = FB_NEW(*tra_pool) MappingList(this); - } + return tra_mapping_list; } DbCreatorsList* jrd_tra::getDbCreatorsList() { if (!tra_dbcreators_list) - { tra_dbcreators_list = FB_NEW(*tra_pool) DbCreatorsList(this); - } + return tra_dbcreators_list; } @@ -3413,9 +3404,7 @@ jrd_tra* tra = this; while (tra->tra_outer) - { tra = tra->tra_outer; - } return tra; } Modified: firebird/trunk/src/jrd/tra.h =================================================================== --- firebird/trunk/src/jrd/tra.h 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/tra.h 2015-02-19 14:15:00 UTC (rev 60730) @@ -154,6 +154,9 @@ { typedef Firebird::GenericMap<Firebird::Pair<Firebird::NonPooled<USHORT, SINT64> > > GenIdCache; + static const size_t MAX_UNDO_RECORDS = 2; + typedef Firebird::HalfStaticArray<Record*, MAX_UNDO_RECORDS> UndoRecordList; + public: enum wait_t { tra_no_wait, @@ -184,7 +187,7 @@ tra_interface(NULL), tra_blob_space(NULL), tra_undo_space(NULL), - tra_undo_record(NULL), + tra_undo_records(*p), tra_user_management(NULL), tra_sec_db_context(NULL), tra_mapping_list(NULL), @@ -295,7 +298,7 @@ TempSpace* tra_blob_space; // temp blob storage TempSpace* tra_undo_space; // undo log storage - Record* tra_undo_record; // temporary record used for the undo purposes + UndoRecordList tra_undo_records; // temporary records used for the undo purposes UserManagement* tra_user_management; SecDbContext* tra_sec_db_context; MappingList* tra_mapping_list; @@ -338,17 +341,27 @@ return tra_undo_space; } - Record* getUndoRecord(ULONG length) + Record* getUndoRecord(const Format* format) { - if (!tra_undo_record || tra_undo_record->rec_length < length) + for (Record** iter = tra_undo_records.begin(); iter != tra_undo_records.end(); ++iter) { - delete tra_undo_record; - tra_undo_record = FB_NEW_RPT(*tra_pool, length) Record(*tra_pool); + Record* const record = *iter; + fb_assert(record); + + if (!record->checkFlags(REC_undo_active)) + { + // initialize record for reuse + record->reset(format, REC_undo_active); + return record; + } } - memset(tra_undo_record, 0, sizeof(Record) + length); + fb_assert(tra_undo_records.getCount() < MAX_UNDO_RECORDS); - return tra_undo_record; + Record* const record = FB_NEW(*tra_pool) Record(*tra_pool, format, REC_undo_active); + tra_undo_records.add(record); + + return record; } UserManagement* getUserManagement(); @@ -361,9 +374,7 @@ GenIdCache* getGenIdCache() { if (!tra_gen_ids) - { tra_gen_ids = FB_NEW(*tra_pool) GenIdCache(*tra_pool); - } return tra_gen_ids; } @@ -533,76 +544,83 @@ class UndoItem { + static const UCHAR FLAG_SAME_TX = 1; // record inserted/updated and deleted by same tx + static const UCHAR FLAG_NEW_VER = 2; // savepoint created new record version and deleted it + public: - static const SINT64& generate(const void* /*sender*/, const UndoItem& item) + static const SINT64& generate(const void* /*sender*/, const UndoItem& item) { - return item.number; + return item.m_number; } UndoItem() {} - UndoItem(RecordNumber recordNumber, UCHAR recordFlags) - : number(recordNumber.getValue()), - flags(recordFlags), - length(0), offset(0), format(NULL) - {} + UndoItem(RecordNumber recordNumber, bool sameTx, bool newVersion) + : m_number(recordNumber.getValue()), m_offset(0), m_format(NULL) + { + m_flags = (sameTx ? FLAG_SAME_TX : 0) | (newVersion ? FLAG_NEW_VER : 0); + } - UndoItem(jrd_tra* transaction, RecordNumber recordNumber, const Record* record, UCHAR recordFlags) - : number(recordNumber.getValue()), - flags(recordFlags), - length(record->rec_length), - offset(0), - format(record->rec_format) + UndoItem(jrd_tra* transaction, RecordNumber recordNumber, const Record* record, + bool sameTx, bool newVersion) + : m_number(recordNumber.getValue()), m_format(record->getFormat()) { - if (length) - { - offset = transaction->getUndoSpace()->allocateSpace(length); - transaction->getUndoSpace()->write(offset, record->rec_data, length); - } + m_flags = (sameTx ? FLAG_SAME_TX : 0) | (newVersion ? FLAG_NEW_VER : 0); + m_offset = transaction->getUndoSpace()->allocateSpace(m_format->fmt_length); + transaction->getUndoSpace()->write(m_offset, record->getData(), record->getLength()); } - Record* setupRecord(jrd_tra* transaction, UCHAR newFlags = 0) + Record* setupRecord(jrd_tra* transaction) const { - flags |= newFlags; + if (m_format) + { + Record* const record = transaction->getUndoRecord(m_format); + transaction->getUndoSpace()->read(m_offset, record->getData(), record->getLength()); + return record; + } - Record* const record = transaction->getUndoRecord(length); - record->rec_number.setValue(number); - record->rec_flags = flags; - record->rec_length = length; - record->rec_format = format; - - if (length) - transaction->getUndoSpace()->read(offset, record->rec_data, length); - - return record; + return NULL; } void release(jrd_tra* transaction) { - if (length) + if (m_format) { - transaction->getUndoSpace()->releaseSpace(offset, length); - length = 0; - format = NULL; + transaction->getUndoSpace()->releaseSpace(m_offset, m_format->fmt_length); + m_format = NULL; } } - const UCHAR getFlags() const + void markSameTx() { - return flags; + m_flags |= FLAG_SAME_TX; } - ULONG getLength() const + const bool isSameTx() const { - return length; + return (m_flags & FLAG_SAME_TX); } + const bool isNewVersion() const + { + return (m_flags & FLAG_NEW_VER); + } + + bool hasData() const + { + return (m_format != NULL); + } + + bool isEmpty() const + { + return (m_format == NULL); + } + private: - SINT64 number; - UCHAR flags; - ULONG length; - offset_t offset; - const Format* format; + SINT64 m_number; + offset_t m_offset; + const Format* m_format; + UCHAR m_flags; }; typedef Firebird::BePlusTree<UndoItem, SINT64, MemoryPool, UndoItem> UndoItemTree; Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2015-02-19 14:06:48 UTC (rev 60729) +++ firebird/trunk/src/jrd/vio.cpp 2015-02-19 14:15:00 UTC (rev 60730) @@ -149,7 +149,6 @@ static void list_staying(thread_db*, record_param*, RecordStack&); static void notify_garbage_collector(thread_db* tdbb, record_param* rpb, TraNumber tranid = MAX_TRA_NUMBER); -static Record* realloc_record(Record*& record, ULONG fmt_length); const int PREPARE_OK = 0; const int PREPARE_CONFLICT = 1; @@ -164,7 +163,6 @@ static void protect_system_table_delupd(thread_db* tdbb, const jrd_rel* relation, const char* operation, bool force_flag = false); static void purge(thread_db*, record_param*); -static Record* replace_gc_record(jrd_rel*, Record**, ULONG); static void replace_record(thread_db*, record_param*, PageStack*, const jrd_tra*); static SSHORT set_metadata_id(thread_db*, Record*, USHORT, drq_type_t, const char*); static void set_owner_name(thread_db*, Record*, USHORT); @@ -236,9 +234,7 @@ * **************************************/ while (stack.hasData()) - { delete stack.pop(); - } } inline bool needDfw(thread_db* tdbb, const jrd_tra* transaction) @@ -372,8 +368,10 @@ RecordStack going, staying; Record* data = NULL; Record* old_data = NULL; - Record* gc_rec2 = NULL; + AutoGCRecord gc_rec1; + AutoGCRecord gc_rec2; + bool samePage; bool deleted; @@ -381,12 +379,11 @@ CCH_RELEASE(tdbb, &temp.getWindow(tdbb)); else { - temp.rpb_record = VIO_gc_record(tdbb, relation); + temp.rpb_record = gc_rec1 = VIO_gc_record(tdbb, relation); VIO_data(tdbb, &temp, dbb->dbb_permanent); data = temp.rpb_prior; old_data = temp.rpb_record; rpb->rpb_prior = temp.rpb_prior; - gc_rec2 = temp.rpb_record; going.push(temp.rpb_record); } @@ -397,24 +394,23 @@ // If there is an old version of the record, fetch it's data now. - Record* gc_rec1 = NULL; - RuntimeStatistics::Accumulator backversions(tdbb, relation, RuntimeStatistics::RECORD_BACKVERSION_READS); if (rpb->rpb_b_page) { - temp.rpb_record = gc_rec1 = VIO_gc_record(tdbb, relation); + temp.rpb_record = gc_rec2 = VIO_gc_record(tdbb, relation); + while (true) { if (!DPM_get(tdbb, &temp, LCK_read)) - goto gc_cleanup; + return; if (temp.rpb_b_page != rpb->rpb_b_page || temp.rpb_b_line != rpb->rpb_b_line || temp.rpb_transaction_nr != rpb->rpb_transaction_nr) { CCH_RELEASE(tdbb, &temp.getWindow(tdbb)); - goto gc_cleanup; + return; } if (temp.rpb_flags & rpb_delta) @@ -433,7 +429,6 @@ else VIO_data(tdbb, &temp, dbb->dbb_permanent); - gc_rec1 = temp.rpb_record; temp.rpb_page = rpb->rpb_b_page; temp.rpb_line = rpb->rpb_b_line; @@ -444,7 +439,7 @@ // Re-fetch the record. if (!DPM_get(tdbb, rpb, LCK_write)) - goto gc_cleanup; + return; #ifdef VIO_DEBUG if (temp2.rpb_b_page != rpb->rpb_b_page || temp.rpb_b_line != rpb->rpb_b_line || @@ -461,7 +456,7 @@ rpb->rpb_transaction_nr != temp2.rpb_transaction_nr) { CCH_RELEASE(tdbb, &rpb->getWindow(tdbb)); - goto gc_cleanup; + return; } // even if the record isn't suspicious, it may have changed a little @@ -486,12 +481,12 @@ going.pop(); if (!DPM_get(tdbb, rpb, LCK_write)) - goto gc_cleanup; + return; if (rpb->rpb_transaction_nr != transaction->tra_number) { CCH_RELEASE(tdbb, &rpb->getWindow(tdbb)); - goto gc_cleanup; + return; } temp2 = *rpb; @@ -501,8 +496,10 @@ rpb->rpb_prior = data; } - delete_record(tdbb, rpb, 0, 0); - goto gc_cleanup; + delete_record(tdbb, rpb, 0, NULL); + + tdbb->bumpRelStats(RuntimeStatistics::RECORD_BACKOUTS, relation->rel_id); + return; } // If both record versions are on the same page, things are a little simpler @@ -525,12 +522,12 @@ clearRecordStack(staying); if (!DPM_get(tdbb, rpb, LCK_write)) - goto gc_cleanup; + return; if (rpb->rpb_transaction_nr != transaction->tra_number) { CCH_RELEASE(tdbb, &rpb->getWindow(tdbb)); - goto gc_cleanup; + return; } temp2 = *rpb; @@ -577,17 +574,10 @@ if (!DPM_fetch(tdbb, &temp, LCK_write)) BUGCHECK(291); // msg 291 cannot find record back version - delete_record(tdbb, &temp, rpb->rpb_page, 0); + + delete_record(tdbb, &temp, rpb->rpb_page, NULL); } - // Return relation garbage collect record blocks to vector. - - gc_cleanup: - if (gc_rec1) - gc_rec1->rec_flags &= ~REC_gc_active; - if (gc_rec2) - gc_rec2->rec_flags &= ~REC_gc_active; - tdbb->bumpRelStats(RuntimeStatistics::RECORD_BACKOUTS, relation->rel_id); } @@ -1163,12 +1153,12 @@ // fetched and moved separately, remembering to set the missing flag. if (new_rpb->rpb_format_number == org_rpb->rpb_format_number) - memcpy(new_rpb->rpb_address, org_record->rec_data, new_rpb->rpb_length); + new_record->copyDataFrom(org_record, true); else { DSC org_desc, new_desc; - for (USHORT i = 0; i < new_record->rec_format->fmt_count; i++) + for (USHORT i = 0; i < new_record->getFormat()->fmt_count; i++) { new_record->clearNull(i); @@ -1227,8 +1217,8 @@ // optimization. jrd_rel* const relation = rpb->rpb_relation; - Record* record = VIO_record(tdbb, rpb, 0, pool); - const Format* format = record->rec_format; + Record* const record = VIO_record(tdbb, rpb, NULL, pool); + const Format* const format = record->getFormat(); // If the record is a delta version, start with data from prior record. UCHAR* tail; @@ -1239,22 +1229,14 @@ { tail = differences; tail_end = differences + sizeof(differences); + if (prior != record) - { - if (record->rec_length < prior->rec_length) - { - if (record->rec_flags & REC_gc_active) - record = replace_gc_record(rpb->rpb_relation, &rpb->rpb_record, prior->rec_length); - else - record = realloc_record(rpb->rpb_record, prior->rec_length); - } - memcpy(record->rec_data, prior->rec_data, prior->rec_format->fmt_length); - } + record->copyDataFrom(prior); } else { - tail = record->rec_data; - tail_end = tail + record->rec_length; + tail = record->getData(); + tail_end = tail + record->getLength(); } // Set up prior record point for next version @@ -1272,12 +1254,14 @@ const ULONG back_page = rpb->rpb_b_page; const USHORT back_line = rpb->rpb_b_line; const USHORT save_flags = rpb->rpb_flags; + while (rpb->rpb_flags & rpb_incomplete) { DPM_fetch_fragment(tdbb, rpb, LCK_read); tail = Compressor::unpack(rpb->rpb_length, rpb->rpb_address, tail_end - tail, tail); ++fragments; } + rpb->rpb_b_page = back_page; rpb->rpb_b_line = back_line; rpb->rpb_flags = save_flags; @@ -1290,11 +1274,11 @@ if (prior) { length = (ULONG) Compressor::applyDiff(tail - differences, differences, - record->rec_length, record->rec_data); + record->getLength(), record->getData()); } else { - length = tail - record->rec_data; + length = tail - record->getData(); } if (format->fmt_length != length) @@ -1313,7 +1297,7 @@ BUGCHECK(183); // msg 183 wrong record length } - rpb->rpb_address = record->rec_data; + rpb->rpb_address = record->getData(); rpb->rpb_length = format->fmt_length; } @@ -1799,7 +1783,7 @@ if (!(transaction->tra_flags & TRA_system) && transaction->tra_save_point && transaction->tra_save_point->sav_verb_count) { - verb_post(tdbb, transaction, rpb, 0, same_tx, false); + verb_post(tdbb, transaction, rpb, NULL, same_tx, false); } tdbb->bumpRelStats(RuntimeStatistics::RECORD_DELETES, relation->rel_id); @@ -1955,37 +1939,29 @@ Database* dbb = tdbb->getDatabase(); CHECK_DBB(dbb); - // Allocate a vector of garbage collect record blocks for relation. - vec<Record*>* vector = relation->rel_gc_rec; - if (!vector) - vector = relation->rel_gc_rec = vec<Record*>::newVector(*relation->rel_pool, 1); + const Format* const format = MET_current(tdbb, relation); - // Set the active flag on an inactive garbage collect record block and return it. - vec<Record*>::iterator rec_ptr = vector->begin(); - for (const vec<Record*>::const_iterator end = vector->end(); rec_ptr != end; ++rec_ptr) + // Set the active flag on an inactive garbage collect record block and return it + + for (Record** iter = relation->rel_gc_records.begin(); + iter != relation->rel_gc_records.end(); ++iter) { - Record* record = *rec_ptr; - if (record && !(record->rec_flags & REC_gc_active)) + Record* const record = *iter; + fb_assert(record); + + if (!record->checkFlags(REC_gc_active)) { - record->rec_flags |= REC_gc_active; + // initialize record for reuse + record->reset(format, REC_gc_active); return record; } } - // Allocate a garbage collect record block if all are active. - record_param rpb; - rpb.rpb_record = NULL; - Record* record = VIO_record(tdbb, &rpb, MET_current(tdbb, relation), dbb->dbb_permanent); - record->rec_flags |= REC_gc_active; + // Allocate a garbage collect record block if all are active - // Insert the new record block into the last slot of the vector. - - FB_SIZE_T slot = vector->count() - 1; - if ((*vector)[slot]) - vector->resize((++slot) + 1); - - (*vector)[slot] = record; - + Record* const record = FB_NEW(*relation->rel_pool) + Record(*relation->rel_pool, format, REC_gc_active); + relation->rel_gc_records.add(record); return record; } @@ -2817,7 +2793,7 @@ if (!(transaction->tra_flags & TRA_system) && transaction->tra_save_point && transaction->tra_save_point->sav_verb_count) { - verb_post(tdbb, transaction, org_rpb, 0, false, false); + verb_post(tdbb, transaction, org_rpb, NULL, false, false); } tdbb->bumpRelStats(RuntimeStatistics::RECORD_UPDATES, relation->rel_id); @@ -2926,8 +2902,6 @@ * **************************************/ SET_TDBB(tdbb); - Database* dbb = tdbb->getDatabase(); - CHECK_DBB(dbb); #ifdef VIO_DEBUG VIO_trace(DEBUG_TRACE, @@ -2942,28 +2916,17 @@ format = MET_format(tdbb, rpb->rpb_relation, rpb->rpb_format_number); Record* record = rpb->rpb_record; + if (!record) { if (!pool) pool = rpb->rpb_relation->rel_pool; - record = rpb->rpb_record = FB_NEW_RPT(*pool, format->fmt_length) Record(*pool); + record = rpb->rpb_record = FB_NEW(*pool) Record(*pool, format); } - else if (record->rec_length < format->fmt_length) - { - Record* const old = record; - if (record->rec_flags & REC_gc_active) - record = replace_gc_record(rpb->rpb_relation, &rpb->rpb_record, format->fmt_length); - else - record = realloc_record(rpb->rpb_record, format->fmt_length); - if (rpb->rpb_prior == old) - rpb->rpb_prior = record; - } + record->reset(format); - record->rec_format = format; - record->rec_length = format->fmt_length; - return record; } @@ -3402,8 +3365,8 @@ rpb->rpb_flags = 0; rpb->rpb_transaction_nr = transaction->tra_number; rpb->getWindow(tdbb).win_flags = 0; - rpb->rpb_record->rec_precedence.push(PageNumber(TRANS_PAGE_SPACE, rpb->rpb_transaction_nr)); - DPM_store(tdbb, rpb, rpb->rpb_record->rec_precedence, DPM_primary); + rpb->rpb_record->pushPrecedence(PageNumber(TRANS_PAGE_SPACE, rpb->rpb_transaction_nr)); + DPM_store(tdbb, rpb, rpb->rpb_record->getPrecedence(), DPM_primary); #ifdef VIO_DEBUG VIO_trace(DEBUG_WRITES_INFO, @@ -3417,7 +3380,7 @@ if (!(transaction->tra_flags & TRA_system) && transaction->tra_save_point && transaction->tra_save_point->sav_verb_count) { - verb_post(tdbb, transaction, rpb, 0, false, false); + verb_post(tdbb, transaction, rpb, NULL, false, false); } tdbb->bumpRelStats(RuntimeStatistics::RECORD_INSERTS, relation->rel_id); @@ -3670,6 +3633,7 @@ { sav_point->sav_verb_actions = action->vct_next; jrd_rel* relation = action->vct_relation; + if (sav_point->sav_verb_count || transaction->tra_save_point) { rpb.rpb_relation = relation; @@ -3706,8 +3670,10 @@ } else { - Record* const record = action->vct_undo->current().setupRecord(transaction); - const bool same_tx = (record->rec_flags & REC_same_tx) != 0; + const UndoItem& undo = action->vct_undo->current(); + const bool same_tx = undo.isSameTx(); + const bool new_ver = undo.isNewVersion(); + AutoUndoRecord record(undo.setupRecord(transaction)); // Have we done BOTH an update and delete to this record // in the same transaction? @@ -3721,7 +3687,7 @@ it was modified and deleted under our savepoint we need to back it out to the state as it were before our transaction started */ - if (record->rec_length == 0 && (record->rec_flags & REC_new_version)) + if (undo.isEmpty() && new_ver) { if (!DPM_get(tdbb, &rpb, LCK_write)) BUGCHECK(186); // msg 186 record disappeared @@ -3735,13 +3701,16 @@ } } - if (record->rec_length != 0) + if (undo.hasData()) { + fb_assert(record); + Record* dead_record = rpb.rpb_record; record_param new_rpb = rpb; new_rpb.rpb_record = record; - new_rpb.rpb_address = record->rec_data; - new_rpb.rpb_length = record->rec_length; + new_rpb.rpb_address = record->getData(); + new_rpb.rpb_length = record->getLength(); + if (!(rpb.rpb_flags & rpb_delta)) { if (!DPM_get(tdbb, &rpb, LCK_write)) @@ -3771,7 +3740,7 @@ if (!action->vct_undo || !action->vct_undo->locate(Firebird::locEqual, rpb.rpb_number.getValue())) { - verb_post(tdbb, transaction, &rpb, 0, false, false); + verb_post(tdbb, transaction, &rpb, NULL, false, false); } else { @@ -3785,13 +3754,12 @@ CCH_RELEASE(tdbb, &rpb.getWindow(tdbb)); - Record* const record = action->vct_undo->current().setupRecord(transaction); - const bool same_tx = (record->rec_flags & REC_same_tx) != 0; - const bool new_ver = (record->rec_flags & REC_new_version) != 0; - if (record->rec_length != 0) - verb_post(tdbb, transaction, &rpb, record, same_tx, new_ver); - else if (same_tx) - verb_post(tdbb, transaction, &rpb, 0, true, new_ver); + const UndoItem& undo = action->vct_undo->current(); + const bool same_tx = undo.isSameTx(); + const bool new_ver = undo.isNewVersion(); + AutoUndoRecord record(undo.setupRecord(transaction)); + + verb_post(tdbb, transaction, &rpb, record, same_tx, new_ver); } } while (accessor.getNext()); } @@ -3889,9 +3857,10 @@ if (!org_rpb->rpb_record) { Record* const org_record = VIO_record(tdbb, org_rpb, NULL, tdbb->getDefaultPool()); - org_rpb->rpb_address = org_record->rec_data; - org_rpb->rpb_length = org_record->rec_format->fmt_length; - org_rpb->rpb_format_number = org_record->rec_format->fmt_version; + org_rpb->rpb_address = org_record->getData(); + const Format* const org_format = org_record->getFormat(); + org_rpb->rpb_length = org_format->fmt_length; + org_rpb->rpb_format_number = org_format->fmt_version; } if (org_rpb->rpb_transaction_nr == transaction->tra_number) @@ -3915,7 +3884,7 @@ { new_rpb.rpb_record = NULL; new_record = VIO_record(tdbb, &new_rpb, new_format, tdbb->getDefaultPool()); - new_rpb.rpb_address = new_record->rec_data; + new_rpb.rpb_address = new_record->getData(); new_rpb.rpb_length = new_format->fmt_length; new_rpb.rpb_format_number = new_format->fmt_version; @@ -3950,7 +3919,7 @@ replace_record(tdbb, org_rpb, &stack, transacti... [truncated message content] |
From: <di...@us...> - 2015-02-19 19:52:36
|
Revision: 60738 http://sourceforge.net/p/firebird/code/60738 Author: dimitr Date: 2015-02-19 19:52:28 +0000 (Thu, 19 Feb 2015) Log Message: ----------- Misc code simplification. Modified Paths: -------------- firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/tra.h Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2015-02-19 19:50:22 UTC (rev 60737) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2015-02-19 19:52:28 UTC (rev 60738) @@ -10838,9 +10838,8 @@ if (transaction != attachment->getSysTransaction()) { - for (const Savepoint* savePoint = transaction->tra_save_point; - savePoint && savePointNumber < savePoint->sav_number; - savePoint = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number > savePointNumber) { VIO_verb_cleanup(tdbb, transaction); } Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2015-02-19 19:50:22 UTC (rev 60737) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2015-02-19 19:52:28 UTC (rev 60738) @@ -518,9 +518,8 @@ { count = *request->getImpure<SLONG>(impureOffset); - for (const Savepoint* save_point = transaction->tra_save_point; - save_point && count <= save_point->sav_number; - save_point = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number >= count) { VIO_verb_cleanup(tdbb, transaction); } @@ -537,9 +536,8 @@ // up to, but not including, the savepoint of this block. The // savepoint of this block will be dealt with below. - for (const Savepoint* save_point = transaction->tra_save_point; - save_point && count < save_point->sav_number; - save_point = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number > count) { ++transaction->tra_save_point->sav_verb_count; VIO_verb_cleanup(tdbb, transaction); @@ -610,9 +608,8 @@ if (transaction != sysTransaction) { - for (const Savepoint* save_point = transaction->tra_save_point; - save_point && count <= save_point->sav_number; - save_point = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number >= count) { VIO_verb_cleanup(tdbb, transaction); } @@ -629,9 +626,8 @@ if (exeState->errorPending && transaction != sysTransaction) { - for (const Savepoint* save_point = transaction->tra_save_point; - save_point && count <= save_point->sav_number; - save_point = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number >= count) { ++transaction->tra_save_point->sav_verb_count; VIO_verb_cleanup(tdbb, transaction); @@ -646,9 +642,8 @@ { count = *request->getImpure<SLONG>(impureOffset); - for (const Savepoint* save_point = transaction->tra_save_point; - save_point && count <= save_point->sav_number; - save_point = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number >= count) { VIO_verb_cleanup(tdbb, transaction); } @@ -2850,9 +2845,8 @@ if (transaction != attachment->getSysTransaction()) { - for (const Savepoint* savePoint = transaction->tra_save_point; - savePoint && savePointNumber < savePoint->sav_number; - savePoint = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number > savePointNumber) { VIO_verb_cleanup(tdbb, transaction); } @@ -3606,9 +3600,8 @@ tdbb, &thread_db::getRequest, &thread_db::setRequest, NULL); // undo all savepoints up to our one - for (const Savepoint* save_point = transaction->tra_save_point; - save_point && impure->savNumber <= save_point->sav_number; - save_point = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number >= impure->savNumber) { ++transaction->tra_save_point->sav_verb_count; VIO_verb_cleanup(tdbb, transaction); @@ -4538,15 +4531,16 @@ default: { const SLONG sav_number = *request->getImpure<SLONG>(impureOffset); + if (sav_number) { - for (const Savepoint* save_point = transaction->tra_save_point; - save_point && sav_number <= save_point->sav_number; - save_point = transaction->tra_save_point) + while (transaction->tra_save_point && + transaction->tra_save_point->sav_number >= sav_number) { VIO_verb_cleanup(tdbb, transaction); } } + cursor->close(tdbb); return parentStmt; } @@ -5969,24 +5963,22 @@ // exists for the stream and is big enough, and copying fields from the // original record to the new record. - const Format* newFormat = MET_current(tdbb, newRpb->rpb_relation); + const Format* const newFormat = MET_current(tdbb, newRpb->rpb_relation); Record* newRecord = VIO_record(tdbb, newRpb, newFormat, tdbb->getDefaultPool()); newRpb->rpb_address = newRecord->getData(); newRpb->rpb_length = newFormat->fmt_length; newRpb->rpb_format_number = newFormat->fmt_version; - Record* orgRecord = orgRpb->rpb_record; - - if (!orgRecord) + if (!orgRpb->rpb_record) { - orgRecord = VIO_record(tdbb, orgRpb, newFormat, tdbb->getDefaultPool()); - const Format* const orgFormat = orgRecord->getFormat(); + const Format* const orgFormat = newFormat; + Record* const orgRecord = VIO_record(tdbb, orgRpb, orgFormat, tdbb->getDefaultPool()); orgRpb->rpb_address = orgRecord->getData(); orgRpb->rpb_length = orgFormat->fmt_length; orgRpb->rpb_format_number = orgFormat->fmt_version; } - // Copy the original record to the new record. + // Copy the original record to the new record VIO_copy_record(tdbb, orgRpb, newRpb); @@ -6852,7 +6844,7 @@ if (!savepoint || !(savepoint->sav_flags & SAV_user)) break; - if (!strcmp(name.c_str(), savepoint->sav_name)) + if (name == savepoint->sav_name) { found = true; break; @@ -6880,7 +6872,7 @@ // Use the savepoint created by EXE_start transaction->tra_save_point->sav_flags |= SAV_user; - strcpy(transaction->tra_save_point->sav_name, name.c_str()); + transaction->tra_save_point->sav_name = name; break; case CMD_RELEASE_ONLY: @@ -6925,7 +6917,7 @@ // Now set the savepoint again to allow to return to it later VIO_start_save_point(tdbb, transaction); transaction->tra_save_point->sav_flags |= SAV_user; - strcpy(transaction->tra_save_point->sav_name, name.c_str()); + transaction->tra_save_point->sav_name = name; break; } Modified: firebird/trunk/src/jrd/exe.cpp =================================================================== --- firebird/trunk/src/jrd/exe.cpp 2015-02-19 19:50:22 UTC (rev 60737) +++ firebird/trunk/src/jrd/exe.cpp 2015-02-19 19:52:28 UTC (rev 60738) @@ -1317,9 +1317,8 @@ if (request->req_transaction != sysTransaction) { - for (const Savepoint* save_point = request->req_transaction->tra_save_point; - ((save_point) && (save_point_number <= save_point->sav_number)); - save_point = request->req_transaction->tra_save_point) + while (request->req_transaction->tra_save_point && + request->req_transaction->tra_save_point->sav_number >= save_point_number) { ++request->req_transaction->tra_save_point->sav_verb_count; VIO_verb_cleanup(tdbb, request->req_transaction); @@ -1395,9 +1394,8 @@ { if (request->req_transaction != sysTransaction) { - for (const Savepoint* save_point = request->req_transaction->tra_save_point; - ((save_point) && (save_point_number <= save_point->sav_number)); - save_point = request->req_transaction->tra_save_point) + while (request->req_transaction->tra_save_point && + request->req_transaction->tra_save_point->sav_number >= save_point_number) { ++request->req_transaction->tra_save_point->sav_verb_count; VIO_verb_cleanup(tdbb, request->req_transaction); Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-02-19 19:50:22 UTC (rev 60737) +++ firebird/trunk/src/jrd/jrd.cpp 2015-02-19 19:52:28 UTC (rev 60738) @@ -7043,25 +7043,12 @@ if (transaction == attachment->getSysTransaction()) return; - // start a savepoint to rollback changes of all triggers - VIO_start_save_point(tdbb, transaction); + AutoSavePoint savePoint(tdbb, transaction); - try - { - // run ON TRANSACTION COMMIT triggers - EXE_execute_db_triggers(tdbb, transaction, TRIGGER_TRANS_COMMIT); - VIO_verb_cleanup(tdbb, transaction); - } - catch (const Exception&) - { - if (!(tdbb->getDatabase()->dbb_flags & DBB_bugcheck)) - { - // rollbacks the created savepoint - ++transaction->tra_save_point->sav_verb_count; - VIO_verb_cleanup(tdbb, transaction); - } - throw; - } + // run ON TRANSACTION COMMIT triggers + EXE_execute_db_triggers(tdbb, transaction, TRIGGER_TRANS_COMMIT); + + savePoint.release(); } Modified: firebird/trunk/src/jrd/tra.h =================================================================== --- firebird/trunk/src/jrd/tra.h 2015-02-19 19:50:22 UTC (rev 60737) +++ firebird/trunk/src/jrd/tra.h 2015-02-19 19:52:28 UTC (rev 60738) @@ -447,13 +447,13 @@ deleteActions(sav_verb_free); } - VerbAction* sav_verb_actions; // verb action list - VerbAction* sav_verb_free; // free verb actions - USHORT sav_verb_count; // Active verb count - SLONG sav_number; // save point number - Savepoint* sav_next; - USHORT sav_flags; - TEXT sav_name[MAX_SQL_IDENTIFIER_SIZE]; // Savepoint name + VerbAction* sav_verb_actions; // verb action list + VerbAction* sav_verb_free; // free verb actions + USHORT sav_verb_count; // active verb count + SLONG sav_number; // save point number + Savepoint* sav_next; + USHORT sav_flags; + Firebird::MetaName sav_name; // savepoint name private: void deleteActions(VerbAction* list); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2015-02-20 09:38:47
|
Revision: 60740 http://sourceforge.net/p/firebird/code/60740 Author: hvlad Date: 2015-02-20 09:38:40 +0000 (Fri, 20 Feb 2015) Log Message: ----------- More memory leaks (CORE-4683) Modified Paths: -------------- firebird/trunk/src/plugins/crypt/arc4/Arc4.cpp firebird/trunk/src/remote/remote.h Modified: firebird/trunk/src/plugins/crypt/arc4/Arc4.cpp =================================================================== --- firebird/trunk/src/plugins/crypt/arc4/Arc4.cpp 2015-02-20 00:15:00 UTC (rev 60739) +++ firebird/trunk/src/plugins/crypt/arc4/Arc4.cpp 2015-02-20 09:38:40 UTC (rev 60740) @@ -92,6 +92,12 @@ : en(NULL), de(NULL) { } + ~Arc4() + { + delete en; + delete de; + } + // ICryptPlugin implementation const char* getKnownTypes(CheckStatusWrapper* status); void setKey(CheckStatusWrapper* status, ICryptKey* key); Modified: firebird/trunk/src/remote/remote.h =================================================================== --- firebird/trunk/src/remote/remote.h 2015-02-20 00:15:00 UTC (rev 60739) +++ firebird/trunk/src/remote/remote.h 2015-02-20 09:38:40 UTC (rev 60740) @@ -503,6 +503,8 @@ { if (rsr_self && *rsr_self == this) *rsr_self = NULL; + + delete rsr_status; } void saveException(Firebird::IStatus* status, bool overwrite); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2015-02-22 10:49:59
|
Revision: 60753 http://sourceforge.net/p/firebird/code/60753 Author: hvlad Date: 2015-02-22 10:49:56 +0000 (Sun, 22 Feb 2015) Log Message: ----------- Fixed regression in 32-bit builds: transaction numbers in sweep info (both trace event and firebird.log message) printed incorrectly Modified Paths: -------------- firebird/trunk/src/jrd/tra.cpp firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp Modified: firebird/trunk/src/jrd/tra.cpp =================================================================== --- firebird/trunk/src/jrd/tra.cpp 2015-02-21 11:26:22 UTC (rev 60752) +++ firebird/trunk/src/jrd/tra.cpp 2015-02-22 10:49:56 UTC (rev 60753) @@ -3494,7 +3494,7 @@ gds__log("Sweep is started by %s\n" "\tDatabase \"%s\" \n" - "\tOIT %"ULONGFORMAT", OAT %"ULONGFORMAT", OST %"ULONGFORMAT", Next %"ULONGFORMAT, + "\tOIT %"UQUADFORMAT", OAT %"UQUADFORMAT", OST %"UQUADFORMAT", Next %"UQUADFORMAT, att->att_user->usr_user_name.c_str(), att->att_filename.c_str(), m_sweep_info.getOIT(), @@ -3583,7 +3583,7 @@ { gds__log("Sweep is finished\n" "\tDatabase \"%s\" \n" - "\tOIT %"ULONGFORMAT", OAT %"ULONGFORMAT", OST %"ULONGFORMAT", Next %"ULONGFORMAT, + "\tOIT %"UQUADFORMAT", OAT %"UQUADFORMAT", OST %"UQUADFORMAT", Next %"UQUADFORMAT, att->att_filename.c_str(), m_sweep_info.getOIT(), m_sweep_info.getOAT(), Modified: firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp =================================================================== --- firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2015-02-21 11:26:22 UTC (rev 60752) +++ firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2015-02-22 10:49:56 UTC (rev 60753) @@ -2056,10 +2056,10 @@ sweep_state == SWEEP_STATE_FINISHED) { record.printf("\nTransaction counters:\n" - "\tOldest interesting %10ld\n" - "\tOldest active %10ld\n" - "\tOldest snapshot %10ld\n" - "\tNext transaction %10ld\n", + "\tOldest interesting %10"UQUADFORMAT"\n" + "\tOldest active %10"UQUADFORMAT"\n" + "\tOldest snapshot %10"UQUADFORMAT"\n" + "\tNext transaction %10"UQUADFORMAT"\n", sweep->getOIT(), sweep->getOAT(), sweep->getOST(), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-02-25 14:24:15
|
Revision: 60781 http://sourceforge.net/p/firebird/code/60781 Author: alexpeshkoff Date: 2015-02-25 14:24:13 +0000 (Wed, 25 Feb 2015) Log Message: ----------- Fixed memory leaks in events API Modified Paths: -------------- firebird/trunk/src/remote/client/interface.cpp firebird/trunk/src/yvalve/YObjects.h firebird/trunk/src/yvalve/why.cpp Modified: firebird/trunk/src/remote/client/interface.cpp =================================================================== --- firebird/trunk/src/remote/client/interface.cpp 2015-02-25 00:23:43 UTC (rev 60780) +++ firebird/trunk/src/remote/client/interface.cpp 2015-02-25 14:24:13 UTC (rev 60781) @@ -423,7 +423,7 @@ public: Events(Rvnt* handle) - : rvnt(handle) + : rvnt(handle), rdb(rvnt->rvnt_rdb) { rvnt->rvnt_self = &rvnt; } @@ -432,12 +432,18 @@ void freeClientData(IStatus* status, bool force = false); Rvnt* rvnt; + Rdb* rdb; }; + int Events::release() { - if (--refCounter != 0) + int rc = --refCounter; + if (rc != 0) + { + fb_assert(rc > 0); return 1; + } if (rvnt) { @@ -1001,18 +1007,16 @@ **************************************/ try { + CHECK_HANDLE(rdb, isc_bad_db_handle); + rem_port* port = rdb->rdb_port; + RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); + if (!rvnt) { return; } - CHECK_HANDLE(rvnt, isc_bad_events_handle); - Rdb* rdb = rvnt->rvnt_rdb; - CHECK_HANDLE(rdb, isc_bad_db_handle); - rem_port* port = rdb->rdb_port; - RefMutexGuard portGuard(*port->port_sync, FB_FUNCTION); - try { // Tell the remote server to cancel it and delete it from the list @@ -3952,9 +3956,6 @@ event->p_event_items.cstr_length = length; event->p_event_items.cstr_address = events; event->p_event_ast = 0; - // Nickolay Samofatov: We pass this value to the server (as 32-bit value) - // then it returns it to us and we do not use it. Maybe pass zero here - // to avoid client-side security risks? event->p_event_arg = 0; event->p_event_rid = rem_event->rvnt_id; @@ -3963,7 +3964,6 @@ Firebird::IEvents* rc = new Events(rem_event); rc->addRef(); - rem_event->rvnt_iface = rc; return rc; } catch (const Exception& ex) @@ -5953,9 +5953,11 @@ if (event) { + // Mark event as already processed + event->rvnt_id = 0; + // Call the asynchronous event routine associated // with this event - const ULONG length = pevent->p_event_items.cstr_length; if (length <= event->rvnt_length) { @@ -5964,9 +5966,6 @@ //else {.... //This is error condition, but we have absolutely no ways to report it. //Therefore simply ignore such bad packet. - - event->rvnt_id = 0; - event->rvnt_iface = NULL; } } // end of event handling for op_event @@ -6871,8 +6870,6 @@ } } - event->rvnt_iface = NULL; - delete event; } @@ -7129,9 +7126,8 @@ if (event->rvnt_id) { + event->rvnt_id = 0; event->rvnt_callback->eventCallbackFunction(0, NULL); - event->rvnt_id = 0; - event->rvnt_iface = NULL; } } @@ -7252,9 +7248,8 @@ { if (event->rvnt_id) { + event->rvnt_id = 0; event->rvnt_callback->eventCallbackFunction(0, NULL); - event->rvnt_id = 0; - event->rvnt_iface = NULL; } } } Modified: firebird/trunk/src/yvalve/YObjects.h =================================================================== --- firebird/trunk/src/yvalve/YObjects.h 2015-02-25 00:23:43 UTC (rev 60780) +++ firebird/trunk/src/yvalve/YObjects.h 2015-02-25 14:24:13 UTC (rev 60781) @@ -133,7 +133,8 @@ int release() { - if (--this->refCounter == 0) + int rc = --(this->refCounter); + if (rc == 0) { Impl* impl = static_cast<Impl*>(this); @@ -146,6 +147,7 @@ return 0; } + fb_assert(rc > 0); return 1; } @@ -181,6 +183,7 @@ public: YAttachment* attachment; Firebird::RefPtr<Firebird::IEventCallback> callback; + bool autoReleased; }; class YRequest FB_FINAL : Modified: firebird/trunk/src/yvalve/why.cpp =================================================================== --- firebird/trunk/src/yvalve/why.cpp 2015-02-25 00:23:43 UTC (rev 60780) +++ firebird/trunk/src/yvalve/why.cpp 2015-02-25 14:24:13 UTC (rev 60781) @@ -2832,9 +2832,7 @@ if (events) { - StatusVector temp(NULL); - CheckStatusWrapper tempCheckStatusWrapper(&temp); - events->cancel(&tempCheckStatusWrapper); + events->release(); } return status[1]; @@ -2848,19 +2846,33 @@ public: QueCallback(FPTR_EVENT_CALLBACK aAst, void* aArg) : ast(aAst), - arg(aArg) + arg(aArg), + events(NULL) { + mtx.enter(FB_FUNCTION); } + void setEvents(YEvents* e) + { + fb_assert(!events); + events = e; + mtx.leave(); + } + // IEventCallback implementation - virtual void eventCallbackFunction(unsigned int length, const UCHAR* events) + virtual void eventCallbackFunction(unsigned int length, const UCHAR* list) { try { - ast(arg, length, events); + MutexLockGuard g(mtx, FB_FUNCTION); + ast(arg, length, list); } catch (const Firebird::Exception&) { } + + fb_assert(events); + events->autoReleased = true; + events->release(); } int release() @@ -2874,8 +2886,10 @@ return 1; } + Mutex mtx; FPTR_EVENT_CALLBACK ast; void* arg; + YEvents* events; }; } @@ -2894,11 +2908,12 @@ ///nullCheck(idFB_FINAL , isc_bad_events_handle); RefPtr<QueCallback> callback(new QueCallback(ast, arg)); - events = attachment->queEvents(&statusWrapper, callback, length, eventsData); - + callback->setEvents(events); // should be called in case of NULL events too if (status.getState() & Firebird::IStatus::STATE_ERRORS) + { return status[1]; + } *id = FB_API_HANDLE_TO_ULONG(events->getHandle()); } @@ -2907,9 +2922,7 @@ if (events) { *id = 0; - StatusVector temp(NULL); - CheckStatusWrapper tempCheckStatusWrapper(&temp); - events->cancel(&tempCheckStatusWrapper); + events->release(); } e.stuffException(&status); @@ -3803,12 +3816,15 @@ /*** : YHelper(aNext), attachment(aAttachment), - callback(aCallback) + callback(aCallback), + autoReleased(false) ***/ : YHelper(aNext) { attachment = aAttachment; callback = aCallback; + autoReleased = false; + attachment->childEvents.add(this); } @@ -3837,7 +3853,7 @@ entry.next()->cancel(status); if (!(status->getState() & Firebird::IStatus::STATE_ERRORS)) - destroy(DF_RELEASE); + destroy(autoReleased ? 0 : DF_RELEASE); } catch (const Exception& e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-02-25 17:03:47
|
Revision: 60783 http://sourceforge.net/p/firebird/code/60783 Author: alexpeshkoff Date: 2015-02-25 17:03:39 +0000 (Wed, 25 Feb 2015) Log Message: ----------- Dynamic buffer for status vector and dynamic strings in IStatus Modified Paths: -------------- firebird/trunk/src/common/StatusHolder.cpp firebird/trunk/src/common/StatusHolder.h firebird/trunk/src/common/utils.cpp firebird/trunk/src/common/utils_proto.h firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/remote/protocol.cpp firebird/trunk/src/remote/remote.cpp firebird/trunk/src/remote/server/server.cpp Modified: firebird/trunk/src/common/StatusHolder.cpp =================================================================== --- firebird/trunk/src/common/StatusHolder.cpp 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/common/StatusHolder.cpp 2015-02-25 17:03:39 UTC (rev 60783) @@ -33,139 +33,147 @@ namespace Firebird { -ISC_STATUS DynamicStatusVector::save(const ISC_STATUS* status) +ISC_STATUS DynamicStatusVector::merge(const IStatus* status) { - m_status_vector.clear(); + SimpleStatusVector<> tmp; + unsigned length = fb_utils::statusLength(status->getErrors()); + length += fb_utils::statusLength(status->getWarnings()); + ISC_STATUS* s = tmp.getBuffer(length + 1); + fb_utils::mergeStatus(s, length + 1, status); + return save(s); +} - const ISC_STATUS* from = status; +ISC_STATUS StatusHolder::save(IStatus* status) +{ + fb_assert(isSuccess() || m_raised); + if (m_raised) + { + clear(); + } - while (true) + setErrors(status->getErrors()); + setWarnings(status->getWarnings()); + return getErrors()[1]; +} + +void StatusHolder::clear() +{ + BaseStatus<StatusHolder>::clear(); + m_raised = false; +} + +void StatusHolder::raise() +{ + if (getError()) { + Arg::StatusVector tmp(getErrors()); + tmp << Arg::StatusVector(getWarnings()); + m_raised = true; + tmp.raise(); + } +} + +unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src) +{ + const ISC_STATUS* end = &src[length]; + + // allocate space for strings + size_t len = 0; + for (const ISC_STATUS* from = src; from < end; ++from) + { const ISC_STATUS type = *from++; - m_status_vector.push(type == isc_arg_cstring ? isc_arg_string : type); - if (type == isc_arg_end) + if (from >= end || type == isc_arg_end) + { + end = from - 1; break; + } switch (type) { case isc_arg_cstring: + if (from + 1 >= end) { - const size_t len = *from++; - - char* string = FB_NEW(*getDefaultMemoryPool()) char[len + 1]; - const char *temp = reinterpret_cast<const char*>(*from++); - memcpy(string, temp, len); - string[len] = 0; - - m_status_vector.push((ISC_STATUS)(IPTR) string); + end = from - 1; + break; } + len += *from++; + len++; break; case isc_arg_string: case isc_arg_interpreted: case isc_arg_sql_state: - { - const char* temp = reinterpret_cast<const char*>(*from++); + len += strlen(reinterpret_cast<const char*>(*from)); + len++; + break; + } + } - const size_t len = strlen(temp); - char* string = FB_NEW(*getDefaultMemoryPool()) char[len + 1]; - memcpy(string, temp, len + 1); + char* string = len ? FB_NEW(*getDefaultMemoryPool()) char[len] : NULL; + ISC_STATUS* to = dst; - m_status_vector.push((ISC_STATUS)(IPTR) string); - } + // copy status vector saving strings in local buffer + for (const ISC_STATUS* from = src; from < end; ++from) + { + const ISC_STATUS type = *from++; + *to++ = type == isc_arg_cstring ? isc_arg_string : type; + + switch (type) + { + case isc_arg_cstring: + fb_assert(string); + *to++ = (ISC_STATUS)(IPTR) string; + memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]); + string += *from++; + *string++ = 0; break; + case isc_arg_string: + case isc_arg_interpreted: + case isc_arg_sql_state: + fb_assert(string); + *to++ = (ISC_STATUS)(IPTR) string; + strcpy(string, reinterpret_cast<const char*>(*from)); + string += strlen(string); + string++; + break; + default: - m_status_vector.push(*from++); + *to++ = *from; break; } } - // Sanity check - if (m_status_vector.getCount() < 3) - { - fb_utils::init_status(m_status_vector.getBuffer(3)); - } - - return m_status_vector[1]; + *to++ = isc_arg_end; + return (to - dst) - 1; } -ISC_STATUS DynamicStatusVector::save(const IStatus* status) +void freeDynamicStrings(unsigned length, ISC_STATUS* ptr) { - ISC_STATUS_ARRAY tmp; - fb_utils::mergeStatus(tmp, FB_NELEM(tmp), status); - return save(tmp); -} - -void DynamicStatusVector::clear() -{ - ISC_STATUS *ptr = m_status_vector.begin(); - - while (true) + while (length--) { const ISC_STATUS type = *ptr++; if (type == isc_arg_end) - break; + return; switch (type) { case isc_arg_cstring: + fb_assert(false); // CVC: according to the new logic, this case cannot happen ptr++; - delete[] reinterpret_cast<char*>(*ptr++); - fb_assert(false); // CVC: according to the new logic, this case cannot happen - break; case isc_arg_string: case isc_arg_interpreted: case isc_arg_sql_state: delete[] reinterpret_cast<char*>(*ptr++); - break; + return; default: ptr++; break; } } - - // Sanity check - if (m_status_vector.getCount() < 3) - { - m_status_vector.getBuffer(3); - } - - fb_utils::init_status(m_status_vector.begin()); } -ISC_STATUS StatusHolder::save(IStatus* status) -{ - fb_assert(isSuccess() || m_raised); - if (m_raised) - { - clear(); - } - m_error.save(status->getErrors()); - m_warning.save(status->getWarnings()); - return m_error.value()[1]; -} - -void StatusHolder::clear() -{ - m_error.clear(); - m_warning.clear(); - m_raised = false; -} - -void StatusHolder::raise() -{ - if (getError()) - { - Arg::StatusVector tmp(m_error.value()); - tmp << Arg::StatusVector(m_warning.value()); - m_raised = true; - tmp.raise(); - } -} - - } // namespace Firebird Modified: firebird/trunk/src/common/StatusHolder.h =================================================================== --- firebird/trunk/src/common/StatusHolder.h 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/common/StatusHolder.h 2015-02-25 17:03:39 UTC (rev 60783) @@ -36,190 +36,200 @@ namespace Firebird { -template <class Final> -class BaseStatus : public IStatusImpl<Final, CheckStatusWrapper> +unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src); +void freeDynamicStrings(unsigned length, ISC_STATUS* ptr); + + +// This trivial container is used when we need to grow vector element by element w/o any conversions +template <unsigned S = ISC_STATUS_LENGTH> +class SimpleStatusVector : public HalfStaticArray<ISC_STATUS, S> { public: - // IStatus implementation - void init() + SimpleStatusVector() + : HalfStaticArray<ISC_STATUS, S>() + { } + + SimpleStatusVector(MemoryPool& p) + : HalfStaticArray<ISC_STATUS, S>(p) + { } +}; + + +// DynamicVector owns strings, contained in it +template <unsigned S> +class DynamicVector : private SimpleStatusVector<S> +{ +public: + DynamicVector(MemoryPool& p) + : SimpleStatusVector<S>(p) { - errors.init(); - warnings.init(); + fb_utils::init_status(this->getBuffer(3)); } - void setErrors(const ISC_STATUS* value) + ~DynamicVector() { - errors.set(fb_utils::statusLength(value), value); + freeDynamicStrings(this->getCount(), this->begin()); } - void setErrors2(unsigned int length, const ISC_STATUS* value) + void clear() { - errors.set(length, value); + freeDynamicStrings(this->getCount(), this->begin()); + this->resize(0); + fb_utils::init_status(this->getBuffer(3)); } - void setWarnings(const ISC_STATUS* value) + void save(unsigned int length, const ISC_STATUS* status) { - warnings.set(fb_utils::statusLength(value), value); - } + clear(); + this->resize(0); + unsigned newLen = makeDynamicStrings(length, this->getBuffer(length), status); - void setWarnings2(unsigned int length, const ISC_STATUS* value) - { - warnings.set(length, value); + fb_assert(newLen <= length); + + // Sanity check + if (newLen < 2) + fb_utils::init_status(this->getBuffer(3)); + else + this->resize(newLen); } - const ISC_STATUS* getErrors() const + ISC_STATUS save(const ISC_STATUS* status) { - return errors.get(); + save(fb_utils::statusLength(status), status); + return status[1]; } - const ISC_STATUS* getWarnings() const + const ISC_STATUS* value() const { - return warnings.get(); + return SimpleStatusVector<S>::begin(); } - unsigned getState() const + ISC_STATUS operator[](unsigned int index) const { - return (errors.vector[1] ? IStatus::STATE_ERRORS : 0) | - (warnings.vector[1] ? IStatus::STATE_WARNINGS : 0); + return SimpleStatusVector<S>::operator[](index); } +}; - IStatus* clone() const - { - Final* ret = new Final(); - ret->setWarnings(getWarnings()); - ret->setErrors(getErrors()); - - return ret; - } - +// DynamicStatusVector performs error/success checks and load from IStatus +class DynamicStatusVector : public DynamicVector<ISC_STATUS_LENGTH> +{ public: - BaseStatus() + DynamicStatusVector() + : DynamicVector(*getDefaultMemoryPool()) { } - void check() + ISC_STATUS merge(const IStatus* status); + + ISC_STATUS getError() const { - errors.check(); + return value()[1]; } -private: - class ErrorVector + bool isSuccess() const { - public: - ErrorVector() - { - init(); - } + return getError() == 0; + } +}; - ~ErrorVector() { } - void set(unsigned int length, const ISC_STATUS* value) - { - fb_utils::copyStatus(vector, FB_NELEM(vector), value, length); - } - - const ISC_STATUS* get() const - { - return vector; - } - - void init() - { - fb_utils::init_status(vector); - } - - void check() - { - if (vector[1]) - status_exception::raise(get()); - } - - ISC_STATUS vector[40]; // FixMe - may be a kind of dynamic storage will be better? - }; - - ErrorVector errors, warnings; -}; - -class LocalStatus : public AutoIface<BaseStatus<LocalStatus> > +// Implements IStatus using 2 DynamicVectors +template <class Final> +class BaseStatus : public IStatusImpl<Final, CheckStatusWrapper> { public: - void dispose() + // IStatus implementation + void init() { + errors.clear(); + warnings.clear(); } -public: - static void checkException(LocalStatus* status) + void setErrors(const ISC_STATUS* value) { + errors.save(fb_utils::statusLength(value), value); } - static void catchException(LocalStatus* status) + void setErrors2(unsigned int length, const ISC_STATUS* value) { - BaseStatusWrapper<LocalStatus>::catchException(status); + errors.save(length, value); } - static void setVersionError(IStatus* status, const char* interfaceName, - unsigned currentVersion, unsigned expectedVersion) + void setWarnings(const ISC_STATUS* value) { - BaseStatusWrapper<LocalStatus>::setVersionError( - status, interfaceName,currentVersion, expectedVersion); + warnings.save(fb_utils::statusLength(value), value); } -}; + void setWarnings2(unsigned int length, const ISC_STATUS* value) + { + warnings.save(length, value); + } -// This trivial container is used when we need to grow vector element by element w/o any conversions -typedef HalfStaticArray<ISC_STATUS, ISC_STATUS_LENGTH> SimpleStatusVector; + const ISC_STATUS* getErrors() const + { + return errors.value(); + } + const ISC_STATUS* getWarnings() const + { + return warnings.value(); + } -// DynamicStatusVector owns strings, contained in it -class DynamicStatusVector -{ -public: - DynamicStatusVector() - : m_status_vector(*getDefaultMemoryPool()) + unsigned getState() const { - ISC_STATUS* s = m_status_vector.getBuffer(ISC_STATUS_LENGTH); - fb_utils::init_status(s); + return (errors.value()[1] ? IStatus::STATE_ERRORS : 0) | + (warnings.value()[1] ? IStatus::STATE_WARNINGS : 0); } - ~DynamicStatusVector() + IStatus* clone() const { - clear(); + Final* ret = new Final(); + + ret->setWarnings(getWarnings()); + ret->setErrors(getErrors()); + + return ret; } - ISC_STATUS save(const ISC_STATUS* status); - ISC_STATUS save(const IStatus* status); - void clear(); - - ISC_STATUS getError() const +public: + BaseStatus(MemoryPool& p) + : errors(p), warnings(p) { - return value()[1]; + init(); } - const ISC_STATUS* value() const + BaseStatus() + : errors(*getDefaultMemoryPool()), warnings(*getDefaultMemoryPool()) { - return m_status_vector.begin(); + init(); } - bool isSuccess() const + void check() { - return getError() == 0; + const ISC_STATUS* s = errors.value(); + if (s[0] == isc_arg_gds && s[1] != isc_arg_end) + status_exception::raise(s); } - ISC_STATUS& operator[](unsigned int index) +protected: + void clear() { - return m_status_vector[index]; + errors.clear(); + warnings.clear(); } private: - SimpleStatusVector m_status_vector; + DynamicVector<11> errors; // gds-code (2) + 3 args (6) + stack trace (2) + end (1) + DynamicVector<3> warnings; // no warnings (empty vector) }; -class StatusHolder +// Hold status vector and raise error on request +class StatusHolder : public BaseStatus<StatusHolder> { public: StatusHolder() - : m_raised(false) + : BaseStatus(*getDefaultMemoryPool()), m_raised(false) { } ISC_STATUS save(IStatus* status); @@ -233,14 +243,10 @@ const IStatus* value() { - if (m_raised) { + if (m_raised) clear(); - } - m_rc.init(); - m_rc.setErrors(m_error.value()); - m_rc.setWarnings(m_warning.value()); - return &m_rc; + return this; } bool isSuccess() @@ -250,19 +256,53 @@ const StatusHolder& operator=(const StatusHolder& val) { - m_error.save(val.m_error.value()); - m_warning.save(val.m_warning.value()); + setErrors(val.getErrors()); + setWarnings(val.getWarnings()); m_raised = val.m_raised; return *this; } +public: + void dispose() + { + } + private: - DynamicStatusVector m_error, m_warning; - LocalStatus m_rc; bool m_raised; }; +// Status interface to be used on stack when entering engine +class LocalStatus : public BaseStatus<LocalStatus> +{ +public: + LocalStatus() + : BaseStatus<LocalStatus>(AutoStorage::getAutoMemoryPool()) + { } + +public: + void dispose() + { + } + +public: + static void checkException(LocalStatus* status) + { + } + + static void catchException(LocalStatus* status) + { + BaseStatusWrapper<LocalStatus>::catchException(status); + } + + static void setVersionError(IStatus* status, const char* interfaceName, + unsigned currentVersion, unsigned expectedVersion) + { + BaseStatusWrapper<LocalStatus>::setVersionError( + status, interfaceName,currentVersion, expectedVersion); + } +}; + } // namespace Firebird Modified: firebird/trunk/src/common/utils.cpp =================================================================== --- firebird/trunk/src/common/utils.cpp 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/common/utils.cpp 2015-02-25 17:03:39 UTC (rev 60783) @@ -1132,12 +1132,13 @@ return copied; } -unsigned int mergeStatus(ISC_STATUS* to, unsigned int space, +unsigned int mergeStatus(ISC_STATUS* const dest, unsigned int space, const Firebird::IStatus* from) throw() { const ISC_STATUS* s; unsigned int copied = 0; int state = from->getState(); + ISC_STATUS* to = dest; if (state & Firebird::IStatus::STATE_ERRORS) { @@ -1162,7 +1163,9 @@ } if (!copied) - init_status(to); + init_status(dest); + else + Firebird::makePermanentVector(dest); return copied; } Modified: firebird/trunk/src/common/utils_proto.h =================================================================== --- firebird/trunk/src/common/utils_proto.h 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/common/utils_proto.h 2015-02-25 17:03:39 UTC (rev 60783) @@ -123,7 +123,7 @@ unsigned int copyStatus(ISC_STATUS* const to, const unsigned int space, const ISC_STATUS* const from, const unsigned int count) throw(); - unsigned int mergeStatus(ISC_STATUS* to, unsigned int space, const Firebird::IStatus* from) throw(); + unsigned int mergeStatus(ISC_STATUS* const to, unsigned int space, const Firebird::IStatus* from) throw(); void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw(); Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/jrd/jrd.cpp 2015-02-25 17:03:39 UTC (rev 60783) @@ -1117,11 +1117,9 @@ return vector->getErrors()[1]; } - // OK as long as we do not change vectors length - // for current way of keeping strings in vector! - - ISC_STATUS* const vectorStart = const_cast<ISC_STATUS*>(vector->getErrors()); - ISC_STATUS* status = vectorStart; + const ISC_STATUS* const vectorStart = vector->getErrors(); + const ISC_STATUS* status = vectorStart; + SimpleStatusVector<> newVector; Array<UCHAR*> buffers; try @@ -1131,6 +1129,7 @@ while (cont) { const ISC_STATUS type = *status++; + newVector.push(type); switch (type) { @@ -1140,8 +1139,8 @@ case isc_arg_cstring: { - FB_SIZE_T len = *status; - const UCHAR* str = reinterpret_cast<UCHAR*>(status[1]); + FB_SIZE_T len = *status++; + const UCHAR* str = reinterpret_cast<UCHAR*>(*status++); try { @@ -1154,15 +1153,15 @@ catch (const Exception&) {} // no-op - *status++ = (ISC_STATUS) len; - *status++ = (ISC_STATUS)(IPTR) str; + newVector.push(len); + newVector.push((ISC_STATUS)(IPTR) str); } break; case isc_arg_string: case isc_arg_interpreted: { - const UCHAR* str = reinterpret_cast<UCHAR*>(*status); + const UCHAR* str = reinterpret_cast<UCHAR*>(*status++); FB_SIZE_T len = fb_strlen((const char*) str); try @@ -1176,22 +1175,22 @@ catch (const Exception&) {} // no-op - *status++ = (ISC_STATUS)(IPTR) str; + newVector.push((ISC_STATUS)(IPTR) str); } break; default: - ++status; + newVector.push(*status++); break; } } } catch (...) { - return ex.stuff_exception(vectorStart); + return ex.stuffException(vector); } - makePermanentVector(vectorStart); + vector->setErrors2(newVector.getCount() - 1, newVector.begin()); for (Array<UCHAR*>::iterator i = buffers.begin(); i != buffers.end(); ++i) delete [] *i; Modified: firebird/trunk/src/remote/protocol.cpp =================================================================== --- firebird/trunk/src/remote/protocol.cpp 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/remote/protocol.cpp 2015-02-25 17:03:39 UTC (rev 60783) @@ -1657,7 +1657,7 @@ if (!vector) vector = FB_NEW(*getDefaultMemoryPool()) DynamicStatusVector(); - SimpleStatusVector vectorDecode; + SimpleStatusVector<> vectorDecode; const ISC_STATUS* vectorEncode = vector->value(); Stack<SCHAR*> space; Modified: firebird/trunk/src/remote/remote.cpp =================================================================== --- firebird/trunk/src/remote/remote.cpp 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/remote/remote.cpp 2015-02-25 17:03:39 UTC (rev 60783) @@ -1138,7 +1138,7 @@ // Translate any gds codes into local operating specific codes - Firebird::SimpleStatusVector newVector; + Firebird::SimpleStatusVector<> newVector; while (*vector != isc_arg_end) { Modified: firebird/trunk/src/remote/server/server.cpp =================================================================== --- firebird/trunk/src/remote/server/server.cpp 2015-02-25 15:54:55 UTC (rev 60782) +++ firebird/trunk/src/remote/server/server.cpp 2015-02-25 17:03:39 UTC (rev 60783) @@ -4595,7 +4595,7 @@ if (!sendL->p_resp.p_resp_status_vector) sendL->p_resp.p_resp_status_vector = FB_NEW(*getDefaultMemoryPool()) Firebird::DynamicStatusVector(); - sendL->p_resp.p_resp_status_vector->save(status_vector); + sendL->p_resp.p_resp_status_vector->merge(status_vector); this->send_partial(sendL); @@ -5058,7 +5058,7 @@ // Start by translating the status vector into "generic" form - Firebird::SimpleStatusVector new_vector; + Firebird::SimpleStatusVector<> new_vector; const ISC_STATUS* old_vector = status_vector; const ISC_STATUS exit_code = old_vector[1]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-03-04 16:19:01
|
Revision: 60829 http://sourceforge.net/p/firebird/code/60829 Author: alexpeshkoff Date: 2015-03-04 16:18:53 +0000 (Wed, 04 Mar 2015) Log Message: ----------- Full fix for CORE-4698, also fixed some more or less related leaks, segfaults and assertions Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/dsql/dsql.h firebird/trunk/src/jrd/EngineInterface.h firebird/trunk/src/jrd/JrdStatement.cpp firebird/trunk/src/jrd/JrdStatement.h firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/jrd_proto.h firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/jrd/svc.h Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/dsql/dsql.cpp 2015-03-04 16:18:53 UTC (rev 60829) @@ -1502,8 +1502,7 @@ req_cursor_name(req_pool), req_cursor(NULL), req_user_descs(req_pool), - req_traced(false), - req_interface(NULL) + req_traced(false) { } Modified: firebird/trunk/src/dsql/dsql.h =================================================================== --- firebird/trunk/src/dsql/dsql.h 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/dsql/dsql.h 2015-03-04 16:18:53 UTC (rev 60829) @@ -580,8 +580,6 @@ SINT64 req_fetch_rowcount; // Total number of rows returned by this request bool req_traced; // request is traced via TraceAPI - JStatement* req_interface; - protected: // Request should never be destroyed using delete. // It dies together with it's pool in release_request(). Modified: firebird/trunk/src/jrd/EngineInterface.h =================================================================== --- firebird/trunk/src/jrd/EngineInterface.h 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/jrd/EngineInterface.h 2015-03-04 16:18:53 UTC (rev 60829) @@ -366,7 +366,7 @@ private: StableAttachmentPart* att; - void freeEngineData(Firebird::CheckStatusWrapper* status); + void freeEngineData(Firebird::CheckStatusWrapper* status, bool forceFree); }; class JService FB_FINAL : @@ -392,6 +392,8 @@ void freeEngineData(Firebird::CheckStatusWrapper* status); }; +const static int INTERNAL_ATT_OVERWRITE_CHECK = 0x01; + class JProvider FB_FINAL : public Firebird::StdPlugin<Firebird::IProviderImpl<JProvider, Firebird::CheckStatusWrapper> > { @@ -421,6 +423,8 @@ int release(); private: + JAttachment* internalAttach(Firebird::CheckStatusWrapper* status, const char* fileName, + unsigned int dpbLength, const unsigned char* dpb, unsigned int internalFlags); Firebird::ICryptKeyCallback* cryptCallback; Firebird::IPluginConfig* pluginConfig; }; Modified: firebird/trunk/src/jrd/JrdStatement.cpp =================================================================== --- firebird/trunk/src/jrd/JrdStatement.cpp 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/jrd/JrdStatement.cpp 2015-03-04 16:18:53 UTC (rev 60829) @@ -60,8 +60,7 @@ invariants(*p), blr(*p), mapFieldInfo(*p), - mapItemInfo(*p), - interface(NULL) + mapItemInfo(*p) { try { Modified: firebird/trunk/src/jrd/JrdStatement.h =================================================================== --- firebird/trunk/src/jrd/JrdStatement.h 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/jrd/JrdStatement.h 2015-03-04 16:18:53 UTC (rev 60829) @@ -85,7 +85,6 @@ Firebird::Array<UCHAR> blr; // BLR for non-SQL query MapFieldInfo mapFieldInfo; // Map field name to field info MapItemInfo mapItemInfo; // Map item to item info - JRequest* interface; // External interface to this JrdStatement }; Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/jrd/jrd.cpp 2015-03-04 16:18:53 UTC (rev 60829) @@ -161,10 +161,13 @@ freeEngineData(&statusWrapper); } - if (!blob) + if (blob) { - delete this; + // normal cleanup failed, take minimum precautions before deleting JBlob + blob->blb_interface = NULL; + blob = NULL; } + delete this; return 0; } @@ -183,10 +186,15 @@ freeEngineData(&statusWrapper); } - if (!transaction) + + if (transaction) { + fb_assert(!(transaction->tra_flags & TRA_own_interface)); + transaction->tra_flags |= TRA_own_interface; + addRef(); + } + else delete this; - } return 0; } @@ -203,10 +211,7 @@ freeEngineData(&statusWrapper); } - if (!statement) - { - delete this; - } + delete this; return 0; } @@ -223,10 +228,7 @@ freeEngineData(&statusWrapper); } - if (!rq) - { - delete this; - } + delete this; return 0; } @@ -243,10 +245,7 @@ freeEngineData(&statusWrapper); } - if (id < 0) - { - delete this; - } + delete this; return 0; } @@ -297,7 +296,7 @@ LocalStatus status; CheckStatusWrapper statusWrapper(&status); - freeEngineData(&statusWrapper); + freeEngineData(&statusWrapper, true); } if (!att) { @@ -359,9 +358,7 @@ LocalStatus status; CheckStatusWrapper statusWrapper(&status); - ++refCounter; freeEngineData(&statusWrapper); - --refCounter; } if (!svc) { @@ -1019,7 +1016,7 @@ static VdnResult verifyDatabaseName(const PathName&, ISC_STATUS*, bool); static void unwindAttach(thread_db* tdbb, const Exception& ex, Firebird::IStatus* userStatus, - Jrd::Attachment* attachment, Database* dbb); + Jrd::Attachment* attachment, Database* dbb, unsigned internalFlags); static JAttachment* initAttachment(thread_db*, const PathName&, const PathName&, RefPtr<Config>, bool, const DatabaseOptions&, RefMutexUnlock&, IPluginConfig*); static JAttachment* create_attachment(const PathName&, Database*, const DatabaseOptions&, bool newDb); @@ -1038,6 +1035,7 @@ // purge_attachment() flags static const unsigned PURGE_FORCE = 0x01; static const unsigned PURGE_LINGER = 0x02; +static const unsigned PURGE_NOCHECK = 0x04; TraceFailedConnection::TraceFailedConnection(const char* filename, const DatabaseOptions* options) : m_filename(filename), @@ -1366,6 +1364,12 @@ JAttachment* JProvider::attachDatabase(CheckStatusWrapper* user_status, const char* filename, unsigned int dpb_length, const unsigned char* dpb) { + return internalAttach(user_status, filename, dpb_length, dpb, 0); +} + +JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const char* filename, + unsigned int dpb_length, const unsigned char* dpb, unsigned int internal_flags) +{ /************************************** * * g d s _ $ a t t a c h _ d a t a b a s e @@ -1922,7 +1926,7 @@ filename, options, false, user_status->getErrors()); } - unwindAttach(tdbb, ex, user_status, attachment, dbb); + unwindAttach(tdbb, ex, user_status, attachment, dbb, internal_flags); } } catch (const Exception& ex) @@ -2337,7 +2341,6 @@ successful_completion(user_status); JRequest* jr = new JRequest(stmt, getStable()); - stmt->interface = jr; jr->addRef(); return jr; } @@ -2597,7 +2600,8 @@ OverwriteHolder overwriteCheckHolder(dbb); - JAttachment* attachment2 = attachDatabase(user_status, filename, dpb_length, dpb); + JAttachment* attachment2 = internalAttach(user_status, filename, dpb_length, + dpb, INTERNAL_ATT_OVERWRITE_CHECK); if (user_status->getErrors()[1] == isc_adm_task_denied) { throw; @@ -2774,7 +2778,7 @@ trace_failed_attach(attachment ? attachment->att_trace_manager : NULL, filename, options, true, user_status->getErrors()); - unwindAttach(tdbb, ex, user_status, attachment, dbb); + unwindAttach(tdbb, ex, user_status, attachment, dbb, 0); } } catch (const Exception& ex) @@ -2853,11 +2857,11 @@ * **************************************/ RefDeb(DEB_RLS_JATT, "JAttachment::detach"); - freeEngineData(user_status); + freeEngineData(user_status, false); } -void JAttachment::freeEngineData(CheckStatusWrapper* user_status) +void JAttachment::freeEngineData(CheckStatusWrapper* user_status, bool forceFree) { /************************************** * @@ -2889,6 +2893,9 @@ flags |= PURGE_FORCE; } + if (forceFree) + flags |= PURGE_NOCHECK; + attachment->signalShutdown(); purge_attachment(tdbb, getStable(), flags); @@ -3763,7 +3770,6 @@ Service* svc = new Service(service_name, spbLength, spb, cryptCallback); jSvc = new JService(svc); - svc->jSvc = jSvc; jSvc->addRef(); } catch (const Exception& ex) @@ -4931,7 +4937,6 @@ statement = DSQL_prepare(tdbb, getHandle(), tra, stmtLength, sqlStmt, dialect, &items, &buffer, false); rc = new JStatement(statement, getStable(), buffer); - statement->req_interface = rc; rc->addRef(); trace_warning(tdbb, user_status, "JStatement::prepare"); @@ -6516,7 +6521,7 @@ RefMutexUnlock finiGuard; { // scope - fb_assert(!databases_mutex->locked()); + fb_assert((flags & SHUT_DBB_OVERWRITE_CHECK) || (!databases_mutex->locked())); MutexLockGuard listGuard1(databases_mutex, FB_FUNCTION); Database** d_ptr; @@ -6917,6 +6922,7 @@ Database* const dbb = attachment->att_database; const bool forcedPurge = (flags & PURGE_FORCE); + const bool nocheckPurge = (flags & (PURGE_FORCE | PURGE_NOCHECK)); tdbb->tdbb_flags |= TDBB_detaching; @@ -6972,7 +6978,7 @@ } catch (const Exception&) { - if (!forcedPurge) + if (!nocheckPurge) { attachment->att_flags &= ~ATT_purge_started; throw; @@ -6988,12 +6994,12 @@ if (!(dbb->dbb_flags & DBB_bugcheck)) { // Check for any pending transactions - purge_transactions(tdbb, attachment, forcedPurge); + purge_transactions(tdbb, attachment, nocheckPurge); } } catch (const Exception&) { - if (!forcedPurge) + if (!nocheckPurge) { attachment->att_flags &= ~ATT_purge_started; throw; @@ -7236,7 +7242,7 @@ } static void unwindAttach(thread_db* tdbb, const Exception& ex, IStatus* userStatus, - Jrd::Attachment* attachment, Database* dbb) + Jrd::Attachment* attachment, Database* dbb, unsigned internalFlags) { RefDeb(DEB_RLS_JATT, "unwindAttach"); RefDeb(DEB_AR_JATT, "unwindAttach"); @@ -7278,7 +7284,8 @@ sAtt->release(); } - JRD_shutdown_database(dbb, SHUT_DBB_RELEASE_POOLS); + JRD_shutdown_database(dbb, SHUT_DBB_RELEASE_POOLS | + (internalFlags & INTERNAL_ATT_OVERWRITE_CHECK ? SHUT_DBB_OVERWRITE_CHECK : 0)); } } catch (const Exception&) Modified: firebird/trunk/src/jrd/jrd_proto.h =================================================================== --- firebird/trunk/src/jrd/jrd_proto.h 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/jrd/jrd_proto.h 2015-03-04 16:18:53 UTC (rev 60829) @@ -79,7 +79,8 @@ bool JRD_shutdown_database(Jrd::Database* dbb, const unsigned flags = 0); // JRD_shutdown_database() flags -static const unsigned SHUT_DBB_RELEASE_POOLS = 0x01; -static const unsigned SHUT_DBB_LINGER = 0x02; +static const unsigned SHUT_DBB_RELEASE_POOLS = 0x01; +static const unsigned SHUT_DBB_LINGER = 0x02; +static const unsigned SHUT_DBB_OVERWRITE_CHECK = 0x04; #endif /* JRD_JRD_PROTO_H */ Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/jrd/svc.cpp 2015-03-04 16:18:53 UTC (rev 60829) @@ -189,35 +189,41 @@ using namespace Jrd; -Service::SafeMutexLock::SafeMutexLock(Service* svc, const char* f) - : from(f) +Service::Validate::Validate(Service* svc) + : sharedGuard(globalServicesMutex, FB_FUNCTION) { - MutexLockGuard guard(globalServicesMutex, FB_FUNCTION); + sharedGuard.enter(); - if (! svc->locateInAllServices()) + if (!svc->locateInAllServices()) { // Service is so old that it's even missing in allServices array Arg::Gds(isc_bad_svc_handle).raise(); } // Appears we have correct service object, may use it later to lock mutex - jSvc = svc->jSvc; } +Service::SafeMutexLock::SafeMutexLock(Service* svc, const char* f) + : Validate(svc), + existenceMutex(svc->svc_existence), + from(f) +{ + sharedGuard.leave(); +} + bool Service::SafeMutexLock::lock() { - jSvc->mutex.enter(from); - return jSvc->svc; + existenceMutex->enter(from); + return existenceMutex->link; } Service::ExistenceGuard::ExistenceGuard(Service* svc, const char* from) : SafeMutexLock(svc, from) { - bool lck = lock(); - if (!lck) + if (!lock()) { // could not lock service - jSvc->mutex.leave(); + existenceMutex->leave(); Arg::Gds(isc_bad_svc_handle).raise(); } } @@ -226,7 +232,7 @@ { try { - jSvc->mutex.leave(); + existenceMutex->leave(); } catch (const Exception&) { @@ -237,7 +243,7 @@ Service::UnlockGuard::UnlockGuard(Service* svc, const char* from) : SafeMutexLock(svc, from), locked(false), doLock(false) { - jSvc->mutex.leave(); + existenceMutex->leave(); doLock = true; } @@ -744,6 +750,7 @@ svc_command_line(getPool()), svc_network_protocol(getPool()), svc_remote_address(getPool()), svc_remote_process(getPool()), svc_remote_pid(0), svc_trace_manager(NULL), svc_crypt_callback(crypt_callback), + svc_existence(FB_NEW(*getDefaultMemoryPool()) SvcMutex(this)), svc_stdin_size_requested(0), svc_stdin_buffer(NULL), svc_stdin_size_preload(0), svc_stdin_preload_requested(0), svc_stdin_user_size(0) { @@ -952,8 +959,8 @@ delete svc_trace_manager; svc_trace_manager = NULL; - fb_assert(jSvc->mutex.locked()); - jSvc->svc = NULL; + fb_assert(svc_existence->locked()); + svc_existence->link = NULL; } @@ -1985,7 +1992,7 @@ try { Service* svc = (Service*)arg; - RefPtr<JService> ref(svc->jSvc); + RefPtr<SvcMutex> ref(svc->svc_existence); int exit_code = svc->svc_service_run->serv_thd(svc); svc->started(); Modified: firebird/trunk/src/jrd/svc.h =================================================================== --- firebird/trunk/src/jrd/svc.h 2015-03-04 16:01:10 UTC (rev 60828) +++ firebird/trunk/src/jrd/svc.h 2015-03-04 16:18:53 UTC (rev 60829) @@ -39,6 +39,7 @@ #include "../jrd/EngineInterface.h" #include "../common/classes/Switches.h" #include "../common/classes/ClumpletReader.h" +#include "../common/classes/RefMutex.h" #include "../burp/split/spit.h" // forward decl. @@ -309,21 +310,38 @@ Firebird::Semaphore svc_detach_sem; - JService* jSvc; + class SvcMutex : public Firebird::RefMutex + { + public: + explicit SvcMutex(Service* svc) + : link(svc) + { } + Service* link; + }; + + Firebird::RefPtr<SvcMutex> svc_existence; + private: StatusStringsHelper svc_thread_strings; Firebird::Semaphore svc_sem_empty, svc_sem_full; - class SafeMutexLock + class Validate { public: + explicit Validate(Service* svc); + Firebird::MutexEnsureUnlock sharedGuard; + }; + + class SafeMutexLock : private Validate + { + public: SafeMutexLock(Service* svc, const char* f); bool lock(); protected: - Firebird::RefPtr<JService> jSvc; + Firebird::RefPtr<SvcMutex> existenceMutex; const char* from; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2015-03-13 15:31:16
|
Revision: 60983 http://sourceforge.net/p/firebird/code/60983 Author: robocop Date: 2015-03-13 15:31:14 +0000 (Fri, 13 Mar 2015) Log Message: ----------- rdb$system_flag is not nullable in FB3. Modified Paths: -------------- firebird/trunk/src/dsql/metd.epp firebird/trunk/src/jrd/scl.epp Modified: firebird/trunk/src/dsql/metd.epp =================================================================== --- firebird/trunk/src/dsql/metd.epp 2015-03-13 15:30:23 UTC (rev 60982) +++ firebird/trunk/src/dsql/metd.epp 2015-03-13 15:31:14 UTC (rev 60983) @@ -91,7 +91,7 @@ FOR(REQUEST_HANDLE handle TRANSACTION_HANDLE transaction) R IN RDB$RELATIONS WITH R.RDB$RELATION_NAME EQ relName AND - R.RDB$SYSTEM_FLAG EQUIV 1 + R.RDB$SYSTEM_FLAG EQ 1 { rc = true; } @@ -108,7 +108,7 @@ FOR(REQUEST_HANDLE handle TRANSACTION_HANDLE transaction) R IN RDB$FIELDS WITH R.RDB$FIELD_NAME EQ fldName AND - R.RDB$SYSTEM_FLAG EQUIV 1 + R.RDB$SYSTEM_FLAG EQ 1 { rc = true; } Modified: firebird/trunk/src/jrd/scl.epp =================================================================== --- firebird/trunk/src/jrd/scl.epp 2015-03-13 15:30:23 UTC (rev 60982) +++ firebird/trunk/src/jrd/scl.epp 2015-03-13 15:31:14 UTC (rev 60983) @@ -1035,7 +1035,6 @@ FOR(REQUEST_HANDLE request) R IN RDB$ROLES WITH R.RDB$ROLE_NAME EQ sql_role - AND R.RDB$SYSTEM_FLAG NOT MISSING AND R.RDB$SYSTEM_FLAG != 0 { adminRole = true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2015-03-17 21:45:02
|
Revision: 60999 http://sourceforge.net/p/firebird/code/60999 Author: asfernandes Date: 2015-03-17 21:44:55 +0000 (Tue, 17 Mar 2015) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp firebird/trunk/src/jrd/Record.h firebird/trunk/src/jrd/pcmet.epp firebird/trunk/src/jrd/vio.cpp firebird/trunk/src/msgs/facilities2.sql firebird/trunk/src/remote/server/server.cpp firebird/trunk/src/yvalve/MasterImplementation.cpp firebird/trunk/src/yvalve/why.cpp Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2015-03-17 21:44:55 UTC (rev 60999) @@ -765,6 +765,7 @@ extern "C" void FB_PLUGIN_ENTRY_POINT(Firebird::IMaster* master) { Firebird::CachedMasterInterface::set(master); - Firebird::PluginManagerInterfacePtr()->registerPluginFactory(Firebird::IPluginManager::TYPE_AUTH_USER_MANAGEMENT, "Legacy_UserManager", &factory); + Firebird::PluginManagerInterfacePtr()->registerPluginFactory( + Firebird::IPluginManager::TYPE_AUTH_USER_MANAGEMENT, "Legacy_UserManager", &factory); Firebird::getUnloadDetector()->registerMe(); } Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-17 21:44:55 UTC (rev 60999) @@ -563,7 +563,8 @@ void registerLegacyServer(Firebird::IPluginManager* iPlugin) { - iPlugin->registerPluginFactory(Firebird::IPluginManager::TYPE_AUTH_SERVER, "Legacy_Auth", &factory); + iPlugin->registerPluginFactory(Firebird::IPluginManager::TYPE_AUTH_SERVER, + "Legacy_Auth", &factory); } } // namespace Auth Modified: firebird/trunk/src/jrd/Record.h =================================================================== --- firebird/trunk/src/jrd/Record.h 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/jrd/Record.h 2015-03-17 21:44:55 UTC (rev 60999) @@ -231,4 +231,3 @@ } // namespace #endif // JRD_RECORD_H - Modified: firebird/trunk/src/jrd/pcmet.epp =================================================================== --- firebird/trunk/src/jrd/pcmet.epp 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/jrd/pcmet.epp 2015-03-17 21:44:55 UTC (rev 60999) @@ -178,7 +178,7 @@ fb_assert(id <= dbb->dbb_max_idx); idx.idx_id = id; IDX_create_index(tdbb, relation, &idx, name.c_str(), &id, transaction, selectivity); - + fb_assert(id == idx.idx_id); } catch (const Exception&) Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/jrd/vio.cpp 2015-03-17 21:44:55 UTC (rev 60999) @@ -1943,7 +1943,8 @@ // Set the active flag on an inactive garbage collect record block and return it for (Record** iter = relation->rel_gc_records.begin(); - iter != relation->rel_gc_records.end(); ++iter) + iter != relation->rel_gc_records.end(); + ++iter) { Record* const record = *iter; fb_assert(record); @@ -3648,6 +3649,7 @@ RecordBitmap::Accessor accessor(action->vct_records); if (accessor.getFirst()) + { do { rpb.rpb_number.setValue(accessor.current()); @@ -3727,6 +3729,7 @@ } } } while (accessor.getNext()); + } } else { @@ -3734,6 +3737,7 @@ RecordBitmap::Accessor accessor(action->vct_records); if (accessor.getFirst()) + { do { rpb.rpb_number.setValue(accessor.current()); if (!action->vct_undo || @@ -3761,6 +3765,7 @@ verb_post(tdbb, transaction, &rpb, record, same_tx, new_ver); } } while (accessor.getNext()); + } } delete rpb.rpb_record; Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/msgs/facilities2.sql 2015-03-17 21:44:55 UTC (rev 60999) @@ -2,7 +2,7 @@ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?); -- ('2015-02-02 12:30:00', 'JRD', 0, 783) -('2012-01-23 20:10:30', 'QLI', 1, 533) +('2015-03-17 18:33:00', 'QLI', 1, 533) ('2015-01-07 18:01:51', 'GFIX', 3, 134) ('1996-11-07 13:39:40', 'GPRE', 4, 1) ('2012-08-27 21:26:00', 'DSQL', 7, 33) Modified: firebird/trunk/src/remote/server/server.cpp =================================================================== --- firebird/trunk/src/remote/server/server.cpp 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/remote/server/server.cpp 2015-03-17 21:44:55 UTC (rev 60999) @@ -3220,7 +3220,8 @@ this->port_statement->rsr_format = this->port_statement->rsr_select_format; sendL->p_operation = op_sql_response; - sendL->p_sqldata.p_sqldata_messages = ((status_vector.getState() & Firebird::IStatus::STATE_ERRORS) || !out_msg) ? 0 : 1; + sendL->p_sqldata.p_sqldata_messages = + ((status_vector.getState() & Firebird::IStatus::STATE_ERRORS) || !out_msg) ? 0 : 1; this->send_partial(sendL); } @@ -3356,7 +3357,8 @@ { fb_assert(statement->rsr_msgs_waiting == 0); - rc = statement->rsr_cursor->fetchNext(&status_vector, message->msg_buffer) == IStatus::RESULT_OK; + rc = statement->rsr_cursor->fetchNext( + &status_vector, message->msg_buffer) == IStatus::RESULT_OK; statement->rsr_flags.set(Rsr::FETCHED); @@ -3435,7 +3437,9 @@ next = message; } - rc = statement->rsr_cursor->fetchNext(&status_vector, message->msg_buffer) == IStatus::RESULT_OK; + rc = statement->rsr_cursor->fetchNext( + &status_vector, message->msg_buffer) == IStatus::RESULT_OK; + if (status_vector.getState() & Firebird::IStatus::STATE_ERRORS) { // If already have an error queued, don't overwrite it @@ -5408,8 +5412,12 @@ PathName plugName(crypt->p_plugin.cstr_address, crypt->p_plugin.cstr_length); // Check it's availability Remote::ParsedList plugins; - REMOTE_parseList(plugins, Config::getDefaultConfig()->getPlugins(IPluginManager::TYPE_WIRE_CRYPT)); + + REMOTE_parseList(plugins, Config::getDefaultConfig()->getPlugins( + IPluginManager::TYPE_WIRE_CRYPT)); + bool found = false; + for (unsigned n = 0; n < plugins.getCount(); ++n) { if (plugins[n] == plugName) Modified: firebird/trunk/src/yvalve/MasterImplementation.cpp =================================================================== --- firebird/trunk/src/yvalve/MasterImplementation.cpp 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/yvalve/MasterImplementation.cpp 2015-03-17 21:44:55 UTC (rev 60999) @@ -379,7 +379,8 @@ } }; - typedef Firebird::SortedArray<ThreadBuffer*, EmptyStorage<ThreadBuffer*>, ThreadId, ThreadBuffer> ProcessBuffer; + typedef Firebird::SortedArray<ThreadBuffer*, + EmptyStorage<ThreadBuffer*>, ThreadId, ThreadBuffer> ProcessBuffer; ProcessBuffer processBuffer; Firebird::Mutex mutex; Modified: firebird/trunk/src/yvalve/why.cpp =================================================================== --- firebird/trunk/src/yvalve/why.cpp 2015-03-17 09:16:45 UTC (rev 60998) +++ firebird/trunk/src/yvalve/why.cpp 2015-03-17 21:44:55 UTC (rev 60999) @@ -2072,8 +2072,11 @@ RefPtr<YAttachment> attachment(translateHandle(attachments, handle)); attachment->dropDatabase(&statusWrapper); - if ((!(status.getState() & Firebird::IStatus::STATE_ERRORS)) || status[1] == isc_drdb_completed_with_errs) + if ((!(status.getState() & Firebird::IStatus::STATE_ERRORS)) || + status[1] == isc_drdb_completed_with_errs) + { *handle = 0; + } } catch (const Exception& e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2015-03-18 02:03:27
|
Revision: 61002 http://sourceforge.net/p/firebird/code/61002 Author: asfernandes Date: 2015-03-18 02:03:25 +0000 (Wed, 18 Mar 2015) Log Message: ----------- Added IUtil::formatStatus. Modified Paths: -------------- firebird/trunk/src/include/firebird/FirebirdInterface.idl firebird/trunk/src/include/firebird/IdlFbInterfaces.h firebird/trunk/src/yvalve/YObjects.h firebird/trunk/src/yvalve/utl.cpp Modified: firebird/trunk/src/include/firebird/FirebirdInterface.idl =================================================================== --- firebird/trunk/src/include/firebird/FirebirdInterface.idl 2015-03-18 00:20:33 UTC (rev 61001) +++ firebird/trunk/src/include/firebird/FirebirdInterface.idl 2015-03-18 02:03:25 UTC (rev 61002) @@ -916,6 +916,7 @@ void decodeTime(ISC_TIME time, uint* hours, uint* minutes, uint* seconds, uint* fractions); ISC_DATE encodeDate(uint year, uint month, uint day); ISC_TIME encodeTime(uint hours, uint minutes, uint seconds, uint fractions); + uint formatStatus(string buffer, uint bufferSize, Status status); } // Database trace objects Modified: firebird/trunk/src/include/firebird/IdlFbInterfaces.h =================================================================== --- firebird/trunk/src/include/firebird/IdlFbInterfaces.h 2015-03-18 00:20:33 UTC (rev 61001) +++ firebird/trunk/src/include/firebird/IdlFbInterfaces.h 2015-03-18 02:03:25 UTC (rev 61002) @@ -3269,6 +3269,7 @@ void (CLOOP_CARG *decodeTime)(IUtil* self, ISC_TIME time, unsigned* hours, unsigned* minutes, unsigned* seconds, unsigned* fractions) throw(); ISC_DATE (CLOOP_CARG *encodeDate)(IUtil* self, unsigned year, unsigned month, unsigned day) throw(); ISC_TIME (CLOOP_CARG *encodeTime)(IUtil* self, unsigned hours, unsigned minutes, unsigned seconds, unsigned fractions) throw(); + unsigned (CLOOP_CARG *formatStatus)(IUtil* self, char* buffer, unsigned bufferSize, IStatus* status) throw(); }; protected: @@ -3336,6 +3337,12 @@ ISC_TIME ret = static_cast<VTable*>(this->cloopVTable)->encodeTime(this, hours, minutes, seconds, fractions); return ret; } + + unsigned formatStatus(char* buffer, unsigned bufferSize, IStatus* status) + { + unsigned ret = static_cast<VTable*>(this->cloopVTable)->formatStatus(this, buffer, bufferSize, status); + return ret; + } }; class ITraceConnection : public IVersioned @@ -11845,6 +11852,7 @@ this->decodeTime = &Name::cloopdecodeTimeDispatcher; this->encodeDate = &Name::cloopencodeDateDispatcher; this->encodeTime = &Name::cloopencodeTimeDispatcher; + this->formatStatus = &Name::cloopformatStatusDispatcher; } } vTable; @@ -11971,6 +11979,19 @@ return static_cast<ISC_TIME>(0); } } + + static unsigned CLOOP_CARG cloopformatStatusDispatcher(IUtil* self, char* buffer, unsigned bufferSize, IStatus* status) throw() + { + try + { + return static_cast<Name*>(self)->Name::formatStatus(buffer, bufferSize, status); + } + catch (...) + { + StatusType::catchException(0); + return static_cast<unsigned>(0); + } + } }; template <typename Name, typename StatusType, typename Base = IVersionedImpl<Name, StatusType, Inherit<IUtil> > > @@ -11995,6 +12016,7 @@ virtual void decodeTime(ISC_TIME time, unsigned* hours, unsigned* minutes, unsigned* seconds, unsigned* fractions) = 0; virtual ISC_DATE encodeDate(unsigned year, unsigned month, unsigned day) = 0; virtual ISC_TIME encodeTime(unsigned hours, unsigned minutes, unsigned seconds, unsigned fractions) = 0; + virtual unsigned formatStatus(char* buffer, unsigned bufferSize, IStatus* status) = 0; }; template <typename Name, typename StatusType, typename Base> Modified: firebird/trunk/src/yvalve/YObjects.h =================================================================== --- firebird/trunk/src/yvalve/YObjects.h 2015-03-18 00:20:33 UTC (rev 61001) +++ firebird/trunk/src/yvalve/YObjects.h 2015-03-18 02:03:25 UTC (rev 61002) @@ -561,6 +561,7 @@ unsigned* hours, unsigned* minutes, unsigned* seconds, unsigned* fractions); ISC_DATE encodeDate(unsigned year, unsigned month, unsigned day); ISC_TIME encodeTime(unsigned hours, unsigned minutes, unsigned seconds, unsigned fractions); + unsigned formatStatus(char* buffer, unsigned bufferSize, Firebird::IStatus* status); }; } // namespace Why Modified: firebird/trunk/src/yvalve/utl.cpp =================================================================== --- firebird/trunk/src/yvalve/utl.cpp 2015-03-18 00:20:33 UTC (rev 61001) +++ firebird/trunk/src/yvalve/utl.cpp 2015-03-18 02:03:25 UTC (rev 61002) @@ -687,6 +687,37 @@ return time; } +unsigned UtilInterface::formatStatus(char* buffer, unsigned bufferSize, IStatus* status) +{ + unsigned state = status->getState(); + unsigned states[] = {IStatus::STATE_ERRORS, IStatus::STATE_WARNINGS}; + const ISC_STATUS* vectors[] = {status->getErrors(), status->getWarnings()}; + string s; + + for (int i = 0; i < 2; ++i) + { + if (state & states[i]) + { + const ISC_STATUS* vector = vectors[i]; + SLONG n; + + while ((n = fb_interpret(buffer, bufferSize, &vector)) != 0) + { + if (!s.empty()) + s += "\n-"; + + s += string(buffer, n); + } + } + } + + unsigned ret = MIN((unsigned) s.length(), bufferSize); + + strncpy(buffer, s.c_str(), ret); + + return ret; +} + } // namespace Why This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-03-20 18:02:46
|
Revision: 61033 http://sourceforge.net/p/firebird/code/61033 Author: alexpeshkoff Date: 2015-03-20 18:02:30 +0000 (Fri, 20 Mar 2015) Log Message: ----------- Avoid limits on size of status vector in engine. Ensure that status is always clean on entry to interface methods. Modified Paths: -------------- firebird/trunk/src/auth/AuthDbg.cpp firebird/trunk/src/auth/SecureRemotePassword/Message.h firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp firebird/trunk/src/common/MsgMetadata.cpp firebird/trunk/src/common/StatementMetadata.cpp firebird/trunk/src/common/StatusArg.cpp firebird/trunk/src/common/StatusArg.h firebird/trunk/src/common/StatusHolder.cpp firebird/trunk/src/common/StatusHolder.h firebird/trunk/src/common/UtilSvc.cpp firebird/trunk/src/common/UtilSvc.h firebird/trunk/src/common/classes/GetPlugins.h firebird/trunk/src/common/fb_exception.cpp firebird/trunk/src/common/isc.cpp firebird/trunk/src/common/isc_proto.h firebird/trunk/src/common/sdl.cpp firebird/trunk/src/common/sdl_proto.h firebird/trunk/src/common/utils.cpp firebird/trunk/src/common/utils_proto.h firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/dsql/errd.cpp firebird/trunk/src/dsql/errd_proto.h firebird/trunk/src/dsql/utld.cpp firebird/trunk/src/dsql/utld_proto.h firebird/trunk/src/include/fb_exception.h firebird/trunk/src/include/fb_types.h firebird/trunk/src/include/firebird/FirebirdInterface.idl firebird/trunk/src/include/firebird/IdlFbInterfaces.h firebird/trunk/src/include/firebird/Interface.h firebird/trunk/src/isql/isql.epp firebird/trunk/src/jrd/CryptoManager.cpp firebird/trunk/src/jrd/CryptoManager.h firebird/trunk/src/jrd/Database.cpp firebird/trunk/src/jrd/DbCreators.cpp firebird/trunk/src/jrd/ExtEngineManager.cpp firebird/trunk/src/jrd/GlobalRWLock.cpp firebird/trunk/src/jrd/Mapping.cpp firebird/trunk/src/jrd/Routine.cpp firebird/trunk/src/jrd/blob_filter.cpp firebird/trunk/src/jrd/cch.cpp firebird/trunk/src/jrd/cch_proto.h firebird/trunk/src/jrd/dfw.epp firebird/trunk/src/jrd/err.cpp firebird/trunk/src/jrd/err_proto.h firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/exe.h firebird/trunk/src/jrd/extds/ExtDS.cpp firebird/trunk/src/jrd/extds/ExtDS.h firebird/trunk/src/jrd/extds/InternalDS.cpp firebird/trunk/src/jrd/extds/InternalDS.h firebird/trunk/src/jrd/extds/IscDS.cpp firebird/trunk/src/jrd/extds/IscDS.h firebird/trunk/src/jrd/fun.epp firebird/trunk/src/jrd/idx.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/jrd.h firebird/trunk/src/jrd/nbak.cpp firebird/trunk/src/jrd/nbak.h firebird/trunk/src/jrd/os/pio_proto.h firebird/trunk/src/jrd/os/posix/unix.cpp firebird/trunk/src/jrd/os/win32/winnt.cpp firebird/trunk/src/jrd/pag.cpp firebird/trunk/src/jrd/par.cpp firebird/trunk/src/jrd/status.h firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/jrd/svc.h firebird/trunk/src/jrd/tra.cpp firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp firebird/trunk/src/jrd/trace/TraceManager.cpp firebird/trunk/src/jrd/trace/TraceObjects.cpp firebird/trunk/src/jrd/trace/TraceObjects.h firebird/trunk/src/jrd/validation.cpp firebird/trunk/src/jrd/vio.cpp firebird/trunk/src/plugins/udr_engine/UdrEngine.cpp firebird/trunk/src/remote/client/BlrFromMessage.cpp firebird/trunk/src/remote/client/interface.cpp firebird/trunk/src/remote/inet.cpp firebird/trunk/src/remote/server/server.cpp firebird/trunk/src/yvalve/PluginManager.cpp firebird/trunk/src/yvalve/utl.cpp Added Paths: ----------- firebird/trunk/src/common/DynamicStrings.cpp firebird/trunk/src/common/DynamicStrings.h Removed Paths: ------------- firebird/trunk/src/jrd/status.cpp Modified: firebird/trunk/src/auth/AuthDbg.cpp =================================================================== --- firebird/trunk/src/auth/AuthDbg.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/auth/AuthDbg.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -56,7 +56,8 @@ DebugServer::DebugServer(Firebird::IPluginConfig* pConf) : str(getPool()) { - Firebird::LocalStatus s; + Firebird::LocalStatus ls; + Firebird::CheckStatusWrapper s(&ls); config.assignRefNoIncr(pConf->getDefaultConfig(&s)); check(&s); } @@ -96,7 +97,8 @@ #ifdef AUTH_VERBOSE fprintf(stderr, "DebugServer::authenticate2: %s\n", str.c_str()); #endif - Firebird::LocalStatus s; + Firebird::LocalStatus ls; + Firebird::CheckStatusWrapper s(&ls); writerInterface->add(&s, str.c_str()); check(&s); str.erase(); Modified: firebird/trunk/src/auth/SecureRemotePassword/Message.h =================================================================== --- firebird/trunk/src/auth/SecureRemotePassword/Message.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/auth/SecureRemotePassword/Message.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -26,7 +26,8 @@ public: Meta(Firebird::IStatement* stmt, bool out) { - Firebird::LocalStatus st; + Firebird::LocalStatus ls; + Firebird::CheckStatusWrapper st(&ls); Firebird::IMessageMetadata* m = out ? stmt->getOutputMetadata(&st) : stmt->getInputMetadata(&st); if (st.getState() & Firebird::IStatus::STATE_ERRORS) { Modified: firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp =================================================================== --- firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/auth/SecureRemotePassword/manage/SrpManagement.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -260,7 +260,8 @@ if (att) { // detach from database - Firebird::LocalStatus lStatus; + Firebird::LocalStatus ls; + Firebird::CheckStatusWrapper lStatus(&ls); att->detach(&lStatus); att = NULL; } Modified: firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp =================================================================== --- firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -57,7 +57,8 @@ verifier(getPool()), salt(getPool()), sessionKey(getPool()), secDbName(NULL) { - Firebird::LocalStatus s; + LocalStatus ls; + CheckStatusWrapper s(&ls); config.assignRefNoIncr(par->getFirebirdConf(&s)); check(&s); } @@ -198,7 +199,8 @@ } catch(const Exception&) { - LocalStatus s; + LocalStatus ls; + CheckStatusWrapper s(&ls); if (stmt) stmt->free(&s); if (tra) tra->rollback(&s); Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -371,7 +371,8 @@ } } - LocalStatus s; + LocalStatus ls; + CheckStatusWrapper s(&ls); authBlock->add(&s, login.c_str()); check(&s); authBlock->setDb(&s, secureDbName); @@ -447,7 +448,8 @@ { if (curInstances[i]) { - LocalStatus s; + LocalStatus ls; + CheckStatusWrapper s(&ls); TimerInterfacePtr()->stop(&s, curInstances[i]); check(&s); curInstances[i]->release(); @@ -483,7 +485,8 @@ { PathName secDbName; { // config scope - LocalStatus s; + LocalStatus ls; + CheckStatusWrapper s(&ls); RefPtr<IFirebirdConf> config(REF_NO_INCR, iParameter->getFirebirdConf(&s)); check(&s); @@ -526,7 +529,8 @@ int rc = instance->verify(writerInterface, sBlock); #define USE_ATT_RQ_CACHE #ifdef USE_ATT_RQ_CACHE - LocalStatus s; + LocalStatus ls; + CheckStatusWrapper s(&ls); TimerInterfacePtr()->start(&s, instance, 10 * 1000 * 1000); if (s.getState() & IStatus::STATE_ERRORS) instance->handler(); Added: firebird/trunk/src/common/DynamicStrings.cpp =================================================================== --- firebird/trunk/src/common/DynamicStrings.cpp (rev 0) +++ firebird/trunk/src/common/DynamicStrings.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -0,0 +1,143 @@ +/* + * PROGRAM: Firebird exceptions classes + * MODULE: StatusHolder.cpp + * DESCRIPTION: Firebird's exception classes + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. + * See the License for the specific language governing rights + * and limitations under the License. + * + * The Original Code was created by Vlad Khorsun + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2007 Vlad Khorsun <hvlad at users.sourceforge.net> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * + * + */ + +#include "firebird.h" + +#include "DynamicStrings.h" +#include "utils_proto.h" +#include "gen/iberror.h" +#include "classes/alloc.h" + +#include <string.h> + +namespace Firebird { + +unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src) throw(BadAlloc) +{ + const ISC_STATUS* end = &src[length]; + + // allocate space for strings + size_t len = 0; + for (const ISC_STATUS* from = src; from < end; ++from) + { + const ISC_STATUS type = *from++; + if (from == end || type == isc_arg_end) + { + end = from - 1; + break; + } + + switch (type) + { + case isc_arg_cstring: + if (from + 1 >= end) + { + end = from - 1; + break; + } + len += *from++; + len++; + break; + + case isc_arg_string: + case isc_arg_interpreted: + case isc_arg_sql_state: + len += strlen(reinterpret_cast<const char*>(*from)); + len++; + break; + } + } + + char* string = len ? FB_NEW(*getDefaultMemoryPool()) char[len] : NULL; + ISC_STATUS* to = dst; + + // copy status vector saving strings in local buffer + for (const ISC_STATUS* from = src; from < end; ++from) + { + const ISC_STATUS type = *from++; + *to++ = type == isc_arg_cstring ? isc_arg_string : type; + + switch (type) + { + case isc_arg_cstring: + fb_assert(string); + *to++ = (ISC_STATUS)(IPTR) string; + memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]); + string += *from++; + *string++ = 0; + break; + + case isc_arg_string: + case isc_arg_interpreted: + case isc_arg_sql_state: + fb_assert(string); + *to++ = (ISC_STATUS)(IPTR) string; + strcpy(string, reinterpret_cast<const char*>(*from)); + string += strlen(string); + string++; + break; + + default: + *to++ = *from; + break; + } + } + + *to++ = isc_arg_end; + return (to - dst) - 1; +} + +char* freeDynamicStrings(unsigned length, ISC_STATUS* ptr) throw() +{ + while (length--) + { + const ISC_STATUS type = *ptr++; + if (type == isc_arg_end) + break; + + switch (type) + { + case isc_arg_cstring: + fb_assert(false); // CVC: according to the new logic, this case cannot happen + ptr++; + + case isc_arg_string: + case isc_arg_interpreted: + case isc_arg_sql_state: + return reinterpret_cast<char*>(*ptr); + + default: + ptr++; + break; + } + } + return NULL; +} + + +} // namespace Firebird Property changes on: firebird/trunk/src/common/DynamicStrings.cpp ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-c++src \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: firebird/trunk/src/common/DynamicStrings.h =================================================================== --- firebird/trunk/src/common/DynamicStrings.h (rev 0) +++ firebird/trunk/src/common/DynamicStrings.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -0,0 +1,44 @@ +/* + * PROGRAM: Firebird status vector support. + * MODULE: DynamicStrings.h + * DESCRIPTION: Dynamically store strings in status vector. + * + * The contents of this file are subject to the Initial + * Developer's Public License Version 1.0 (the "License"); + * you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_idpl. + * + * Software distributed under the License is distributed AS IS, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. + * See the License for the specific language governing rights + * and limitations under the License. + * + * The Original Code was created by Alex Peshkov + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2015 Alex Peshkov <peshkoff at mail dot ru> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + * + * + */ + +#ifndef FB_DYNAMIC_STRINGS +#define FB_DYNAMIC_STRINGS + +#include "firebird/Interface.h" + +namespace Firebird { + +class BadAlloc; + +unsigned makeDynamicStrings(unsigned len, ISC_STATUS* const dst, const ISC_STATUS* const src) throw(BadAlloc); +char* freeDynamicStrings(unsigned len, ISC_STATUS* ptr) throw(); + +} // namespace Firebird + + +#endif // FB_DYNAMIC_STRINGS Property changes on: firebird/trunk/src/common/DynamicStrings.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/x-chdr \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Modified: firebird/trunk/src/common/MsgMetadata.cpp =================================================================== --- firebird/trunk/src/common/MsgMetadata.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/MsgMetadata.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -329,7 +329,8 @@ void MsgMetadata::assign(IMessageMetadata* from) { - LocalStatus status; + LocalStatus ls; + CheckStatusWrapper status(&ls); unsigned count = from->getCount(&status); check(&status); Modified: firebird/trunk/src/common/StatementMetadata.cpp =================================================================== --- firebird/trunk/src/common/StatementMetadata.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/StatementMetadata.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -426,9 +426,10 @@ void StatementMetadata::getAndParse(unsigned itemsLength, const UCHAR* items, unsigned bufferLength, UCHAR* buffer) { - LocalStatus status; + LocalStatus ls; + CheckStatusWrapper status(&ls); statement->getInfo(&status, itemsLength, items, bufferLength, buffer); - status.check(); + ls.check(); parse(bufferLength, buffer); } Modified: firebird/trunk/src/common/StatusArg.cpp =================================================================== --- firebird/trunk/src/common/StatusArg.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/StatusArg.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -58,7 +58,9 @@ { } -StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) throw() : Base::ImplBase(0, 0) +StatusVector::ImplStatusVector::ImplStatusVector(const ISC_STATUS* s) throw() + : Base::ImplBase(0, 0), + m_status_vector(*getDefaultMemoryPool()) { fb_assert(s); @@ -66,27 +68,26 @@ // special case - empty initialized status vector, no warnings if (s[0] != isc_arg_gds || s[1] != 0 || s[2] != 0) - { - append(s, FB_NELEM(m_status_vector) - 1); - } + append(s); } -StatusVector::ImplStatusVector::ImplStatusVector(const IStatus* s) throw() : - Base::ImplBase(0, 0) +StatusVector::ImplStatusVector::ImplStatusVector(const IStatus* s) throw() + : Base::ImplBase(0, 0), + m_status_vector(*getDefaultMemoryPool()) { fb_assert(s); clear(); if (s->getState() & IStatus::STATE_ERRORS) - append(s->getErrors(), FB_NELEM(m_status_vector) - 1); - + append(s->getErrors()); if (s->getState() & IStatus::STATE_WARNINGS) - append(s->getWarnings(), FB_NELEM(m_status_vector) - 1); + append(s->getWarnings()); } -StatusVector::ImplStatusVector::ImplStatusVector(const Exception& ex) throw() : - Base::ImplBase(0, 0) +StatusVector::ImplStatusVector::ImplStatusVector(const Exception& ex) throw() + : Base::ImplBase(0, 0), + m_status_vector(*getDefaultMemoryPool()) { assign(ex); } @@ -119,20 +120,19 @@ void StatusVector::ImplStatusVector::clear() throw() { - m_length = 0; m_warning = 0; - m_status_vector[0] = isc_arg_end; + m_status_vector.clear(); + m_status_vector.push(isc_arg_end); } bool StatusVector::ImplStatusVector::compare(const StatusVector& v) const throw() { - return m_length == v.length() && - memcmp(m_status_vector, v.value(), m_length * sizeof(ISC_STATUS)) == 0; + return length() == v.length() && fb_utils::cmpStatus(length(), value(), v.value()); } void StatusVector::ImplStatusVector::makePermanent() throw() { - makePermanentVector(m_status_vector); + makePermanentVector(m_status_vector.begin()); } void StatusVector::ImplStatusVector::assign(const StatusVector& v) throw() @@ -143,9 +143,8 @@ void StatusVector::ImplStatusVector::assign(const Exception& ex) throw() { - clear(); - ex.stuff_exception(m_status_vector); - m_length = fb_utils::statusLength(m_status_vector); + m_status_vector.clear(); + ex.stuffException(m_status_vector); } void StatusVector::ImplStatusVector::append(const StatusVector& v) throw() @@ -195,17 +194,20 @@ bool StatusVector::ImplStatusVector::append(const ISC_STATUS* const from, const unsigned int count) throw() { // CVC: I didn't expect count to be zero but it's, in some calls - fb_assert(count >= 0 && count <= ISC_STATUS_LENGTH); + fb_assert(count >= 0); if (!count) return true; // not sure it's the best option here + unsigned lenBefore = length(); + ISC_STATUS* s = m_status_vector.getBuffer(lenBefore + count + 1); unsigned int copied = - fb_utils::copyStatus(&m_status_vector[m_length], FB_NELEM(m_status_vector) - m_length, from, count); - m_length += copied; + fb_utils::copyStatus(&s[lenBefore], count + 1, from, count); + if (copied < count) + m_status_vector.shrink(lenBefore + copied + 1); if (!m_warning) { - for (unsigned n = 0; n < m_length; ) + for (unsigned n = 0; n < length(); ) { if (m_status_vector[n] == isc_arg_warning) { @@ -219,19 +221,22 @@ return copied == count; } +void StatusVector::ImplStatusVector::append(const ISC_STATUS* const from) throw() +{ + unsigned l = fb_utils::statusLength(from); + append(from, l + 1); +} + void StatusVector::ImplStatusVector::shiftLeft(const Base& arg) throw() { - if (m_length < FB_NELEM(m_status_vector) - 2) - { - m_status_vector[m_length++] = arg.getKind(); - m_status_vector[m_length++] = arg.getCode(); - m_status_vector[m_length] = isc_arg_end; - } + m_status_vector[length()] = arg.getKind(); + m_status_vector.push(arg.getCode()); + m_status_vector.push(isc_arg_end); } void StatusVector::ImplStatusVector::shiftLeft(const Warning& arg) throw() { - const int cur = m_warning ? 0 : m_length; + const int cur = m_warning ? 0 : length(); shiftLeft(*static_cast<const Base*>(&arg)); if (cur && m_status_vector[cur] == isc_arg_warning) m_warning = cur; @@ -265,6 +270,7 @@ { if (hasData()) { + unsigned l = (length() >= ISC_STATUS_LENGTH) ? (ISC_STATUS_LENGTH - 1u) : length(); memcpy(dest, value(), (length() + 1u) * sizeof(ISC_STATUS)); } else @@ -276,25 +282,24 @@ return dest[1]; } -ISC_STATUS StatusVector::ImplStatusVector::copyTo(IStatus* dest) const throw() +void StatusVector::ImplStatusVector::copyTo(IStatus* dest) const throw() { dest->init(); if (hasData()) { - const ISC_STATUS* v = m_status_vector; - unsigned int length = m_length; + const ISC_STATUS* v = m_status_vector.begin(); + unsigned int len = length(); unsigned int warning = m_warning; if (v[warning] == isc_arg_warning) { - dest->setWarnings2(length - warning, &v[warning]); + dest->setWarnings2(len - warning, &v[warning]); if (warning) dest->setErrors2(warning, v); } else - dest->setErrors2(length, v); + dest->setErrors2(len, v); } - return m_status_vector[1]; } Gds::Gds(ISC_STATUS s) throw() : Modified: firebird/trunk/src/common/StatusArg.h =================================================================== --- firebird/trunk/src/common/StatusArg.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/StatusArg.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -31,6 +31,7 @@ #include "fb_exception.h" #include "firebird/Interface.h" +#include "../common/SimpleStatusVector.h" namespace Firebird { @@ -72,7 +73,7 @@ virtual void assign(const StatusVector& ex) throw() { } virtual void assign(const Exception& ex) throw() { } virtual ISC_STATUS copyTo(ISC_STATUS*) const throw() { return 0; } - virtual ISC_STATUS copyTo(IStatus*) const throw() { return 0; } + virtual void copyTo(IStatus*) const throw() { } virtual void shiftLeft(const Base&) throw() { } virtual void shiftLeft(const Warning&) throw() { } @@ -103,18 +104,19 @@ class ImplStatusVector : public ImplBase { private: - ISC_STATUS_ARRAY m_status_vector; - unsigned int m_length, m_warning; + SimpleStatusVector<> m_status_vector; + unsigned int m_warning; bool appendErrors(const ImplBase* const v) throw(); bool appendWarnings(const ImplBase* const v) throw(); bool append(const ISC_STATUS* const from, const unsigned int count) throw(); + void append(const ISC_STATUS* const from) throw(); public: - virtual const ISC_STATUS* value() const throw() { return m_status_vector; } - virtual unsigned int length() const throw() { return m_length; } + virtual const ISC_STATUS* value() const throw() { return m_status_vector.begin(); } + virtual unsigned int length() const throw() { return m_status_vector.getCount() - 1u; } virtual unsigned int firstWarning() const throw() { return m_warning; } - virtual bool hasData() const throw() { return m_length > 0; } + virtual bool hasData() const throw() { return length() > 0u; } virtual void clear() throw(); virtual void makePermanent() throw(); virtual void append(const StatusVector& v) throw(); @@ -122,7 +124,7 @@ virtual void assign(const StatusVector& v) throw(); virtual void assign(const Exception& ex) throw(); virtual ISC_STATUS copyTo(ISC_STATUS* dest) const throw(); - virtual ISC_STATUS copyTo(IStatus* dest) const throw(); + virtual void copyTo(IStatus* dest) const throw(); virtual void shiftLeft(const Base& arg) throw(); virtual void shiftLeft(const Warning& arg) throw(); virtual void shiftLeft(const char* text) throw(); @@ -130,7 +132,9 @@ virtual void shiftLeft(const MetaName& text) throw(); virtual bool compare(const StatusVector& v) const throw(); - ImplStatusVector(ISC_STATUS k, ISC_STATUS c) throw() : ImplBase(k, c) + ImplStatusVector(ISC_STATUS k, ISC_STATUS c) throw() + : ImplBase(k, c), + m_status_vector(*getDefaultMemoryPool()) { clear(); } @@ -162,7 +166,7 @@ void assign(const Exception& ex) throw() { implementation->assign(ex); } void raise() const; ISC_STATUS copyTo(ISC_STATUS* dest) const throw() { return implementation->copyTo(dest); } - ISC_STATUS copyTo(IStatus* dest) const throw() { return implementation->copyTo(dest); } + void copyTo(IStatus* dest) const throw() { implementation->copyTo(dest); } // generic argument insert StatusVector& operator<<(const Base& arg) throw() Modified: firebird/trunk/src/common/StatusHolder.cpp =================================================================== --- firebird/trunk/src/common/StatusHolder.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/StatusHolder.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -33,14 +33,14 @@ namespace Firebird { -ISC_STATUS DynamicStatusVector::merge(const IStatus* status) +ISC_STATUS DynamicStatusVector::load(const IStatus* status) { SimpleStatusVector<> tmp; unsigned length = fb_utils::statusLength(status->getErrors()); length += fb_utils::statusLength(status->getWarnings()); ISC_STATUS* s = tmp.getBuffer(length + 1); fb_utils::mergeStatus(s, length + 1, status); - return save(s); + return save(s, false); } ISC_STATUS StatusHolder::save(IStatus* status) @@ -73,107 +73,4 @@ } } -unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src) -{ - const ISC_STATUS* end = &src[length]; - - // allocate space for strings - size_t len = 0; - for (const ISC_STATUS* from = src; from < end; ++from) - { - const ISC_STATUS type = *from++; - if (from >= end || type == isc_arg_end) - { - end = from - 1; - break; - } - - switch (type) - { - case isc_arg_cstring: - if (from + 1 >= end) - { - end = from - 1; - break; - } - len += *from++; - len++; - break; - - case isc_arg_string: - case isc_arg_interpreted: - case isc_arg_sql_state: - len += strlen(reinterpret_cast<const char*>(*from)); - len++; - break; - } - } - - char* string = len ? FB_NEW(*getDefaultMemoryPool()) char[len] : NULL; - ISC_STATUS* to = dst; - - // copy status vector saving strings in local buffer - for (const ISC_STATUS* from = src; from < end; ++from) - { - const ISC_STATUS type = *from++; - *to++ = type == isc_arg_cstring ? isc_arg_string : type; - - switch (type) - { - case isc_arg_cstring: - fb_assert(string); - *to++ = (ISC_STATUS)(IPTR) string; - memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]); - string += *from++; - *string++ = 0; - break; - - case isc_arg_string: - case isc_arg_interpreted: - case isc_arg_sql_state: - fb_assert(string); - *to++ = (ISC_STATUS)(IPTR) string; - strcpy(string, reinterpret_cast<const char*>(*from)); - string += strlen(string); - string++; - break; - - default: - *to++ = *from; - break; - } - } - - *to++ = isc_arg_end; - return (to - dst) - 1; -} - -void freeDynamicStrings(unsigned length, ISC_STATUS* ptr) -{ - while (length--) - { - const ISC_STATUS type = *ptr++; - if (type == isc_arg_end) - return; - - switch (type) - { - case isc_arg_cstring: - fb_assert(false); // CVC: according to the new logic, this case cannot happen - ptr++; - - case isc_arg_string: - case isc_arg_interpreted: - case isc_arg_sql_state: - delete[] reinterpret_cast<char*>(*ptr++); - return; - - default: - ptr++; - break; - } - } -} - - } // namespace Firebird Modified: firebird/trunk/src/common/StatusHolder.h =================================================================== --- firebird/trunk/src/common/StatusHolder.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/StatusHolder.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -32,29 +32,11 @@ #include "firebird/Interface.h" #include "../common/utils_proto.h" #include "../common/classes/ImplementHelper.h" -#include "../common/classes/array.h" +#include "../common/SimpleStatusVector.h" +#include "../common/DynamicStrings.h" namespace Firebird { -unsigned makeDynamicStrings(unsigned length, ISC_STATUS* const dst, const ISC_STATUS* const src); -void freeDynamicStrings(unsigned length, ISC_STATUS* ptr); - - -// This trivial container is used when we need to grow vector element by element w/o any conversions -template <unsigned S = ISC_STATUS_LENGTH> -class SimpleStatusVector : public HalfStaticArray<ISC_STATUS, S> -{ -public: - SimpleStatusVector() - : HalfStaticArray<ISC_STATUS, S>() - { } - - explicit SimpleStatusVector(MemoryPool& p) - : HalfStaticArray<ISC_STATUS, S>(p) - { } -}; - - // DynamicVector owns strings, contained in it template <unsigned S> class DynamicVector : private SimpleStatusVector<S> @@ -68,34 +50,68 @@ ~DynamicVector() { - freeDynamicStrings(this->getCount(), this->begin()); + delete[] freeDynamicStrings(this->getCount(), this->begin()); } +private: + char* prepareForNewValue() + { + char* oldBuffer = freeDynamicStrings(this->getCount(), this->begin()); + this->resize(0); + return oldBuffer; + } + +public: void clear() { - freeDynamicStrings(this->getCount(), this->begin()); - this->resize(0); + delete[] this->prepareForNewValue(); fb_utils::init_status(this->getBuffer(3)); } - void save(unsigned int length, const ISC_STATUS* status) + void save(unsigned int length, const ISC_STATUS* status, bool warningMode) throw() { - clear(); - this->resize(0); - unsigned newLen = makeDynamicStrings(length, this->getBuffer(length), status); + try + { + char* oldBuffer = this->prepareForNewValue(); + ISC_STATUS* b = this->getBuffer(length + 1); + unsigned newLen = makeDynamicStrings(length, b, status); + delete[] oldBuffer; - fb_assert(newLen <= length); + fb_assert(newLen <= length); - // Sanity check - if (newLen < 2) - fb_utils::init_status(this->getBuffer(3)); - else - this->resize(newLen); + // Sanity check + if (newLen < 2) + fb_utils::init_status(this->getBuffer(3)); + else + this->resize(newLen + 1); + } + catch(const BadAlloc&) + { + if (!warningMode) + { + // do not use stuff here to avoid endless cycle + this->shrink(3); + ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor + fb_utils::statusBadAlloc(s); + } + else + { + this->clear(); + } + } + catch(const Exception&) + { + fb_assert(false); + + this->shrink(3); + ISC_STATUS* s = this->getBuffer(3); // Should not throw - see assert() in ctor + fb_utils::statusUnknown(s); + } } - ISC_STATUS save(const ISC_STATUS* status) + ISC_STATUS save(const ISC_STATUS* status, bool warningMode = false) throw() { - save(fb_utils::statusLength(status), status); + save(fb_utils::statusLength(status), status, warningMode); return status[1]; } @@ -119,7 +135,7 @@ : DynamicVector(*getDefaultMemoryPool()) { } - ISC_STATUS merge(const IStatus* status); + ISC_STATUS load(const IStatus* status); ISC_STATUS getError() const { @@ -147,22 +163,22 @@ void setErrors(const ISC_STATUS* value) { - errors.save(fb_utils::statusLength(value), value); + errors.save(fb_utils::statusLength(value), value, false); } void setErrors2(unsigned int length, const ISC_STATUS* value) { - errors.save(length, value); + errors.save(length, value, false); } void setWarnings(const ISC_STATUS* value) { - warnings.save(fb_utils::statusLength(value), value); + warnings.save(fb_utils::statusLength(value), value, true); } void setWarnings2(unsigned int length, const ISC_STATUS* value) { - warnings.save(length, value); + warnings.save(length, value, true); } const ISC_STATUS* getErrors() const Modified: firebird/trunk/src/common/UtilSvc.cpp =================================================================== --- firebird/trunk/src/common/UtilSvc.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/UtilSvc.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -139,7 +139,7 @@ virtual ULONG getBytes(UCHAR*, ULONG) { return 0; } virtual void setServiceStatus(const ISC_STATUS*) { } virtual void setServiceStatus(const USHORT, const USHORT, const MsgFormat::SafeArg&) { } - virtual const ISC_STATUS* getStatus() { return 0; } + virtual const Firebird::CheckStatusWrapper* getStatus() { return NULL; } virtual void fillDpb(ClumpletWriter&) { } virtual bool finished() { return false; } virtual void initStatus() { } Modified: firebird/trunk/src/common/UtilSvc.h =================================================================== --- firebird/trunk/src/common/UtilSvc.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/UtilSvc.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -65,7 +65,7 @@ virtual ULONG getBytes(UCHAR*, ULONG) = 0; virtual void setServiceStatus(const ISC_STATUS*) = 0; virtual void setServiceStatus(const USHORT, const USHORT, const MsgFormat::SafeArg&) = 0; - virtual const ISC_STATUS* getStatus() = 0; + virtual const Firebird::CheckStatusWrapper* getStatus() = 0; virtual void initStatus() = 0; virtual void checkService() = 0; virtual void hidePasswd(ArgvType&, int) = 0; Modified: firebird/trunk/src/common/classes/GetPlugins.h =================================================================== --- firebird/trunk/src/common/classes/GetPlugins.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/classes/GetPlugins.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -42,9 +42,8 @@ public: GetPlugins(unsigned int interfaceType, const char* namesList = NULL) : masterInterface(), pluginInterface(), - pluginSet(NULL), currentPlugin(NULL) + pluginSet(NULL), currentPlugin(NULL), status(&ls) { - LocalStatus status; pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType, (namesList ? namesList : Config::getDefaultConfig()->getPlugins(interfaceType)), NULL)); @@ -56,9 +55,8 @@ GetPlugins(unsigned int interfaceType, Config* knownConfig, const char* namesList = NULL) : masterInterface(), pluginInterface(), - pluginSet(NULL), currentPlugin(NULL) + pluginSet(NULL), currentPlugin(NULL), status(&ls) { - LocalStatus status; pluginSet.assignRefNoIncr(pluginInterface->getPlugins(&status, interfaceType, (namesList ? namesList : knownConfig->getPlugins(interfaceType)), new FirebirdConf(knownConfig))); @@ -89,7 +87,6 @@ pluginInterface->releasePlugin(currentPlugin); currentPlugin = NULL; - LocalStatus status; pluginSet->next(&status); check(&status); getPlugin(); @@ -104,7 +101,6 @@ currentPlugin = NULL; } - LocalStatus status; pluginSet->set(&status, newName); check(&status); getPlugin(); @@ -124,10 +120,11 @@ PluginManagerInterfacePtr pluginInterface; RefPtr<IPluginSet> pluginSet; P* currentPlugin; + LocalStatus ls; + CheckStatusWrapper status; void getPlugin() { - LocalStatus status; currentPlugin = (P*) pluginSet->getPlugin(&status); check(&status); } Modified: firebird/trunk/src/common/fb_exception.cpp =================================================================== --- firebird/trunk/src/common/fb_exception.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/fb_exception.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -9,6 +9,7 @@ #include "../common/classes/array.h" #include "../common/ThreadStart.h" #include "../common/utils_proto.h" +#include "../common/SimpleStatusVector.h" #include "../common/StatusHolder.h" namespace Firebird { @@ -90,16 +91,45 @@ return status_vector[1]; } +ISC_STATUS Exception::stuffException(SimpleStatusVector<>& status_vector) const throw() +{ + LocalStatus status; + stuffException(&status); + try + { + status_vector.mergeStatus(&status); + } + catch(const BadAlloc&) + { + // do not use stuff here to avoid endless cycle + status_vector.shrink(3); + ISC_STATUS* s = status_vector.getBuffer(3); // Should not throw - see assert() in ctor + fb_utils::statusBadAlloc(s); + } + catch(const Exception&) + { + fb_assert(false); + + status_vector.shrink(3); + ISC_STATUS* s = status_vector.getBuffer(3); // Should not throw - see assert() in ctor + fb_utils::statusUnknown(s); + } + + return status_vector[1]; +} + // ********************************* status_exception ******************************* status_exception::status_exception() throw() + : m_status_vector(m_buffer) { - memset(m_status_vector, 0, sizeof(m_status_vector)); + fb_utils::init_status(m_status_vector); } status_exception::status_exception(const ISC_STATUS *status_vector) throw() + : m_status_vector(m_buffer) { - memset(m_status_vector, 0, sizeof(m_status_vector)); + fb_utils::init_status(m_status_vector); if (status_vector) { @@ -110,12 +140,35 @@ void status_exception::set_status(const ISC_STATUS *new_vector) throw() { fb_assert(new_vector != 0); + unsigned len = fb_utils::statusLength(new_vector); - makePermanentVector(m_status_vector, new_vector); + try + { + if (len >= FB_NELEM(m_buffer)) + { + m_status_vector = FB_NEW(*getDefaultMemoryPool()) ISC_STATUS[len + 1]; + } + len = makeDynamicStrings(len, m_status_vector, new_vector); + m_status_vector[len] = isc_arg_end; + } + catch(const BadAlloc&) + { + if (m_status_vector != m_buffer) + { + delete[] m_status_vector; + m_status_vector = m_buffer; + } + fb_utils::statusBadAlloc(m_buffer); + } } status_exception::~status_exception() throw() { + delete[] freeDynamicStrings(fb_utils::statusLength(m_status_vector), m_status_vector); + if (m_status_vector != m_buffer) + { + delete[] m_status_vector; + } } const char* status_exception::what() const throw() @@ -130,9 +183,9 @@ void status_exception::raise(const IStatus* status) { - ISC_STATUS_ARRAY status_vector; - fb_utils::mergeStatus(status_vector, ISC_STATUS_LENGTH, status); - throw status_exception(status_vector); + SimpleStatusVector<> status_vector; + status_vector.mergeStatus(status); + throw status_exception(status_vector.begin()); } void status_exception::raise(const Arg::StatusVector& statusVector) Modified: firebird/trunk/src/common/isc.cpp =================================================================== --- firebird/trunk/src/common/isc.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/isc.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -587,12 +587,26 @@ void iscLogStatus(const TEXT* text, Firebird::IStatus* status) { - ISC_STATUS_BIG_ARRAY tmp; - fb_utils::mergeStatus(tmp, FB_NELEM(tmp), status); - iscLogStatus(text, tmp); + Firebird::SimpleStatusVector<> tmp; + tmp.mergeStatus(status); + iscLogStatus(text, tmp.begin()); } +void iscDbLogStatus(const TEXT* text, Firebird::IStatus* status) +{ + const TEXT* hdr = NULL; + Firebird::string buf; + if (text) + { + buf = "Database: "; + buf += text; + hdr = buf.c_str(); + } + iscLogStatus(hdr, status); +} + + void iscLogException(const char* text, const Firebird::Exception& e) { /************************************** Modified: firebird/trunk/src/common/isc_proto.h =================================================================== --- firebird/trunk/src/common/isc_proto.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/isc_proto.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -33,7 +33,8 @@ bool ISC_get_user(Firebird::string*, int*, int*); SLONG ISC_set_prefix(const TEXT*, const TEXT*); -// Does not add word "Database" in the beginning like gds__log_status +void iscDbLogStatus(const TEXT* text, Firebird::IStatus* status); +// Do not add word "Database" in the beginning like gds__log_status / iscDbLogStatus void iscLogStatus(const TEXT* text, const ISC_STATUS* status_vector); void iscLogStatus(const TEXT* text, Firebird::IStatus* status); void iscLogException(const TEXT* text, const Firebird::Exception& e); Modified: firebird/trunk/src/common/sdl.cpp =================================================================== --- firebird/trunk/src/common/sdl.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/sdl.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -44,7 +44,7 @@ SLONG* sdl_arg_variables; SDL_walk_callback sdl_arg_callback; array_slice* sdl_arg_argument; - ISC_STATUS* sdl_arg_status_vector; + CheckStatusWrapper* sdl_arg_status_vector; IPTR sdl_arg_compiled[COMPILE_SIZE]; IPTR* sdl_arg_next; const IPTR* sdl_arg_end; @@ -63,7 +63,7 @@ }; static const UCHAR* compile(const UCHAR*, sdl_arg*); -static ISC_STATUS error(ISC_STATUS* status_vector, const Arg::StatusVector& v); +static ISC_STATUS error(CheckStatusWrapper* status_vector, const Arg::StatusVector& v); static bool execute(sdl_arg*); static const UCHAR* get_range(const UCHAR*, array_range*, SLONG*, SLONG*); @@ -114,7 +114,7 @@ */ -SLONG SDL_compute_subscript(ISC_STATUS* status_vector, +SLONG SDL_compute_subscript(CheckStatusWrapper* status_vector, const Ods::InternalArrayDesc* desc, USHORT dimensions, const SLONG* subscripts) @@ -167,6 +167,27 @@ ************************************** * * Functional description + * Status vector time changing form. + * + **************************************/ + LocalStatus s1; + CheckStatusWrapper s2(&s1); + ISC_STATUS rc = SDL_info(&s2, sdl, info, vector); + fb_utils::mergeStatus(status_vector, ISC_STATUS_LENGTH, &s2); + + return rc; +} + +ISC_STATUS SDL_info(CheckStatusWrapper* status_vector, + const UCHAR* sdl, sdl_info* info, SLONG* vector) +{ +/************************************** + * + * S D L _ i n f o + * + ************************************** + * + * Functional description * Parse enough of SDL to pick relation and field identification and * element descriptor. * @@ -232,7 +253,7 @@ } -int SDL_walk(ISC_STATUS* status_vector, +int SDL_walk(CheckStatusWrapper* status_vector, const UCHAR* sdl, UCHAR* array, Ods::InternalArrayDesc* array_desc, @@ -470,7 +491,7 @@ } -static ISC_STATUS error(ISC_STATUS* status_vector, const Arg::StatusVector& v) +static ISC_STATUS error(CheckStatusWrapper* status_vector, const Arg::StatusVector& v) { /************************************** * @@ -479,15 +500,12 @@ ************************************** * * Functional description - * Post an error sequence to the status vector. Since an error - * sequence can, in theory, be arbitrarily lock, pull a cheap - * trick to get the address of the argument vector. + * Post an error sequence to the status vector. * **************************************/ v.copyTo(status_vector); - makePermanentVector(status_vector); - return status_vector[1]; + return status_vector->getErrors()[1]; } Modified: firebird/trunk/src/common/sdl_proto.h =================================================================== --- firebird/trunk/src/common/sdl_proto.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/sdl_proto.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -31,9 +31,10 @@ struct sdl_info; struct array_alice; -SLONG SDL_compute_subscript(ISC_STATUS*, const Ods::InternalArrayDesc*, USHORT, const SLONG*); +SLONG SDL_compute_subscript(Firebird::CheckStatusWrapper*, const Ods::InternalArrayDesc*, USHORT, const SLONG*); ISC_STATUS SDL_info(ISC_STATUS*, const UCHAR*, sdl_info*, SLONG*); -int SDL_walk(ISC_STATUS*, const UCHAR*, UCHAR*, Ods::InternalArrayDesc*, SLONG*, +ISC_STATUS SDL_info(Firebird::CheckStatusWrapper*, const UCHAR*, sdl_info*, SLONG*); +int SDL_walk(Firebird::CheckStatusWrapper*, const UCHAR*, UCHAR*, Ods::InternalArrayDesc*, SLONG*, SDL_walk_callback, array_slice*); #endif // JRD_SDL_PROTO_H Modified: firebird/trunk/src/common/utils.cpp =================================================================== --- firebird/trunk/src/common/utils.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/utils.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -1170,6 +1170,17 @@ return copied; } +void copyStatus(Firebird::CheckStatusWrapper* to, const Firebird::CheckStatusWrapper* from) throw() +{ + to->init(); + + int flags = from->getState(); + if (flags & Firebird::CheckStatusWrapper::STATE_ERRORS) + to->setErrors(from->getErrors()); + if (flags & Firebird::CheckStatusWrapper::STATE_WARNINGS) + to->setWarnings(from->getWarnings()); +} + void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw() { try @@ -1196,6 +1207,121 @@ } } +bool cmpStatus(unsigned int len, const ISC_STATUS* a, const ISC_STATUS* b) throw() +{ + for (unsigned i = 0; i < len; ) + { + const ISC_STATUS* op1 = &a[i]; + const ISC_STATUS* op2 = &b[i]; + if (*op1 != *op2) + return false; + + if (i == len - 1 && *op1 == isc_arg_end) + break; + + i += (*op1 == isc_arg_cstring ? 3 : 2); + if (i > len) // arg does not fit + return false; + + unsigned l1, l2; + const char *s1, *s2; + switch (*op1) + { + case isc_arg_cstring: + case isc_arg_string: + case isc_arg_interpreted: + case isc_arg_sql_state: + if (*op1 == isc_arg_cstring) + { + l1 = op1[1]; + l2 = op2[1]; + s1 = (const char*)(op1[2]); + s2 = (const char*)(op2[2]); + } + else + { + s1 = (const char*)(op1[1]); + s2 = (const char*)(op2[1]); + l1 = strlen(s1); + l2 = strlen(s2); + } + + if (l1 != l2) + return false; + if (memcmp(s1, s2, l1) != 0) + return false; + break; + + default: + if (op1[1] != op2[1]) + return false; + break; + } + } + + return true; +} + +unsigned int subStatus(const ISC_STATUS* in, unsigned int cin, + const ISC_STATUS* sub, unsigned int csub) throw() +{ + for (unsigned pos = 0; csub <= cin - pos; ) + { + for (unsigned i = 0; i < csub; ) + { + const ISC_STATUS* op1 = &in[pos + i]; + const ISC_STATUS* op2 = &sub[i]; + if (*op1 != *op2) + goto miss; + + i += (*op1 == isc_arg_cstring ? 3 : 2); + if (i > csub) // arg does not fit + goto miss; + + unsigned l1, l2; + const char *s1, *s2; + switch (*op1) + { + case isc_arg_cstring: + case isc_arg_string: + case isc_arg_interpreted: + case isc_arg_sql_state: + if (*op1 == isc_arg_cstring) + { + l1 = op1[1]; + l2 = op2[1]; + s1 = (const char*)(op1[2]); + s2 = (const char*)(op2[2]); + } + else + { + s1 = (const char*)(op1[1]); + s2 = (const char*)(op2[1]); + l1 = strlen(s1); + l2 = strlen(s2); + } + + if (l1 != l2) + goto miss; + if (memcmp(s1, s2, l1) != 0) + goto miss; + break; + + default: + if (op1[1] != op2[1]) + goto miss; + break; + } + + } + return pos; + +miss: pos += (in[pos] == isc_arg_cstring ? 3 : 2); + } + + return ~0u; +} + // moves DB path information (from limbo transaction) to another buffer void getDbPathInfo(unsigned int& itemsLength, const unsigned char*& items, unsigned int& bufferLength, unsigned char*& buffer, Modified: firebird/trunk/src/common/utils_proto.h =================================================================== --- firebird/trunk/src/common/utils_proto.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/common/utils_proto.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -105,16 +105,30 @@ Firebird::PathName get_process_name(); SLONG genUniqueId(); - void getCwd(Firebird::PathName& pn); - void inline init_status(ISC_STATUS* status) + void inline initStatusTo(ISC_STATUS* status, ISC_STATUS to) { status[0] = isc_arg_gds; - status[1] = FB_SUCCESS; + status[1] = to; status[2] = isc_arg_end; } + void inline init_status(ISC_STATUS* status) + { + initStatusTo(status, FB_SUCCESS); + } + + void inline statusBadAlloc(ISC_STATUS* status) + { + initStatusTo(status, isc_virmemexh); + } + + void inline statusUnknown(ISC_STATUS* status) + { + initStatusTo(status, isc_exception_sigill); // Any better ideas? New error code? + } + void inline init_status(Firebird::CheckStatusWrapper* status) { status->init(); @@ -122,12 +136,13 @@ unsigned int copyStatus(ISC_STATUS* const to, const unsigned int space, const ISC_STATUS* const from, const unsigned int count) throw(); - + void copyStatus(Firebird::CheckStatusWrapper* to, const Firebird::CheckStatusWrapper* from) throw(); unsigned int mergeStatus(ISC_STATUS* const to, unsigned int space, const Firebird::IStatus* from) throw(); - void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw(); - unsigned int statusLength(const ISC_STATUS* const status) throw(); + unsigned int subStatus(const ISC_STATUS* in, unsigned int cin, + const ISC_STATUS* sub, unsigned int csub) throw(); + bool cmpStatus(unsigned int len, const ISC_STATUS* a, const ISC_STATUS* b) throw(); enum FetchPassResult { FETCH_PASS_OK, Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/dsql/DdlNodes.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -238,7 +238,8 @@ objType(aObjType), objName(pool, aObjName), subName(pool, aSubName), - text(pool, aText) + text(pool, aText), + str(pool) { } @@ -250,23 +251,19 @@ protected: virtual void putErrorPrefix(Firebird::Arg::StatusVector& statusVector) { - Firebird::string str(objName.toString()); + str = objName.toString(); if (subName.hasData()) str.append(".").append(subName.c_str()); - //// ASF: What a hack, as StatusVector does not save the pointer content! - const char* p = Firebird::MasterInterfacePtr()->circularAlloc(str.c_str(), str.length(), - (intptr_t) getThreadId()); - - statusVector << Firebird::Arg::Gds(isc_dsql_comment_on_failed) << p; + statusVector << Firebird::Arg::Gds(isc_dsql_comment_on_failed) << str; } private: int objType; Firebird::QualifiedName objName; Firebird::MetaName subName; - Firebird::string text; + Firebird::string text, str; }; Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -663,7 +663,7 @@ if (tdbb->tdbb_flags & TDBB_sys_error) return false; - ISC_STATUS* statusVector = tdbb->tdbb_status_vector; + Jrd::FbStatusVector* statusVector = tdbb->tdbb_status_vector; bool found = false; @@ -673,7 +673,7 @@ { case ExceptionItem::SQL_CODE: { - const SSHORT sqlcode = gds__sqlcode(statusVector); + const SSHORT sqlcode = gds__sqlcode(statusVector->getErrors()); if (sqlcode == conditions[i].code) found = true; } @@ -682,22 +682,22 @@ case ExceptionItem::SQL_STATE: { FB_SQLSTATE_STRING sqlstate; - fb_sqlstate(sqlstate, statusVector); + fb_sqlstate(sqlstate, statusVector->getErrors()); if (conditions[i].name == sqlstate) found = true; } break; case ExceptionItem::GDS_CODE: - if (statusVector[1] == conditions[i].code) + if (statusVector->getErrors()[1] == conditions[i].code) found = true; break; case ExceptionItem::XCP_CODE: // Look at set_error() routine to understand how the // exception ID info is encoded inside the status vector. - if ((statusVector[1] == isc_except) && - (statusVector[3] == conditions[i].code)) + if ((statusVector->getErrors()[1] == isc_except) && + (statusVector->getErrors()[3] == conditions[i].code)) { found = true; } Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/dsql/dsql.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -42,6 +42,7 @@ #include "../jrd/intl.h" #include "../common/intlobj_new.h" #include "../jrd/jrd.h" +#include "../jrd/status.h" #include "../common/CharSet.h" #include "../dsql/Parser.h" #include "../dsql/ddl_proto.h" @@ -599,14 +600,13 @@ } #endif - ISC_STATUS_ARRAY localStatus; - MOVE_CLEAR(localStatus, sizeof(localStatus)); + FbLocalStatus localStatus; // check for warnings - if (tdbb->tdbb_status_vector[2] == isc_arg_warning) + if (tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_WARNINGS) { // save a status vector - memcpy(localStatus, tdbb->tdbb_status_vector, sizeof(ISC_STATUS_ARRAY)); + fb_utils::copyStatus(localStatus, tdbb->tdbb_status_vector); fb_utils::init_status(tdbb->tdbb_status_vector); } @@ -622,27 +622,19 @@ } catch (const Exception&) { - status = tdbb->tdbb_status_vector[1]; + status = tdbb->tdbb_status_vector->getErrors()[1]; *traceResult = status == isc_no_priv ? ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED; } // restore warnings (if there are any) - if (localStatus[2] == isc_arg_warning) + if (localStatus->getState() & FbStatusVector::STATE_WARNINGS) { - FB_SIZE_T indx, len, warning; + Arg::StatusVector cur(tdbb->tdbb_status_vector->getWarnings()); + Arg::StatusVector saved(localStatus->getWarnings()); + saved << cur; - // find end of a status vector - PARSE_STATUS(tdbb->tdbb_status_vector, indx, warning); - if (indx) - --indx; - - // calculate length of saved warnings - PARSE_STATUS(localStatus, len, warning); - len -= 2; - - if ((len + indx - 1) < ISC_STATUS_LENGTH) - memcpy(&tdbb->tdbb_status_vector[indx], &localStatus[2], sizeof(ISC_STATUS) * len); + tdbb->tdbb_status_vector->setWarnings2(saved.length(), saved.value()); } // free blr memory @@ -738,12 +730,12 @@ UCHAR* message_buffer = (UCHAR*) gds__alloc(message->msg_length); ISC_STATUS status = FB_SUCCESS; - ISC_STATUS_ARRAY localStatus; + FbLocalStatus localStatus; for (counter = 0; counter < 2 && !status; counter++) { - AutoSetRestore<ISC_STATUS*> autoStatus(&tdbb->tdbb_status_vector, localStatus); - fb_utils::init_status(localStatus); + localStatus->init(); + AutoSetRestore<Jrd::FbStatusVector*> autoStatus(&tdbb->tdbb_status_vector, localStatus); try { @@ -753,7 +745,7 @@ } catch (Firebird::Exception&) { - status = tdbb->tdbb_status_vector[1]; + status = tdbb->tdbb_status_vector->getErrors()[1]; } } @@ -1195,7 +1187,7 @@ if (!meta) return parameters.getCount(); - LocalStatus st; + FbLocalStatus st; unsigned count = meta->getCount(&st); checkD(&st); Modified: firebird/trunk/src/dsql/errd.cpp =================================================================== --- firebird/trunk/src/dsql/errd.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/dsql/errd.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -59,7 +59,7 @@ using namespace Firebird; -static void internal_post(const ISC_STATUS* status_vector); +static void internal_post(const Arg::StatusVector& v); #ifdef DEV_BUILD /** @@ -142,42 +142,15 @@ @param **/ -bool ERRD_post_warning(const Firebird::Arg::StatusVector& v) +void ERRD_post_warning(const Firebird::Arg::StatusVector& v) { fb_assert(v.value()[0] == isc_arg_warning); - ISC_STATUS* status_vector = JRD_get_thread_data()->tdbb_status_vector; - FB_SIZE_T indx = 0; + Jrd::FbStatusVector* status_vector = JRD_get_thread_data()->tdbb_status_vector; - if (status_vector[0] != isc_arg_gds || - (status_vector[0] == isc_arg_gds && status_vector[1] == 0 && - status_vector[2] != isc_arg_warning)) - { - // this is a blank status vector - status_vector[0] = isc_arg_gds; - status_vector[1] = 0; - status_vector[2] = isc_arg_end; - indx = 2; - } - else - { - // find end of a status vector - FB_SIZE_T warning_indx = 0; - PARSE_STATUS(status_vector, indx, warning_indx); - if (indx) { - --indx; - } - } - - if (indx + v.length() + 1 < ISC_STATUS_LENGTH) - { - memcpy(&status_vector[indx], v.value(), sizeof(ISC_STATUS) * (v.length() + 1)); - ERR_make_permanent(&status_vector[indx]); - return true; - } - - // not enough free space - return false; + Arg::StatusVector cur(status_vector->getWarnings()); + cur << v; + status_vector->setWarnings2(cur.length(), cur.value()); } @@ -193,11 +166,11 @@ @param **/ -void ERRD_post(const Firebird::Arg::StatusVector& v) +void ERRD_post(const Arg::StatusVector& v) { fb_assert(v.value()[0] == isc_arg_gds); - internal_post(v.value()); + internal_post(v); } @@ -213,83 +186,29 @@ @param **/ -static void internal_post(const ISC_STATUS* tmp_status) +static void internal_post(const Arg::StatusVector& v) { - ISC_STATUS* status_vector = JRD_get_thread_data()->tdbb_status_vector; - - // calculate length of the status - FB_SIZE_T tmp_status_len = 0, warning_indx = 0; - PARSE_STATUS(tmp_status, tmp_status_len, warning_indx); - fb_assert(warning_indx == 0); - - if (status_vector[0] != isc_arg_gds || - (status_vector[0] == isc_arg_gds && status_vector[1] == 0 && - status_vector[2] != isc_arg_warning)) + // start building resulting vector + Jrd::FbStatusVector* status_vector = JRD_get_thread_data()->tdbb_status_vector; + Arg::StatusVector final(status_vector->getErrors()); + if (final.length() == 0) { // this is a blank status vector - status_vector[0] = isc_arg_gds; - status_vector[1] = isc_dsql_error; - status_vector[2] = isc_arg_end; + final << Arg::Gds(isc_dsql_error); } - FB_SIZE_T status_len = 0; - PARSE_STATUS(status_vector, status_len, warning_indx); - if (status_len) - --status_len; - // check for duplicated error code - size_t i; - for (i = 0; i < ISC_STATUS_LENGTH; i++) + if (fb_utils::subStatus(final.value(), final.length(), v.value(), v.length()) == ~0u) { - if (status_vector[i] == isc_arg_end && i == status_len) { - break; // end of argument list - } - - if (i && i == warning_indx) { - break; // vector has no more errors - } - - if (status_vector[i] == tmp_status[1] && i && status_vector[i - 1] != isc_arg_warning && - i + tmp_status_len - 2 < ISC_STATUS_LENGTH && - (memcmp(&status_vector[i], &tmp_status[1], sizeof(ISC_STATUS) * (tmp_status_len - 2)) == 0)) - { - // duplicate found - ERRD_punt(); - } + // no dup - append new vector to old one + final << v; } - // if the status_vector has only warnings then adjust err_status_len - size_t err_status_len = i; - if (err_status_len == 2 && warning_indx) { - err_status_len = 0; - } + // keep existing warnings + final << Arg::StatusVector(status_vector->getWarnings()); - FB_SIZE_T warning_count = 0; - ISC_STATUS_ARRAY warning_status; - - if (warning_indx) - { - // copy current warning(s) to a temp buffer - MOVE_CLEAR(warning_status, sizeof(warning_status)); - memcpy(warning_status, &status_vector[warning_indx], - sizeof(ISC_STATUS) * (ISC_STATUS_LENGTH - warning_indx)); - PARSE_STATUS(warning_status, warning_count, warning_indx); - } - - // add the status into a real buffer right in between last - // error and first warning - - i = err_status_len + tmp_status_len; - if (i < ISC_STATUS_LENGTH) - { - memcpy(&status_vector[err_status_len], tmp_status, sizeof(ISC_STATUS) * tmp_status_len); - ERR_make_permanent(&status_vector[err_status_len]); - // copy current warning(s) to the status_vector - if (warning_count && i + warning_count - 1 < ISC_STATUS_LENGTH) - { - memcpy(&status_vector[i - 1], warning_status, sizeof(ISC_STATUS) * warning_count); - } - } + // save & punt + final.copyTo(status_vector); ERRD_punt(); } @@ -304,14 +223,13 @@ **/ -void ERRD_punt(const ISC_STATUS* local) +void ERRD_punt(const Jrd::FbStatusVector* local) { thread_db* tdbb = JRD_get_thread_data(); - // Save any strings in a permanent location if (local) { - Firebird::makePermanentVector(tdbb->tdbb_status_vector, local); + fb_utils::copyStatus(tdbb->tdbb_status_vector, local); } // Give up whatever we were doing and return to the user. Modified: firebird/trunk/src/dsql/errd_proto.h =================================================================== --- firebird/trunk/src/dsql/errd_proto.h 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/dsql/errd_proto.h 2015-03-20 18:02:30 UTC (rev 61033) @@ -24,6 +24,8 @@ #ifndef DSQL_ERRD_PROTO_H #define DSQL_ERRD_PROTO_H +#include "../jrd/status.h" + #ifdef DEV_BUILD void ERRD_assert_msg(const char*, const char*, ULONG); #endif @@ -31,8 +33,8 @@ void ERRD_bugcheck(const char*); void ERRD_error(const char*); void ERRD_post(const Firebird::Arg::StatusVector& v); -bool ERRD_post_warning(const Firebird::Arg::StatusVector& v); -void ERRD_punt(const ISC_STATUS* = 0); +void ERRD_post_warning(const Firebird::Arg::StatusVector& v); +void ERRD_punt(const Jrd::FbStatusVector* = 0); #endif // DSQL_ERRD_PROTO_H Modified: firebird/trunk/src/dsql/utld.cpp =================================================================== --- firebird/trunk/src/dsql/utld.cpp 2015-03-20 14:28:23 UTC (rev 61032) +++ firebird/trunk/src/dsql/utld.cpp 2015-03-20 18:02:30 UTC (rev 61033) @@ -59,25 +59,3 @@ return MIN(((MAX_COLUMN_SIZE - overhead) / maxBytesPerChar) * maxBytesPerChar, (ULONG) lengthInChars * maxBytesPerChar); } - - -ISC_STA... [truncated message content] |
From: <ro...@us...> - 2015-03-22 00:23:47
|
Revision: 61049 http://sourceforge.net/p/firebird/code/61049 Author: robocop Date: 2015-03-22 00:23:40 +0000 (Sun, 22 Mar 2015) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/include/firebird/Interface.h firebird/trunk/src/jrd/Routine.cpp firebird/trunk/src/jrd/extds/IscDS.cpp firebird/trunk/src/jrd/svc.cpp Modified: firebird/trunk/src/include/firebird/Interface.h =================================================================== --- firebird/trunk/src/include/firebird/Interface.h 2015-03-22 00:12:30 UTC (rev 61048) +++ firebird/trunk/src/include/firebird/Interface.h 2015-03-22 00:23:40 UTC (rev 61049) @@ -136,7 +136,7 @@ } } - bool isDirty() + bool isDirty() const { return dirty; } Modified: firebird/trunk/src/jrd/Routine.cpp =================================================================== --- firebird/trunk/src/jrd/Routine.cpp 2015-03-22 00:12:30 UTC (rev 61048) +++ firebird/trunk/src/jrd/Routine.cpp 2015-03-22 00:23:40 UTC (rev 61049) @@ -67,11 +67,11 @@ { unsigned descOffset, nullOffset, descDtype, descLength; - unsigned t = params->getType(&status, i); + unsigned type = params->getType(&status, i); status.check(); - unsigned l = params->getLength(&status, i); + unsigned len = params->getLength(&status, i); status.check(); - runOffset = fb_utils::sqlTypeToDsc(runOffset, t, l, &descDtype, &descLength, + runOffset = fb_utils::sqlTypeToDsc(runOffset, type, len, &descDtype, &descLength, &descOffset, &nullOffset); desc->clear(); Modified: firebird/trunk/src/jrd/extds/IscDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/IscDS.cpp 2015-03-22 00:12:30 UTC (rev 61048) +++ firebird/trunk/src/jrd/extds/IscDS.cpp 2015-03-22 00:23:40 UTC (rev 61049) @@ -691,7 +691,7 @@ class IscStatus { public: - IscStatus(FbStatusVector* pStatus) + explicit IscStatus(FbStatusVector* pStatus) : iStatus(pStatus) { fb_utils::init_status(aStatus); Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2015-03-22 00:12:30 UTC (rev 61048) +++ firebird/trunk/src/jrd/svc.cpp 2015-03-22 00:23:40 UTC (rev 61049) @@ -2068,8 +2068,8 @@ TraceServiceImpl service(this); this->svc_trace_manager->event_service_start(&service, this->svc_switches.length(), this->svc_switches.c_str(), - this->svc_status->getState() & FbStatusVector::STATE_ERRORS ? - ITracePlugin::RESULT_FAILED : ITracePlugin::RESULT_SUCCESS); + (this->svc_status->getState() & FbStatusVector::STATE_ERRORS ? + ITracePlugin::RESULT_FAILED : ITracePlugin::RESULT_SUCCESS)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2015-03-22 22:43:19
|
Revision: 61056 http://sourceforge.net/p/firebird/code/61056 Author: hvlad Date: 2015-03-22 22:43:12 +0000 (Sun, 22 Mar 2015) Log Message: ----------- Fixed Windows build Modified Paths: -------------- firebird/trunk/src/jrd/os/win32/winnt.cpp firebird/trunk/src/remote/SockAddr.h firebird/trunk/src/remote/os/win32/wnet.cpp Modified: firebird/trunk/src/jrd/os/win32/winnt.cpp =================================================================== --- firebird/trunk/src/jrd/os/win32/winnt.cpp 2015-03-22 22:42:23 UTC (rev 61055) +++ firebird/trunk/src/jrd/os/win32/winnt.cpp 2015-03-22 22:43:12 UTC (rev 61056) @@ -115,7 +115,7 @@ static bool maybeCloseFile(HANDLE&); static jrd_file* seek_file(jrd_file*, BufferDesc*, FbStatusVector*, OVERLAPPED*, OVERLAPPED**); static jrd_file* setup_file(Database*, const Firebird::PathName&, HANDLE, bool, bool); -static bool nt_error(const TEXT*, const jrd_file*, FbStatusVector, FbStatusVector* const); +static bool nt_error(const TEXT*, const jrd_file*, ISC_STATUS, FbStatusVector* const); static void adjustFileSystemCacheSize(); struct AdjustFsCache @@ -1036,8 +1036,8 @@ } static bool nt_error(const TEXT* string, - const jrd_file* file, FbStatusVector operation, - FbStatusVector* const status_vector) + const jrd_file* file, ISC_STATUS operation, + FbStatusVector* const status_vector) { /************************************** * @@ -1061,7 +1061,7 @@ ERR_post(status); ERR_build_status(status_vector, status); - gds__log_status(0, status_vector); + iscLogStatus(NULL, status_vector); return false; } Modified: firebird/trunk/src/remote/SockAddr.h =================================================================== --- firebird/trunk/src/remote/SockAddr.h 2015-03-22 22:42:23 UTC (rev 61055) +++ firebird/trunk/src/remote/SockAddr.h 2015-03-22 22:43:12 UTC (rev 61056) @@ -48,13 +48,13 @@ class SockAddr { private: - union { + union sa_data { struct sockaddr sock; struct sockaddr_in inet; struct sockaddr_in6 inet6; } data; socklen_t len; - static const unsigned MAX_LEN = sizeof(data); + static const unsigned MAX_LEN = sizeof(sa_data); public: void clear(); Modified: firebird/trunk/src/remote/os/win32/wnet.cpp =================================================================== --- firebird/trunk/src/remote/os/win32/wnet.cpp 2015-03-22 22:42:23 UTC (rev 61055) +++ firebird/trunk/src/remote/os/win32/wnet.cpp 2015-03-22 22:43:12 UTC (rev 61056) @@ -1330,7 +1330,9 @@ // decrypt if (port->port_crypt_plugin) { - LocalStatus st; + LocalStatus ls; + CheckStatusWrapper st(&ls); + port->port_crypt_plugin->decrypt(&st, n, buffer, buffer); if (st.getState() & IStatus::STATE_ERRORS) { @@ -1370,7 +1372,8 @@ HalfStaticArray<char, BUFFER_TINY> b; if (port->port_crypt_plugin && port->port_crypt_complete) { - LocalStatus st; + LocalStatus ls; + CheckStatusWrapper st(&ls); char* d = b.getBuffer(buffer_length); port->port_crypt_plugin->encrypt(&st, buffer_length, data, d); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-03-23 11:07:01
|
Revision: 61065 http://sourceforge.net/p/firebird/code/61065 Author: alexpeshkoff Date: 2015-03-23 11:06:51 +0000 (Mon, 23 Mar 2015) Log Message: ----------- Cleanup - avoid automatic type conversion in FbLocalStatus as suggested by Claudio Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/jrd/CryptoManager.cpp firebird/trunk/src/jrd/DbCreators.cpp firebird/trunk/src/jrd/Mapping.cpp firebird/trunk/src/jrd/cch.cpp firebird/trunk/src/jrd/dfw.epp firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/extds/ExtDS.cpp firebird/trunk/src/jrd/extds/InternalDS.cpp firebird/trunk/src/jrd/extds/IscDS.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/jrd.h firebird/trunk/src/jrd/nbak.cpp firebird/trunk/src/jrd/pag.cpp firebird/trunk/src/jrd/status.h firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/jrd/svc.h firebird/trunk/src/jrd/vio.cpp Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/dsql/dsql.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -606,7 +606,7 @@ if (tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_WARNINGS) { // save a status vector - fb_utils::copyStatus(localStatus, tdbb->tdbb_status_vector); + fb_utils::copyStatus(&localStatus, tdbb->tdbb_status_vector); fb_utils::init_status(tdbb->tdbb_status_vector); } @@ -735,7 +735,7 @@ for (counter = 0; counter < 2 && !status; counter++) { localStatus->init(); - AutoSetRestore<Jrd::FbStatusVector*> autoStatus(&tdbb->tdbb_status_vector, localStatus); + AutoSetRestore<Jrd::FbStatusVector*> autoStatus(&tdbb->tdbb_status_vector, &localStatus); try { @@ -760,7 +760,7 @@ else if (status == isc_req_sync && counter == 1) status_exception::raise(Arg::Gds(isc_stream_eof)); else if (status != isc_req_sync) - status_exception::raise(localStatus); + status_exception::raise(&localStatus); } } Modified: firebird/trunk/src/jrd/CryptoManager.cpp =================================================================== --- firebird/trunk/src/jrd/CryptoManager.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/CryptoManager.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -379,7 +379,7 @@ attachment->att_filename = dbb.dbb_filename; attachment->att_user = &user; - BackgroundContextHolder tdbb(&dbb, attachment, status_vector, FB_FUNCTION); + BackgroundContextHolder tdbb(&dbb, attachment, &status_vector, FB_FUNCTION); tdbb->tdbb_quantum = SWEEP_QUANTUM; ULONG lastPage = getLastPage(tdbb); Modified: firebird/trunk/src/jrd/DbCreators.cpp =================================================================== --- firebird/trunk/src/jrd/DbCreators.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/DbCreators.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -82,7 +82,7 @@ if (st->getState() & IStatus::STATE_ERRORS) { if (!fb_utils::containsErrorCode(st->getErrors(), isc_io_error)) - check("IProvider::attachDatabase", st); + check("IProvider::attachDatabase", &st); // missing security DB - checking granted rights not possible return false; @@ -92,7 +92,7 @@ readOnly.insertTag(isc_tpb_read); readOnly.insertTag(isc_tpb_wait); tra = att->startTransaction(&st, readOnly.getBufferLength(), readOnly.getBuffer()); - check("IAttachment::startTransaction", st); + check("IAttachment::startTransaction", &st); return true; } @@ -163,7 +163,7 @@ // isc_dsql_relation_err when exec SQL - i.e. table RDB$USER_PRIVILEGES // is missing due to non-FB security DB if (!fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err)) - check("IAttachment::execute", st); + check("IAttachment::execute", &st); role = ""; } @@ -201,7 +201,7 @@ // is missing due to non-FB3 security DB return false; } - check("IAttachment::execute", st); + check("IAttachment::execute", &st); } return cnt > 0; @@ -267,7 +267,7 @@ if (st->getState() & IStatus::STATE_ERRORS) { if (!fb_utils::containsErrorCode(st->getErrors(), isc_dsql_relation_err)) - check("IAttachment::openCursor", st); + check("IAttachment::openCursor", &st); // isc_dsql_relation_err when opening cursor - i.e. table // is missing due to non-FB3 security DB Modified: firebird/trunk/src/jrd/Mapping.cpp =================================================================== --- firebird/trunk/src/jrd/Mapping.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/Mapping.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -292,7 +292,7 @@ dataFlag = true; return; } - check("IAttachment::openCursor", st); + check("IAttachment::openCursor", &st); } while (curs->fetchNext(&st, mMap.getBuffer()) == IStatus::RESULT_OK) Modified: firebird/trunk/src/jrd/cch.cpp =================================================================== --- firebird/trunk/src/jrd/cch.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/cch.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -2881,7 +2881,7 @@ attachment->att_filename = dbb->dbb_filename; attachment->att_user = &user; - BackgroundContextHolder tdbb(dbb, attachment, status_vector, FB_FUNCTION); + BackgroundContextHolder tdbb(dbb, attachment, &status_vector, FB_FUNCTION); try { @@ -2926,7 +2926,7 @@ { BufferDesc* const bdb = get_buffer(tdbb, FREE_PAGE, SYNC_NONE, 1); if (bdb) - write_buffer(tdbb, bdb, bdb->bdb_page, true, status_vector, true); + write_buffer(tdbb, bdb, bdb->bdb_page, true, &status_vector, true); } // If there's more work to do voluntarily ask to be rescheduled. @@ -2959,8 +2959,8 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); - iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); + ex.stuff_exception(&status_vector); + iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); // continue execution to clean up } @@ -2972,8 +2972,8 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); - iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); + ex.stuff_exception(&status_vector); + iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } bcb->bcb_flags &= ~(BCB_cache_writer | BCB_writer_start); @@ -2984,8 +2984,8 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); - iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); + ex.stuff_exception(&status_vector); + iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } return 0; Modified: firebird/trunk/src/jrd/dfw.epp =================================================================== --- firebird/trunk/src/jrd/dfw.epp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/dfw.epp 2015-03-23 11:06:51 UTC (rev 61065) @@ -1324,7 +1324,7 @@ } if (!phase) { - fb_utils::copyStatus(tdbb->tdbb_status_vector, err_status); + fb_utils::copyStatus(tdbb->tdbb_status_vector, &err_status); ERR_punt(); } ++phase; @@ -1341,7 +1341,7 @@ ERR_punt(); } else - ex.stuff_exception(err_status); + ex.stuff_exception(&err_status); phase = 0; more = true; Modified: firebird/trunk/src/jrd/exe.cpp =================================================================== --- firebird/trunk/src/jrd/exe.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/exe.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -163,12 +163,12 @@ void StatusXcp::init(const FbStatusVector* vector) { - fb_utils::copyStatus(status, vector); + fb_utils::copyStatus(&status, vector); } void StatusXcp::copyTo(FbStatusVector* vector) const { - fb_utils::copyStatus(vector, status); + fb_utils::copyStatus(vector, &status); } bool StatusXcp::success() const Modified: firebird/trunk/src/jrd/extds/ExtDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/ExtDS.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/extds/ExtDS.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -582,10 +582,10 @@ generateTPB(tdbb, tpb, traMode, readOnly, wait, lockTimeout); FbLocalStatus status; - doStart(status, tdbb, tpb); + doStart(&status, tdbb, tpb); if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_connection.raise(status, tdbb, "transaction start"); + m_connection.raise(&status, tdbb, "transaction start"); } jrd_tra* tran = tdbb->getTransaction(); @@ -608,20 +608,20 @@ void Transaction::prepare(thread_db* tdbb, int info_len, const char* info) { FbLocalStatus status; - doPrepare(status, tdbb, info_len, info); + doPrepare(&status, tdbb, info_len, info); if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_connection.raise(status, tdbb, "transaction prepare"); + m_connection.raise(&status, tdbb, "transaction prepare"); } } void Transaction::commit(thread_db* tdbb, bool retain) { FbLocalStatus status; - doCommit(status, tdbb, retain); + doCommit(&status, tdbb, retain); if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_connection.raise(status, tdbb, "transaction commit"); + m_connection.raise(&status, tdbb, "transaction commit"); } if (!retain) @@ -634,7 +634,7 @@ void Transaction::rollback(thread_db* tdbb, bool retain) { FbLocalStatus status; - doRollback(status, tdbb, retain); + doRollback(&status, tdbb, retain); Connection& conn = m_connection; if (!retain) @@ -644,7 +644,7 @@ } if (status->getState() & FbStatusVector::STATE_ERRORS) { - conn.raise(status, tdbb, "transaction rollback"); + conn.raise(&status, tdbb, "transaction rollback"); } } @@ -869,8 +869,8 @@ if (doFetch(tdbb)) { FbLocalStatus status; - Arg::Gds(isc_sing_select_err).copyTo(status); - raise(status, tdbb, "isc_dsql_fetch"); + Arg::Gds(isc_sing_select_err).copyTo(&status); + raise(&status, tdbb, "isc_dsql_fetch"); } return false; } @@ -1496,7 +1496,7 @@ if (status == tdbb->tdbb_status_vector) { - fb_utils::init_status(status); + status->init(); } } Modified: firebird/trunk/src/jrd/extds/InternalDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/InternalDS.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/extds/InternalDS.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -121,7 +121,7 @@ ~IntStatus() { if (v) - fb_utils::copyStatus(v, *this); + fb_utils::copyStatus(v, &(*this)); } private: @@ -158,13 +158,13 @@ { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); RefPtr<JProvider> jInstance(JProvider::getInstance()); - jInstance->setDbCryptCallback(status, tdbb->getAttachment()->att_crypt_callback); - m_attachment.assignRefNoIncr(jInstance->attachDatabase(status, m_dbName.c_str(), + jInstance->setDbCryptCallback(&status, tdbb->getAttachment()->att_crypt_callback); + m_attachment.assignRefNoIncr(jInstance->attachDatabase(&status, m_dbName.c_str(), m_dpb.getBufferLength(), m_dpb.getBuffer())); } if (status->getState() & IStatus::STATE_ERRORS) - raise(status, tdbb, "JProvider::attach"); + raise(&status, tdbb, "JProvider::attach"); } m_sqlDialect = (m_attachment->getHandle()->att_database->dbb_flags & DBB_DB_SQL_dialect_3) ? @@ -188,7 +188,7 @@ { // scope EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - att->detach(status); + att->detach(&status); } if (status->getErrors()[1] == isc_att_shutdown) @@ -199,7 +199,7 @@ if (status->getState() & IStatus::STATE_ERRORS) { m_attachment = att; - raise(status, tdbb, "JAttachment::detach"); + raise(&status, tdbb, "JAttachment::detach"); } } @@ -213,7 +213,7 @@ FbLocalStatus status; - m_attachment->cancelOperation(status, fb_cancel_raise); + m_attachment->cancelOperation(&status, fb_cancel_raise); return !(status->getState() & IStatus::STATE_ERRORS); } @@ -277,7 +277,7 @@ IntStatus s(status); m_transaction.assignRefNoIncr( - att->startTransaction(s, tpb.getBufferLength(), tpb.getBuffer())); + att->startTransaction(&s, tpb.getBufferLength(), tpb.getBuffer())); if (m_transaction) m_transaction->getHandle()->tra_callback_count = localTran->tra_callback_count; @@ -307,10 +307,10 @@ EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); if (retain) - m_transaction->commitRetaining(s); + m_transaction->commitRetaining(&s); else { - m_transaction->commit(s); + m_transaction->commit(&s); m_transaction = NULL; } } @@ -332,10 +332,10 @@ EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); if (retain) - m_transaction->rollbackRetaining(s); + m_transaction->rollbackRetaining(&s); else { - m_transaction->rollback(s); + m_transaction->rollback(&s); m_transaction = NULL; } } @@ -416,7 +416,7 @@ tran->getHandle()->tra_caller_name = CallerName(); } - m_request.assignRefNoIncr(att->prepare(status, tran, sql.length(), sql.c_str(), + m_request.assignRefNoIncr(att->prepare(&status, tran, sql.length(), sql.c_str(), m_connection.getSqlDialect(), 0)); m_allocated = (m_request != NULL); @@ -424,7 +424,7 @@ } if (status->getState() & IStatus::STATE_ERRORS) - raise(status, tdbb, "JAttachment::prepare", &sql); + raise(&status, tdbb, "JAttachment::prepare", &sql); const DsqlCompiledStatement* statement = m_request->getHandle()->getStatement(); @@ -476,8 +476,8 @@ case DsqlCompiledStatement::TYPE_COMMIT_RETAIN: case DsqlCompiledStatement::TYPE_ROLLBACK_RETAIN: case DsqlCompiledStatement::TYPE_CREATE_DB: - Arg::Gds(isc_eds_expl_tran_ctrl).copyTo(status); - raise(status, tdbb, "JAttachment::prepare", &sql); + Arg::Gds(isc_eds_expl_tran_ctrl).copyTo(&status); + raise(&status, tdbb, "JAttachment::prepare", &sql); break; case DsqlCompiledStatement::TYPE_INSERT: @@ -507,12 +507,12 @@ fb_assert(m_inMetadata->getMessageLength() == m_in_buffer.getCount()); fb_assert(m_outMetadata->getMessageLength() == m_out_buffer.getCount()); - m_request->execute(status, transaction, + m_request->execute(&status, transaction, m_inMetadata, m_in_buffer.begin(), m_outMetadata, m_out_buffer.begin()); } if (status->getState() & IStatus::STATE_ERRORS) - raise(status, tdbb, "JStatement::execute"); + raise(&status, tdbb, "JStatement::execute"); } @@ -527,18 +527,18 @@ if (m_cursor) { - m_cursor->close(status); + m_cursor->close(&status); m_cursor = NULL; } fb_assert(m_inMetadata->getMessageLength() == m_in_buffer.getCount()); - m_cursor.assignRefNoIncr(m_request->openCursor(status, transaction, + m_cursor.assignRefNoIncr(m_request->openCursor(&status, transaction, m_inMetadata, m_in_buffer.begin(), m_outMetadata, 0)); } if (status->getState() & IStatus::STATE_ERRORS) - raise(status, tdbb, "JStatement::open"); + raise(&status, tdbb, "JStatement::open"); } @@ -553,11 +553,11 @@ fb_assert(m_outMetadata->getMessageLength() == m_out_buffer.getCount()); fb_assert(m_cursor); - res = m_cursor->fetchNext(status, m_out_buffer.begin()) == IStatus::RESULT_OK; + res = m_cursor->fetchNext(&status, m_out_buffer.begin()) == IStatus::RESULT_OK; } if (status->getState() & IStatus::STATE_ERRORS) - raise(status, tdbb, "JResultSet::fetchNext"); + raise(&status, tdbb, "JResultSet::fetchNext"); return res; } @@ -571,25 +571,25 @@ EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); if (m_cursor) - m_cursor->close(status); + m_cursor->close(&status); m_cursor = NULL; if (status->getState() & IStatus::STATE_ERRORS) { - raise(status, tdbb, "JResultSet::close"); + raise(&status, tdbb, "JResultSet::close"); } if (drop) { if (m_request) - m_request->free(status); + m_request->free(&status); m_allocated = false; m_request = NULL; if (status->getState() & IStatus::STATE_ERRORS) { - raise(status, tdbb, "JStatement::free"); + raise(&status, tdbb, "JStatement::free"); } } } @@ -649,11 +649,11 @@ const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL; m_blob.assignRefNoIncr( - att->openBlob(status, transaction, &m_blob_id, bpb_len, bpb_buff)); + att->openBlob(&status, transaction, &m_blob_id, bpb_len, bpb_buff)); } if (status->getState() & IStatus::STATE_ERRORS) - m_connection.raise(status, tdbb, "JAttachment::openBlob"); + m_connection.raise(&status, tdbb, "JAttachment::openBlob"); fb_assert(m_blob); } @@ -676,11 +676,11 @@ const UCHAR* bpb_buff = bpb ? bpb->begin() : NULL; m_blob.assignRefNoIncr( - att->createBlob(status, transaction, &m_blob_id, bpb_len, bpb_buff)); + att->createBlob(&status, transaction, &m_blob_id, bpb_len, bpb_buff)); } if (status->getState() & IStatus::STATE_ERRORS) - m_connection.raise(status, tdbb, "JAttachment::createBlob"); + m_connection.raise(&status, tdbb, "JAttachment::createBlob"); fb_assert(m_blob); memcpy(desc.dsc_address, &m_blob_id, sizeof(m_blob_id)); @@ -695,11 +695,11 @@ { EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION); - m_blob->getSegment(status, len, buff, &result); + m_blob->getSegment(&status, len, buff, &result); } if (status->getState() & IStatus::STATE_ERRORS) - m_connection.raise(status, tdbb, "JBlob::getSegment"); + m_connection.raise(&status, tdbb, "JBlob::getSegment"); return result; } @@ -712,11 +712,11 @@ { EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION); - m_blob->putSegment(status, len, buff); + m_blob->putSegment(&status, len, buff); } if (status->getState() & IStatus::STATE_ERRORS) - m_connection.raise(status, tdbb, "JBlob::putSegment"); + m_connection.raise(&status, tdbb, "JBlob::putSegment"); } void InternalBlob::close(thread_db* tdbb) @@ -726,12 +726,12 @@ { EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION); - m_blob->close(status); + m_blob->close(&status); m_blob = NULL; } if (status->getState() & IStatus::STATE_ERRORS) - m_connection.raise(status, tdbb, "JBlob::close"); + m_connection.raise(&status, tdbb, "JBlob::close"); fb_assert(!m_blob); } @@ -746,12 +746,12 @@ { EngineCallbackGuard guard(tdbb, m_connection, FB_FUNCTION); - m_blob->cancel(status); + m_blob->cancel(&status); m_blob = NULL; } if (status->getState() & IStatus::STATE_ERRORS) - m_connection.raise(status, tdbb, "JBlob::cancel"); + m_connection.raise(&status, tdbb, "JBlob::cancel"); fb_assert(!m_blob); } Modified: firebird/trunk/src/jrd/extds/IscDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/IscDS.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/extds/IscDS.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -119,12 +119,12 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - m_iscProvider.isc_attach_database(status, m_dbName.length(), m_dbName.c_str(), + m_iscProvider.isc_attach_database(&status, m_dbName.length(), m_dbName.c_str(), &m_handle, m_dpb.getBufferLength(), reinterpret_cast<const char*>(m_dpb.getBuffer())); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - raise(status, tdbb, "attach"); + raise(&status, tdbb, "attach"); } char buff[16]; @@ -132,10 +132,10 @@ EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); const char info[] = {isc_info_db_sql_dialect, isc_info_end}; - m_iscProvider.isc_database_info(status, &m_handle, sizeof(info), info, sizeof(buff), buff); + m_iscProvider.isc_database_info(&status, &m_handle, sizeof(info), info, sizeof(buff), buff); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - raise(status, tdbb, "isc_database_info"); + raise(&status, tdbb, "isc_database_info"); } const char* p = buff, *end = buff + sizeof(buff); @@ -185,14 +185,14 @@ FB_API_HANDLE h = m_handle; m_handle = 0; - m_iscProvider.isc_detach_database(status, &h); + m_iscProvider.isc_detach_database(&status, &h); m_handle = h; } if ((status->getState() & FbStatusVector::STATE_ERRORS) && - !isConnectionBrokenError(status)) + !isConnectionBrokenError(&status)) { - raise(status, tdbb, "detach"); + raise(&status, tdbb, "detach"); } } @@ -202,12 +202,12 @@ if (m_handle) { - m_iscProvider.fb_cancel_operation(status, &m_handle, fb_cancel_raise); + m_iscProvider.fb_cancel_operation(&status, &m_handle, fb_cancel_raise); if (m_handle && (status->getErrors()[1] == isc_wish_list)) { status->init(); - m_iscProvider.fb_cancel_operation(status, &m_handle, fb_cancel_abort); + m_iscProvider.fb_cancel_operation(&status, &m_handle, fb_cancel_abort); } } return !(status->getState() & FbStatusVector::STATE_ERRORS); @@ -336,14 +336,14 @@ if (!m_handle) { fb_assert(!m_allocated); - if (m_iscProvider.isc_dsql_allocate_statement(status, &h_conn, &m_handle)) { + if (m_iscProvider.isc_dsql_allocate_statement(&status, &h_conn, &m_handle)) { sWhereError = "isc_dsql_allocate_statement"; } m_allocated = (m_handle != 0); } if (!sWhereError) { - if (m_iscProvider.isc_dsql_prepare(status, &h_tran, &m_handle, sql.length(), + if (m_iscProvider.isc_dsql_prepare(&status, &h_tran, &m_handle, sql.length(), sql.c_str(), m_connection.getSqlDialect(), m_out_xsqlda)) { sWhereError = "isc_dsql_prepare"; @@ -351,7 +351,7 @@ } } if (sWhereError) { - raise(status, tdbb, sWhereError, &sql); + raise(&status, tdbb, sWhereError, &sql); } // adjust output parameters @@ -365,13 +365,13 @@ m_out_xsqlda->version = 1; EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - if (m_iscProvider.isc_dsql_describe(status, &m_handle, 1, m_out_xsqlda)) + if (m_iscProvider.isc_dsql_describe(&status, &m_handle, 1, m_out_xsqlda)) { sWhereError = "isc_dsql_describe"; } } if (sWhereError) { - raise(status, tdbb, sWhereError, &sql); + raise(&status, tdbb, sWhereError, &sql); } for (int i = 0; i != m_out_xsqlda->sqld; ++i) @@ -393,13 +393,13 @@ { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - if (m_iscProvider.isc_dsql_describe_bind(status, &m_handle, 1, m_in_xsqlda)) + if (m_iscProvider.isc_dsql_describe_bind(&status, &m_handle, 1, m_in_xsqlda)) { sWhereError = "isc_dsql_describe_bind"; } } if (sWhereError) { - raise(status, tdbb, sWhereError, &sql); + raise(&status, tdbb, sWhereError, &sql); } // adjust input parameters @@ -413,13 +413,13 @@ m_in_xsqlda->version = 1; EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - if (m_iscProvider.isc_dsql_describe_bind(status, &m_handle, 1, m_in_xsqlda)) + if (m_iscProvider.isc_dsql_describe_bind(&status, &m_handle, 1, m_in_xsqlda)) { sWhereError = "isc_dsql_describe_bind"; } } if (sWhereError) { - raise(status, tdbb, sWhereError, &sql); + raise(&status, tdbb, sWhereError, &sql); } parseSQLDA(m_in_xsqlda, m_in_buffer, m_inDescs); @@ -430,22 +430,22 @@ char info_buff[16]; { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - if (m_iscProvider.isc_dsql_sql_info(status, &m_handle, sizeof(stmt_info), stmt_info, + if (m_iscProvider.isc_dsql_sql_info(&status, &m_handle, sizeof(stmt_info), stmt_info, sizeof(info_buff), info_buff)) { sWhereError = "isc_dsql_sql_info"; } } if (sWhereError) { - raise(status, tdbb, sWhereError, &sql); + raise(&status, tdbb, sWhereError, &sql); } if (info_buff[0] != stmt_info[0]) { - ERR_build_status(status, Arg::Gds(isc_random) << "Unknown statement type"); + ERR_build_status(&status, Arg::Gds(isc_random) << "Unknown statement type"); sWhereError = "isc_dsql_sql_info"; - raise(status, tdbb, sWhereError, &sql); + raise(&status, tdbb, sWhereError, &sql); } { @@ -460,10 +460,10 @@ stmt_type == isc_info_sql_stmt_commit || stmt_type == isc_info_sql_stmt_rollback) { - ERR_build_status(status, Arg::Gds(isc_eds_expl_tran_ctrl)); + ERR_build_status(&status, Arg::Gds(isc_eds_expl_tran_ctrl)); sWhereError = "isc_dsql_prepare"; - raise(status, tdbb, sWhereError, &sql); + raise(&status, tdbb, sWhereError, &sql); } } } @@ -475,10 +475,10 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - m_iscProvider.isc_dsql_execute2(status, &h_tran, &m_handle, 1, m_in_xsqlda, m_out_xsqlda); + m_iscProvider.isc_dsql_execute2(&status, &h_tran, &m_handle, 1, m_in_xsqlda, m_out_xsqlda); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - raise(status, tdbb, "isc_dsql_execute2"); + raise(&status, tdbb, "isc_dsql_execute2"); } } @@ -488,10 +488,10 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - m_iscProvider.isc_dsql_execute(status, &h_tran, &m_handle, 1, m_in_xsqlda); + m_iscProvider.isc_dsql_execute(&status, &h_tran, &m_handle, 1, m_in_xsqlda); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - raise(status, tdbb, "isc_dsql_execute"); + raise(&status, tdbb, "isc_dsql_execute"); } } @@ -500,13 +500,13 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - const ISC_STATUS res = m_iscProvider.isc_dsql_fetch(status, &m_handle, 1, m_out_xsqlda); + const ISC_STATUS res = m_iscProvider.isc_dsql_fetch(&status, &m_handle, 1, m_out_xsqlda); if (res == 100) { return false; } } if (status->getState() & FbStatusVector::STATE_ERRORS) { - raise(status, tdbb, "isc_dsql_fetch"); + raise(&status, tdbb, "isc_dsql_fetch"); } return true; } @@ -517,14 +517,14 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); - m_iscProvider.isc_dsql_free_statement(status, &m_handle, drop ? DSQL_drop : DSQL_close); + m_iscProvider.isc_dsql_free_statement(&status, &m_handle, drop ? DSQL_drop : DSQL_close); m_allocated = (m_handle != 0); } if (status->getState() & FbStatusVector::STATE_ERRORS) { // we can do nothing else with this statement after this point m_allocated = m_handle = 0; - raise(status, tdbb, "isc_dsql_free_statement"); + raise(&status, tdbb, "isc_dsql_free_statement"); } } @@ -580,11 +580,11 @@ ISC_USHORT bpb_len = bpb ? bpb->getCount() : 0; const ISC_UCHAR* bpb_buff = bpb ? bpb->begin() : NULL; - m_iscProvider.isc_open_blob2(status, &h_db, &h_tran, &m_handle, &m_blob_id, + m_iscProvider.isc_open_blob2(&status, &h_db, &h_tran, &m_handle, &m_blob_id, bpb_len, bpb_buff); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_iscConnection.raise(status, tdbb, "isc_open_blob2"); + m_iscConnection.raise(&status, tdbb, "isc_open_blob2"); } fb_assert(m_handle); } @@ -604,12 +604,12 @@ ISC_USHORT bpb_len = bpb ? bpb->getCount() : 0; const char* bpb_buff = bpb ? reinterpret_cast<const char*>(bpb->begin()) : NULL; - m_iscProvider.isc_create_blob2(status, &h_db, &h_tran, &m_handle, &m_blob_id, + m_iscProvider.isc_create_blob2(&status, &h_db, &h_tran, &m_handle, &m_blob_id, bpb_len, bpb_buff); memcpy(desc.dsc_address, &m_blob_id, sizeof(m_blob_id)); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_iscConnection.raise(status, tdbb, "isc_create_blob2"); + m_iscConnection.raise(&status, tdbb, "isc_create_blob2"); } fb_assert(m_handle); } @@ -622,7 +622,7 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION); - m_iscProvider.isc_get_segment(status, &m_handle, &result, len, reinterpret_cast<SCHAR*>(buff)); + m_iscProvider.isc_get_segment(&status, &m_handle, &result, len, reinterpret_cast<SCHAR*>(buff)); } switch (status->getErrors()[1]) { @@ -633,7 +633,7 @@ case 0: break; default: - m_iscConnection.raise(status, tdbb, "isc_get_segment"); + m_iscConnection.raise(&status, tdbb, "isc_get_segment"); } return result; @@ -646,10 +646,10 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION); - m_iscProvider.isc_put_segment(status, &m_handle, len, reinterpret_cast<const SCHAR*>(buff)); + m_iscProvider.isc_put_segment(&status, &m_handle, len, reinterpret_cast<const SCHAR*>(buff)); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_iscConnection.raise(status, tdbb, "isc_put_segment"); + m_iscConnection.raise(&status, tdbb, "isc_put_segment"); } } @@ -659,10 +659,10 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION); - m_iscProvider.isc_close_blob(status, &m_handle); + m_iscProvider.isc_close_blob(&status, &m_handle); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_iscConnection.raise(status, tdbb, "isc_close_blob"); + m_iscConnection.raise(&status, tdbb, "isc_close_blob"); } fb_assert(!m_handle); } @@ -676,10 +676,10 @@ FbLocalStatus status; { EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION); - m_iscProvider.isc_cancel_blob(status, &m_handle); + m_iscProvider.isc_cancel_blob(&status, &m_handle); } if (status->getState() & FbStatusVector::STATE_ERRORS) { - m_iscConnection.raise(status, tdbb, "isc_close_blob"); + m_iscConnection.raise(&status, tdbb, "isc_close_blob"); } fb_assert(!m_handle); } @@ -1472,8 +1472,8 @@ void IscProvider::loadAPI() { FbLocalStatus status; - notImplemented(status); - status_exception::raise(status); + notImplemented(&status); + status_exception::raise(&status); } Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/jrd.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -5521,12 +5521,12 @@ { if (unlink(file->fil_string)) { - ERR_build_status(status, Arg::Gds(isc_io_error) << Arg::Str("unlink") << + ERR_build_status(&status, Arg::Gds(isc_io_error) << Arg::Str("unlink") << Arg::Str(file->fil_string) << Arg::Gds(isc_io_delete_err) << SYS_ERR(errno)); Database* dbb = GET_DBB(); PageSpace* pageSpace = dbb->dbb_page_manager.findPageSpace(DB_PAGE_SPACE); - iscDbLogStatus(pageSpace->file->fil_string, status); + iscDbLogStatus(pageSpace->file->fil_string, &status); } } @@ -7831,8 +7831,8 @@ if (transliterate) { FbLocalStatus tempStatus; - transliterateException(tdbb, ex, tempStatus, "startTransaction"); - status_exception::raise(tempStatus); + transliterateException(tdbb, ex, &tempStatus, "startTransaction"); + status_exception::raise(&tempStatus); } throw; } Modified: firebird/trunk/src/jrd/jrd.h =================================================================== --- firebird/trunk/src/jrd/jrd.h 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/jrd.h 2015-03-23 11:06:51 UTC (rev 61065) @@ -590,14 +590,14 @@ { public: explicit ThreadContextHolder(Firebird::CheckStatusWrapper* status = NULL) - : currentStatus(status ? status : localStatus), context(currentStatus) + : currentStatus(status ? status : &localStatus), context(currentStatus) { context.putSpecific(); currentStatus->init(); } ThreadContextHolder(Database* dbb, Jrd::Attachment* att, FbStatusVector* status = NULL) - : currentStatus(status ? status : localStatus), context(currentStatus) + : currentStatus(status ? status : &localStatus), context(currentStatus) { context.putSpecific(); context.setDatabase(dbb); @@ -639,7 +639,7 @@ explicit ThreadStatusGuard(thread_db* tdbb) : m_tdbb(tdbb), m_old_status(tdbb->tdbb_status_vector) { - m_tdbb->tdbb_status_vector = m_local_status; + m_tdbb->tdbb_status_vector = &m_local_status; } ~ThreadStatusGuard() @@ -653,15 +653,15 @@ return m_old_status; } - operator FbStatusVector*() { return m_local_status; } - FbStatusVector* operator->() { return m_local_status; } + operator FbStatusVector*() { return &m_local_status; } + FbStatusVector* operator->() { return &m_local_status; } - operator const FbStatusVector*() const { return m_local_status; } - const FbStatusVector* operator->() const { return m_local_status; } + operator const FbStatusVector*() const { return &m_local_status; } + const FbStatusVector* operator->() const { return &m_local_status; } void copyToOriginal() { - fb_utils::copyStatus(m_old_status, m_local_status); + fb_utils::copyStatus(m_old_status, &m_local_status); } private: Modified: firebird/trunk/src/jrd/nbak.cpp =================================================================== --- firebird/trunk/src/jrd/nbak.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/nbak.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -361,9 +361,9 @@ temp_bdb.bdb_page = pageNum; FbLocalStatus status; // It's PIP - therefore no need to try to decrypt - if (!PIO_read(pageSpace->file, &temp_bdb, temp_bdb.bdb_buffer, status)) + if (!PIO_read(pageSpace->file, &temp_bdb, temp_bdb.bdb_buffer, &status)) { - Firebird::status_exception::raise(status); + Firebird::status_exception::raise(&status); } } }; Modified: firebird/trunk/src/jrd/pag.cpp =================================================================== --- firebird/trunk/src/jrd/pag.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/pag.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -784,7 +784,7 @@ FbLocalStatus status; const ULONG start = sequence * pageMgr.pagesPerPIP + pip_page->pip_used; - init_pages = PIO_init_data(dbb, pageSpace->file, status, start, init_pages); + init_pages = PIO_init_data(dbb, pageSpace->file, &status, start, init_pages); } if (init_pages) Modified: firebird/trunk/src/jrd/status.h =================================================================== --- firebird/trunk/src/jrd/status.h 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/status.h 2015-03-23 11:06:51 UTC (rev 61065) @@ -30,6 +30,7 @@ #define FB_MFbStatusVector_H #include "../common/StatusHolder.h" +#include "../common/utils_proto.h" const int MAX_ERRMSG_LEN = 128; const int MAX_ERRSTR_LEN = 1024; @@ -45,27 +46,28 @@ : localStatusVector(&localStatus) { } - operator FbStatusVector*() + FbStatusVector* operator->() { return &localStatusVector; } - FbStatusVector* operator->() + FbStatusVector* operator&() { return &localStatusVector; } - FbStatusVector* operator&() + ISC_STATUS operator[](unsigned n) const { - return &localStatusVector; + fb_assert(n < fb_utils::statusLength(localStatusVector.getErrors())); + return localStatusVector.getErrors()[n]; } - operator const FbStatusVector*() const + const FbStatusVector* operator->() const { return &localStatusVector; } - const FbStatusVector* operator->() const + const FbStatusVector* operator&() const { return &localStatusVector; } Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/svc.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -487,7 +487,7 @@ } Arg::StatusVector passed(status_vector); - ERR_post_nothrow(passed, svc_status); + ERR_post_nothrow(passed, &svc_status); } void Service::setServiceStatus(const USHORT facility, const USHORT errcode, @@ -510,7 +510,7 @@ put_status_arg(status, args.getCell(loop)); } - ERR_post_nothrow(status, svc_status); + ERR_post_nothrow(status, &svc_status); } void Service::hidePasswd(ArgvType&, int) @@ -520,12 +520,12 @@ const FbStatusVector* Service::getStatus() { - return svc_status; + return &svc_status; } void Service::initStatus() { - fb_utils::init_status(svc_status); + svc_status->init(); } void Service::checkService() @@ -761,7 +761,7 @@ if (trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_ATTACH)) { - const ISC_STATUS exc = ex.stuff_exception(status_vector); + const ISC_STATUS exc = ex.stuff_exception(&status_vector); const bool no_priv = (exc == isc_login || exc == isc_no_priv); TraceServiceImpl service(this); @@ -944,7 +944,7 @@ } -FbStatusVector Service::query2(thread_db* /*tdbb*/, +ISC_STATUS Service::query2(thread_db* /*tdbb*/, USHORT send_item_length, const UCHAR* send_items, USHORT recv_item_length, @@ -1451,7 +1451,7 @@ if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_QUERY)) { - const ISC_STATUS exc = ex.stuff_exception(status_vector); + const ISC_STATUS exc = ex.stuff_exception(&status_vector); const bool no_priv = (exc == isc_login || exc == isc_no_priv || exc == isc_insufficient_svc_privileges); @@ -1834,7 +1834,7 @@ if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_QUERY)) { - const ISC_STATUS exc = ex.stuff_exception(status_vector); + const ISC_STATUS exc = ex.stuff_exception(&status_vector); const bool no_priv = (exc == isc_login || exc == isc_no_priv); // Report to Trace API that query failed @@ -2052,7 +2052,7 @@ if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_START)) { FbLocalStatus status_vector; - const ISC_STATUS exc = ex.stuff_exception(status_vector); + const ISC_STATUS exc = ex.stuff_exception(&status_vector); const bool no_priv = (exc == isc_login || exc == isc_no_priv); TraceServiceImpl service(this); @@ -2107,7 +2107,7 @@ if (!file || (file && ferror(file))) { (Arg::Gds(isc_sys_request) << Arg::Str(file ? "fgets" : "fopen") << - SYS_ERR(errno)).copyTo(svc_status); + SYS_ERR(errno)).copyTo(&svc_status); if (!svc_started) { started(); @@ -2117,7 +2117,7 @@ catch (const Firebird::Exception& e) { setDataMode(false); - e.stuff_exception(svc_status); + e.stuff_exception(&svc_status); } if (file) Modified: firebird/trunk/src/jrd/svc.h =================================================================== --- firebird/trunk/src/jrd/svc.h 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/svc.h 2015-03-23 11:06:51 UTC (rev 61065) @@ -164,7 +164,7 @@ // Query service state (v. 1 & 2) void query(USHORT send_item_length, const UCHAR* send_items, USHORT recv_item_length, const UCHAR* recv_items, USHORT buffer_length, UCHAR* info); - FbStatusVector query2(thread_db* tdbb, USHORT send_item_length, const UCHAR* send_items, + ISC_STATUS query2(thread_db* tdbb, USHORT send_item_length, const UCHAR* send_items, USHORT recv_item_length, const UCHAR* recv_items, USHORT buffer_length, UCHAR* info); // Detach from service void detach(); Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2015-03-23 09:58:57 UTC (rev 61064) +++ firebird/trunk/src/jrd/vio.cpp 2015-03-23 11:06:51 UTC (rev 61065) @@ -4539,7 +4539,7 @@ attachment->att_flags |= ATT_garbage_collector; attachment->att_user = &user; - BackgroundContextHolder tdbb(dbb, attachment, status_vector, FB_FUNCTION); + BackgroundContextHolder tdbb(dbb, attachment, &status_vector, FB_FUNCTION); tdbb->tdbb_quantum = SWEEP_QUANTUM; tdbb->tdbb_flags = TDBB_sweeper; @@ -4730,8 +4730,8 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); - iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); + ex.stuff_exception(&status_vector); + iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); if (relation && relation->rel_sweep_count) --relation->rel_sweep_count; @@ -4754,8 +4754,8 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); - iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); + ex.stuff_exception(&status_vector); + iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } dbb->dbb_flags &= ~(DBB_garbage_collector | DBB_gc_active | DBB_gc_pending); @@ -4767,8 +4767,8 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); - iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); + ex.stuff_exception(&status_vector); + iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2015-03-25 17:52:16
|
Revision: 61083 http://sourceforge.net/p/firebird/code/61083 Author: asfernandes Date: 2015-03-25 17:52:14 +0000 (Wed, 25 Mar 2015) Log Message: ----------- Rework new aggregate functions so that they use the single blr_agg_function BLR verb. Modified Paths: -------------- firebird/trunk/src/dsql/AggNodes.cpp firebird/trunk/src/dsql/AggNodes.h firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/WinNodes.cpp firebird/trunk/src/jrd/blp.h firebird/trunk/src/jrd/blr.h Modified: firebird/trunk/src/dsql/AggNodes.cpp =================================================================== --- firebird/trunk/src/dsql/AggNodes.cpp 2015-03-25 17:52:13 UTC (rev 61082) +++ firebird/trunk/src/dsql/AggNodes.cpp 2015-03-25 17:52:14 UTC (rev 61083) @@ -48,6 +48,10 @@ namespace Jrd { +static RegisterNode<AggNode> regAggNode(blr_agg_function); + +AggNode::Factory* AggNode::factories = NULL; + AggNode::AggNode(MemoryPool& pool, const AggInfo& aAggInfo, bool aDistinct, bool aDialect1, ValueExprNode* aArg) : TypedNode<ValueExprNode, ExprNode::TYPE_AGGREGATE>(pool), @@ -61,6 +65,35 @@ addChildNode(arg, arg); } +DmlNode* AggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/) +{ + MetaName name; + PAR_name(csb, name); + + AggNode* node = NULL; + + for (const Factory* factory = factories; factory; factory = factory->next) + { + if (name == factory->name) + { + node = factory->newInstance(pool); + break; + } + } + + if (!node) + PAR_error(csb, Arg::Gds(isc_funnotdef) << name); + + UCHAR count = csb->csb_blr_reader.getByte(); + + if (count != node->jrdChildNodes.getCount()) + PAR_error(csb, Arg::Gds(isc_funmismat) << name); + + node->parseArgs(tdbb, csb, count); + + return node; +} + AggNode* AggNode::dsqlPass(DsqlCompilerScratch* dsqlScratch) { if (dsqlScratch->isPsql()) @@ -1173,10 +1206,14 @@ //-------------------- -static AggNode::Register<StdDevAggNode> stdDevSampAggInfo("STDDEV_SAMP", blr_agg_stddev_samp); -static AggNode::Register<StdDevAggNode> stdDevPopAggInfo("STDDEV_POP", blr_agg_stddev_pop); -static AggNode::Register<StdDevAggNode> varSampAggInfo("VAR_SAMP", blr_agg_var_samp); -static AggNode::Register<StdDevAggNode> varPopAggInfo("VAR_POP", blr_agg_var_pop); +static AggNode::RegisterFactory1<StdDevAggNode, StdDevAggNode::StdDevType> stdDevSampAggInfo( + "STDDEV_SAMP", StdDevAggNode::TYPE_STDDEV_SAMP); +static AggNode::RegisterFactory1<StdDevAggNode, StdDevAggNode::StdDevType> stdDevPopAggInfo( + "STDDEV_POP", StdDevAggNode::TYPE_STDDEV_POP); +static AggNode::RegisterFactory1<StdDevAggNode, StdDevAggNode::StdDevType> varSampAggInfo( + "VAR_SAMP", StdDevAggNode::TYPE_VAR_SAMP); +static AggNode::RegisterFactory1<StdDevAggNode, StdDevAggNode::StdDevType> varPopAggInfo( + "VAR_POP", StdDevAggNode::TYPE_VAR_POP); StdDevAggNode::StdDevAggNode(MemoryPool& pool, StdDevType aType, ValueExprNode* aArg) : AggNode(pool, @@ -1190,42 +1227,17 @@ { } +void StdDevAggNode::parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned /*count*/) +{ + arg = PAR_parse_value(tdbb, csb); +} + void StdDevAggNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb) { AggNode::aggPostRse(tdbb, csb); impure2Offset = CMP_impure(csb, sizeof(StdDevImpure)); } -DmlNode* StdDevAggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp) -{ - StdDevType type; - - switch (blrOp) - { - case blr_agg_stddev_samp: - type = TYPE_STDDEV_SAMP; - break; - - case blr_agg_stddev_pop: - type = TYPE_STDDEV_POP; - break; - - case blr_agg_var_samp: - type = TYPE_VAR_SAMP; - break; - - case blr_agg_var_pop: - type = TYPE_VAR_POP; - break; - - default: - fb_assert(false); - return NULL; - } - - return FB_NEW(pool) StdDevAggNode(pool, type, PAR_parse_value(tdbb, csb)); -} - void StdDevAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc) { desc->makeDouble(); @@ -1317,9 +1329,12 @@ //-------------------- -static AggNode::Register<CorrAggNode> coVarSampAggInfo("COVAR_SAMP", blr_agg_covar_samp); -static AggNode::Register<CorrAggNode> coVarPopAggInfo("COVAR_POP", blr_agg_covar_pop); -static AggNode::Register<CorrAggNode> corrAggInfo("CORR", blr_agg_corr); +static AggNode::RegisterFactory1<CorrAggNode, CorrAggNode::CorrType> coVarSampAggInfo( + "COVAR_SAMP", CorrAggNode::TYPE_COVAR_SAMP); +static AggNode::RegisterFactory1<CorrAggNode, CorrAggNode::CorrType> coVarPopAggInfo( + "COVAR_POP", CorrAggNode::TYPE_COVAR_POP); +static AggNode::RegisterFactory1<CorrAggNode, CorrAggNode::CorrType> corrAggInfo( + "CORR", CorrAggNode::TYPE_CORR); CorrAggNode::CorrAggNode(MemoryPool& pool, CorrType aType, ValueExprNode* aArg, ValueExprNode* aArg2) : AggNode(pool, @@ -1334,40 +1349,18 @@ addChildNode(arg2, arg2); } +void CorrAggNode::parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned /*count*/) +{ + arg = PAR_parse_value(tdbb, csb); + arg2 = PAR_parse_value(tdbb, csb); +} + void CorrAggNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb) { AggNode::aggPostRse(tdbb, csb); impure2Offset = CMP_impure(csb, sizeof(CorrImpure)); } -DmlNode* CorrAggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp) -{ - CorrType type; - - switch (blrOp) - { - case blr_agg_covar_samp: - type = TYPE_COVAR_SAMP; - break; - - case blr_agg_covar_pop: - type = TYPE_COVAR_POP; - break; - - case blr_agg_corr: - type = TYPE_CORR; - break; - - default: - fb_assert(false); - return NULL; - } - - ValueExprNode* a1 = PAR_parse_value(tdbb, csb); - ValueExprNode* a2 = PAR_parse_value(tdbb, csb); - return FB_NEW(pool) CorrAggNode(pool, type, a1, a2); -} - void CorrAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc) { desc->makeDouble(); @@ -1492,14 +1485,22 @@ //-------------------- -static AggNode::Register<RegrAggNode> regrAvgxAggInfo("REGR_AVGX", blr_agg_regr_avgx); -static AggNode::Register<RegrAggNode> regrAvgyAggInfo("REGR_AVGY", blr_agg_regr_avgy); -static AggNode::Register<RegrAggNode> regrInterceptAggInfo("REGR_INTERCEPT", blr_agg_regr_intercept); -static AggNode::Register<RegrAggNode> regrR2AggInfo("REGR_R2", blr_agg_regr_r2); -static AggNode::Register<RegrAggNode> regrSlopeAggInfo("REGR_SLOPE", blr_agg_regr_slope); -static AggNode::Register<RegrAggNode> regrSxxAggInfo("REGR_SXX", blr_agg_regr_sxx); -static AggNode::Register<RegrAggNode> regrSxyAggInfo("REGR_SXY", blr_agg_regr_sxy); -static AggNode::Register<RegrAggNode> regrSyyAggInfo("REGR_SYY", blr_agg_regr_syy); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrAvgxAggInfo( + "REGR_AVGX", RegrAggNode::TYPE_REGR_AVGX); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrAvgyAggInfo( + "REGR_AVGY", RegrAggNode::TYPE_REGR_AVGY); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrInterceptAggInfo( + "REGR_INTERCEPT", RegrAggNode::TYPE_REGR_INTERCEPT); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrR2AggInfo( + "REGR_R2", RegrAggNode::TYPE_REGR_R2); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrSlopeAggInfo( + "REGR_SLOPE", RegrAggNode::TYPE_REGR_SLOPE); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrSxxAggInfo( + "REGR_SXX", RegrAggNode::TYPE_REGR_SXX); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrSxyAggInfo( + "REGR_SXY", RegrAggNode::TYPE_REGR_SXY); +static AggNode::RegisterFactory1<RegrAggNode, RegrAggNode::RegrType> regrSyyAggInfo( + "REGR_SYY", RegrAggNode::TYPE_REGR_SYY); RegrAggNode::RegrAggNode(MemoryPool& pool, RegrType aType, ValueExprNode* aArg, ValueExprNode* aArg2) : AggNode(pool, @@ -1520,60 +1521,18 @@ addChildNode(arg2, arg2); } +void RegrAggNode::parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned /*count*/) +{ + arg = PAR_parse_value(tdbb, csb); + arg2 = PAR_parse_value(tdbb, csb); +} + void RegrAggNode::aggPostRse(thread_db* tdbb, CompilerScratch* csb) { AggNode::aggPostRse(tdbb, csb); impure2Offset = CMP_impure(csb, sizeof(RegrImpure)); } -DmlNode* RegrAggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp) -{ - RegrType type; - - switch (blrOp) - { - case blr_agg_regr_avgx: - type = TYPE_REGR_AVGX; - break; - - case blr_agg_regr_avgy: - type = TYPE_REGR_AVGY; - break; - - case blr_agg_regr_intercept: - type = TYPE_REGR_INTERCEPT; - break; - - case blr_agg_regr_r2: - type = TYPE_REGR_R2; - break; - - case blr_agg_regr_slope: - type = TYPE_REGR_SLOPE; - break; - - case blr_agg_regr_sxx: - type = TYPE_REGR_SXX; - break; - - case blr_agg_regr_sxy: - type = TYPE_REGR_SXY; - break; - - case blr_agg_regr_syy: - type = TYPE_REGR_SYY; - break; - - default: - fb_assert(false); - return NULL; - } - - ValueExprNode* a1 = PAR_parse_value(tdbb, csb); - ValueExprNode* a2 = PAR_parse_value(tdbb, csb); - return FB_NEW(pool) RegrAggNode(pool, type, a1, a2); -} - void RegrAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc) { desc->makeDouble(); @@ -1724,7 +1683,7 @@ //-------------------- -static AggNode::Register<RegrCountAggNode> regrCountAggInfo("REGR_COUNT", blr_agg_regr_count); +static AggNode::RegisterFactory0<RegrCountAggNode> regrCountAggInfo("REGR_COUNT"); RegrCountAggNode::RegrCountAggNode(MemoryPool& pool, ValueExprNode* aArg, ValueExprNode* aArg2) : AggNode(pool, regrCountAggInfo, false, false, aArg), @@ -1733,11 +1692,10 @@ addChildNode(arg2, arg2); } -DmlNode* RegrCountAggNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp) +void RegrCountAggNode::parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned /*count*/) { - ValueExprNode* a1 = PAR_parse_value(tdbb, csb); - ValueExprNode* a2 = PAR_parse_value(tdbb, csb); - return FB_NEW(pool) RegrCountAggNode(pool, a1, a2); + arg = PAR_parse_value(tdbb, csb); + arg2 = PAR_parse_value(tdbb, csb); } void RegrCountAggNode::make(DsqlCompilerScratch* dsqlScratch, dsc* desc) Modified: firebird/trunk/src/dsql/AggNodes.h =================================================================== --- firebird/trunk/src/dsql/AggNodes.h 2015-03-25 17:52:13 UTC (rev 61082) +++ firebird/trunk/src/dsql/AggNodes.h 2015-03-25 17:52:14 UTC (rev 61083) @@ -170,10 +170,11 @@ }; explicit StdDevAggNode(MemoryPool& pool, StdDevType aType, ValueExprNode* aArg = NULL); + + virtual void parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned count); + virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb); - static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp); - virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; @@ -210,10 +211,10 @@ explicit CorrAggNode(MemoryPool& pool, CorrType aType, ValueExprNode* aArg = NULL, ValueExprNode* aArg2 = NULL); + virtual void parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned count); + virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb); - static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp); - virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; @@ -257,10 +258,10 @@ explicit RegrAggNode(MemoryPool& pool, RegrType aType, ValueExprNode* aArg = NULL, ValueExprNode* aArg2 = NULL); + virtual void parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned count); + virtual void aggPostRse(thread_db* tdbb, CompilerScratch* csb); - static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp); - virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); virtual ValueExprNode* copy(thread_db* tdbb, NodeCopier& copier) const; @@ -287,7 +288,7 @@ explicit RegrCountAggNode(MemoryPool& pool, ValueExprNode* aArg = NULL, ValueExprNode* aArg2 = NULL); - static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp); + virtual void parseArgs(thread_db* tdbb, CompilerScratch* csb, unsigned count); virtual void make(DsqlCompilerScratch* dsqlScratch, dsc* desc); virtual void getDesc(thread_db* tdbb, CompilerScratch* csb, dsc* desc); Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2015-03-25 17:52:13 UTC (rev 61082) +++ firebird/trunk/src/dsql/Nodes.h 2015-03-25 17:52:14 UTC (rev 61083) @@ -818,8 +818,61 @@ const UCHAR distinctBlr; }; + // Base factory to create instance of subclasses. + class Factory : public AggInfo + { + public: + explicit Factory(const char* aName) + : AggInfo(aName, 0, 0) + { + next = factories; + factories = this; + } + + virtual AggNode* newInstance(MemoryPool& pool) const = 0; + + public: + const Factory* next; + }; + public: + // Concrete implementations for the factory. + template <typename T> + class RegisterFactory0 : public Factory + { + public: + explicit RegisterFactory0(const char* aName) + : Factory(aName) + { + } + + AggNode* newInstance(MemoryPool& pool) const + { + return new T(pool); + } + }; + + template <typename T, typename Type> + class RegisterFactory1 : public Factory + { + public: + explicit RegisterFactory1(const char* aName, Type aType) + : Factory(aName), + type(aType) + { + } + + AggNode* newInstance(MemoryPool& pool) const + { + return new T(pool, type); + } + + public: + const Type type; + }; + + template <typename T> class Register : public AggInfo { public: @@ -844,6 +897,8 @@ explicit AggNode(MemoryPool& pool, const AggInfo& aAggInfo, bool aDistinct, bool aDialect1, ValueExprNode* aArg = NULL); + static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp); + virtual void print(Firebird::string& text) const; virtual bool dsqlAggregateFinder(AggregateFinder& visitor); @@ -916,6 +971,11 @@ virtual AggNode* dsqlPass(DsqlCompilerScratch* dsqlScratch); protected: + virtual void parseArgs(thread_db* /*tdbb*/, CompilerScratch* /*csb*/, unsigned count) + { + fb_assert(count == 0); + } + virtual AggNode* dsqlCopy(DsqlCompilerScratch* dsqlScratch) /*const*/ = 0; public: @@ -925,59 +985,17 @@ NestConst<ValueExprNode> arg; const AggregateSort* asb; bool indexed; + +private: + static Factory* factories; }; // Base class for window functions. class WinFuncNode : public AggNode { -private: - // Base factory to create instance of subclasses. - class Factory : public AggInfo - { - public: - explicit Factory(const char* aName) - : AggInfo(aName, 0, 0) - { - } - - virtual WinFuncNode* newInstance(MemoryPool& pool) const = 0; - - public: - const Factory* next; - }; - public: - // Concrete implementation of the factory. - template <typename T> - class Register : public Factory - { - public: - explicit Register(const char* aName) - : Factory(aName) - { - next = factories; - factories = this; - } - - WinFuncNode* newInstance(MemoryPool& pool) const - { - return new T(pool); - } - }; - explicit WinFuncNode(MemoryPool& pool, const AggInfo& aAggInfo, ValueExprNode* aArg = NULL); - - static DmlNode* parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR blrOp); - -protected: - virtual void parseArgs(thread_db* /*tdbb*/, CompilerScratch* /*csb*/, unsigned count) - { - fb_assert(count == 0); - } - -private: - static Factory* factories; }; Modified: firebird/trunk/src/dsql/WinNodes.cpp =================================================================== --- firebird/trunk/src/dsql/WinNodes.cpp 2015-03-25 17:52:13 UTC (rev 61082) +++ firebird/trunk/src/dsql/WinNodes.cpp 2015-03-25 17:52:14 UTC (rev 61083) @@ -36,49 +36,16 @@ namespace Jrd { -static RegisterNode<WinFuncNode> regWinFuncNode(blr_agg_function); - -WinFuncNode::Factory* WinFuncNode::factories = NULL; - WinFuncNode::WinFuncNode(MemoryPool& pool, const AggInfo& aAggInfo, ValueExprNode* aArg) : AggNode(pool, aAggInfo, false, false, aArg) { } -DmlNode* WinFuncNode::parse(thread_db* tdbb, MemoryPool& pool, CompilerScratch* csb, const UCHAR /*blrOp*/) -{ - MetaName name; - PAR_name(csb, name); - WinFuncNode* node = NULL; - - for (const Factory* factory = factories; factory; factory = factory->next) - { - if (name == factory->name) - { - node = factory->newInstance(pool); - break; - } - } - - if (!node) - PAR_error(csb, Arg::Gds(isc_funnotdef) << name); - - UCHAR count = csb->csb_blr_reader.getByte(); - - if (count != node->jrdChildNodes.getCount()) - PAR_error(csb, Arg::Gds(isc_funmismat) << name); - - node->parseArgs(tdbb, csb, count); - - return node; -} - - //-------------------- -static WinFuncNode::Register<DenseRankWinNode> denseRankWinInfo("DENSE_RANK"); +static WinFuncNode::RegisterFactory0<DenseRankWinNode> denseRankWinInfo("DENSE_RANK"); DenseRankWinNode::DenseRankWinNode(MemoryPool& pool) : WinFuncNode(pool, denseRankWinInfo) @@ -134,7 +101,7 @@ //-------------------- -static WinFuncNode::Register<RankWinNode> rankWinInfo("RANK"); +static WinFuncNode::RegisterFactory0<RankWinNode> rankWinInfo("RANK"); RankWinNode::RankWinNode(MemoryPool& pool) : WinFuncNode(pool, rankWinInfo), @@ -210,7 +177,7 @@ //-------------------- -static WinFuncNode::Register<RowNumberWinNode> rowNumberWinInfo("ROW_NUMBER"); +static WinFuncNode::RegisterFactory0<RowNumberWinNode> rowNumberWinInfo("ROW_NUMBER"); RowNumberWinNode::RowNumberWinNode(MemoryPool& pool) : WinFuncNode(pool, rowNumberWinInfo) @@ -272,7 +239,7 @@ //-------------------- -static WinFuncNode::Register<FirstValueWinNode> firstValueWinInfo("FIRST_VALUE"); +static WinFuncNode::RegisterFactory0<FirstValueWinNode> firstValueWinInfo("FIRST_VALUE"); FirstValueWinNode::FirstValueWinNode(MemoryPool& pool, ValueExprNode* aArg) : WinFuncNode(pool, firstValueWinInfo, aArg) @@ -346,7 +313,7 @@ //-------------------- -static WinFuncNode::Register<LastValueWinNode> lastValueWinInfo("LAST_VALUE"); +static WinFuncNode::RegisterFactory0<LastValueWinNode> lastValueWinInfo("LAST_VALUE"); LastValueWinNode::LastValueWinNode(MemoryPool& pool, ValueExprNode* aArg) : WinFuncNode(pool, lastValueWinInfo, aArg) @@ -411,7 +378,7 @@ //-------------------- -static WinFuncNode::Register<NthValueWinNode> nthValueWinInfo("NTH_VALUE"); +static WinFuncNode::RegisterFactory0<NthValueWinNode> nthValueWinInfo("NTH_VALUE"); NthValueWinNode::NthValueWinNode(MemoryPool& pool, ValueExprNode* aArg, ValueExprNode* aRow, ValueExprNode* aFrom) @@ -603,7 +570,7 @@ //-------------------- -static WinFuncNode::Register<LagWinNode> lagWinInfo("LAG"); +static WinFuncNode::RegisterFactory0<LagWinNode> lagWinInfo("LAG"); LagWinNode::LagWinNode(MemoryPool& pool, ValueExprNode* aArg, ValueExprNode* aRows, ValueExprNode* aOutExpr) @@ -632,7 +599,7 @@ //-------------------- -static WinFuncNode::Register<LeadWinNode> leadWinInfo("LEAD"); +static WinFuncNode::RegisterFactory0<LeadWinNode> leadWinInfo("LEAD"); LeadWinNode::LeadWinNode(MemoryPool& pool, ValueExprNode* aArg, ValueExprNode* aRows, ValueExprNode* aOutExpr) Modified: firebird/trunk/src/jrd/blp.h =================================================================== --- firebird/trunk/src/jrd/blp.h 2015-03-25 17:52:13 UTC (rev 61082) +++ firebird/trunk/src/jrd/blp.h 2015-03-25 17:52:14 UTC (rev 61083) @@ -241,21 +241,5 @@ {"subfunc", function}, {"record_version2", byte_line}, {"gen_id2", gen_id2}, // 210 - {"agg_stddev_samp", one}, - {"agg_stddev_pop", one}, - {"agg_var_samp", one}, - {"agg_var_pop", one}, - {"agg_covar_samp", two}, - {"agg_covar_pop", two}, - {"agg_corr", two}, - {"blr_agg_regr_avgx", two}, - {"blr_agg_regr_avgy", two}, - {"blr_agg_regr_count", two}, - {"blr_agg_regr_intercept", two}, - {"blr_agg_regr_r2", two}, - {"blr_agg_regr_slope", two}, - {"blr_agg_regr_sxx", two}, - {"blr_agg_regr_sxy", two}, - {"blr_agg_regr_syy", two}, {0, 0} }; Modified: firebird/trunk/src/jrd/blr.h =================================================================== --- firebird/trunk/src/jrd/blr.h 2015-03-25 17:52:13 UTC (rev 61082) +++ firebird/trunk/src/jrd/blr.h 2015-03-25 17:52:14 UTC (rev 61083) @@ -407,21 +407,4 @@ #define blr_record_version2 (unsigned char) 209 #define blr_gen_id2 (unsigned char) 210 // NEXT VALUE FOR generator -#define blr_agg_stddev_samp (unsigned char) 211 -#define blr_agg_stddev_pop (unsigned char) 212 -#define blr_agg_var_samp (unsigned char) 213 -#define blr_agg_var_pop (unsigned char) 214 -#define blr_agg_covar_samp (unsigned char) 215 -#define blr_agg_covar_pop (unsigned char) 216 -#define blr_agg_corr (unsigned char) 217 -#define blr_agg_regr_avgx (unsigned char) 218 -#define blr_agg_regr_avgy (unsigned char) 219 -#define blr_agg_regr_count (unsigned char) 220 -#define blr_agg_regr_intercept (unsigned char) 221 -#define blr_agg_regr_r2 (unsigned char) 222 -#define blr_agg_regr_slope (unsigned char) 223 -#define blr_agg_regr_sxx (unsigned char) 224 -#define blr_agg_regr_sxy (unsigned char) 225 -#define blr_agg_regr_syy (unsigned char) 226 - #endif // JRD_BLR_H This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-03-27 14:36:44
|
Revision: 61112 http://sourceforge.net/p/firebird/code/61112 Author: alexpeshkoff Date: 2015-03-27 14:36:30 +0000 (Fri, 27 Mar 2015) Log Message: ----------- Use status interface instead plain status vector when working with exceptions. Avoid use of circullar allocation for strings in status vector (except when unavoidable for ISC API backward compatibility). Use TLS for circullar allocation buffer instead manually working with threads' list. Modified Paths: -------------- firebird/trunk/src/alice/alice.cpp firebird/trunk/src/alice/exe.cpp firebird/trunk/src/alice/main/aliceMain.cpp firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp firebird/trunk/src/burp/burp.cpp firebird/trunk/src/burp/canonical.cpp firebird/trunk/src/burp/main/burpMain.cpp firebird/trunk/src/common/SimpleStatusVector.h firebird/trunk/src/common/StatusArg.cpp firebird/trunk/src/common/StatusArg.h firebird/trunk/src/common/StatusHolder.cpp firebird/trunk/src/common/StatusHolder.h firebird/trunk/src/common/classes/init.cpp firebird/trunk/src/common/fb_exception.cpp firebird/trunk/src/common/isc.cpp firebird/trunk/src/common/isc_proto.h firebird/trunk/src/common/isc_s_proto.h firebird/trunk/src/common/isc_sync.cpp firebird/trunk/src/common/sdl.cpp firebird/trunk/src/common/sdl_proto.h firebird/trunk/src/common/utils.cpp firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp firebird/trunk/src/include/fb_exception.h firebird/trunk/src/include/firebird/FirebirdInterface.idl firebird/trunk/src/include/firebird/IdlFbInterfaces.h firebird/trunk/src/include/firebird/Interface.h firebird/trunk/src/jrd/Function.epp firebird/trunk/src/jrd/Monitoring.cpp firebird/trunk/src/jrd/TempSpace.cpp firebird/trunk/src/jrd/event.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/lck.cpp firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/status.h firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/jrd/trace/TraceService.cpp firebird/trunk/src/lock/lock.cpp firebird/trunk/src/lock/lock_proto.h firebird/trunk/src/lock/print.cpp firebird/trunk/src/remote/protocol.cpp firebird/trunk/src/remote/server/os/posix/inet_server.cpp firebird/trunk/src/utilities/fbsvcmgr/fbsvcmgr.cpp firebird/trunk/src/utilities/fbtracemgr/traceMgrMain.cpp firebird/trunk/src/utilities/gsec/gsec.cpp firebird/trunk/src/utilities/gsec/main/gsecMain.cpp firebird/trunk/src/utilities/gstat/dba.epp firebird/trunk/src/utilities/gstat/main/gstatMain.cpp firebird/trunk/src/utilities/nbackup/nbackup.cpp firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp firebird/trunk/src/yvalve/MasterImplementation.cpp firebird/trunk/src/yvalve/MasterImplementation.h firebird/trunk/src/yvalve/alt.cpp firebird/trunk/src/yvalve/preparse.cpp firebird/trunk/src/yvalve/user_dsql.cpp firebird/trunk/src/yvalve/utl.cpp firebird/trunk/src/yvalve/utl_proto.h firebird/trunk/src/yvalve/why.cpp Modified: firebird/trunk/src/alice/alice.cpp =================================================================== --- firebird/trunk/src/alice/alice.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/alice/alice.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -49,6 +49,7 @@ #include "../alice/alice_proto.h" #include "../common/utils_proto.h" #include "../common/classes/Switches.h" +#include "../common/SimpleStatusVector.h" #include "../alice/aliceswi.h" #ifdef HAVE_UNISTD_H @@ -110,9 +111,9 @@ } catch (const Firebird::Exception& e) { - ISC_STATUS_ARRAY status; - e.stuff_exception(status); - uSvc->setServiceStatus(status); + Firebird::SimpleStatusVector<> status; + e.stuffException(status); + uSvc->setServiceStatus(status.begin()); uSvc->started(); exit_code = FB_FAILURE; } @@ -564,7 +565,9 @@ catch (const Firebird::Exception& e) { // Non-alice exception was caught - e.stuff_exception(tdgbl->status_vector); + Firebird::SimpleStatusVector<> status; + e.stuffException(status); + fb_utils::copyStatus(tdgbl->status_vector, ISC_STATUS_LENGTH, status.begin(), status.getCount()); ALICE_print_status(true, tdgbl->status_vector); exit_code = FINI_ERROR; } Modified: firebird/trunk/src/alice/exe.cpp =================================================================== --- firebird/trunk/src/alice/exe.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/alice/exe.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -101,13 +101,8 @@ if (tdgbl->status[2] == isc_arg_warning) { - Firebird::makePermanentVector(tdgbl->status); ALICE_print_status(false, tdgbl->status); } - else if (error) - { - Firebird::makePermanentVector(tdgbl->status); - } if (handle != 0) { Modified: firebird/trunk/src/alice/main/aliceMain.cpp =================================================================== --- firebird/trunk/src/alice/main/aliceMain.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/alice/main/aliceMain.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -29,6 +29,7 @@ #include "firebird.h" #include "../alice/alice_proto.h" #include "../common/classes/auto.h" +#include "../common/SimpleStatusVector.h" int CLIB_ROUTINE main(int argc, char* argv[]) @@ -50,9 +51,9 @@ } catch (const Firebird::Exception& ex) { - ISC_STATUS_ARRAY st; - ex.stuff_exception(st); - isc_print_status(st); + Firebird::SimpleStatusVector<> st; + ex.stuffException(st); + isc_print_status(st.begin()); } return 1; } Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -429,8 +429,9 @@ } catch (Exception &ex) { - ISC_STATUS_ARRAY status; - ex.stuff_exception(status); + SimpleStatusVector<> st; + ex.stuffException(st); + const ISC_STATUS* status = st.begin(); if (status[0] == 1 && status[1] != isc_att_shutdown) { iscLogStatus("Legacy security database timer handler", status); @@ -460,8 +461,9 @@ } catch (Exception &ex) { - ISC_STATUS_ARRAY status; - ex.stuff_exception(status); + SimpleStatusVector<> st; + ex.stuffException(st); + const ISC_STATUS* status = st.begin(); if (status[0] == 1 && status[1] != isc_att_shutdown) { iscLogStatus("Legacy security database shutdown", status); Modified: firebird/trunk/src/burp/burp.cpp =================================================================== --- firebird/trunk/src/burp/burp.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/burp/burp.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -139,10 +139,10 @@ } catch (const Firebird::Exception& e) { - ISC_STATUS_ARRAY status; - e.stuff_exception(status); + Firebird::SimpleStatusVector<> status; + e.stuffException(status); uSvc->initStatus(); - uSvc->setServiceStatus(status); + uSvc->setServiceStatus(status.begin()); exit_code = FB_FAILURE; } @@ -386,8 +386,9 @@ } catch (const Firebird::Exception& e) { - e.stuff_exception(status); - BURP_print_status(true, status); + Firebird::SimpleStatusVector<> s; + e.stuffException(s); + BURP_print_status(true, s.begin()); if (svc_handle) { isc_service_detach(status, &svc_handle); @@ -1236,7 +1237,9 @@ { // Non-burp exception was caught tdgbl->burp_throw = false; - e.stuff_exception(tdgbl->status_vector); + Firebird::SimpleStatusVector<> s; + e.stuffException(s); + fb_utils::copyStatus(tdgbl->status_vector, ISC_STATUS_LENGTH, s.begin(), s.getCount()); BURP_print_status(true, tdgbl->status_vector); if (! tdgbl->uSvc->isService()) { @@ -2105,7 +2108,6 @@ isc_drop_database(status_vector, &tdgbl->db_handle); if (tdgbl->db_handle) { - Firebird::makePermanentVector(status_vector); ISC_STATUS_ARRAY status_vector2; if (isc_detach_database(status_vector2, &tdgbl->db_handle)) { BURP_print_status(false, status_vector2); Modified: firebird/trunk/src/burp/canonical.cpp =================================================================== --- firebird/trunk/src/burp/canonical.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/burp/canonical.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -41,6 +41,7 @@ #include "../common/sdl_proto.h" #include "../common/xdr_proto.h" #include "../common/gdsassert.h" +#include "../common/StatusHolder.h" #include "fb_types.h" // TMN: Currently we can't include remote/remote.h because we'd get @@ -408,10 +409,13 @@ // Get descriptor of array element - ISC_STATUS_ARRAY status_vector; sdl_info info; - if (SDL_info(status_vector, sdl, &info, 0)) - return FALSE; + { + Firebird::LocalStatus ls; + Firebird::CheckStatusWrapper s(&ls); + if (SDL_info(&s, sdl, &info, 0)) + return FALSE; + } dsc* desc = &info.sdl_info_element; const ULONG n = slice->lstr_length / desc->dsc_length; Modified: firebird/trunk/src/burp/main/burpMain.cpp =================================================================== --- firebird/trunk/src/burp/main/burpMain.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/burp/main/burpMain.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -29,6 +29,7 @@ #include "firebird.h" #include "../burp/burp_proto.h" #include "../common/classes/auto.h" +#include "../common/SimpleStatusVector.h" int CLIB_ROUTINE main( int argc, char* argv[]) @@ -50,9 +51,9 @@ } catch (const Firebird::Exception& ex) { - ISC_STATUS_ARRAY st; - ex.stuff_exception(st); - isc_print_status(st); + Firebird::SimpleStatusVector<> st; + ex.stuffException(st); + isc_print_status(st.begin()); } return 1; } Modified: firebird/trunk/src/common/SimpleStatusVector.h =================================================================== --- firebird/trunk/src/common/SimpleStatusVector.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/SimpleStatusVector.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -36,20 +36,20 @@ namespace Firebird { // This trivial container is used when we need to grow vector element by element w/o any conversions -template <unsigned S> // default set in fb_exception.h +template <unsigned S> // Default value is in fb_exception.h class SimpleStatusVector : public HalfStaticArray<ISC_STATUS, S> { public: SimpleStatusVector() : HalfStaticArray<ISC_STATUS, S>() { - fb_assert(S >= 3u); // Required for minimum no-throw support + fb_assert(S >= 3u); // Required for no-throw support in makeEmergencyStatus() } SimpleStatusVector(MemoryPool& p) : HalfStaticArray<ISC_STATUS, S>(p) { - fb_assert(S >= 3u); // Required for minimum no-throw support + fb_assert(S >= 3u); // Required for no-throw support in makeEmergencyStatus() } void mergeStatus(const IStatus* from) @@ -79,6 +79,12 @@ this->push(isc_arg_end); } + + ISC_STATUS* makeEmergencyStatus() throw() + { + // Should not throw - see assertions in constructors + return this->getBuffer(3); + } }; } // namespace Firebird Modified: firebird/trunk/src/common/StatusArg.cpp =================================================================== --- firebird/trunk/src/common/StatusArg.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/StatusArg.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -130,11 +130,6 @@ return length() == v.length() && fb_utils::cmpStatus(length(), value(), v.value()); } -void StatusVector::ImplStatusVector::makePermanent() throw() -{ - makePermanentVector(m_status_vector.begin()); -} - void StatusVector::ImplStatusVector::assign(const StatusVector& v) throw() { clear(); Modified: firebird/trunk/src/common/StatusArg.h =================================================================== --- firebird/trunk/src/common/StatusArg.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/StatusArg.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -67,7 +67,6 @@ virtual unsigned int firstWarning() const throw() { return 0; } virtual bool hasData() const throw() { return false; } virtual void clear() throw() { } - virtual void makePermanent() throw() { } virtual void append(const StatusVector&) throw() { } virtual void prepend(const StatusVector&) throw() { } virtual void assign(const StatusVector& ex) throw() { } @@ -118,7 +117,6 @@ virtual unsigned int firstWarning() const throw() { return m_warning; } virtual bool hasData() const throw() { return length() > 0u; } virtual void clear() throw(); - virtual void makePermanent() throw(); virtual void append(const StatusVector& v) throw(); virtual void prepend(const StatusVector& v) throw(); virtual void assign(const StatusVector& v) throw(); @@ -159,7 +157,6 @@ bool isEmpty() const throw() { return !implementation->hasData(); } void clear() throw() { implementation->clear(); } - void makePermanent() throw() { implementation->makePermanent(); } void append(const StatusVector& v) throw() { implementation->append(v); } void prepend(const StatusVector& v) throw() { implementation->prepend(v); } void assign(const StatusVector& v) throw() { implementation->assign(v); } Modified: firebird/trunk/src/common/StatusHolder.cpp =================================================================== --- firebird/trunk/src/common/StatusHolder.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/StatusHolder.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -36,11 +36,8 @@ ISC_STATUS DynamicStatusVector::load(const IStatus* status) { SimpleStatusVector<> tmp; - unsigned length = fb_utils::statusLength(status->getErrors()); - length += fb_utils::statusLength(status->getWarnings()); - ISC_STATUS* s = tmp.getBuffer(length + 1); - fb_utils::mergeStatus(s, length + 1, status); - return save(s, false); + tmp.mergeStatus(status); + return save(tmp.begin(), false); } ISC_STATUS StatusHolder::save(IStatus* status) Modified: firebird/trunk/src/common/StatusHolder.h =================================================================== --- firebird/trunk/src/common/StatusHolder.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/StatusHolder.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -124,6 +124,11 @@ return SimpleStatusVector<S>::begin(); } + const unsigned length() const + { + return SimpleStatusVector<S>::getCount(); + } + ISC_STATUS operator[](unsigned int index) const { return SimpleStatusVector<S>::operator[](index); Modified: firebird/trunk/src/common/classes/init.cpp =================================================================== --- firebird/trunk/src/common/classes/init.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/classes/init.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -27,6 +27,7 @@ #include "firebird.h" #include "init.h" #include "alloc.h" +#include "../common/SimpleStatusVector.h" // Setting this define helps (with AV at exit time) detect globals // with destructors, declared not using InstanceControl. @@ -40,13 +41,14 @@ #ifdef DEV_BUILD void cleanError(const Firebird::Exception* e) { - // This is done to be able to look at status in debugger - ISC_STATUS_ARRAY status; if (e) { - e->stuff_exception(status); + // This is done to be able to look at status in debugger + Firebird::SimpleStatusVector<> status; + e->stuffException(status); } - // we do not have big choice in error reporting when running destructors + + // we do not have big choice in error reporting when running global destructors abort(); } #else Modified: firebird/trunk/src/common/fb_exception.cpp =================================================================== --- firebird/trunk/src/common/fb_exception.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/fb_exception.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -14,108 +14,50 @@ namespace Firebird { -// Before using thr parameter, make sure that thread is not going to work with -// this functions itself. -// CVC: Do not let "perm" be incremented before "trans", because it may lead to serious memory errors, -// since several places in our code blindly pass the same vector twice. -void makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* trans, ThreadId thr) throw() +// ********************************* Exception ******************************* + +Exception::~Exception() throw() { } + +void Exception::stuffException(DynamicStatusVector& status_vector) const throw() { + SimpleStatusVector<> status; + stuffException(status); try { - while (true) - { - const ISC_STATUS type = *perm++ = *trans++; - - switch (type) - { - case isc_arg_end: - return; - case isc_arg_cstring: - { - perm [-1] = isc_arg_string; - const size_t len = *trans++; - const char* temp = reinterpret_cast<char*>(*trans++); - *perm++ = (ISC_STATUS)(IPTR) (MasterInterfacePtr()->circularAlloc(temp, len, (intptr_t) thr)); - } - break; - case isc_arg_string: - case isc_arg_interpreted: - case isc_arg_sql_state: - { - const char* temp = reinterpret_cast<char*>(*trans++); - const size_t len = strlen(temp); - *perm++ = (ISC_STATUS)(IPTR) (MasterInterfacePtr()->circularAlloc(temp, len, (intptr_t) thr)); - } - break; - default: - *perm++ = *trans++; - break; - } - } + status_vector.save(status.begin()); } - catch (const system_call_failed& ex) + catch(const BadAlloc&) { - memcpy(perm, ex.value(), sizeof(ISC_STATUS_ARRAY)); + ISC_STATUS tmp[3]; + processUnexpectedException(tmp); + status_vector.save(tmp); } - catch (const BadAlloc&) - { - *perm++ = isc_arg_gds; - *perm++ = isc_virmemexh; - *perm++ = isc_arg_end; - } - catch (...) - { - *perm++ = isc_arg_gds; - *perm++ = isc_random; - *perm++ = isc_arg_string; - *perm++ = (ISC_STATUS)(IPTR) "Unexpected exception in makePermanentVector()"; - *perm++ = isc_arg_end; - } } -void makePermanentVector(ISC_STATUS* v, ThreadId thr) throw() +void Exception::stuffException(IStatus* status_vector) const throw() { - makePermanentVector(v, v, thr); + SimpleStatusVector<> status; + stuffException(status); + fb_utils::setIStatus(status_vector, status.begin()); } -// ********************************* Exception ******************************* - -Exception::~Exception() throw() { } - -ISC_STATUS Exception::stuff_exception(ISC_STATUS* const status_vector) const throw() +void Exception::processUnexpectedException(ISC_STATUS* vector) throw() { - LocalStatus status; - stuffException(&status); - fb_utils::mergeStatus(status_vector, ISC_STATUS_LENGTH, &status); - - return status_vector[1]; -} - -ISC_STATUS Exception::stuffException(SimpleStatusVector<>& status_vector) const throw() -{ - LocalStatus status; - stuffException(&status); + // do not use stuff_exception() here to avoid endless loop try { - status_vector.mergeStatus(&status); + throw; } catch(const BadAlloc&) { - // do not use stuff here to avoid endless cycle - status_vector.shrink(3); - ISC_STATUS* s = status_vector.getBuffer(3); // Should not throw - see assert() in ctor - fb_utils::statusBadAlloc(s); + fb_utils::statusBadAlloc(vector); } catch(const Exception&) { fb_assert(false); - status_vector.shrink(3); - ISC_STATUS* s = status_vector.getBuffer(3); // Should not throw - see assert() in ctor - fb_utils::statusUnknown(s); + fb_utils::statusUnknown(vector); } - - return status_vector[1]; } // ********************************* status_exception ******************************* @@ -151,14 +93,14 @@ len = makeDynamicStrings(len, m_status_vector, new_vector); m_status_vector[len] = isc_arg_end; } - catch(const BadAlloc&) + catch(const Exception&) { if (m_status_vector != m_buffer) { delete[] m_status_vector; m_status_vector = m_buffer; } - fb_utils::statusBadAlloc(m_buffer); + processUnexpectedException(m_buffer); } } @@ -193,14 +135,16 @@ throw status_exception(statusVector.value()); } -ISC_STATUS status_exception::stuffException(IStatus* status) const throw() +void status_exception::stuffByException(SimpleStatusVector<>& status) const throw() { - if (status) + try { - fb_utils::setIStatus(status, value()); + status.assign(m_status_vector, fb_utils::statusLength(m_status_vector) + 1); } - - return value()[1]; + catch(const BadAlloc&) + { + processUnexpectedException(status.makeEmergencyStatus()); + } } // ********************************* BadAlloc **************************** @@ -210,16 +154,9 @@ throw BadAlloc(); } -ISC_STATUS BadAlloc::stuffException(IStatus* status) const throw() +void BadAlloc::stuffByException(SimpleStatusVector<>& status) const throw() { - const ISC_STATUS sv[] = {isc_arg_gds, isc_virmemexh}; - - if (status) - { - status->setErrors2(FB_NELEM(sv), sv); - } - - return sv[1]; + fb_utils::statusBadAlloc(status.makeEmergencyStatus()); } const char* BadAlloc::what() const throw() @@ -234,16 +171,19 @@ throw LongJump(); } -ISC_STATUS LongJump::stuffException(IStatus* status) const throw() +void LongJump::stuffByException(SimpleStatusVector<>& status) const throw() { - ISC_STATUS sv[] = {isc_arg_gds, isc_random, isc_arg_string, (ISC_STATUS)(IPTR) "Unexpected Firebird::LongJump"}; + ISC_STATUS sv[] = {isc_arg_gds, isc_random, isc_arg_string, + (ISC_STATUS)(IPTR) "Unexpected call to Firebird::LongJump::stuffException()", isc_arg_end}; - if (status) + try { - status->setErrors2(FB_NELEM(sv), sv); + status.assign(sv, FB_NELEM(sv)); } - - return sv[1]; + catch(const BadAlloc&) + { + processUnexpectedException(status.makeEmergencyStatus()); + } } const char* LongJump::what() const throw() Modified: firebird/trunk/src/common/isc.cpp =================================================================== --- firebird/trunk/src/common/isc.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/isc.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -585,7 +585,7 @@ } -void iscLogStatus(const TEXT* text, Firebird::IStatus* status) +void iscLogStatus(const TEXT* text, const Firebird::IStatus* status) { Firebird::SimpleStatusVector<> tmp; tmp.mergeStatus(status); @@ -619,9 +619,9 @@ * Add record about an exception to firebird.log * **************************************/ - ISC_STATUS_ARRAY s; - e.stuff_exception(s); - iscLogStatus(text, s); + Firebird::SimpleStatusVector<> s; + e.stuffException(s); + iscLogStatus(text, s.begin()); } Modified: firebird/trunk/src/common/isc_proto.h =================================================================== --- firebird/trunk/src/common/isc_proto.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/isc_proto.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -36,7 +36,7 @@ void iscDbLogStatus(const TEXT* text, Firebird::IStatus* status); // Do not add word "Database" in the beginning like gds__log_status / iscDbLogStatus void iscLogStatus(const TEXT* text, const ISC_STATUS* status_vector); -void iscLogStatus(const TEXT* text, Firebird::IStatus* status); +void iscLogStatus(const TEXT* text, const Firebird::IStatus* status); void iscLogException(const TEXT* text, const Firebird::Exception& e); #ifdef WIN9X_SUPPORT Modified: firebird/trunk/src/common/isc_s_proto.h =================================================================== --- firebird/trunk/src/common/isc_s_proto.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/isc_s_proto.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -228,7 +228,7 @@ int setlock(const LockMode mode); // Alternative locker is using status vector to report errors - bool setlock(Firebird::Arg::StatusVector& status, const LockMode mode); + bool setlock(Firebird::CheckStatusWrapper* status, const LockMode mode); // unlocking can only put error into log file - we can't throw in dtors void unlock(); @@ -271,10 +271,10 @@ ~SharedMemoryBase(); #ifdef HAVE_OBJECT_MAP - UCHAR* mapObject(Firebird::Arg::StatusVector& status, ULONG offset, ULONG size); - void unmapObject(Firebird::Arg::StatusVector& status, UCHAR** object, ULONG size); + UCHAR* mapObject(Firebird::CheckStatusWrapper* status, ULONG offset, ULONG size); + void unmapObject(Firebird::CheckStatusWrapper* status, UCHAR** object, ULONG size); #endif - bool remapFile(Firebird::Arg::StatusVector& status, ULONG newSize, bool truncateFlag); + bool remapFile(Firebird::CheckStatusWrapper* status, ULONG newSize, bool truncateFlag); void removeMapFile(); #ifdef UNIX void internalUnmap(); @@ -349,7 +349,7 @@ }; protected: - void logError(const char* text, const Firebird::Arg::StatusVector& status); + void logError(const char* text, const Firebird::CheckStatusWrapper* status); }; template <class Header> // Header must be "public MemoryHeader" @@ -361,12 +361,12 @@ { } #ifdef HAVE_OBJECT_MAP - template <class Object> Object* mapObject(Firebird::Arg::StatusVector& status, ULONG offset) + template <class Object> Object* mapObject(Firebird::CheckStatusWrapper* status, ULONG offset) { return (Object*) SharedMemoryBase::mapObject(status, offset, sizeof(Object)); } - template <class Object> void unmapObject(Firebird::Arg::StatusVector& status, Object** object) + template <class Object> void unmapObject(Firebird::CheckStatusWrapper* status, Object** object) { SharedMemoryBase::unmapObject(status, (UCHAR**) object, sizeof(Object)); } Modified: firebird/trunk/src/common/isc_sync.cpp =================================================================== --- firebird/trunk/src/common/isc_sync.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/isc_sync.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -140,7 +140,7 @@ using namespace Firebird; -static void error(Arg::StatusVector&, const TEXT*, ISC_STATUS); +static void error(CheckStatusWrapper*, const TEXT*, ISC_STATUS); static bool event_blocked(const event_t* event, const SLONG value); #ifdef UNIX @@ -238,9 +238,10 @@ explicit FileLockHolder(FileLock* l) : lock(l) { - Arg::StatusVector status; - if (!lock->setlock(status, FileLock::FLM_EXCLUSIVE)) - status.raise(); + LocalStatus ls; + CheckStatusWrapper status(&ls); + if (!lock->setlock(&status, FileLock::FLM_EXCLUSIVE)) + status_exception::raise(&status); } ~FileLockHolder() @@ -488,7 +489,7 @@ return 0; } -bool FileLock::setlock(Arg::StatusVector& status, const LockMode mode) +bool FileLock::setlock(CheckStatusWrapper* status, const LockMode mode) { int rc = setlock(mode); if (rc != 0) @@ -556,9 +557,10 @@ if (flock(oFile->fd, LOCK_UN) != 0) { #endif - Arg::StatusVector local; - error(local, NAME, errno); - iscLogStatus("Unlock error", local.value()); + LocalStatus ls; + CheckStatusWrapper local(&ls); + error(&local, NAME, errno); + iscLogStatus("Unlock error", &local); } rwUnlock(); @@ -632,7 +634,7 @@ }; #endif -static SLONG create_semaphores(Arg::StatusVector&, SLONG, int); +static SLONG create_semaphores(CheckStatusWrapper*, SLONG, int); namespace { @@ -1756,8 +1758,9 @@ #ifdef USE_SYS5SEMAPHORE if (fileNum != -1 && mainLock.hasData()) { - Arg::StatusVector statusVector; - semTable->cleanup(fileNum, mainLock->setlock(statusVector, FileLock::FLM_TRY_EXCLUSIVE)); + LocalStatus ls; + CheckStatusWrapper statusVector(&ls); + semTable->cleanup(fileNum, mainLock->setlock(&statusVector, FileLock::FLM_TRY_EXCLUSIVE)); } #endif if (sh_mem_header) @@ -1790,7 +1793,8 @@ * routine (if given) or punt (leaving the file unmapped). * **************************************/ - Arg::StatusVector statusVector; + LocalStatus ls; + CheckStatusWrapper statusVector(&ls); sh_mem_name[0] = '\0'; @@ -1840,12 +1844,12 @@ fb_assert(semTable); - if (semFile->setlock(statusVector, FileLock::FLM_TRY_EXCLUSIVE)) + if (semFile->setlock(&statusVector, FileLock::FLM_TRY_EXCLUSIVE)) { semTable->init(semFile->getFd()); semFile->unlock(); } - if (!semFile->setlock(statusVector, FileLock::FLM_SHARED)) + if (!semFile->setlock(&statusVector, FileLock::FLM_SHARED)) { if (statusVector.hasData()) statusVector.raise(); @@ -1913,7 +1917,7 @@ #if defined(HAVE_SHARED_MUTEX_SECTION) && defined(USE_MUTEX_MAP) - sh_mem_mutex = (mtx*) mapObject(statusVector, offsetof(MemoryHeader, mhb_mutex), sizeof(mtx)); + sh_mem_mutex = (mtx*) mapObject(&statusVector, offsetof(MemoryHeader, mhb_mutex), sizeof(mtx)); if (!sh_mem_mutex) { system_call_failed::raise("mmap"); @@ -1935,7 +1939,7 @@ // Try to get an exclusive lock on the lock file. This will // fail if somebody else has the exclusive or shared lock - if (mainLock->setlock(statusVector, FileLock::FLM_TRY_EXCLUSIVE)) + if (mainLock->setlock(&statusVector, FileLock::FLM_TRY_EXCLUSIVE)) { if (trunc_flag) FB_UNUSED(ftruncate(mainLock->getFd(), length)); @@ -2053,10 +2057,10 @@ #endif // HAVE_SHARED_MUTEX_SECTION mainLock->unlock(); - if (!mainLock->setlock(statusVector, FileLock::FLM_SHARED)) + if (!mainLock->setlock(&statusVector, FileLock::FLM_SHARED)) { if (statusVector.hasData()) - status_exception::raise(statusVector); + status_exception::raise(&statusVector); else (Arg::Gds(isc_random) << "Unknown error in setlock(SHARED)").raise(); } @@ -2066,10 +2070,10 @@ { if (callback->initialize(this, false)) { - if (!mainLock->setlock(statusVector, FileLock::FLM_SHARED)) + if (!mainLock->setlock(&statusVector, FileLock::FLM_SHARED)) { if (statusVector.hasData()) - status_exception::raise(statusVector); + status_exception::raise(&statusVector); else (Arg::Gds(isc_random) << "Unknown error in setlock(SHARED)").raise(); } @@ -2402,7 +2406,7 @@ #ifdef HAVE_MMAP -UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector, ULONG object_offset, ULONG object_length) +UCHAR* SharedMemoryBase::mapObject(CheckStatusWrapper* statusVector, ULONG object_offset, ULONG object_length) { /************************************** * @@ -2456,7 +2460,7 @@ } -void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, UCHAR** object_pointer, ULONG object_length) +void SharedMemoryBase::unmapObject(CheckStatusWrapper* statusVector, UCHAR** object_pointer, ULONG object_length) { /************************************** * @@ -2509,7 +2513,7 @@ #ifdef WIN_NT -UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector, +UCHAR* SharedMemoryBase::mapObject(CheckStatusWrapper* statusVector, ULONG object_offset, ULONG object_length) { @@ -2550,7 +2554,7 @@ } -void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, +void SharedMemoryBase::unmapObject(CheckStatusWrapper* statusVector, UCHAR** object_pointer, ULONG /*object_length*/) { /************************************** @@ -3032,7 +3036,7 @@ #ifdef UNIX #ifdef HAVE_MMAP #define ISC_REMAP_FILE_DEFINED -bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG new_length, bool flag) +bool SharedMemoryBase::remapFile(CheckStatusWrapper* statusVector, ULONG new_length, bool flag) { /************************************** * @@ -3080,7 +3084,7 @@ #ifdef WIN_NT #define ISC_REMAP_FILE_DEFINED -bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, +bool SharedMemoryBase::remapFile(CheckStatusWrapper* statusVector, ULONG new_length, bool flag) { /************************************** @@ -3181,7 +3185,7 @@ #ifndef ISC_REMAP_FILE_DEFINED -bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG, bool) +bool SharedMemoryBase::remapFile(CheckStatusWrapper* statusVector, ULONG, bool) { /************************************** * @@ -3194,8 +3198,8 @@ * **************************************/ - statusVector << Arg::Gds(isc_unavailable) << - Arg::Gds(isc_random) << "SharedMemory::remapFile"; + (Arg::Gds(isc_unavailable) << + Arg::Gds(isc_random) << "SharedMemory::remapFile").copyTo(statusVector); return NULL; } @@ -3204,7 +3208,7 @@ #ifdef USE_SYS5SEMAPHORE -static SLONG create_semaphores(Arg::StatusVector& statusVector, SLONG key, int semaphores) +static SLONG create_semaphores(CheckStatusWrapper* statusVector, SLONG key, int semaphores) { /************************************** * @@ -3562,9 +3566,10 @@ // Lock init file. FileLockHolder initLock(initFile); - Arg::StatusVector statusVector; // ignored + LocalStatus ls; + CheckStatusWrapper statusVector(&ls); mainLock->unlock(); - semTable->cleanup(fileNum, mainLock->setlock(statusVector, FileLock::FLM_TRY_EXCLUSIVE)); + semTable->cleanup(fileNum, mainLock->setlock(&statusVector, FileLock::FLM_TRY_EXCLUSIVE)); } catch (const Exception& ex) { @@ -3575,11 +3580,12 @@ #endif #if defined(HAVE_SHARED_MUTEX_SECTION) && defined(USE_MUTEX_MAP) - Arg::StatusVector statusVector; - unmapObject(statusVector, (UCHAR**) &sh_mem_mutex, sizeof(mtx)); + LocalStatus ls; + CheckStatusWrapper statusVector(&ls); + unmapObject(&statusVector, (UCHAR**) &sh_mem_mutex, sizeof(mtx)); if (statusVector.hasData()) { - iscLogStatus("unmapObject failed", statusVector.value()); + iscLogStatus("unmapObject failed", &statusVector); } #endif @@ -3588,11 +3594,9 @@ #endif #ifdef WIN_NT - Arg::StatusVector statusVector; CloseHandle(sh_mem_interest); if (!UnmapViewOfFile(sh_mem_header)) { - error(statusVector, "UnmapViewOfFile", GetLastError()); return; } CloseHandle(sh_mem_object); @@ -3600,7 +3604,6 @@ CloseHandle(sh_mem_handle); if (!UnmapViewOfFile(sh_mem_hdr_address)) { - error(statusVector, "UnmapViewOfFile", GetLastError()); return; } CloseHandle(sh_mem_hdr_object); @@ -3632,9 +3635,9 @@ #endif } -void SharedMemoryBase::logError(const char* text, const Arg::StatusVector& status) +void SharedMemoryBase::logError(const char* text, const CheckStatusWrapper* status) { - iscLogStatus(text, status.value()); + iscLogStatus(text, status); } @@ -3668,7 +3671,7 @@ } -static void error(Arg::StatusVector& statusVector, const TEXT* string, ISC_STATUS status) +static void error(CheckStatusWrapper* statusVector, const TEXT* string, ISC_STATUS status) { /************************************** * @@ -3680,6 +3683,6 @@ * We've encountered an error, report it. * **************************************/ - statusVector << Arg::Gds(isc_sys_request) << Arg::Str(string) << SYS_ERR(status); - statusVector.makePermanent(); + (Arg::StatusVector(statusVector) << + Arg::Gds(isc_sys_request) << string << SYS_ERR(status)).copyTo(statusVector); } Modified: firebird/trunk/src/common/sdl.cpp =================================================================== --- firebird/trunk/src/common/sdl.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/sdl.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -157,27 +157,6 @@ } -ISC_STATUS SDL_info(ISC_STATUS* status_vector, - const UCHAR* sdl, sdl_info* info, SLONG* vector) -{ -/************************************** - * - * S D L _ i n f o - * - ************************************** - * - * Functional description - * Status vector time changing form. - * - **************************************/ - LocalStatus s1; - CheckStatusWrapper s2(&s1); - ISC_STATUS rc = SDL_info(&s2, sdl, info, vector); - fb_utils::mergeStatus(status_vector, ISC_STATUS_LENGTH, &s2); - - return rc; -} - ISC_STATUS SDL_info(CheckStatusWrapper* status_vector, const UCHAR* sdl, sdl_info* info, SLONG* vector) { Modified: firebird/trunk/src/common/sdl_proto.h =================================================================== --- firebird/trunk/src/common/sdl_proto.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/sdl_proto.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -32,7 +32,6 @@ struct array_alice; SLONG SDL_compute_subscript(Firebird::CheckStatusWrapper*, const Ods::InternalArrayDesc*, USHORT, const SLONG*); -ISC_STATUS SDL_info(ISC_STATUS*, const UCHAR*, sdl_info*, SLONG*); ISC_STATUS SDL_info(Firebird::CheckStatusWrapper*, const UCHAR*, sdl_info*, SLONG*); int SDL_walk(Firebird::CheckStatusWrapper*, const UCHAR*, UCHAR*, Ods::InternalArrayDesc*, SLONG*, SDL_walk_callback, array_slice*); Modified: firebird/trunk/src/common/utils.cpp =================================================================== --- firebird/trunk/src/common/utils.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/common/utils.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -1164,8 +1164,6 @@ if (!copied) init_status(dest); - else - Firebird::makePermanentVector(dest); return copied; } @@ -1185,10 +1183,19 @@ { try { - Firebird::Arg::StatusVector sv(from); - sv.copyTo(to); + const ISC_STATUS* w = from; + while (*w != isc_arg_end) + { + if (*w == isc_arg_warning) + { + to->setWarnings(w); + break; + } + w += (*w == isc_arg_cstring ? 3 : 2); + } + to->setErrors2(w - from, from); } - catch (const Firebird::BadAlloc& ex) + catch (const Firebird::Exception& ex) { ex.stuffException(to); } Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -10847,7 +10847,8 @@ } catch (const Exception& ex) { - const bool noPriv = (ex.stuff_exception(tdbb->tdbb_status_vector) == isc_no_priv); + ex.stuff_exception(tdbb->tdbb_status_vector); + const bool noPriv = (tdbb->tdbb_status_vector->getErrors()[1] == isc_no_priv); trace.finish(noPriv ? ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED); tdbb->setRequest(request); Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/dsql/Nodes.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -241,6 +241,8 @@ public: // Prefix DDL exceptions. To be implemented in each command. + // Attention: do not store temp strings in Arg::StatusVector, + // when needed keep them permanently in command's node. virtual void putErrorPrefix(Firebird::Arg::StatusVector& statusVector) = 0; virtual void execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction) = 0; Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -2854,7 +2854,8 @@ } catch (const Exception& ex) { - const bool noPriv = (ex.stuff_exception(tdbb->tdbb_status_vector) == isc_no_priv); + ex.stuff_exception(tdbb->tdbb_status_vector); + const bool noPriv = (tdbb->tdbb_status_vector->getErrors()[1] == isc_no_priv); trace.finish(false, noPriv ? Firebird::ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED); Modified: firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp =================================================================== --- firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/gpre/boot/gpre_meta_boot.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -707,14 +707,6 @@ return NULL; } - const char* circularAlloc(const char* s, unsigned len, intptr_t /*thr*/) - { - char* buf = (char*) malloc(len + 1); - memcpy(buf, s, len); - buf[len] = 0; - return buf; - } - ITimerControl* getTimerControl() { fb_assert(false); Modified: firebird/trunk/src/include/fb_exception.h =================================================================== --- firebird/trunk/src/include/fb_exception.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/include/fb_exception.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -48,6 +48,7 @@ namespace Firebird { class MemoryPool; +class DynamicStatusVector; template <unsigned S = ISC_STATUS_LENGTH> class SimpleStatusVector; @@ -55,15 +56,25 @@ { protected: Exception() throw() { } + static void processUnexpectedException(ISC_STATUS* vector) throw(); + public: - ISC_STATUS stuff_exception(ISC_STATUS* const status_vector) const throw(); - ISC_STATUS stuff_exception(CheckStatusWrapper* status_vector) const throw() + void stuff_exception(CheckStatusWrapper* status_vector) const throw() { return stuffException(status_vector); } - ISC_STATUS stuffException(SimpleStatusVector<>& status_vector) const throw(); + + void stuffException(SimpleStatusVector<>& status_vector) const throw() + { + stuffByException(status_vector); + } + + void stuffException(DynamicStatusVector& status_vector) const throw(); + void stuffException(IStatus* status_vector) const throw(); virtual ~Exception() throw(); - virtual ISC_STATUS stuffException(IStatus* status_vector) const throw() = 0; +private: + virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw() = 0; +public: virtual const char* what() const throw() = 0; }; @@ -71,7 +82,7 @@ class LongJump : public Exception { public: - virtual ISC_STATUS stuffException(IStatus* status_vector) const throw(); + virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw(); virtual const char* what() const throw(); static void raise(); LongJump() throw() : Exception() { } @@ -93,7 +104,7 @@ #endif // USE_SYSTEM_NEW public: - virtual ISC_STATUS stuffException(IStatus* status_vector) const throw(); + virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw(); virtual const char* what() const throw(); static void raise(); }; @@ -105,7 +116,7 @@ explicit status_exception(const ISC_STATUS *status_vector) throw(); virtual ~status_exception() throw(); - virtual ISC_STATUS stuffException(IStatus* status_vector) const throw(); + virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw(); virtual const char* what() const throw(); const ISC_STATUS* value() const throw() { return m_status_vector; } @@ -170,10 +181,6 @@ }; -// Put status vector strings into strings buffer -void makePermanentVector(ISC_STATUS* perm, const ISC_STATUS* trans, ThreadId thr = getThreadId()) throw(); -void makePermanentVector(ISC_STATUS* v, ThreadId thr = getThreadId()) throw(); - } // namespace Firebird Modified: firebird/trunk/src/include/firebird/FirebirdInterface.idl =================================================================== --- firebird/trunk/src/include/firebird/FirebirdInterface.idl 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/include/firebird/FirebirdInterface.idl 2015-03-27 14:36:30 UTC (rev 61112) @@ -82,7 +82,6 @@ Status getStatus(); Provider getDispatcher(); PluginManager getPluginManager(); - const string circularAlloc(const string s, uint len, intptr thr); TimerControl getTimerControl(); Dtc getDtc(); Attachment registerAttachment(Provider provider, Attachment attachment); Modified: firebird/trunk/src/include/firebird/IdlFbInterfaces.h =================================================================== --- firebird/trunk/src/include/firebird/IdlFbInterfaces.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/include/firebird/IdlFbInterfaces.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -290,7 +290,6 @@ IStatus* (CLOOP_CARG *getStatus)(IMaster* self) throw(); IProvider* (CLOOP_CARG *getDispatcher)(IMaster* self) throw(); IPluginManager* (CLOOP_CARG *getPluginManager)(IMaster* self) throw(); - const char* (CLOOP_CARG *circularAlloc)(IMaster* self, const char* s, unsigned len, intptr_t thr) throw(); ITimerControl* (CLOOP_CARG *getTimerControl)(IMaster* self) throw(); IDtc* (CLOOP_CARG *getDtc)(IMaster* self) throw(); IAttachment* (CLOOP_CARG *registerAttachment)(IMaster* self, IProvider* provider, IAttachment* attachment) throw(); @@ -332,12 +331,6 @@ return ret; } - const char* circularAlloc(const char* s, unsigned len, intptr_t thr) - { - const char* ret = static_cast<VTable*>(this->cloopVTable)->circularAlloc(this, s, len, thr); - return ret; - } - ITimerControl* getTimerControl() { ITimerControl* ret = static_cast<VTable*>(this->cloopVTable)->getTimerControl(this); @@ -5099,7 +5092,6 @@ this->getStatus = &Name::cloopgetStatusDispatcher; this->getDispatcher = &Name::cloopgetDispatcherDispatcher; this->getPluginManager = &Name::cloopgetPluginManagerDispatcher; - this->circularAlloc = &Name::cloopcircularAllocDispatcher; this->getTimerControl = &Name::cloopgetTimerControlDispatcher; this->getDtc = &Name::cloopgetDtcDispatcher; this->registerAttachment = &Name::cloopregisterAttachmentDispatcher; @@ -5153,19 +5145,6 @@ } } - static const char* CLOOP_CARG cloopcircularAllocDispatcher(IMaster* self, const char* s, unsigned len, intptr_t thr) throw() - { - try - { - return static_cast<Name*>(self)->Name::circularAlloc(s, len, thr); - } - catch (...) - { - StatusType::catchException(0); - return static_cast<const char*>(0); - } - } - static ITimerControl* CLOOP_CARG cloopgetTimerControlDispatcher(IMaster* self) throw() { try @@ -5289,7 +5268,6 @@ virtual IStatus* getStatus() = 0; virtual IProvider* getDispatcher() = 0; virtual IPluginManager* getPluginManager() = 0; - virtual const char* circularAlloc(const char* s, unsigned len, intptr_t thr) = 0; virtual ITimerControl* getTimerControl() = 0; virtual IDtc* getDtc() = 0; virtual IAttachment* registerAttachment(IProvider* provider, IAttachment* attachment) = 0; Modified: firebird/trunk/src/include/firebird/Interface.h =================================================================== --- firebird/trunk/src/include/firebird/Interface.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/include/firebird/Interface.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -141,6 +141,16 @@ return dirty; } + bool hasData() const + { + return getState() & IStatus::STATE_ERRORS; + } + + bool isEmpty() const + { + return !hasData(); + } + static void setVersionError(IStatus* status, const char* interfaceName, unsigned currentVersion, unsigned expectedVersion) { Modified: firebird/trunk/src/jrd/Function.epp =================================================================== --- firebird/trunk/src/jrd/Function.epp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/Function.epp 2015-03-27 14:36:30 UTC (rev 61112) @@ -430,11 +430,11 @@ } catch (const Exception& ex) { - ISC_STATUS_ARRAY temp_status; - ex.stuff_exception(temp_status); + SimpleStatusVector<> temp_status; + ex.stuffException(temp_status); const string name = function->getName().toString(); (Arg::Gds(isc_bad_fun_BLR) << Arg::Str(name) - << Arg::StatusVector(temp_status)).raise(); + << Arg::StatusVector(temp_status.begin())).raise(); } } } Modified: firebird/trunk/src/jrd/Monitoring.cpp =================================================================== --- firebird/trunk/src/jrd/Monitoring.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/Monitoring.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -116,11 +116,10 @@ if (shared_memory->getHeader()->allocated > shared_memory->sh_mem_length_mapped) { #ifdef HAVE_OBJECT_MAP - Arg::StatusVector statusVector; - shared_memory->remapFile(statusVector, shared_memory->getHeader()->allocated, false); - if (!shared_memory->remapFile(statusVector, shared_memory->getHeader()->allocated, false)) + FbLocalStatus statusVector; + if (!shared_memory->remapFile(&statusVector, shared_memory->getHeader()->allocated, false)) { - status_exception::raise(statusVector); + status_exception::raise(&statusVector); } #else status_exception::raise(Arg::Gds(isc_montabexh)); @@ -258,10 +257,10 @@ newSize = FB_ALIGN(newSize, DEFAULT_SIZE); #ifdef HAVE_OBJECT_MAP - Arg::StatusVector statusVector; - if (!shared_memory->remapFile(statusVector, newSize, true)) + FbLocalStatus statusVector; + if (!shared_memory->remapFile(&statusVector, newSize, true)) { - status_exception::raise(statusVector); + status_exception::raise(&statusVector); } shared_memory->getHeader()->allocated = shared_memory->sh_mem_length_mapped; #else Modified: firebird/trunk/src/jrd/TempSpace.cpp =================================================================== --- firebird/trunk/src/jrd/TempSpace.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/TempSpace.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -371,7 +371,7 @@ TempFile* TempSpace::setupFile(FB_SIZE_T size) { - ISC_STATUS_ARRAY status_vector = {0}; + Firebird::SimpleStatusVector<> status_vector; for (FB_SIZE_T i = 0; i < tempDirs->getCount(); i++) { @@ -404,7 +404,7 @@ } catch (const Firebird::system_error& ex) { - ex.stuff_exception(status_vector); + ex.stuffException(status_vector); continue; } @@ -413,7 +413,7 @@ // no room in all directories Firebird::Arg::Gds status(isc_out_of_temp_space); - status.append(Firebird::Arg::StatusVector(status_vector)); + status.append(Firebird::Arg::StatusVector(status_vector.begin())); iscLogStatus(NULL, status.value()); status.raise(); Modified: firebird/trunk/src/jrd/event.cpp =================================================================== --- firebird/trunk/src/jrd/event.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/event.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -138,7 +138,8 @@ m_exiting = true; const SLONG process_offset = m_processOffset; - Arg::StatusVector localStatus; + LocalStatus ls; + CheckStatusWrapper localStatus(&ls); if (m_process) { @@ -148,7 +149,7 @@ m_cleanupSemaphore.tryEnter(5); #ifdef HAVE_OBJECT_MAP - m_sharedMemory->unmapObject(localStatus, &m_process); + m_sharedMemory->unmapObject(&localStatus, &m_process); #else m_process = NULL; #endif @@ -549,12 +550,13 @@ const ULONG length = m_sharedMemory->getHeader()->evh_length; #ifdef HAVE_OBJECT_MAP - Arg::StatusVector localStatus; - if (!m_sharedMemory->remapFile(localStatus, length, false)) + LocalStatus ls; + CheckStatusWrapper localStatus(&ls); + if (!m_sharedMemory->remapFile(&localStatus, length, false)) #endif { release_shmem(); - iscLogStatus("Event table remap failed", localStatus.value()); + iscLogStatus("Event table remap failed", &localStatus); exit(FINI_ERROR); } } @@ -597,8 +599,9 @@ const ULONG old_length = m_sharedMemory->sh_mem_length_mapped; const ULONG ev_length = old_length + m_config->getEventMemSize(); - Arg::StatusVector localStatus; - if (m_sharedMemory->remapFile(localStatus, ev_length, true)) + LocalStatus ls; + CheckStatusWrapper localStatus(&ls); + if (m_sharedMemory->remapFile(&localStatus, ev_length, true)) { free = (frb*) (((UCHAR*) m_sharedMemory->getHeader()) + old_length); //free->frb_header.hdr_length = EVENT_EXTEND_SIZE - sizeof (struct evh); @@ -669,13 +672,14 @@ m_processOffset = SRQ_REL_PTR(process); #ifdef HAVE_OBJECT_MAP - Arg::StatusVector localStatus; - m_process = m_sharedMemory->mapObject<prb>(localStatus, m_processOffset); + LocalStatus ls; + CheckStatusWrapper localStatus(&ls); + m_process = m_sharedMemory->mapObject<prb>(&localStatus, m_processOffset); if (!m_process) { release_shmem(); - localStatus.raise(); + status_exception::raise(&localStatus); } #else m_process = process; Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/jrd.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -1223,12 +1223,12 @@ } catch (...) { - return ex.stuffException(vector); + ex.stuffException(vector); + return vector->getErrors()[1]; } vector->setErrors2(newVector.getCount() - 1, newVector.begin()); - - return vectorStart[1]; + return vector->getErrors()[1]; } Modified: firebird/trunk/src/jrd/lck.cpp =================================================================== --- firebird/trunk/src/jrd/lck.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/lck.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -57,7 +57,7 @@ static void bug_lck(const TEXT*); static bool compatible(const Lock*, const Lock*, USHORT); -static void enqueue(thread_db*, Arg::StatusVector&, Lock*, USHORT, SSHORT); +static void enqueue(thread_db*, CheckStatusWrapper*, Lock*, USHORT, SSHORT); static int external_ast(void*); static USHORT hash_func(const UCHAR*, USHORT); static void hash_allocate(Lock*); @@ -67,8 +67,8 @@ static void internal_ast(Lock*); static bool internal_compatible(Lock*, const Lock*, USHORT); static void internal_dequeue(thread_db*, Lock*); -static USHORT internal_downgrade(thread_db*, Arg::StatusVector&, Lock*); -static bool internal_enqueue(thread_db*, Arg::StatusVector&, Lock*, USHORT, SSHORT, bool); +static USHORT internal_downgrade(thread_db*, CheckStatusWrapper*, Lock*); +static bool internal_enqueue(thread_db*, CheckStatusWrapper*, Lock*, USHORT, SSHORT, bool); static SLONG get_owner_handle(thread_db* tdbb, enum lck_t lock_type); #ifdef DEBUG_LCK @@ -141,7 +141,7 @@ const int LOCK_HASH_SIZE = 19; -inline void ENQUEUE(thread_db* tdbb, Arg::StatusVector& statusVector, Lock* lock, USHORT level, SSHORT wait) +inline void ENQUEUE(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* lock, USHORT level, SSHORT wait) { if (lock->lck_compatible) internal_enqueue(tdbb, statusVector, lock, level, wait, false); @@ -149,7 +149,7 @@ enqueue(tdbb, statusVector, lock, level, wait); } -inline bool CONVERT(thread_db* tdbb, Arg::StatusVector& statusVector, Lock* lock, USHORT level, SSHORT wait) +inline bool CONVERT(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* lock, USHORT level, SSHORT wait) { Database* const dbb = tdbb->getDatabase(); Jrd::Attachment* const att = tdbb->getAttachment(); @@ -175,11 +175,11 @@ Database* const dbb = tdbb->getDatabase(); Jrd::Attachment* const att = tdbb->getAttachment(); - Arg::StatusVector statusVector; + FbLocalStatus statusVector; USHORT ret = lock->lck_compatible ? - internal_downgrade(tdbb, statusVector, lock) : - dbb->dbb_lock_mgr->downgrade(att, statusVector, lock->lck_id); + internal_downgrade(tdbb, &statusVector, lock) : + dbb->dbb_lock_mgr->downgrade(att, &statusVector, lock->lck_id); fb_assert(statusVector.isEmpty()); @@ -336,15 +336,15 @@ lock->setLockAttachment(tdbb, tdbb->getAttachment()); WaitCancelGuard guard(tdbb, lock, wait); - Arg::StatusVector statusVector; + FbLocalStatus statusVector; - const bool result = CONVERT(tdbb, statusVector, lock, level, wait); + const bool result = CONVERT(tdbb, &statusVector, lock, level, wait); if (!result) { lock->setLockAttachment(tdbb, old_attachment); - switch (statusVector.value()[1]) + switch (statusVector[1]) { case isc_deadlock: case isc_lock_conflict: @@ -592,11 +592,11 @@ break; } - Arg::StatusVector statusVector; + FbLocalStatus statusVector; - if (!dbb->dbb_lock_mgr->initializeOwner(statusVector, owner_id, owner_type, owner_handle_ptr)) + if (!dbb->dbb_lock_mgr->initializeOwner(&statusVector, owner_id, owner_type, owner_handle_ptr)) { - if (statusVector.value()[1] == isc_lockmanerr) + if (statusVector[1] == isc_lockmanerr) { statusVector.copyTo(tdbb->tdbb_status_vector); tdbb->getDatabase()->dbb_flags |= DBB_bugcheck; @@ -630,9 +630,9 @@ lock->setLockAttachment(tdbb, tdbb->getAttachment()); WaitCancelGuard guard(tdbb, lock, wait); - Arg::StatusVector statusVector; + FbLocalStatus statusVector; - ENQUEUE(tdbb, statusVector, lock, level, wait); + ENQUEUE(tdbb, &statusVector, lock, level, wait); fb_assert(LCK_CHECK_LOCK(lock)); if (!lock->lck_id) @@ -644,7 +644,7 @@ return false; } - switch (statusVector.value()[1]) + switch (statusVector[1]) { case isc_deadlock: case isc_lock_conflict: @@ -890,7 +890,7 @@ } -static void enqueue(thread_db* tdbb, Arg::StatusVector& statusVector, Lock* lock, USHORT level, SSHORT wait) +static void enqueue(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* lock, USHORT level, SSHORT wait) { /************************************** * @@ -1293,13 +1293,13 @@ // check for a potential downgrade - Arg::StatusVector statusVector; - internal_downgrade(tdbb, statusVector, match); + FbLocalStatus statusVector; + internal_downgrade(tdbb, &statusVector, match); fb_assert(statusVector.isEmpty()); } -static USHORT internal_downgrade(thread_db* tdbb, Arg::StatusVector& statusVector, Lock* first) +static USHORT internal_downgrade(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* first) { /************************************** * @@ -1346,7 +1346,7 @@ } -static bool internal_enqueue(thread_db* tdbb, Arg::StatusVector& statusVector, Lock* lock, +static bool internal_enqueue(thread_db* tdbb, CheckStatusWrapper* statusVector, Lock* lock, USHORT level, SSHORT wait, bool convert_flg) { /************************************** @@ -1384,7 +1384,7 @@ // for now return a lock conflict; it would be better if we were to // do a wait on the other lock by setting some flag bit or some such - statusVector << Arg::Gds(isc_lock_conflict); + (Arg::StatusVector(statusVector) << Arg::Gds(isc_lock_conflict)).copyTo(statusVector); return false; } Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/met.epp 2015-03-27 14:36:30 UTC (rev 61112) @@ -3381,11 +3381,11 @@ } catch (const Exception& ex) { - ISC_STATUS_ARRAY temp_status; - ex.stuff_exception(temp_status); + SimpleStatusVector<> temp_status; + ex.stuffException(temp_status); const string name = procedure->getName().toString(); (Arg::Gds(isc_bad_proc_BLR) << Arg::Str(name) - << Arg::StatusVector(temp_status)).raise(); + << Arg::StatusVector(temp_status.begin())).raise(); } } } Modified: firebird/trunk/src/jrd/status.h =================================================================== --- firebird/trunk/src/jrd/status.h 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/status.h 2015-03-27 14:36:30 UTC (rev 61112) @@ -72,15 +72,30 @@ return &localStatusVector; } - void check() + void check() const { if (localStatusVector.isDirty()) { if (localStatus.getState() & FbStatusVector::STATE_ERRORS) - Firebird::status_exception::raise(&localStatus); + raise(); } } + void copyTo(FbStatusVector* to) const + { + fb_utils::copyStatus(to, &localStatusVector); + } + + void raise() const + { + Firebird::status_exception::raise(&localStatus); + } + + bool isEmpty() const + { + return localStatusVector.isEmpty(); + } + private: Firebird::LocalStatus localStatus; FbStatusVector localStatusVector; Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2015-03-27 13:51:09 UTC (rev 61111) +++ firebird/trunk/src/jrd/svc.cpp 2015-03-27 14:36:30 UTC (rev 61112) @@ -761,7 +761,8 @@ if (trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_ATTACH)) { - const ISC_STATUS exc = ex.stuff_exception(&status_vector); + ex.stuff_exception(&status_vector); + const ISC_STATUS exc = status_vector[1]; const bool no_priv = (exc == isc_login || exc == isc_no_priv); TraceServiceImpl service(this); @@ -1447,11 +1448,12 @@ } // try catch (const Firebird::Exception& ex) { - FbLocalStatus status_vector; - if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_QUERY)) { - const ISC_STATUS exc = ex.stuff_exception(&status_vector); + FbLocalStatus status_vector; + ex.stuff_exception(&status_vector); + + const ISC_STATUS exc = status_vector[1]; const bool no_priv = (exc == isc_login || exc == isc_no_priv || exc == isc_insufficient_svc_privileges); ... [truncated message content] |
From: <hv...@us...> - 2015-03-27 15:41:43
|
Revision: 61114 http://sourceforge.net/p/firebird/code/61114 Author: hvlad Date: 2015-03-27 15:41:36 +0000 (Fri, 27 Mar 2015) Log Message: ----------- Fixed Windows build Modified Paths: -------------- firebird/trunk/src/jrd/os/win32/ibinitdll.cpp firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp Modified: firebird/trunk/src/jrd/os/win32/ibinitdll.cpp =================================================================== --- firebird/trunk/src/jrd/os/win32/ibinitdll.cpp 2015-03-27 15:30:12 UTC (rev 61113) +++ firebird/trunk/src/jrd/os/win32/ibinitdll.cpp 2015-03-27 15:41:36 UTC (rev 61114) @@ -25,7 +25,7 @@ #include "firebird.h" #include <windows.h> #include "../../../common/dllinst.h" -#include "../../../yvalve/MasterImplementation.h" +#include "../../../yvalve/utl_proto.h" using namespace Firebird; Modified: firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp =================================================================== --- firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp 2015-03-27 15:30:12 UTC (rev 61113) +++ firebird/trunk/src/remote/server/os/win32/srvr_w32.cpp 2015-03-27 15:41:36 UTC (rev 61114) @@ -449,8 +449,8 @@ } catch (const Exception& ex) { - ISC_STATUS_ARRAY status_vector; - ex.stuff_exception(status_vector); + SimpleStatusVector<> status_vector; + ex.stuffException(status_vector); if (status_vector[1] == isc_net_server_shutdown) break; @@ -500,8 +500,8 @@ } catch (const Exception& ex) { - ISC_STATUS_ARRAY status_vector; - ex.stuff_exception(status_vector); + SimpleStatusVector<> status_vector; + ex.stuffException(status_vector); if (status_vector[1] == isc_net_server_shutdown) break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-03-27 17:51:22
|
Revision: 61117 http://sourceforge.net/p/firebird/code/61117 Author: alexpeshkoff Date: 2015-03-27 17:51:19 +0000 (Fri, 27 Mar 2015) Log Message: ----------- Be more consistent putting IStatus into fast inline wrapper. Also some syntax sugar as suggested by Dmitry Modified Paths: -------------- firebird/trunk/src/alice/alice.cpp firebird/trunk/src/alice/main/aliceMain.cpp firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp firebird/trunk/src/burp/burp.cpp firebird/trunk/src/burp/main/burpMain.cpp firebird/trunk/src/common/IntlParametersBlock.cpp firebird/trunk/src/common/SimpleStatusVector.h firebird/trunk/src/common/StatusArg.h firebird/trunk/src/common/StatusHolder.cpp firebird/trunk/src/common/classes/init.cpp firebird/trunk/src/common/fb_exception.cpp firebird/trunk/src/common/isc.cpp firebird/trunk/src/common/unicode_util.cpp firebird/trunk/src/common/utils.cpp firebird/trunk/src/common/utils_proto.h firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/include/fb_exception.h firebird/trunk/src/jrd/CryptoManager.cpp firebird/trunk/src/jrd/Function.epp firebird/trunk/src/jrd/JrdStatement.cpp firebird/trunk/src/jrd/TempSpace.cpp firebird/trunk/src/jrd/btr.cpp firebird/trunk/src/jrd/cch.cpp firebird/trunk/src/jrd/cmp.cpp firebird/trunk/src/jrd/dfw.epp firebird/trunk/src/jrd/err.cpp firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/extds/ExtDS.cpp firebird/trunk/src/jrd/fun.epp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/nbak.cpp firebird/trunk/src/jrd/sdw.cpp firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/jrd/tra.cpp firebird/trunk/src/jrd/trace/TraceService.cpp firebird/trunk/src/jrd/validation.cpp firebird/trunk/src/jrd/vio.cpp firebird/trunk/src/lock/print.cpp firebird/trunk/src/remote/client/interface.cpp firebird/trunk/src/remote/protocol.cpp firebird/trunk/src/remote/remote.cpp firebird/trunk/src/remote/server/os/posix/inet_server.cpp firebird/trunk/src/remote/server/server.cpp firebird/trunk/src/utilities/fbsvcmgr/fbsvcmgr.cpp firebird/trunk/src/utilities/fbtracemgr/traceMgrMain.cpp firebird/trunk/src/utilities/gsec/gsec.cpp firebird/trunk/src/utilities/gsec/main/gsecMain.cpp firebird/trunk/src/utilities/gstat/dba.epp firebird/trunk/src/utilities/gstat/main/gstatMain.cpp firebird/trunk/src/utilities/nbackup/nbackup.cpp firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp firebird/trunk/src/yvalve/user_dsql.cpp firebird/trunk/src/yvalve/utl.cpp firebird/trunk/src/yvalve/why.cpp Modified: firebird/trunk/src/alice/alice.cpp =================================================================== --- firebird/trunk/src/alice/alice.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/alice/alice.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -111,7 +111,7 @@ } catch (const Firebird::Exception& e) { - Firebird::SimpleStatusVector<> status; + Firebird::StaticStatusVector status; e.stuffException(status); uSvc->setServiceStatus(status.begin()); uSvc->started(); @@ -565,7 +565,7 @@ catch (const Firebird::Exception& e) { // Non-alice exception was caught - Firebird::SimpleStatusVector<> status; + Firebird::StaticStatusVector status; e.stuffException(status); fb_utils::copyStatus(tdgbl->status_vector, ISC_STATUS_LENGTH, status.begin(), status.getCount()); ALICE_print_status(true, tdgbl->status_vector); Modified: firebird/trunk/src/alice/main/aliceMain.cpp =================================================================== --- firebird/trunk/src/alice/main/aliceMain.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/alice/main/aliceMain.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -51,7 +51,7 @@ } catch (const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); isc_print_status(st.begin()); } Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyServer.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -429,7 +429,7 @@ } catch (Exception &ex) { - SimpleStatusVector<> st; + StaticStatusVector st; ex.stuffException(st); const ISC_STATUS* status = st.begin(); if (status[0] == 1 && status[1] != isc_att_shutdown) @@ -461,7 +461,7 @@ } catch (Exception &ex) { - SimpleStatusVector<> st; + StaticStatusVector st; ex.stuffException(st); const ISC_STATUS* status = st.begin(); if (status[0] == 1 && status[1] != isc_att_shutdown) Modified: firebird/trunk/src/burp/burp.cpp =================================================================== --- firebird/trunk/src/burp/burp.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/burp/burp.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -139,7 +139,7 @@ } catch (const Firebird::Exception& e) { - Firebird::SimpleStatusVector<> status; + Firebird::StaticStatusVector status; e.stuffException(status); uSvc->initStatus(); uSvc->setServiceStatus(status.begin()); @@ -386,7 +386,7 @@ } catch (const Firebird::Exception& e) { - Firebird::SimpleStatusVector<> s; + Firebird::StaticStatusVector s; e.stuffException(s); BURP_print_status(true, s.begin()); if (svc_handle) @@ -1237,7 +1237,7 @@ { // Non-burp exception was caught tdgbl->burp_throw = false; - Firebird::SimpleStatusVector<> s; + Firebird::StaticStatusVector s; e.stuffException(s); fb_utils::copyStatus(tdgbl->status_vector, ISC_STATUS_LENGTH, s.begin(), s.getCount()); BURP_print_status(true, tdgbl->status_vector); Modified: firebird/trunk/src/burp/main/burpMain.cpp =================================================================== --- firebird/trunk/src/burp/main/burpMain.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/burp/main/burpMain.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -51,7 +51,7 @@ } catch (const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); isc_print_status(st.begin()); } Modified: firebird/trunk/src/common/IntlParametersBlock.cpp =================================================================== --- firebird/trunk/src/common/IntlParametersBlock.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/IntlParametersBlock.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -161,7 +161,8 @@ } catch (const Firebird::status_exception& st) { - LocalStatus l; + LocalStatus ls; + CheckStatusWrapper l(&ls); st.stuffException(&l); if ((l.getState() & IStatus::STATE_ERRORS) && (l.getErrors()[1] == isc_bad_conn_str) && tagName) { Modified: firebird/trunk/src/common/SimpleStatusVector.h =================================================================== --- firebird/trunk/src/common/SimpleStatusVector.h 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/SimpleStatusVector.h 2015-03-27 17:51:19 UTC (rev 61117) @@ -87,6 +87,8 @@ } }; +typedef SimpleStatusVector<> StaticStatusVector; + } // namespace Firebird Modified: firebird/trunk/src/common/StatusArg.h =================================================================== --- firebird/trunk/src/common/StatusArg.h 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/StatusArg.h 2015-03-27 17:51:19 UTC (rev 61117) @@ -103,7 +103,7 @@ class ImplStatusVector : public ImplBase { private: - SimpleStatusVector<> m_status_vector; + StaticStatusVector m_status_vector; unsigned int m_warning; bool appendErrors(const ImplBase* const v) throw(); Modified: firebird/trunk/src/common/StatusHolder.cpp =================================================================== --- firebird/trunk/src/common/StatusHolder.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/StatusHolder.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -35,7 +35,7 @@ ISC_STATUS DynamicStatusVector::load(const IStatus* status) { - SimpleStatusVector<> tmp; + StaticStatusVector tmp; tmp.mergeStatus(status); return save(tmp.begin(), false); } Modified: firebird/trunk/src/common/classes/init.cpp =================================================================== --- firebird/trunk/src/common/classes/init.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/classes/init.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -44,7 +44,7 @@ if (e) { // This is done to be able to look at status in debugger - Firebird::SimpleStatusVector<> status; + Firebird::StaticStatusVector status; e->stuffException(status); } Modified: firebird/trunk/src/common/fb_exception.cpp =================================================================== --- firebird/trunk/src/common/fb_exception.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/fb_exception.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -20,7 +20,7 @@ void Exception::stuffException(DynamicStatusVector& status_vector) const throw() { - SimpleStatusVector<> status; + StaticStatusVector status; stuffException(status); try { @@ -34,16 +34,16 @@ } } -void Exception::stuffException(IStatus* status_vector) const throw() +void Exception::stuffException(CheckStatusWrapper* status_vector) const throw() { - SimpleStatusVector<> status; + StaticStatusVector status; stuffException(status); fb_utils::setIStatus(status_vector, status.begin()); } void Exception::processUnexpectedException(ISC_STATUS* vector) throw() { - // do not use stuff_exception() here to avoid endless loop + // do not use stuffException() here to avoid endless loop try { throw; @@ -125,7 +125,7 @@ void status_exception::raise(const IStatus* status) { - SimpleStatusVector<> status_vector; + StaticStatusVector status_vector; status_vector.mergeStatus(status); throw status_exception(status_vector.begin()); } @@ -135,7 +135,7 @@ throw status_exception(statusVector.value()); } -void status_exception::stuffByException(SimpleStatusVector<>& status) const throw() +void status_exception::stuffByException(StaticStatusVector& status) const throw() { try { @@ -154,7 +154,7 @@ throw BadAlloc(); } -void BadAlloc::stuffByException(SimpleStatusVector<>& status) const throw() +void BadAlloc::stuffByException(StaticStatusVector& status) const throw() { fb_utils::statusBadAlloc(status.makeEmergencyStatus()); } @@ -171,7 +171,7 @@ throw LongJump(); } -void LongJump::stuffByException(SimpleStatusVector<>& status) const throw() +void LongJump::stuffByException(StaticStatusVector& status) const throw() { ISC_STATUS sv[] = {isc_arg_gds, isc_random, isc_arg_string, (ISC_STATUS)(IPTR) "Unexpected call to Firebird::LongJump::stuffException()", isc_arg_end}; Modified: firebird/trunk/src/common/isc.cpp =================================================================== --- firebird/trunk/src/common/isc.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/isc.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -587,7 +587,7 @@ void iscLogStatus(const TEXT* text, const Firebird::IStatus* status) { - Firebird::SimpleStatusVector<> tmp; + Firebird::StaticStatusVector tmp; tmp.mergeStatus(status); iscLogStatus(text, tmp.begin()); } @@ -619,7 +619,7 @@ * Add record about an exception to firebird.log * **************************************/ - Firebird::SimpleStatusVector<> s; + Firebird::StaticStatusVector s; e.stuffException(s); iscLogStatus(text, s.begin()); } Modified: firebird/trunk/src/common/unicode_util.cpp =================================================================== --- firebird/trunk/src/common/unicode_util.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/unicode_util.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1123,7 +1123,8 @@ return *convIcu; } - LocalStatus lastError; + LocalStatus ls; + CheckStatusWrapper lastError(&ls); string version; const int majorArray[] = {5, 4, 3, 6, 0}; Modified: firebird/trunk/src/common/utils.cpp =================================================================== --- firebird/trunk/src/common/utils.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/utils.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1179,7 +1179,7 @@ to->setWarnings(from->getWarnings()); } -void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw() +void setIStatus(Firebird::CheckStatusWrapper* to, const ISC_STATUS* from) throw() { try { Modified: firebird/trunk/src/common/utils_proto.h =================================================================== --- firebird/trunk/src/common/utils_proto.h 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/common/utils_proto.h 2015-03-27 17:51:19 UTC (rev 61117) @@ -138,7 +138,7 @@ const ISC_STATUS* const from, const unsigned int count) throw(); void copyStatus(Firebird::CheckStatusWrapper* to, const Firebird::CheckStatusWrapper* from) throw(); unsigned int mergeStatus(ISC_STATUS* const to, unsigned int space, const Firebird::IStatus* from) throw(); - void setIStatus(Firebird::IStatus* to, const ISC_STATUS* from) throw(); + void setIStatus(Firebird::CheckStatusWrapper* to, const ISC_STATUS* from) throw(); unsigned int statusLength(const ISC_STATUS* const status) throw(); unsigned int subStatus(const ISC_STATUS* in, unsigned int cin, const ISC_STATUS* sub, unsigned int csub) throw(); Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -10847,7 +10847,7 @@ } catch (const Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); const bool noPriv = (tdbb->tdbb_status_vector->getErrors()[1] == isc_no_priv); trace.finish(noPriv ? ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED); Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -2854,7 +2854,7 @@ } catch (const Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); const bool noPriv = (tdbb->tdbb_status_vector->getErrors()[1] == isc_no_priv); trace.finish(false, noPriv ? Firebird::ITracePlugin::RESULT_UNAUTHORIZED : ITracePlugin::RESULT_FAILED); Modified: firebird/trunk/src/include/fb_exception.h =================================================================== --- firebird/trunk/src/include/fb_exception.h 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/include/fb_exception.h 2015-03-27 17:51:19 UTC (rev 61117) @@ -51,6 +51,7 @@ class DynamicStatusVector; template <unsigned S = ISC_STATUS_LENGTH> class SimpleStatusVector; +typedef SimpleStatusVector<> StaticStatusVector; class Exception { @@ -59,21 +60,16 @@ static void processUnexpectedException(ISC_STATUS* vector) throw(); public: - void stuff_exception(CheckStatusWrapper* status_vector) const throw() + void stuffException(StaticStatusVector& status_vector) const throw() { - return stuffException(status_vector); - } - - void stuffException(SimpleStatusVector<>& status_vector) const throw() - { stuffByException(status_vector); } void stuffException(DynamicStatusVector& status_vector) const throw(); - void stuffException(IStatus* status_vector) const throw(); + void stuffException(CheckStatusWrapper* status_vector) const throw(); virtual ~Exception() throw(); private: - virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw() = 0; + virtual void stuffByException(StaticStatusVector& status_vector) const throw() = 0; public: virtual const char* what() const throw() = 0; }; @@ -82,7 +78,7 @@ class LongJump : public Exception { public: - virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw(); + virtual void stuffByException(StaticStatusVector& status_vector) const throw(); virtual const char* what() const throw(); static void raise(); LongJump() throw() : Exception() { } @@ -104,7 +100,7 @@ #endif // USE_SYSTEM_NEW public: - virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw(); + virtual void stuffByException(StaticStatusVector& status_vector) const throw(); virtual const char* what() const throw(); static void raise(); }; @@ -116,7 +112,7 @@ explicit status_exception(const ISC_STATUS *status_vector) throw(); virtual ~status_exception() throw(); - virtual void stuffByException(SimpleStatusVector<>& status_vector) const throw(); + virtual void stuffByException(StaticStatusVector& status_vector) const throw(); virtual const char* what() const throw(); const ISC_STATUS* value() const throw() { return m_status_vector; } Modified: firebird/trunk/src/jrd/CryptoManager.cpp =================================================================== --- firebird/trunk/src/jrd/CryptoManager.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/CryptoManager.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -561,7 +561,7 @@ } catch (const Exception& ex) { - ex.stuff_exception(sv); + ex.stuffException(sv); } return false; } @@ -591,7 +591,7 @@ } catch (const Exception& ex) { - ex.stuff_exception(sv); + ex.stuffException(sv); } return NULL; } Modified: firebird/trunk/src/jrd/Function.epp =================================================================== --- firebird/trunk/src/jrd/Function.epp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/Function.epp 2015-03-27 17:51:19 UTC (rev 61117) @@ -430,7 +430,7 @@ } catch (const Exception& ex) { - SimpleStatusVector<> temp_status; + StaticStatusVector temp_status; ex.stuffException(temp_status); const string name = function->getName().toString(); (Arg::Gds(isc_bad_fun_BLR) << Arg::Str(name) Modified: firebird/trunk/src/jrd/JrdStatement.cpp =================================================================== --- firebird/trunk/src/jrd/JrdStatement.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/JrdStatement.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -273,7 +273,7 @@ } } - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); tdbb->setRequest(old_request); ERR_punt(); } Modified: firebird/trunk/src/jrd/TempSpace.cpp =================================================================== --- firebird/trunk/src/jrd/TempSpace.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/TempSpace.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -371,7 +371,7 @@ TempFile* TempSpace::setupFile(FB_SIZE_T size) { - Firebird::SimpleStatusVector<> status_vector; + Firebird::StaticStatusVector status_vector; for (FB_SIZE_T i = 0; i < tempDirs->getCount(); i++) { Modified: firebird/trunk/src/jrd/btr.cpp =================================================================== --- firebird/trunk/src/jrd/btr.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/btr.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1279,7 +1279,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); key->key_length = 0; return (tdbb->tdbb_flags & TDBB_sys_error) ? idx_e_interrupt : idx_e_conversion; } @@ -3828,7 +3828,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); error = true; } @@ -3862,7 +3862,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); // CCH_unwind does not released page buffers (as we // set TDBB_no_cache_unwind flag), do it now Modified: firebird/trunk/src/jrd/cch.cpp =================================================================== --- firebird/trunk/src/jrd/cch.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/cch.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1380,7 +1380,7 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); // If the buffer control block can't be allocated, memory is // very low. Recalculate the number of buffers to account for // page buffer overhead and reduce that number by a 25% fudge factor. @@ -2745,7 +2745,7 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); + ex.stuffException(status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); return 0; } @@ -2846,7 +2846,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(status_vector); + ex.stuffException(status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), status_vector); } return 0; @@ -2959,7 +2959,7 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); // continue execution to clean up } @@ -2972,7 +2972,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } @@ -2984,7 +2984,7 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } Modified: firebird/trunk/src/jrd/cmp.cpp =================================================================== --- firebird/trunk/src/jrd/cmp.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/cmp.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -201,7 +201,7 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); if (request) CMP_release(tdbb, request); else Modified: firebird/trunk/src/jrd/dfw.epp =================================================================== --- firebird/trunk/src/jrd/dfw.epp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/dfw.epp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1337,11 +1337,11 @@ // Do any necessary cleanup if (!phase) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); ERR_punt(); } else - ex.stuff_exception(&err_status); + ex.stuffException(&err_status); phase = 0; more = true; Modified: firebird/trunk/src/jrd/err.cpp =================================================================== --- firebird/trunk/src/jrd/err.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/err.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -233,7 +233,7 @@ return; // copy memory from/to - SimpleStatusVector<> tmp; + StaticStatusVector tmp; tmp.assign(oldVector, lenOld); tmp.append(toAdd, lenToAdd); statusVector->setErrors2(tmp.getCount(), tmp.begin()); Modified: firebird/trunk/src/jrd/exe.cpp =================================================================== --- firebird/trunk/src/jrd/exe.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/exe.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1164,7 +1164,7 @@ trigger->req_attachment = NULL; trigger->req_flags &= ~req_in_use; - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); trigger_failure(tdbb, trigger); } @@ -1300,7 +1300,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); request->adjustCallerStats(); Modified: firebird/trunk/src/jrd/extds/ExtDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/ExtDS.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/extds/ExtDS.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -897,7 +897,7 @@ if (!doPunt && !wasError) { doPunt = true; - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); } } m_active = false; @@ -921,7 +921,7 @@ if (!doPunt && !wasError) { doPunt = true; - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); } } } @@ -936,7 +936,7 @@ if (!doPunt && !wasError) { doPunt = true; - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); } } } Modified: firebird/trunk/src/jrd/fun.epp =================================================================== --- firebird/trunk/src/jrd/fun.epp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/fun.epp 2015-03-27 17:51:19 UTC (rev 61117) @@ -805,7 +805,7 @@ } catch (const Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); } } catch (const Exception&) @@ -840,7 +840,7 @@ } catch (const Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); } } catch (const Exception&) @@ -886,7 +886,7 @@ } catch (const Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); } } catch (const Exception&) @@ -1187,7 +1187,7 @@ } catch (Firebird::status_exception& e) { - e.stuff_exception(tdbb->tdbb_status_vector); + e.stuffException(tdbb->tdbb_status_vector); return false; } } Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/jrd.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1134,7 +1134,7 @@ ISC_STATUS transliterateException(thread_db* tdbb, const Exception& ex, FbStatusVector* vector, const char* func) throw() { - ex.stuff_exception(vector); + ex.stuffException(vector); Jrd::Attachment* attachment = tdbb->getAttachment(); if (func && attachment && attachment->att_trace_manager->needs(ITraceFactory::TRACE_EVENT_ERROR)) @@ -1155,7 +1155,7 @@ const ISC_STATUS* const vectorStart = vector->getErrors(); const ISC_STATUS* status = vectorStart; - SimpleStatusVector<> newVector; + StaticStatusVector newVector; ObjectsArray<UCharBuffer> buffers; try Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/met.epp 2015-03-27 17:51:19 UTC (rev 61117) @@ -3381,7 +3381,7 @@ } catch (const Exception& ex) { - SimpleStatusVector<> temp_status; + StaticStatusVector temp_status; ex.stuffException(temp_status); const string name = procedure->getName().toString(); (Arg::Gds(isc_bad_proc_BLR) << Arg::Str(name) Modified: firebird/trunk/src/jrd/nbak.cpp =================================================================== --- firebird/trunk/src/jrd/nbak.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/nbak.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -674,7 +674,7 @@ { // Handle out of memory error, etc delete alloc_table; - ex.stuff_exception(status_vector); + ex.stuffException(status_vector); alloc_table = NULL; last_allocated_page = 0; return false; @@ -777,7 +777,7 @@ delete alloc_table; alloc_table = NULL; last_allocated_page = 0; - ex.stuff_exception(status_vector); + ex.stuffException(status_vector); return 0; } Modified: firebird/trunk/src/jrd/sdw.cpp =================================================================== --- firebird/trunk/src/jrd/sdw.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/sdw.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1071,7 +1071,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); if (header_fetched) { CCH_RELEASE(tdbb, &window); } @@ -1236,7 +1236,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); return false; } Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/svc.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -761,7 +761,7 @@ if (trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_ATTACH)) { - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); const ISC_STATUS exc = status_vector[1]; const bool no_priv = (exc == isc_login || exc == isc_no_priv); @@ -1451,7 +1451,7 @@ if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_QUERY)) { FbLocalStatus status_vector; - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); const ISC_STATUS exc = status_vector[1]; const bool no_priv = (exc == isc_login || exc == isc_no_priv || @@ -1835,7 +1835,7 @@ if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_QUERY)) { FbLocalStatus status_vector; - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); const ISC_STATUS exc = status_vector[1]; const bool no_priv = (exc == isc_login || exc == isc_no_priv); @@ -2055,7 +2055,7 @@ if (svc_trace_manager->needs(ITraceFactory::TRACE_EVENT_SERVICE_START)) { FbLocalStatus status_vector; - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); const ISC_STATUS exc = status_vector[1]; const bool no_priv = (exc == isc_login || exc == isc_no_priv); @@ -2122,7 +2122,7 @@ catch (const Firebird::Exception& e) { setDataMode(false); - e.stuff_exception(&svc_status); + e.stuffException(&svc_status); } if (file) Modified: firebird/trunk/src/jrd/tra.cpp =================================================================== --- firebird/trunk/src/jrd/tra.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/tra.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1801,7 +1801,7 @@ { iscLogException("Error during sweep:", ex); - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); if (transaction) { @@ -1811,7 +1811,7 @@ } catch (const Firebird::Exception& ex2) { - ex2.stuff_exception(tdbb->tdbb_status_vector); + ex2.stuffException(tdbb->tdbb_status_vector); } } Modified: firebird/trunk/src/jrd/trace/TraceService.cpp =================================================================== --- firebird/trunk/src/jrd/trace/TraceService.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/trace/TraceService.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -342,7 +342,7 @@ } catch (const Exception& e) { - SimpleStatusVector<> status; + StaticStatusVector status; e.stuffException(status); svc->initStatus(); svc->setServiceStatus(status.begin()); Modified: firebird/trunk/src/jrd/validation.cpp =================================================================== --- firebird/trunk/src/jrd/validation.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/validation.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -757,7 +757,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(tdbb->tdbb_status_vector); + ex.stuffException(tdbb->tdbb_status_vector); Firebird::string err; err.printf("Database: %s\n\tValidation aborted", fileName.c_str()); Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/jrd/vio.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -4730,7 +4730,7 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); if (relation && relation->rel_sweep_count) @@ -4754,7 +4754,7 @@ } // try catch (const Firebird::Exception& ex) { - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } @@ -4767,7 +4767,7 @@ } catch (const Firebird::Exception& ex) { - ex.stuff_exception(&status_vector); + ex.stuffException(&status_vector); iscDbLogStatus(dbb->dbb_filename.c_str(), &status_vector); } Modified: firebird/trunk/src/lock/print.cpp =================================================================== --- firebird/trunk/src/lock/print.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/lock/print.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -661,7 +661,7 @@ { FPRINTF(outfile, "Unable to access lock table.\n"); - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); gds__print_status(st.begin()); Modified: firebird/trunk/src/remote/client/interface.cpp =================================================================== --- firebird/trunk/src/remote/client/interface.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/remote/client/interface.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -158,7 +158,7 @@ } private: - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); Rbl* blob; }; @@ -224,7 +224,7 @@ transaction(from->transaction) { } - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); Attachment* remAtt; Rtr* transaction; @@ -272,7 +272,7 @@ private: void releaseStatement(); - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); Statement* stmt; RefPtr<IMessageMetadata> outputFormat; @@ -347,7 +347,7 @@ } private: - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); StatementMetadata metadata; Attachment* remAtt; @@ -397,7 +397,7 @@ } private: - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); Attachment* remAtt; Rrq* rq; @@ -434,7 +434,7 @@ } private: - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); Rvnt* rvnt; Rdb* rdb; @@ -527,7 +527,7 @@ Statement* createStatement(CheckStatusWrapper* status, unsigned dialect); private: - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); Rdb* rdb; const PathName dbPath; @@ -565,7 +565,7 @@ Service(Rdb* handle) : rdb(handle) { } private: - void freeClientData(IStatus* status, bool force = false); + void freeClientData(CheckStatusWrapper* status, bool force = false); Rdb* rdb; }; @@ -900,7 +900,7 @@ } -void Blob::freeClientData(IStatus* status, bool force) +void Blob::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * @@ -1001,7 +1001,7 @@ } -void Events::freeClientData(IStatus* status, bool force) +void Events::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * @@ -1540,7 +1540,7 @@ } -void Attachment::freeClientData(IStatus* status, bool force) +void Attachment::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * @@ -2206,7 +2206,7 @@ } -void Statement::freeClientData(IStatus* status, bool force) +void Statement::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * @@ -3212,7 +3212,7 @@ return outputFormat; } -void ResultSet::freeClientData(IStatus* status, bool force) +void ResultSet::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * @@ -4181,7 +4181,7 @@ } -void Request::freeClientData(IStatus* status, bool force) +void Request::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * @@ -4363,7 +4363,7 @@ } -void Transaction::freeClientData(IStatus* status, bool force) +void Transaction::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * @@ -4650,7 +4650,7 @@ } -void Service::freeClientData(IStatus* status, bool force) +void Service::freeClientData(CheckStatusWrapper* status, bool force) { /************************************** * Modified: firebird/trunk/src/remote/protocol.cpp =================================================================== --- firebird/trunk/src/remote/protocol.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/remote/protocol.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1660,7 +1660,7 @@ if (!vector) vector = FB_NEW(*getDefaultMemoryPool()) DynamicStatusVector(); - SimpleStatusVector<> vectorDecode; + StaticStatusVector vectorDecode; const ISC_STATUS* vectorEncode = vector->value(); Stack<SCHAR*> space; Modified: firebird/trunk/src/remote/remote.cpp =================================================================== --- firebird/trunk/src/remote/remote.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/remote/remote.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -825,7 +825,8 @@ { if (rrqStatus.isSuccess()) { - Firebird::LocalStatus tmp; + Firebird::LocalStatus ls; + Firebird::CheckStatusWrapper tmp(&ls); ex.stuffException(&tmp); rrqStatus.save(&tmp); } @@ -847,7 +848,8 @@ if (overwrite || !rsr_status->getError()) { - Firebird::LocalStatus temp; + Firebird::LocalStatus ls; + Firebird::CheckStatusWrapper temp(&ls); ex.stuffException(&temp); rsr_status->save(&temp); } @@ -1118,7 +1120,7 @@ // Translate any gds codes into local operating specific codes - Firebird::SimpleStatusVector<> newVector; + Firebird::StaticStatusVector newVector; while (*vector != isc_arg_end) { Modified: firebird/trunk/src/remote/server/os/posix/inet_server.cpp =================================================================== --- firebird/trunk/src/remote/server/os/posix/inet_server.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/remote/server/os/posix/inet_server.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -365,7 +365,7 @@ catch (const Firebird::Exception& ex) { iscLogException("startup:INET_connect:", ex); - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); gds__print_status(st.begin()); exit(STARTUP_ERROR); @@ -441,7 +441,7 @@ } catch (const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); char s[100]; Modified: firebird/trunk/src/remote/server/server.cpp =================================================================== --- firebird/trunk/src/remote/server/server.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/remote/server/server.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -5075,7 +5075,7 @@ ISC_STATUS rem_port::send_response(PACKET* p, OBJCT obj, ULONG length, const Firebird::IStatus* status, bool defer_flag) { - SimpleStatusVector<> tmp; + StaticStatusVector tmp; tmp.mergeStatus(status); return send_response(p, obj, length, tmp.begin(), defer_flag); } @@ -5102,7 +5102,7 @@ // Start by translating the status vector into "generic" form - Firebird::SimpleStatusVector<> new_vector; + Firebird::StaticStatusVector new_vector; const ISC_STATUS* old_vector = status_vector; const ISC_STATUS exit_code = old_vector[1]; Modified: firebird/trunk/src/utilities/fbsvcmgr/fbsvcmgr.cpp =================================================================== --- firebird/trunk/src/utilities/fbsvcmgr/fbsvcmgr.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/fbsvcmgr/fbsvcmgr.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1135,7 +1135,7 @@ } catch (const Exception& e) { - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; e.stuffException(st); isc_print_status(st.begin()); } Modified: firebird/trunk/src/utilities/fbtracemgr/traceMgrMain.cpp =================================================================== --- firebird/trunk/src/utilities/fbtracemgr/traceMgrMain.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/fbtracemgr/traceMgrMain.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -332,7 +332,7 @@ } catch (const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> temp; + Firebird::StaticStatusVector temp; ex.stuffException(temp); isc_print_status(temp.begin()); Modified: firebird/trunk/src/utilities/gsec/gsec.cpp =================================================================== --- firebird/trunk/src/utilities/gsec/gsec.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/gsec/gsec.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -89,7 +89,7 @@ } catch (const Firebird::Exception& e) { - Firebird::SimpleStatusVector<> status; + Firebird::StaticStatusVector status; e.stuffException(status); uSvc->initStatus(); uSvc->setServiceStatus(status.begin()); @@ -489,7 +489,7 @@ if (statusManager.getState() & Firebird::IStatus::STATE_ERRORS) { - Firebird::SimpleStatusVector<> tmp; + Firebird::StaticStatusVector tmp; tmp.mergeStatus(&statusManager); GSEC_error_redirect(tmp.begin(), GsecMsg15); } @@ -694,7 +694,7 @@ catch (const Firebird::Exception& e) { // Real exceptions are coming here - Firebird::SimpleStatusVector<> status; + Firebird::StaticStatusVector status; e.stuffException(status); tdsec->tsec_throw = false; Modified: firebird/trunk/src/utilities/gsec/main/gsecMain.cpp =================================================================== --- firebird/trunk/src/utilities/gsec/main/gsecMain.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/gsec/main/gsecMain.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -51,7 +51,7 @@ } catch (const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); isc_print_status(st.begin()); } Modified: firebird/trunk/src/utilities/gstat/dba.epp =================================================================== --- firebird/trunk/src/utilities/gstat/dba.epp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/gstat/dba.epp 2015-03-27 17:51:19 UTC (rev 61117) @@ -280,7 +280,7 @@ void inline dba_exit(int code, tdba* tddba) { tddba->exit_code = code; - // Throw this kind of exception, because gstat uses status vector (and stuff_exception) to + // Throw this kind of exception, because gstat uses status vector (and stuffException) to // handle errors Firebird::LongJump::raise(); } @@ -331,7 +331,7 @@ } catch (const Firebird::Exception& e) { - Firebird::SimpleStatusVector<> status; + Firebird::StaticStatusVector status; e.stuffException(status); uSvc->initStatus(); uSvc->setServiceStatus(status.begin()); Modified: firebird/trunk/src/utilities/gstat/main/gstatMain.cpp =================================================================== --- firebird/trunk/src/utilities/gstat/main/gstatMain.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/gstat/main/gstatMain.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -51,7 +51,7 @@ } catch (const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); isc_print_status(st.begin()); } Modified: firebird/trunk/src/utilities/nbackup/nbackup.cpp =================================================================== --- firebird/trunk/src/utilities/nbackup/nbackup.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/nbackup/nbackup.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1538,7 +1538,7 @@ const ISC_STATUS* s = e.value(); isc_print_status(s); } - SimpleStatusVector<> status; + StaticStatusVector status; e.stuffException(status); uSvc->initStatus(); uSvc->setServiceStatus(status.begin()); @@ -1549,7 +1549,7 @@ if (!uSvc->isService()) fprintf(stderr, "%s\n", e.what()); - SimpleStatusVector<> status; + StaticStatusVector status; e.stuffException(status); uSvc->initStatus(); uSvc->setServiceStatus(status.begin()); @@ -1808,7 +1808,7 @@ { if (!uSvc->isService() && !nbk.printed()) { - SimpleStatusVector<> status; + StaticStatusVector status; e.stuffException(status); isc_print_status(status.begin()); } Modified: firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp =================================================================== --- firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -62,7 +62,7 @@ const char* TracePluginImpl::marshal_exception(const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> st; + Firebird::StaticStatusVector st; ex.stuffException(st); const ISC_STATUS* status = st.begin(); Modified: firebird/trunk/src/yvalve/user_dsql.cpp =================================================================== --- firebird/trunk/src/yvalve/user_dsql.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/yvalve/user_dsql.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1042,7 +1042,7 @@ // static ISC_STATUS error(const Firebird::Exception& ex) { - Firebird::SimpleStatusVector<> v; + Firebird::StaticStatusVector v; ex.stuffException(v); makePermanentVector(v.begin()); Modified: firebird/trunk/src/yvalve/utl.cpp =================================================================== --- firebird/trunk/src/yvalve/utl.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/yvalve/utl.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -88,8 +88,8 @@ using namespace Firebird; -IAttachment* handleToIAttachment(IStatus*, FB_API_HANDLE*); -ITransaction* handleToITransaction(IStatus*, FB_API_HANDLE*); +IAttachment* handleToIAttachment(CheckStatusWrapper*, FB_API_HANDLE*); +ITransaction* handleToITransaction(CheckStatusWrapper*, FB_API_HANDLE*); // Bug 7119 - BLOB_load will open external file for read in BINARY mode. @@ -1742,12 +1742,12 @@ } catch (const Exception& ex) { - ex.stuffException(&st); + ex.stuffException(&statusWrapper); } - if (st.getState() & Firebird::IStatus::STATE_ERRORS) + if (statusWrapper.getState() & Firebird::IStatus::STATE_ERRORS) { - isc_print_status(st.getErrors()); + isc_print_status(statusWrapper.getErrors()); return FB_FAILURE; } @@ -1921,11 +1921,11 @@ } catch (const Exception& ex) { - ex.stuffException(&st); + ex.stuffException(&statusWrapper); } - if (st.getState() & Firebird::IStatus::STATE_ERRORS) - isc_print_status(st.getErrors()); + if (statusWrapper.getState() & Firebird::IStatus::STATE_ERRORS) + isc_print_status(statusWrapper.getErrors()); return rc; } Modified: firebird/trunk/src/yvalve/why.cpp =================================================================== --- firebird/trunk/src/yvalve/why.cpp 2015-03-27 17:42:38 UTC (rev 61116) +++ firebird/trunk/src/yvalve/why.cpp 2015-03-27 17:51:19 UTC (rev 61117) @@ -1546,7 +1546,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1569,7 +1569,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1579,7 +1579,7 @@ //------------------------------------- -Firebird::IAttachment* handleToIAttachment(Firebird::IStatus* status, FB_API_HANDLE* handle) +Firebird::IAttachment* handleToIAttachment(Firebird::CheckStatusWrapper* status, FB_API_HANDLE* handle) { try { @@ -1596,7 +1596,7 @@ } -Firebird::ITransaction* handleToITransaction(Firebird::IStatus* status, FB_API_HANDLE* handle) +Firebird::ITransaction* handleToITransaction(Firebird::CheckStatusWrapper* status, FB_API_HANDLE* handle) { try { @@ -1647,7 +1647,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1670,7 +1670,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1702,7 +1702,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1731,7 +1731,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1752,7 +1752,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1776,7 +1776,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1799,7 +1799,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1821,7 +1821,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1859,7 +1859,7 @@ request->free(&tempCheckStatusWrapper); } - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1886,8 +1886,9 @@ isc_release_request(temp, reqHandle); StatusVector status(userStatus); + CheckStatusWrapper statusWrapper(&status); - e.stuffException(&status); + e.stuffException(&statusWrapper); return status[1]; } } @@ -1951,7 +1952,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -1979,7 +1980,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2001,7 +2002,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2024,7 +2025,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2047,7 +2048,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2081,7 +2082,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2116,8 +2117,9 @@ isc_dsql_free_statement(temp, stmtHandle, DSQL_drop); StatusVector status(userStatus); + CheckStatusWrapper statusWrapper(&status); - e.stuffException(&status); + e.stuffException(&statusWrapper); return status[1]; } } @@ -2128,6 +2130,7 @@ FB_API_HANDLE* stmtHandle) { StatusVector status(userStatus); + CheckStatusWrapper statusWrapper(&status); IscStatement* statement = NULL; try @@ -2147,7 +2150,7 @@ *stmtHandle = 0; statement->release(); } - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2175,7 +2178,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2203,7 +2206,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2266,7 +2269,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2325,7 +2328,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2397,7 +2400,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2475,7 +2478,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2504,7 +2507,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2538,7 +2541,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2578,7 +2581,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2646,7 +2649,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2696,7 +2699,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2726,7 +2729,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2751,7 +2754,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2831,7 +2834,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } if (events) @@ -2929,7 +2932,7 @@ events->release(); } - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2965,7 +2968,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -2993,7 +2996,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3016,7 +3019,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3062,7 +3065,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3083,7 +3086,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3108,7 +3111,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3129,7 +3132,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3158,7 +3161,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3181,7 +3184,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3204,7 +3207,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3243,7 +3246,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3266,7 +3269,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3290,7 +3293,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3312,7 +3315,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3358,7 +3361,7 @@ service->detach(&tempCheckStatusWrapper); } - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3381,7 +3384,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3409,7 +3412,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3433,7 +3436,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3457,7 +3460,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3480,7 +3483,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3547,7 +3550,7 @@ if (multiTrans) multiTrans->release(); - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3581,8 +3584,9 @@ catch (const Exception& e) { StatusVector status(userStatus); + CheckStatusWrapper statusWrapper(&status); - e.stuffException(&status); + e.stuffException(&statusWrapper); return status[1]; } } @@ -3608,7 +3612,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3636,7 +3640,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3659,7 +3663,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3680,7 +3684,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3705,6 +3709,7 @@ const int mask, void* arg) { StatusVector status(userStatus); + CheckStatusWrapper statusWrapper(&status); try { @@ -3712,7 +3717,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3732,7 +3737,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3744,6 +3749,7 @@ void* obj) { StatusVector status(userStatus); + CheckStatusWrapper statusWrapper(&status); try { @@ -3756,7 +3762,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; @@ -3768,6 +3774,7 @@ void* obj) { StatusVector status(userStatus); + CheckStatusWrapper statusWrapper(&status); try { @@ -3780,7 +3787,7 @@ } catch (const Exception& e) { - e.stuffException(&status); + e.stuffException(&statusWrapper); } return status[1]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2015-03-28 00:36:13
|
Revision: 61121 http://sourceforge.net/p/firebird/code/61121 Author: asfernandes Date: 2015-03-28 00:36:04 +0000 (Sat, 28 Mar 2015) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/auth/SecureRemotePassword/Message.h firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp firebird/trunk/src/common/DynamicStrings.cpp firebird/trunk/src/common/SimpleStatusVector.h firebird/trunk/src/common/StatusHolder.h firebird/trunk/src/common/fb_exception.cpp firebird/trunk/src/common/utils.cpp firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/include/fb_exception.h firebird/trunk/src/jrd/CryptoManager.cpp firebird/trunk/src/jrd/err.cpp firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/extds/ExtDS.cpp firebird/trunk/src/jrd/extds/IscDS.cpp firebird/trunk/src/jrd/extds/IscDS.h firebird/trunk/src/jrd/idx.cpp firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/nbak.cpp firebird/trunk/src/jrd/status.h firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp firebird/trunk/src/jrd/val.h firebird/trunk/src/jrd/vio.cpp firebird/trunk/src/remote/client/interface.cpp firebird/trunk/src/remote/inet.cpp firebird/trunk/src/remote/os/win32/wnet.cpp firebird/trunk/src/remote/os/win32/xnet.cpp firebird/trunk/src/remote/server/server.cpp firebird/trunk/src/utilities/nbackup/nbackup.cpp firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp firebird/trunk/src/yvalve/PluginManager.cpp firebird/trunk/src/yvalve/utl.cpp firebird/trunk/src/yvalve/utl_proto.h Modified: firebird/trunk/src/auth/SecureRemotePassword/Message.h =================================================================== --- firebird/trunk/src/auth/SecureRemotePassword/Message.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/auth/SecureRemotePassword/Message.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -90,7 +90,7 @@ builder->addRef(); } } - catch(...) + catch (...) { s->dispose(); throw; Modified: firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp =================================================================== --- firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/auth/SecureRemotePassword/server/SrpServer.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -197,7 +197,7 @@ check(status); att = NULL; } - catch(const Exception&) + catch (const Exception&) { LocalStatus ls; CheckStatusWrapper s(&ls); Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2015-03-28 00:36:04 UTC (rev 61121) @@ -621,7 +621,7 @@ found = true; } - catch(const Firebird::Exception& ex) + catch (const Firebird::Exception& ex) { ex.stuffException(s); s = &statusWrapper2; @@ -703,7 +703,7 @@ found = true; } - catch(const Firebird::Exception& ex) + catch (const Firebird::Exception& ex) { ex.stuffException(s); s = &statusWrapper2; Modified: firebird/trunk/src/common/DynamicStrings.cpp =================================================================== --- firebird/trunk/src/common/DynamicStrings.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/common/DynamicStrings.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -89,7 +89,7 @@ *to++ = (ISC_STATUS)(IPTR) string; memcpy(string, reinterpret_cast<const char*>(from[1]), from[0]); string += *from++; - *string++ = 0; + *string++ = '\0'; break; case isc_arg_string: @@ -109,6 +109,7 @@ } *to++ = isc_arg_end; + return (to - dst) - 1; } @@ -136,6 +137,7 @@ break; } } + return NULL; } Modified: firebird/trunk/src/common/SimpleStatusVector.h =================================================================== --- firebird/trunk/src/common/SimpleStatusVector.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/common/SimpleStatusVector.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -57,7 +57,7 @@ int state = from->getState(); this->clear(); - if (state & Firebird::IStatus::STATE_ERRORS) + if (state & IStatus::STATE_ERRORS) { const ISC_STATUS* s = from->getErrors(); unsigned copied = fb_utils::statusLength(s); @@ -70,7 +70,7 @@ this->push(0); } - if (state & Firebird::IStatus::STATE_WARNINGS) + if (state & IStatus::STATE_WARNINGS) { const ISC_STATUS* s = from->getWarnings(); unsigned copied = fb_utils::statusLength(s); Modified: firebird/trunk/src/common/StatusHolder.h =================================================================== --- firebird/trunk/src/common/StatusHolder.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/common/StatusHolder.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -89,7 +89,7 @@ else this->resize(newLen + 1); } - catch(const BadAlloc&) + catch (const BadAlloc&) { if (!warningMode) { @@ -103,7 +103,7 @@ this->clear(); } } - catch(const Exception&) + catch (const Exception&) { fb_assert(false); Modified: firebird/trunk/src/common/fb_exception.cpp =================================================================== --- firebird/trunk/src/common/fb_exception.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/common/fb_exception.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -26,7 +26,7 @@ { status_vector.save(status.begin()); } - catch(const BadAlloc&) + catch (const BadAlloc&) { ISC_STATUS tmp[3]; processUnexpectedException(tmp); @@ -48,11 +48,11 @@ { throw; } - catch(const BadAlloc&) + catch (const BadAlloc&) { fb_utils::statusBadAlloc(vector); } - catch(const Exception&) + catch (const Exception&) { fb_assert(false); @@ -93,7 +93,7 @@ len = makeDynamicStrings(len, m_status_vector, new_vector); m_status_vector[len] = isc_arg_end; } - catch(const Exception&) + catch (const Exception&) { if (m_status_vector != m_buffer) { @@ -141,7 +141,7 @@ { status.assign(m_status_vector, fb_utils::statusLength(m_status_vector) + 1); } - catch(const BadAlloc&) + catch (const BadAlloc&) { processUnexpectedException(status.makeEmergencyStatus()); } @@ -180,7 +180,7 @@ { status.assign(sv, FB_NELEM(sv)); } - catch(const BadAlloc&) + catch (const BadAlloc&) { processUnexpectedException(status.makeEmergencyStatus()); } Modified: firebird/trunk/src/common/utils.cpp =================================================================== --- firebird/trunk/src/common/utils.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/common/utils.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -1172,10 +1172,10 @@ { to->init(); - int flags = from->getState(); - if (flags & Firebird::CheckStatusWrapper::STATE_ERRORS) + unsigned flags = from->getState(); + if (flags & Firebird::IStatus::STATE_ERRORS) to->setErrors(from->getErrors()); - if (flags & Firebird::CheckStatusWrapper::STATE_WARNINGS) + if (flags & Firebird::IStatus::STATE_WARNINGS) to->setWarnings(from->getWarnings()); } @@ -1287,6 +1287,7 @@ unsigned l1, l2; const char *s1, *s2; + switch (*op1) { case isc_arg_cstring: @@ -1297,13 +1298,13 @@ { l1 = op1[1]; l2 = op2[1]; - s1 = (const char*)(op1[2]); - s2 = (const char*)(op2[2]); + s1 = (const char*) (op1[2]); + s2 = (const char*) (op2[2]); } else { - s1 = (const char*)(op1[1]); - s2 = (const char*)(op2[1]); + s1 = (const char*) (op1[1]); + s2 = (const char*) (op2[1]); l1 = strlen(s1); l2 = strlen(s2); } @@ -1321,6 +1322,7 @@ } } + return pos; miss: pos += (in[pos] == isc_arg_cstring ? 3 : 2); Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/dsql/dsql.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -603,7 +603,7 @@ FbLocalStatus localStatus; // check for warnings - if (tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_WARNINGS) + if (tdbb->tdbb_status_vector->getState() & IStatus::STATE_WARNINGS) { // save a status vector fb_utils::copyStatus(&localStatus, tdbb->tdbb_status_vector); @@ -628,7 +628,7 @@ } // restore warnings (if there are any) - if (localStatus->getState() & FbStatusVector::STATE_WARNINGS) + if (localStatus->getState() & IStatus::STATE_WARNINGS) { Arg::StatusVector cur(tdbb->tdbb_status_vector->getWarnings()); Arg::StatusVector saved(localStatus->getWarnings()); Modified: firebird/trunk/src/include/fb_exception.h =================================================================== --- firebird/trunk/src/include/fb_exception.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/include/fb_exception.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -49,8 +49,7 @@ { class MemoryPool; class DynamicStatusVector; -template <unsigned S = ISC_STATUS_LENGTH> -class SimpleStatusVector; +template <unsigned S = ISC_STATUS_LENGTH> class SimpleStatusVector; typedef SimpleStatusVector<> StaticStatusVector; class Exception @@ -68,8 +67,10 @@ void stuffException(DynamicStatusVector& status_vector) const throw(); void stuffException(CheckStatusWrapper* status_vector) const throw(); virtual ~Exception() throw(); + private: virtual void stuffByException(StaticStatusVector& status_vector) const throw() = 0; + public: virtual const char* what() const throw() = 0; }; Modified: firebird/trunk/src/jrd/CryptoManager.cpp =================================================================== --- firebird/trunk/src/jrd/CryptoManager.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/CryptoManager.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -166,7 +166,7 @@ { if (!LCK_lock(tdbb, stateLock, LCK_SR, LCK_WAIT)) { - fb_assert(tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_ERRORS); + fb_assert(tdbb->tdbb_status_vector->getState() & IStatus::STATE_ERRORS); ERR_punt(); } @@ -227,7 +227,7 @@ LCK_convert(tdbb, stateLock, LCK_PW, LCK_WAIT); if (!ret) { - fb_assert(tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_ERRORS); + fb_assert(tdbb->tdbb_status_vector->getState() & IStatus::STATE_ERRORS); ERR_punt(); } fb_utils::init_status(tdbb->tdbb_status_vector); Modified: firebird/trunk/src/jrd/err.cpp =================================================================== --- firebird/trunk/src/jrd/err.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/err.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -218,7 +218,7 @@ if (!statusVector) statusVector = JRD_get_thread_data()->tdbb_status_vector; - if (!(statusVector->getState() & FbStatusVector::STATE_ERRORS)) + if (!(statusVector->getState() & IStatus::STATE_ERRORS)) { // this is a blank status vector just stuff the status statusVector->setErrors2(lenToAdd, toAdd); Modified: firebird/trunk/src/jrd/exe.cpp =================================================================== --- firebird/trunk/src/jrd/exe.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/exe.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -173,7 +173,7 @@ bool StatusXcp::success() const { - return !(status->getState() & FbStatusVector::STATE_ERRORS); + return !(status->getState() & IStatus::STATE_ERRORS); } SLONG StatusXcp::as_gdscode() const Modified: firebird/trunk/src/jrd/extds/ExtDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/ExtDS.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/extds/ExtDS.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -584,7 +584,7 @@ FbLocalStatus status; doStart(&status, tdbb, tpb); - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_connection.raise(&status, tdbb, "transaction start"); } @@ -610,7 +610,7 @@ FbLocalStatus status; doPrepare(&status, tdbb, info_len, info); - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_connection.raise(&status, tdbb, "transaction prepare"); } } @@ -620,7 +620,7 @@ FbLocalStatus status; doCommit(&status, tdbb, retain); - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_connection.raise(&status, tdbb, "transaction commit"); } @@ -643,7 +643,7 @@ m_connection.deleteTransaction(this); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { conn.raise(&status, tdbb, "transaction rollback"); } } Modified: firebird/trunk/src/jrd/extds/IscDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/IscDS.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/extds/IscDS.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -123,7 +123,7 @@ &m_handle, m_dpb.getBufferLength(), reinterpret_cast<const char*>(m_dpb.getBuffer())); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { raise(&status, tdbb, "attach"); } @@ -134,7 +134,7 @@ const char info[] = {isc_info_db_sql_dialect, isc_info_end}; m_iscProvider.isc_database_info(&status, &m_handle, sizeof(info), info, sizeof(buff), buff); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { raise(&status, tdbb, "isc_database_info"); } @@ -189,7 +189,7 @@ m_handle = h; } - if ((status->getState() & FbStatusVector::STATE_ERRORS) && + if ((status->getState() & IStatus::STATE_ERRORS) && !isConnectionBrokenError(&status)) { raise(&status, tdbb, "detach"); @@ -210,7 +210,7 @@ m_iscProvider.fb_cancel_operation(&status, &m_handle, fb_cancel_abort); } } - return !(status->getState() & FbStatusVector::STATE_ERRORS); + return !(status->getState() & IStatus::STATE_ERRORS); } // this ISC connection instance is available for the current execution context if it @@ -273,7 +273,7 @@ m_iscProvider.isc_commit_transaction(status, &m_handle); fb_assert(retain && m_handle || !retain && !m_handle || - (status->getState() & FbStatusVector::STATE_ERRORS) && m_handle); + (status->getState() & IStatus::STATE_ERRORS) && m_handle); } void IscTransaction::doRollback(FbStatusVector* status, thread_db* tdbb, bool retain) @@ -284,7 +284,7 @@ else m_iscProvider.isc_rollback_transaction(status, &m_handle); - if ((status->getState() & FbStatusVector::STATE_ERRORS) && + if ((status->getState() & IStatus::STATE_ERRORS) && isConnectionBrokenError(status) && !retain) { m_handle = 0; @@ -292,7 +292,7 @@ } fb_assert(retain && m_handle || !retain && !m_handle || - (status->getState() & FbStatusVector::STATE_ERRORS) && m_handle); + (status->getState() & IStatus::STATE_ERRORS) && m_handle); } @@ -477,7 +477,7 @@ EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); m_iscProvider.isc_dsql_execute2(&status, &h_tran, &m_handle, 1, m_in_xsqlda, m_out_xsqlda); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { raise(&status, tdbb, "isc_dsql_execute2"); } } @@ -490,7 +490,7 @@ EngineCallbackGuard guard(tdbb, *this, FB_FUNCTION); m_iscProvider.isc_dsql_execute(&status, &h_tran, &m_handle, 1, m_in_xsqlda); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { raise(&status, tdbb, "isc_dsql_execute"); } } @@ -505,7 +505,7 @@ return false; } } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { raise(&status, tdbb, "isc_dsql_fetch"); } return true; @@ -520,7 +520,7 @@ m_iscProvider.isc_dsql_free_statement(&status, &m_handle, drop ? DSQL_drop : DSQL_close); m_allocated = (m_handle != 0); } - if (status->getState() & FbStatusVector::STATE_ERRORS) + if (status->getState() & IStatus::STATE_ERRORS) { // we can do nothing else with this statement after this point m_allocated = m_handle = 0; @@ -583,7 +583,7 @@ m_iscProvider.isc_open_blob2(&status, &h_db, &h_tran, &m_handle, &m_blob_id, bpb_len, bpb_buff); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_iscConnection.raise(&status, tdbb, "isc_open_blob2"); } fb_assert(m_handle); @@ -608,7 +608,7 @@ bpb_len, bpb_buff); memcpy(desc.dsc_address, &m_blob_id, sizeof(m_blob_id)); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_iscConnection.raise(&status, tdbb, "isc_create_blob2"); } fb_assert(m_handle); @@ -648,7 +648,7 @@ EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION); m_iscProvider.isc_put_segment(&status, &m_handle, len, reinterpret_cast<const SCHAR*>(buff)); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_iscConnection.raise(&status, tdbb, "isc_put_segment"); } } @@ -661,7 +661,7 @@ EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION); m_iscProvider.isc_close_blob(&status, &m_handle); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_iscConnection.raise(&status, tdbb, "isc_close_blob"); } fb_assert(!m_handle); @@ -678,7 +678,7 @@ EngineCallbackGuard guard(tdbb, m_iscConnection, FB_FUNCTION); m_iscProvider.isc_cancel_blob(&status, &m_handle); } - if (status->getState() & FbStatusVector::STATE_ERRORS) { + if (status->getState() & IStatus::STATE_ERRORS) { m_iscConnection.raise(&status, tdbb, "isc_close_blob"); } fb_assert(!m_handle); Modified: firebird/trunk/src/jrd/extds/IscDS.h =================================================================== --- firebird/trunk/src/jrd/extds/IscDS.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/extds/IscDS.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -61,308 +61,308 @@ bool m_api_loaded; public: - virtual ISC_STATUS ISC_EXPORT isc_attach_database(Jrd::FbStatusVector *, + virtual ISC_STATUS ISC_EXPORT isc_attach_database(Jrd::FbStatusVector*, short, const char*, - isc_db_handle *, + isc_db_handle*, short, const char*); - virtual ISC_STATUS ISC_EXPORT isc_array_gen_sdl(Jrd::FbStatusVector *, + virtual ISC_STATUS ISC_EXPORT isc_array_gen_sdl(Jrd::FbStatusVector*, const ISC_ARRAY_DESC*, - short *, - char *, - short *); + short*, + char*, + short*); - virtual ISC_STATUS ISC_EXPORT isc_array_get_slice(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - ISC_QUAD *, + virtual ISC_STATUS ISC_EXPORT isc_array_get_slice(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, const ISC_ARRAY_DESC*, - void *, - ISC_LONG *); + void*, + ISC_LONG*); - virtual ISC_STATUS ISC_EXPORT isc_array_lookup_bounds(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_array_lookup_bounds(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, const char*, const char*, - ISC_ARRAY_DESC *); + ISC_ARRAY_DESC*); - virtual ISC_STATUS ISC_EXPORT isc_array_lookup_desc(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_array_lookup_desc(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, const char*, const char*, - ISC_ARRAY_DESC *); + ISC_ARRAY_DESC*); - virtual ISC_STATUS ISC_EXPORT isc_array_set_desc(Jrd::FbStatusVector *, + virtual ISC_STATUS ISC_EXPORT isc_array_set_desc(Jrd::FbStatusVector*, const char*, const char*, const short*, const short*, const short*, - ISC_ARRAY_DESC *); + ISC_ARRAY_DESC*); - virtual ISC_STATUS ISC_EXPORT isc_array_put_slice(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - ISC_QUAD *, + virtual ISC_STATUS ISC_EXPORT isc_array_put_slice(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, const ISC_ARRAY_DESC*, - void *, - ISC_LONG *); + void*, + ISC_LONG*); - virtual void ISC_EXPORT isc_blob_default_desc(ISC_BLOB_DESC *, + virtual void ISC_EXPORT isc_blob_default_desc(ISC_BLOB_DESC*, const unsigned char*, const unsigned char*); - virtual ISC_STATUS ISC_EXPORT isc_blob_gen_bpb(Jrd::FbStatusVector *, + virtual ISC_STATUS ISC_EXPORT isc_blob_gen_bpb(Jrd::FbStatusVector*, const ISC_BLOB_DESC*, const ISC_BLOB_DESC*, unsigned short, - unsigned char *, - unsigned short *); + unsigned char*, + unsigned short*); - virtual ISC_STATUS ISC_EXPORT isc_blob_info(Jrd::FbStatusVector *, - isc_blob_handle *, + virtual ISC_STATUS ISC_EXPORT isc_blob_info(Jrd::FbStatusVector*, + isc_blob_handle*, short, const char*, short, - char *); + char*); - virtual ISC_STATUS ISC_EXPORT isc_blob_lookup_desc(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_blob_lookup_desc(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, const unsigned char*, const unsigned char*, - ISC_BLOB_DESC *, - unsigned char *); + ISC_BLOB_DESC*, + unsigned char*); - virtual ISC_STATUS ISC_EXPORT isc_blob_set_desc(Jrd::FbStatusVector *, + virtual ISC_STATUS ISC_EXPORT isc_blob_set_desc(Jrd::FbStatusVector*, const unsigned char*, const unsigned char*, short, short, short, - ISC_BLOB_DESC *); + ISC_BLOB_DESC*); - virtual ISC_STATUS ISC_EXPORT isc_cancel_blob(Jrd::FbStatusVector *, - isc_blob_handle *); + virtual ISC_STATUS ISC_EXPORT isc_cancel_blob(Jrd::FbStatusVector*, + isc_blob_handle*); - virtual ISC_STATUS ISC_EXPORT isc_cancel_events(Jrd::FbStatusVector *, - isc_db_handle *, - ISC_LONG *); + virtual ISC_STATUS ISC_EXPORT isc_cancel_events(Jrd::FbStatusVector*, + isc_db_handle*, + ISC_LONG*); - virtual ISC_STATUS ISC_EXPORT isc_close_blob(Jrd::FbStatusVector *, - isc_blob_handle *); + virtual ISC_STATUS ISC_EXPORT isc_close_blob(Jrd::FbStatusVector*, + isc_blob_handle*); - virtual ISC_STATUS ISC_EXPORT isc_commit_retaining(Jrd::FbStatusVector *, - isc_tr_handle *); + virtual ISC_STATUS ISC_EXPORT isc_commit_retaining(Jrd::FbStatusVector*, + isc_tr_handle*); - virtual ISC_STATUS ISC_EXPORT isc_commit_transaction(Jrd::FbStatusVector *, - isc_tr_handle *); + virtual ISC_STATUS ISC_EXPORT isc_commit_transaction(Jrd::FbStatusVector*, + isc_tr_handle*); - virtual ISC_STATUS ISC_EXPORT isc_create_blob(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - isc_blob_handle *, - ISC_QUAD *); + virtual ISC_STATUS ISC_EXPORT isc_create_blob(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*); - virtual ISC_STATUS ISC_EXPORT isc_create_blob2(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - isc_blob_handle *, - ISC_QUAD *, + virtual ISC_STATUS ISC_EXPORT isc_create_blob2(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*, short, const char*); - virtual ISC_STATUS ISC_EXPORT isc_create_database(Jrd::FbStatusVector *, + virtual ISC_STATUS ISC_EXPORT isc_create_database(Jrd::FbStatusVector*, short, const char*, - isc_db_handle *, + isc_db_handle*, short, const char*, short); - virtual ISC_STATUS ISC_EXPORT isc_database_info(Jrd::FbStatusVector *, - isc_db_handle *, + virtual ISC_STATUS ISC_EXPORT isc_database_info(Jrd::FbStatusVector*, + isc_db_handle*, short, const char*, short, - char *); + char*); virtual void ISC_EXPORT isc_decode_date(const ISC_QUAD*, - void *); + void*); virtual void ISC_EXPORT isc_decode_sql_date(const ISC_DATE*, - void *); + void*); virtual void ISC_EXPORT isc_decode_sql_time(const ISC_TIME*, - void *); + void*); virtual void ISC_EXPORT isc_decode_timestamp(const ISC_TIMESTAMP*, - void *); + void*); - virtual ISC_STATUS ISC_EXPORT isc_detach_database(Jrd::FbStatusVector *, - isc_db_handle *); + virtual ISC_STATUS ISC_EXPORT isc_detach_database(Jrd::FbStatusVector*, + isc_db_handle*); - virtual ISC_STATUS ISC_EXPORT isc_drop_database(Jrd::FbStatusVector *, - isc_db_handle *); + virtual ISC_STATUS ISC_EXPORT isc_drop_database(Jrd::FbStatusVector*, + isc_db_handle*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_allocate_statement(Jrd::FbStatusVector *, - isc_db_handle *, - isc_stmt_handle *); + virtual ISC_STATUS ISC_EXPORT isc_dsql_allocate_statement(Jrd::FbStatusVector*, + isc_db_handle*, + isc_stmt_handle*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_alloc_statement2(Jrd::FbStatusVector *, - isc_db_handle *, - isc_stmt_handle *); + virtual ISC_STATUS ISC_EXPORT isc_dsql_alloc_statement2(Jrd::FbStatusVector*, + isc_db_handle*, + isc_stmt_handle*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_describe(Jrd::FbStatusVector *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_describe(Jrd::FbStatusVector*, + isc_stmt_handle*, unsigned short, - XSQLDA *); + XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_describe_bind(Jrd::FbStatusVector *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_describe_bind(Jrd::FbStatusVector*, + isc_stmt_handle*, unsigned short, - XSQLDA *); + XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_exec_immed2(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_exec_immed2(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, unsigned short, const char*, unsigned short, - const XSQLDA *, - const XSQLDA *); + const XSQLDA*, + const XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_execute(Jrd::FbStatusVector *, - isc_tr_handle *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_execute(Jrd::FbStatusVector*, + isc_tr_handle*, + isc_stmt_handle*, unsigned short, - const XSQLDA *); + const XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_execute2(Jrd::FbStatusVector *, - isc_tr_handle *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_execute2(Jrd::FbStatusVector*, + isc_tr_handle*, + isc_stmt_handle*, unsigned short, - const XSQLDA *, - const XSQLDA *); + const XSQLDA*, + const XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_execute_immediate(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, unsigned short, const char*, unsigned short, - const XSQLDA *); + const XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_fetch(Jrd::FbStatusVector *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_fetch(Jrd::FbStatusVector*, + isc_stmt_handle*, unsigned short, - const XSQLDA *); + const XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle *); + virtual ISC_STATUS ISC_EXPORT isc_dsql_finish(isc_db_handle*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_free_statement(Jrd::FbStatusVector *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_free_statement(Jrd::FbStatusVector*, + isc_stmt_handle*, unsigned short); - virtual ISC_STATUS ISC_EXPORT isc_dsql_insert(Jrd::FbStatusVector *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_insert(Jrd::FbStatusVector*, + isc_stmt_handle*, unsigned short, - XSQLDA *); + XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_prepare(Jrd::FbStatusVector *, - isc_tr_handle *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_prepare(Jrd::FbStatusVector*, + isc_tr_handle*, + isc_stmt_handle*, unsigned short, const char*, unsigned short, - XSQLDA *); + XSQLDA*); - virtual ISC_STATUS ISC_EXPORT isc_dsql_set_cursor_name(Jrd::FbStatusVector *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_set_cursor_name(Jrd::FbStatusVector*, + isc_stmt_handle*, const char*, unsigned short); - virtual ISC_STATUS ISC_EXPORT isc_dsql_sql_info(Jrd::FbStatusVector *, - isc_stmt_handle *, + virtual ISC_STATUS ISC_EXPORT isc_dsql_sql_info(Jrd::FbStatusVector*, + isc_stmt_handle*, short, const char*, short, - char *); + char*); virtual void ISC_EXPORT isc_encode_date(const void*, - ISC_QUAD *); + ISC_QUAD*); virtual void ISC_EXPORT isc_encode_sql_date(const void*, - ISC_DATE *); + ISC_DATE*); virtual void ISC_EXPORT isc_encode_sql_time(const void*, - ISC_TIME *); + ISC_TIME*); virtual void ISC_EXPORT isc_encode_timestamp(const void*, - ISC_TIMESTAMP *); + ISC_TIMESTAMP*); - virtual ISC_LONG ISC_EXPORT_VARARG isc_event_block(char * *, - char * *, + virtual ISC_LONG ISC_EXPORT_VARARG isc_event_block(char**, + char**, unsigned short, ...); - virtual void ISC_EXPORT isc_event_counts(ISC_ULONG *, + virtual void ISC_EXPORT isc_event_counts(ISC_ULONG*, short, - char *, + char*, const char*); // 17 May 2001 - isc_expand_dpb is DEPRECATED - virtual void ISC_EXPORT_VARARG isc_expand_dpb(char * *, - short *, ...); + virtual void ISC_EXPORT_VARARG isc_expand_dpb(char**, + short*, ...); - virtual int ISC_EXPORT isc_modify_dpb(char * *, - short *, + virtual int ISC_EXPORT isc_modify_dpb(char**, + short*, unsigned short, const char*, short); - virtual ISC_LONG ISC_EXPORT isc_free(char *); + virtual ISC_LONG ISC_EXPORT isc_free(char*); - virtual ISC_STATUS ISC_EXPORT isc_get_segment(Jrd::FbStatusVector *, - isc_blob_handle *, - unsigned short *, + virtual ISC_STATUS ISC_EXPORT isc_get_segment(Jrd::FbStatusVector*, + isc_blob_handle*, + unsigned short*, unsigned short, - char *); + char*); - virtual ISC_STATUS ISC_EXPORT isc_get_slice(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - ISC_QUAD *, + virtual ISC_STATUS ISC_EXPORT isc_get_slice(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, short, const char*, short, const ISC_LONG*, ISC_LONG, - void *, - ISC_LONG *); + void*, + ISC_LONG*); - virtual ISC_STATUS ISC_EXPORT isc_interprete(char *, - const Jrd::FbStatusVector * *); + virtual ISC_STATUS ISC_EXPORT isc_interprete(char*, + const Jrd::FbStatusVector**); - virtual ISC_STATUS ISC_EXPORT isc_open_blob(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - isc_blob_handle *, - ISC_QUAD *); + virtual ISC_STATUS ISC_EXPORT isc_open_blob(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*); - virtual ISC_STATUS ISC_EXPORT isc_open_blob2(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - isc_blob_handle *, - ISC_QUAD *, + virtual ISC_STATUS ISC_EXPORT isc_open_blob2(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + isc_blob_handle*, + ISC_QUAD*, ISC_USHORT, const ISC_UCHAR*); - virtual ISC_STATUS ISC_EXPORT isc_prepare_transaction2(Jrd::FbStatusVector *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_prepare_transaction2(Jrd::FbStatusVector*, + isc_tr_handle*, ISC_USHORT, const ISC_UCHAR*); @@ -371,73 +371,73 @@ virtual ISC_STATUS ISC_EXPORT isc_print_status(const Jrd::FbStatusVector*); - virtual ISC_STATUS ISC_EXPORT isc_put_segment(Jrd::FbStatusVector *, - isc_blob_handle *, + virtual ISC_STATUS ISC_EXPORT isc_put_segment(Jrd::FbStatusVector*, + isc_blob_handle*, unsigned short, const char*); - virtual ISC_STATUS ISC_EXPORT isc_put_slice(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, - ISC_QUAD *, + virtual ISC_STATUS ISC_EXPORT isc_put_slice(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, + ISC_QUAD*, short, const char*, short, const ISC_LONG*, ISC_LONG, - void *); + void*); - virtual ISC_STATUS ISC_EXPORT isc_que_events(Jrd::FbStatusVector *, - isc_db_handle *, - ISC_LONG *, + virtual ISC_STATUS ISC_EXPORT isc_que_events(Jrd::FbStatusVector*, + isc_db_handle*, + ISC_LONG*, ISC_USHORT, const ISC_UCHAR*, isc_callback, - void *); + void*); - virtual ISC_STATUS ISC_EXPORT isc_rollback_retaining(Jrd::FbStatusVector *, - isc_tr_handle *); + virtual ISC_STATUS ISC_EXPORT isc_rollback_retaining(Jrd::FbStatusVector*, + isc_tr_handle*); - virtual ISC_STATUS ISC_EXPORT isc_rollback_transaction(Jrd::FbStatusVector *, - isc_tr_handle *); + virtual ISC_STATUS ISC_EXPORT isc_rollback_transaction(Jrd::FbStatusVector*, + isc_tr_handle*); - virtual ISC_STATUS ISC_EXPORT isc_start_multiple(Jrd::FbStatusVector *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_start_multiple(Jrd::FbStatusVector*, + isc_tr_handle*, short, - void *); + void*); - virtual ISC_STATUS ISC_EXPORT_VARARG isc_start_transaction(Jrd::FbStatusVector *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT_VARARG isc_start_transaction(Jrd::FbStatusVector*, + isc_tr_handle*, short, ...); - virtual ISC_STATUS ISC_EXPORT_VARARG isc_reconnect_transaction(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT_VARARG isc_reconnect_transaction(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, short, const char*); virtual ISC_LONG ISC_EXPORT isc_sqlcode(const Jrd::FbStatusVector*); virtual void ISC_EXPORT isc_sql_interprete(short, - char *, + char*, short); - virtual ISC_STATUS ISC_EXPORT isc_transaction_info(Jrd::FbStatusVector *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_transaction_info(Jrd::FbStatusVector*, + isc_tr_handle*, short, const char*, short, - char *); + char*); - virtual ISC_STATUS ISC_EXPORT isc_transact_request(Jrd::FbStatusVector *, - isc_db_handle *, - isc_tr_handle *, + virtual ISC_STATUS ISC_EXPORT isc_transact_request(Jrd::FbStatusVector*, + isc_db_handle*, + isc_tr_handle*, unsigned short, - char *, + char*, unsigned short, - char *, + char*, unsigned short, - char *); + char*); virtual ISC_LONG ISC_EXPORT isc_vax_integer(const char*, short); @@ -445,42 +445,42 @@ virtual ISC_INT64 ISC_EXPORT isc_portable_integer(const unsigned char*, short); - virtual ISC_STATUS ISC_EXPORT isc_seek_blob(Jrd::FbStatusVector *, - isc_blob_handle *, + virtual ISC_STATUS ISC_EXPORT isc_seek_blob(Jrd::FbStatusVector*, + isc_blob_handle*, short, ISC_LONG, - ISC_LONG *); + ISC_LONG*); - virtual ISC_STATUS ISC_EXPORT isc_service_attach(Jrd::FbStatusVector *, + virtual ISC_STATUS ISC_EXPORT isc_service_attach(Jrd::FbStatusVector*, unsigned short, const char*, - isc_svc_handle *, + isc_svc_handle*, unsigned short, const char*); - virtual ISC_STATUS ISC_EXPORT isc_service_detach(Jrd::FbStatusVector *, - isc_svc_handle *); + virtual ISC_STATUS ISC_EXPORT isc_service_detach(Jrd::FbStatusVector*, + isc_svc_handle*); - virtual ISC_STATUS ISC_EXPORT isc_service_query(Jrd::FbStatusVector *, - isc_svc_handle *, - isc_resv_handle *, + virtual ISC_STATUS ISC_EXPORT isc_service_query(Jrd::FbStatusVector*, + isc_svc_handle*, + isc_resv_handle*, unsigned short, const char*, unsigned short, const char*, unsigned short, - char *); + char*); - virtual ISC_STATUS ISC_EXPORT isc_service_start(Jrd::FbStatusVector *, - isc_svc_handle *, - isc_resv_handle *, + virtual ISC_STATUS ISC_EXPORT isc_service_start(Jrd::FbStatusVector*, + isc_svc_handle*, + isc_resv_handle*, unsigned short, const char*); - virtual ISC_STATUS ISC_EXPORT fb_cancel_operation(Jrd::FbStatusVector *, - isc_db_handle *, + virtual ISC_STATUS ISC_EXPORT fb_cancel_operation(Jrd::FbStatusVector*, + isc_db_handle*, USHORT); }; Modified: firebird/trunk/src/jrd/idx.cpp =================================================================== --- firebird/trunk/src/jrd/idx.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/idx.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -1043,7 +1043,7 @@ Firebird::HalfStaticArray<UCHAR, 256> tmp; RecordBitmap::Accessor accessor(insertion->iib_duplicates); - fb_assert(!(tdbb->tdbb_status_vector->getState() & FbStatusVector::STATE_ERRORS)); + fb_assert(!(tdbb->tdbb_status_vector->getState() & IStatus::STATE_ERRORS)); if (accessor.getFirst()) do { Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/jrd.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -3922,7 +3922,7 @@ svc->start(spbLength, spb); - if (svc->getStatus()->getState() & CheckStatusWrapper::STATE_ERRORS) + if (svc->getStatus()->getState() & IStatus::STATE_ERRORS) { fb_utils::copyStatus(user_status, svc->getStatus()); return; @@ -5530,7 +5530,7 @@ } } - return status->getState() & FbStatusVector::STATE_ERRORS ? true : false; + return status->getState() & IStatus::STATE_ERRORS ? true : false; } Modified: firebird/trunk/src/jrd/nbak.cpp =================================================================== --- firebird/trunk/src/jrd/nbak.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/nbak.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -911,7 +911,7 @@ SET_TDBB(tdbb); - FbStatusVector *status = tdbb->tdbb_status_vector; + FbStatusVector* status = tdbb->tdbb_status_vector; // Read original page from database file or shadows. SSHORT retryCount = 0; Modified: firebird/trunk/src/jrd/status.h =================================================================== --- firebird/trunk/src/jrd/status.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/status.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -26,8 +26,8 @@ */ -#ifndef FB_MFbStatusVector_H -#define FB_MFbStatusVector_H +#ifndef JRD_STATUS_H +#define JRD_STATUS_H #include "../common/StatusHolder.h" #include "../common/utils_proto.h" @@ -76,7 +76,7 @@ { if (localStatusVector.isDirty()) { - if (localStatus.getState() & FbStatusVector::STATE_ERRORS) + if (localStatus.getState() & Firebird::IStatus::STATE_ERRORS) raise(); } } @@ -103,4 +103,4 @@ } -#endif // FB_MFbStatusVector_H +#endif // JRD_STATUS_H Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/svc.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -2073,7 +2073,7 @@ TraceServiceImpl service(this); this->svc_trace_manager->event_service_start(&service, this->svc_switches.length(), this->svc_switches.c_str(), - (this->svc_status->getState() & FbStatusVector::STATE_ERRORS ? + (this->svc_status->getState() & IStatus::STATE_ERRORS ? ITracePlugin::RESULT_FAILED : ITracePlugin::RESULT_SUCCESS)); } } Modified: firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp =================================================================== --- firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -273,7 +273,7 @@ addSession(session); } - catch(const Exception& ex) + catch (const Exception& ex) { iscLogException("Cannot open audit configuration file", ex); } Modified: firebird/trunk/src/jrd/val.h =================================================================== --- firebird/trunk/src/jrd/val.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/val.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -133,7 +133,6 @@ blb* vlu_blob; }; - const int VLU_computed = 1; // An invariant sub-query has been computed const int VLU_null = 2; // An invariant sub-query computed to null const int VLU_checked = 4; // Constraint already checked in first read or assignment to argument/variable Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/jrd/vio.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -3427,7 +3427,7 @@ rpb.rpb_stream_flags = RPB_s_no_data | RPB_s_sweeper; rpb.getWindow(tdbb).win_flags = WIN_large_scan; - jrd_rel* relation = 0; // wasn't initialized: memory problem in catch() part. + jrd_rel* relation = 0; // wasn't initialized: memory problem in catch () part. vec<jrd_rel*>* vector = 0; GarbageCollector* gc = dbb->dbb_garbage_collector; Modified: firebird/trunk/src/remote/client/interface.cpp =================================================================== --- firebird/trunk/src/remote/client/interface.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/remote/client/interface.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -5777,7 +5777,7 @@ #endif request->saveStatus(&status); } - catch(const Exception& ex) + catch (const Exception& ex) { #ifdef DEBUG fprintf(stderr, "Got batch error %ld Max message = %d\n", @@ -7135,7 +7135,7 @@ send_packet(rdb->rdb_port, packet); receive_response(&dummy, rdb, packet); } - catch(const Exception&) { } + catch (const Exception&) { } // If the event has never been fired, fire it off with a length of 0. // Note: it is job of person being notified to check that counts Modified: firebird/trunk/src/remote/inet.cpp =================================================================== --- firebird/trunk/src/remote/inet.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/remote/inet.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -653,7 +653,7 @@ CheckStatusWrapper statusWrapper(&warning); REMOTE_check_response(&statusWrapper, rdb, packet, false); } - catch(const Exception&) + catch (const Exception&) { disconnect(port); delete rdb; @@ -2741,7 +2741,7 @@ { inet_error(false, port, "select in packet_receive", isc_net_read_err, inetErrNo); } - catch(const Exception&) { } + catch (const Exception&) { } } return false; } @@ -2796,7 +2796,7 @@ { inet_error(false, port, "read", isc_net_read_err, inetErrNo); } - catch(const Exception&) { } + catch (const Exception&) { } return false; } @@ -2820,7 +2820,7 @@ { inet_error(false, port, "simulated error - read", isc_net_read_err); } - catch(const Exception&) { } + catch (const Exception&) { } return false; } } // end scope @@ -2899,7 +2899,7 @@ { inet_error(false, port, "send", isc_net_write_err, INET_ERRNO); } - catch(const Exception&) { } + catch (const Exception&) { } return false; } @@ -2974,7 +2974,7 @@ { inet_error(false, port, "send/oob", isc_net_write_err, inetErrNo); } - catch(const Exception&) { } + catch (const Exception&) { } return false; } } @@ -2993,7 +2993,7 @@ { inet_error(false, port, "simulated error - send", isc_net_write_err, 0); } - catch(const Exception&) { } + catch (const Exception&) { } return false; } } // end scope Modified: firebird/trunk/src/remote/os/win32/wnet.cpp =================================================================== --- firebird/trunk/src/remote/os/win32/wnet.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/remote/os/win32/wnet.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -230,7 +230,7 @@ Firebird::LocalStatus warning; // Ignore connect warnings for a while REMOTE_check_response(&warning, rdb, packet); } - catch(const Firebird::Exception&) + catch (const Firebird::Exception&) { disconnect(port); delete rdb; Modified: firebird/trunk/src/remote/os/win32/xnet.cpp =================================================================== --- firebird/trunk/src/remote/os/win32/xnet.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/remote/os/win32/xnet.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -314,7 +314,7 @@ Firebird::LocalStatus warning; // Ignore connect warnings for a while REMOTE_check_response(&warning, rdb, packet); } - catch(const Firebird::Exception&) + catch (const Firebird::Exception&) { disconnect(port); delete rdb; Modified: firebird/trunk/src/remote/server/server.cpp =================================================================== --- firebird/trunk/src/remote/server/server.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/remote/server/server.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -1167,7 +1167,7 @@ break; } } - catch(const Exception& ex) + catch (const Exception& ex) { // even if it's already logged somewhere, repeat it iscLogException("SRVR_main", ex); @@ -5497,7 +5497,7 @@ send_response(sendL, 0, 0, &st, false); WIRECRYPT_DEBUG(fprintf(stderr, "Installed cipher %s key %s\n", cp.name(), key->type)); } - catch(const Exception& ex) + catch (const Exception& ex) { iscLogException("start_crypt:", ex); disconnect(); Modified: firebird/trunk/src/utilities/nbackup/nbackup.cpp =================================================================== --- firebird/trunk/src/utilities/nbackup/nbackup.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/utilities/nbackup/nbackup.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -1538,6 +1538,7 @@ const ISC_STATUS* s = e.value(); isc_print_status(s); } + StaticStatusVector status; e.stuffException(status); uSvc->initStatus(); @@ -1809,7 +1810,7 @@ if (!uSvc->isService() && !nbk.printed()) { StaticStatusVector status; - e.stuffException(status); + e.stuffException(status); isc_print_status(status.begin()); } Modified: firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp =================================================================== --- firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/utilities/ntrace/TracePluginImpl.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -63,7 +63,7 @@ const char* TracePluginImpl::marshal_exception(const Firebird::Exception& ex) { Firebird::StaticStatusVector st; - ex.stuffException(st); + ex.stuffException(st); const ISC_STATUS* status = st.begin(); char buff[1024]; Modified: firebird/trunk/src/yvalve/PluginManager.cpp =================================================================== --- firebird/trunk/src/yvalve/PluginManager.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/yvalve/PluginManager.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -1202,7 +1202,7 @@ { return dirCache().getDir(code); } - catch(const Exception&) + catch (const Exception&) { return NULL; } @@ -1216,7 +1216,7 @@ PluginLoadInfo info(pluginName); return findDefConfig(info.conf, info.plugConfigFile); } - catch(const Exception&) + catch (const Exception&) { return NULL; } @@ -1228,7 +1228,7 @@ { return getFirebirdConfig(); } - catch(const Exception&) + catch (const Exception&) { return NULL; } @@ -1246,7 +1246,7 @@ firebirdConf->addRef(); return firebirdConf; } - catch(const Exception&) + catch (const Exception&) { return NULL; } Modified: firebird/trunk/src/yvalve/utl.cpp =================================================================== --- firebird/trunk/src/yvalve/utl.cpp 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/yvalve/utl.cpp 2015-03-28 00:36:04 UTC (rev 61121) @@ -2762,6 +2762,7 @@ { case isc_arg_end: return; + case isc_arg_cstring: { perm [-1] = isc_arg_string; @@ -2770,6 +2771,7 @@ *perm++ = (ISC_STATUS)(IPTR) circularAlloc(temp, len); } break; + case isc_arg_string: case isc_arg_interpreted: case isc_arg_sql_state: @@ -2779,6 +2781,7 @@ *perm++ = (ISC_STATUS)(IPTR) circularAlloc(temp, len); } break; + default: *perm++ = *trans++; break; Modified: firebird/trunk/src/yvalve/utl_proto.h =================================================================== --- firebird/trunk/src/yvalve/utl_proto.h 2015-03-28 00:14:56 UTC (rev 61120) +++ firebird/trunk/src/yvalve/utl_proto.h 2015-03-28 00:36:04 UTC (rev 61121) @@ -90,4 +90,3 @@ } #endif // JRD_UTL_PROTO_H - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-03-31 17:22:06
|
Revision: 61187 http://sourceforge.net/p/firebird/code/61187 Author: alexpeshkoff Date: 2015-03-31 17:22:04 +0000 (Tue, 31 Mar 2015) Log Message: ----------- Fixed CORE-4729: Add a flag to mon$database helping to decide what type of security database is used - default, self or other Modified Paths: -------------- firebird/trunk/src/include/gen/ids.h firebird/trunk/src/jrd/Monitoring.cpp firebird/trunk/src/jrd/fields.h firebird/trunk/src/jrd/names.h firebird/trunk/src/jrd/relations.h Modified: firebird/trunk/src/include/gen/ids.h =================================================================== --- firebird/trunk/src/include/gen/ids.h 2015-03-31 14:45:21 UTC (rev 61186) +++ firebird/trunk/src/include/gen/ids.h 2015-03-31 17:22:04 UTC (rev 61187) @@ -487,6 +487,7 @@ const USHORT f_mon_db_backup_state = 18; const USHORT f_mon_db_crypt_page = 19; const USHORT f_mon_db_owner = 20; + const USHORT f_mon_db_secdb = 21; // Relation 34 (MON$ATTACHMENTS) Modified: firebird/trunk/src/jrd/Monitoring.cpp =================================================================== --- firebird/trunk/src/jrd/Monitoring.cpp 2015-03-31 14:45:21 UTC (rev 61186) +++ firebird/trunk/src/jrd/Monitoring.cpp 2015-03-31 17:22:04 UTC (rev 61187) @@ -38,6 +38,7 @@ #include "../common/isc_proto.h" #include "../common/isc_f_proto.h" #include "../common/isc_s_proto.h" +#include "../common/db_alias.h" #include "../jrd/lck_proto.h" #include "../jrd/met_proto.h" #include "../jrd/mov_proto.h" @@ -807,6 +808,21 @@ // database owner record.storeString(f_mon_db_owner, database->dbb_owner); + // security database type + PathName secDbName; + string secDbType = "Other"; + expandDatabaseName(database->dbb_config->getSecurityDatabase(), secDbName, NULL); + if (secDbName == database->dbb_filename) + secDbType = "Self"; + else + { + PathName defDbName; + expandDatabaseName(Config::getDefaultConfig()->getSecurityDatabase(), defDbName, NULL); + if (secDbName == defDbName) + secDbType = "Default"; + } + record.storeString(f_mon_db_secdb, secDbType); + // statistics record.storeGlobalId(f_mon_db_stat_id, getGlobalId(stat_id)); writer.putRecord(record); Modified: firebird/trunk/src/jrd/fields.h =================================================================== --- firebird/trunk/src/jrd/fields.h 2015-03-31 14:45:21 UTC (rev 61186) +++ firebird/trunk/src/jrd/fields.h 2015-03-31 17:22:04 UTC (rev 61187) @@ -181,6 +181,7 @@ FIELD(fld_auth_method , nam_auth_method , dtype_varying , 255 , dsc_text_type_ascii , NULL , true) FIELD(fld_linger , nam_linger , dtype_long , sizeof(SLONG) , 0 , NULL , true) + FIELD(fld_sec_db , nam_mon_secdb , dtype_text , 7 , dsc_text_type_ascii , NULL , false) FIELD(fld_map_name , nam_map_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , false) FIELD(fld_map_using , nam_map_using , dtype_text , 1 , dsc_text_type_metadata , NULL , false) Modified: firebird/trunk/src/jrd/names.h =================================================================== --- firebird/trunk/src/jrd/names.h 2015-03-31 14:45:21 UTC (rev 61186) +++ firebird/trunk/src/jrd/names.h 2015-03-31 17:22:04 UTC (rev 61187) @@ -321,6 +321,7 @@ NAME("MON$OLDEST_SNAPSHOT", nam_mon_ost) NAME("MON$OLDEST_TRANSACTION", nam_mon_oit) NAME("MON$OWNER", nam_mon_owner) +NAME("MON$SEC_DATABASE", nam_mon_secdb) NAME("MON$PACKAGE_NAME", nam_mon_pkg_name) NAME("MON$PAGE_BUFFERS", nam_mon_page_bufs) NAME("MON$PAGE_FETCHES", nam_mon_page_fetches) Modified: firebird/trunk/src/jrd/relations.h =================================================================== --- firebird/trunk/src/jrd/relations.h 2015-03-31 14:45:21 UTC (rev 61186) +++ firebird/trunk/src/jrd/relations.h 2015-03-31 17:22:04 UTC (rev 61187) @@ -486,6 +486,7 @@ FIELD(f_mon_db_backup_state, nam_mon_backup_state, fld_backup_state, 0, ODS_11_1) FIELD(f_mon_db_crypt_page, nam_mon_crypt_page, fld_counter, 0, ODS_12_0) FIELD(f_mon_db_owner, nam_mon_owner, fld_user, 0, ODS_12_0) + FIELD(f_mon_db_secdb, nam_mon_secdb, fld_sec_db, 0, ODS_12_0) END_RELATION // Relation 34 (MON$ATTACHMENTS) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ego...@us...> - 2015-04-07 10:29:21
|
Revision: 61256 http://sourceforge.net/p/firebird/code/61256 Author: egorpugin Date: 2015-04-07 10:29:14 +0000 (Tue, 07 Apr 2015) Log Message: ----------- [build] [cmake] Add more cloop dependencies. Modified Paths: -------------- firebird/trunk/src/gpre/CMakeLists.txt firebird/trunk/src/remote/CMakeLists.txt Modified: firebird/trunk/src/gpre/CMakeLists.txt =================================================================== --- firebird/trunk/src/gpre/CMakeLists.txt 2015-04-07 10:08:58 UTC (rev 61255) +++ firebird/trunk/src/gpre/CMakeLists.txt 2015-04-07 10:29:14 UTC (rev 61256) @@ -17,6 +17,7 @@ ) add_library (gpre_common ${gpre_common_src}) +add_dependencies_cc (gpre_common UpdateCloopInterfaces) ############################################################################### Modified: firebird/trunk/src/remote/CMakeLists.txt =================================================================== --- firebird/trunk/src/remote/CMakeLists.txt 2015-04-07 10:08:58 UTC (rev 61255) +++ firebird/trunk/src/remote/CMakeLists.txt 2015-04-07 10:29:14 UTC (rev 61256) @@ -25,7 +25,8 @@ ) file(GLOB remote_include "*.h") -add_library(remote ${remote_src} ${remote_include}) +add_library (remote ${remote_src} ${remote_include}) +add_dependencies_cc (remote UpdateCloopInterfaces) ############################################################################### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2015-04-14 17:00:52
|
Revision: 61310 http://sourceforge.net/p/firebird/code/61310 Author: alexpeshkoff Date: 2015-04-14 17:00:45 +0000 (Tue, 14 Apr 2015) Log Message: ----------- Fixed segfault caused when compiler used default copy ctor of status_exception Modified Paths: -------------- firebird/trunk/src/common/fb_exception.cpp firebird/trunk/src/include/fb_exception.h Modified: firebird/trunk/src/common/fb_exception.cpp =================================================================== --- firebird/trunk/src/common/fb_exception.cpp 2015-04-14 16:20:00 UTC (rev 61309) +++ firebird/trunk/src/common/fb_exception.cpp 2015-04-14 17:00:45 UTC (rev 61310) @@ -79,6 +79,14 @@ } } +status_exception::status_exception(const status_exception& from) throw() + : m_status_vector(m_buffer) +{ + fb_utils::init_status(m_status_vector); + + set_status(from.m_status_vector); +} + void status_exception::set_status(const ISC_STATUS *new_vector) throw() { fb_assert(new_vector != 0); Modified: firebird/trunk/src/include/fb_exception.h =================================================================== --- firebird/trunk/src/include/fb_exception.h 2015-04-14 16:20:00 UTC (rev 61309) +++ firebird/trunk/src/include/fb_exception.h 2015-04-14 17:00:45 UTC (rev 61310) @@ -111,6 +111,8 @@ { public: explicit status_exception(const ISC_STATUS *status_vector) throw(); + status_exception(const status_exception&) throw(); + virtual ~status_exception() throw(); virtual void stuffByException(StaticStatusVector& status_vector) const throw(); @@ -132,6 +134,8 @@ private: ISC_STATUS* m_status_vector; ISC_STATUS_ARRAY m_buffer; + + status_exception& operator=(const status_exception&); }; // Parameter syscall later in both system_error & system_call_failed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |