From: <asf...@us...> - 2010-06-05 00:48:52
|
Revision: 51206 http://firebird.svn.sourceforge.net/firebird/?rev=51206&view=rev Author: asfernandes Date: 2010-06-05 00:48:45 +0000 (Sat, 05 Jun 2010) Log Message: ----------- Current build no (ported from CVS) Modified Paths: -------------- firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-06-05 00:48:06 UTC (rev 51205) +++ firebird/trunk/src/jrd/build_no.h 2010-06-05 00:48:45 UTC (rev 51206) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28527 + FORMAL BUILD NUMBER:28557 */ -#define PRODUCT_VER_STRING "3.0.0.28527" -#define FILE_VER_STRING "WI-T3.0.0.28527" -#define LICENSE_VER_STRING "WI-T3.0.0.28527" -#define FILE_VER_NUMBER 3, 0, 0, 28527 +#define PRODUCT_VER_STRING "3.0.0.28557" +#define FILE_VER_STRING "WI-T3.0.0.28557" +#define LICENSE_VER_STRING "WI-T3.0.0.28557" +#define FILE_VER_NUMBER 3, 0, 0, 28557 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28527" +#define FB_BUILD_NO "28557" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-06-05 00:48:06 UTC (rev 51205) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-06-05 00:48:45 UTC (rev 51206) @@ -3,13 +3,13 @@ # This file is used both to rebuild the header file and to set the # environment variables on the config call -BuildVersion="$Id: writeBuildNum.sh,v 1.28702 2010-05-22 12:59:54 fsg Exp $" +BuildVersion="$Id: writeBuildNum.sh,v 1.28732 2010/05/29 13:12:08 fsg Exp $" BuildType=T MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28527 +BuildNum=28557 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds @@ -96,7 +96,7 @@ MajorVer = $MajorVer MinorVer = $MinorVer RevNo = $RevNo -BuildNum=28527 +BuildNum=28557 BuildType = $BuildType BuildSuffix = $BuildSuffix This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-06-12 16:28:17
|
Revision: 51242 http://firebird.svn.sourceforge.net/firebird/?rev=51242&view=rev Author: asfernandes Date: 2010-06-12 16:28:11 +0000 (Sat, 12 Jun 2010) Log Message: ----------- Fixed CORE-3038 - The insert failed because a column definition includes validation Modified Paths: -------------- firebird/trunk/src/common/classes/MetaName.h firebird/trunk/src/dsql/metd_proto.h firebird/trunk/src/jrd/exe.h firebird/trunk/src/jrd/par.cpp Modified: firebird/trunk/src/common/classes/MetaName.h =================================================================== --- firebird/trunk/src/common/classes/MetaName.h 2010-06-10 16:08:18 UTC (rev 51241) +++ firebird/trunk/src/common/classes/MetaName.h 2010-06-12 16:28:11 UTC (rev 51242) @@ -30,6 +30,7 @@ #define METANAME_H #include "../common/classes/fb_string.h" +#include "../common/classes/fb_pair.h" #include "../jrd/constants.h" #ifdef SFIO @@ -117,6 +118,8 @@ ~MetaNameProxy() { strcpy(target, c_str()); } }; +typedef Pair<Full<MetaName, MetaName> > MetaNamePair; + } // namespace Firebird #endif // METANAME_H Modified: firebird/trunk/src/dsql/metd_proto.h =================================================================== --- firebird/trunk/src/dsql/metd_proto.h 2010-06-10 16:08:18 UTC (rev 51241) +++ firebird/trunk/src/dsql/metd_proto.h 2010-06-12 16:28:11 UTC (rev 51242) @@ -32,8 +32,7 @@ // forward declarations namespace Jrd { - typedef Firebird::Pair<Firebird::Full<Firebird::MetaName, Firebird::MetaName> > MetaNamePair; - typedef Firebird::GenericMap<MetaNamePair> MetaNamePairMap; + typedef Firebird::GenericMap<Firebird::MetaNamePair> MetaNamePairMap; class dsql_req; class dsql_str; Modified: firebird/trunk/src/jrd/exe.h =================================================================== --- firebird/trunk/src/jrd/exe.h 2010-06-10 16:08:18 UTC (rev 51241) +++ firebird/trunk/src/jrd/exe.h 2010-06-12 16:28:11 UTC (rev 51242) @@ -712,13 +712,14 @@ } Firebird::MetaName name; - Firebird::MetaName field; + Firebird::MetaNamePair field; bool nullable; bool explicitCollation; bool fullDomain; }; -typedef Firebird::GenericMap<Firebird::Pair<Firebird::Left<Firebird::MetaName, FieldInfo> > > MapFieldInfo; +typedef Firebird::GenericMap<Firebird::Pair<Firebird::Left<Firebird::MetaNamePair, FieldInfo> > > + MapFieldInfo; typedef Firebird::GenericMap<Firebird::Pair<Firebird::Right<Item, ItemInfo> > > MapItemInfo; // Compile scratch block Modified: firebird/trunk/src/jrd/par.cpp =================================================================== --- firebird/trunk/src/jrd/par.cpp 2010-06-10 16:08:18 UTC (rev 51241) +++ firebird/trunk/src/jrd/par.cpp 2010-06-12 16:28:11 UTC (rev 51242) @@ -348,19 +348,21 @@ case blr_domain_name2: { bool fullDomain = (csb->csb_blr_reader.getByte() == blr_domain_full); - Firebird::MetaName* name = FB_NEW(csb->csb_pool) Firebird::MetaName(csb->csb_pool); + MetaName* name = FB_NEW(csb->csb_pool) MetaName(csb->csb_pool); PAR_name(csb, *name); + MetaNamePair namePair(*name, ""); + FieldInfo fieldInfo; - bool exist = csb->csb_map_field_info.get(*name, fieldInfo); + bool exist = csb->csb_map_field_info.get(namePair, fieldInfo); MET_get_domain(tdbb, *name, desc, (exist ? NULL : &fieldInfo)); if (!exist) - csb->csb_map_field_info.put(*name, fieldInfo); + csb->csb_map_field_info.put(namePair, fieldInfo); if (itemInfo) { - itemInfo->field = *name; + itemInfo->field = namePair; if (fullDomain) { @@ -407,21 +409,23 @@ case blr_column_name2: { const bool fullDomain = (csb->csb_blr_reader.getByte() == blr_domain_full); - Firebird::MetaName* relationName = FB_NEW(csb->csb_pool) Firebird::MetaName(csb->csb_pool); + MetaName* relationName = FB_NEW(csb->csb_pool) MetaName(csb->csb_pool); PAR_name(csb, *relationName); - Firebird::MetaName* fieldName = FB_NEW(csb->csb_pool) Firebird::MetaName(csb->csb_pool); + MetaName* fieldName = FB_NEW(csb->csb_pool) MetaName(csb->csb_pool); PAR_name(csb, *fieldName); + MetaNamePair namePair(*relationName, *fieldName); + FieldInfo fieldInfo; - Firebird::MetaName fieldSource = MET_get_relation_field(tdbb, *relationName, *fieldName, desc, &fieldInfo); - bool exist = csb->csb_map_field_info.get(fieldSource, fieldInfo); + bool exist = csb->csb_map_field_info.get(namePair, fieldInfo); + MET_get_relation_field(tdbb, *relationName, *fieldName, desc, (exist ? NULL : &fieldInfo)); if (!exist) - csb->csb_map_field_info.put(fieldSource, fieldInfo); + csb->csb_map_field_info.put(namePair, fieldInfo); if (itemInfo) { - itemInfo->field = fieldSource; + itemInfo->field = namePair; if (fullDomain) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2010-06-17 07:34:22
|
Revision: 51262 http://firebird.svn.sourceforge.net/firebird/?rev=51262&view=rev Author: alexpeshkoff Date: 2010-06-17 07:34:15 +0000 (Thu, 17 Jun 2010) Log Message: ----------- frontported fix for CORE-3021: Segfault in DEV_BUILD Modified Paths: -------------- firebird/trunk/src/jrd/DatabaseSnapshot.cpp firebird/trunk/src/jrd/DatabaseSnapshot.h firebird/trunk/src/jrd/event.cpp firebird/trunk/src/jrd/event_proto.h firebird/trunk/src/jrd/isc_s_proto.h firebird/trunk/src/jrd/isc_sync.cpp firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp firebird/trunk/src/jrd/trace/TraceConfigStorage.h firebird/trunk/src/jrd/trace/TraceLog.cpp firebird/trunk/src/jrd/trace/TraceLog.h firebird/trunk/src/lock/lock.cpp firebird/trunk/src/lock/lock_proto.h Modified: firebird/trunk/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-06-17 07:34:15 UTC (rev 51262) @@ -101,11 +101,7 @@ ISC_remove_map_file(&handle); } -#ifdef WIN_NT - ISC_mutex_fini(&mutex); -#else - ISC_mutex_fini(&base->mutex); -#endif + ISC_mutex_fini(mutex); Arg::StatusVector statusVector; ISC_unmap_file(statusVector, &handle); @@ -114,11 +110,8 @@ void DatabaseSnapshot::SharedData::acquire() { -#ifdef WIN_NT - checkMutex("lock", ISC_mutex_lock(&mutex)); -#else - checkMutex("lock", ISC_mutex_lock(&base->mutex)); -#endif + checkMutex("lock", ISC_mutex_lock(mutex)); + if (base->allocated > handle.sh_mem_length_mapped) { #if (defined HAVE_MMAP || defined WIN_NT) @@ -137,11 +130,7 @@ void DatabaseSnapshot::SharedData::release() { -#ifdef WIN_NT - checkMutex("unlock", ISC_mutex_unlock(&mutex)); -#else - checkMutex("unlock", ISC_mutex_unlock(&base->mutex)); -#endif + checkMutex("unlock", ISC_mutex_unlock(mutex)); } @@ -309,20 +298,27 @@ fb_assert(shmem); #ifdef WIN_NT - checkMutex("init", ISC_mutex_init(&shmem->mutex, shmemData->sh_mem_name)); + checkMutex("init", ISC_mutex_init(&shmem->winMutex, shmemData->sh_mem_name)); + shmem->mutex = &shmem->winMutex; #endif + Header* const header = (Header*) shmemData->sh_mem_address; + if (!initialize) + { +#ifndef WIN_NT + checkMutex("map", ISC_map_mutex(shmemData, &header->mutex, &shmem->mutex)); +#endif return; + } // Initialize the shared data header - Header* const header = (Header*) shmemData->sh_mem_address; header->version = MONITOR_VERSION; header->used = alignOffset(sizeof(Header)); header->allocated = shmemData->sh_mem_length_mapped; #ifndef WIN_NT - checkMutex("init", ISC_mutex_init(&header->mutex)); + checkMutex("init", ISC_mutex_init(shmemData, &header->mutex, &shmem->mutex)); #endif } Modified: firebird/trunk/src/jrd/DatabaseSnapshot.h =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-06-17 07:34:15 UTC (rev 51262) @@ -233,8 +233,9 @@ sh_mem handle; #ifdef WIN_NT - struct mtx mutex; + struct mtx winMutex; #endif + struct mtx *mutex; Header* base; const SLONG process_id; Modified: firebird/trunk/src/jrd/event.cpp =================================================================== --- firebird/trunk/src/jrd/event.cpp 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/event.cpp 2010-06-17 07:34:15 UTC (rev 51262) @@ -61,7 +61,7 @@ #include <windows.h> #define MUTEX &m_mutex #else -#define MUTEX &m_header->evh_mutex +#define MUTEX m_mutex #endif #define SRQ_BASE ((UCHAR*) m_header) @@ -1117,11 +1117,17 @@ #endif m_sharedFileCreated = initialize; + m_header = (evh*) shmem_data->sh_mem_address; if (!initialize) + { +#ifndef WIN_NT + if ( (mutex_state = ISC_map_mutex(shmem_data, &m_header->evh_mutex, &MUTEX)) ) + mutex_bugcheck("mutex map", mutex_state); +#endif return; + } - m_header = (evh*) shmem_data->sh_mem_address; m_header->evh_length = m_shmemData.sh_mem_length_mapped; m_header->evh_version = EVENT_VERSION; m_header->evh_request_id = 0; @@ -1130,7 +1136,7 @@ SRQ_INIT(m_header->evh_events); #ifndef WIN_NT - if ( (mutex_state = ISC_mutex_init(MUTEX)) ) + if ( (mutex_state = ISC_mutex_init(shmem_data, &m_header->evh_mutex, &MUTEX)) ) mutex_bugcheck("mutex init", mutex_state); #endif Modified: firebird/trunk/src/jrd/event_proto.h =================================================================== --- firebird/trunk/src/jrd/event_proto.h 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/event_proto.h 2010-06-17 07:34:15 UTC (rev 51262) @@ -117,6 +117,8 @@ #ifdef WIN_NT struct mtx m_mutex; +#else + struct mtx* m_mutex; #endif bool m_sharedFileCreated; Modified: firebird/trunk/src/jrd/isc_s_proto.h =================================================================== --- firebird/trunk/src/jrd/isc_s_proto.h 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/isc_s_proto.h 2010-06-17 07:34:15 UTC (rev 51262) @@ -45,7 +45,7 @@ #if defined(WIN_NT) int ISC_mutex_init(struct mtx*, const TEXT*); #else -int ISC_mutex_init(struct mtx*); +int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped); #endif int ISC_mutex_lock(struct mtx*); @@ -58,6 +58,9 @@ void ISC_unmap_object(Firebird::Arg::StatusVector&, UCHAR**, ULONG); #endif +int ISC_map_mutex(sh_mem* shmem_data, mtx* mutex, mtx** mapped); +void ISC_unmap_mutex(mtx* mutex); + #ifdef UNIX void ISC_exception_post(ULONG, const TEXT*); void ISC_sync_signals_set(void*); Modified: firebird/trunk/src/jrd/isc_sync.cpp =================================================================== --- firebird/trunk/src/jrd/isc_sync.cpp 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/isc_sync.cpp 2010-06-17 07:34:15 UTC (rev 51262) @@ -2212,6 +2212,9 @@ #ifdef HAVE_MMAP + +#define HAVE_MAP_OBJECT 1 + UCHAR* ISC_map_object(Arg::StatusVector& statusVector, sh_mem* shmem_data, ULONG object_offset, @@ -2321,6 +2324,9 @@ #ifdef WIN_NT + +#define HAVE_MAP_OBJECT 1 + UCHAR* ISC_map_object(Arg::StatusVector& statusVector, sh_mem* shmem_data, ULONG object_offset, @@ -2394,12 +2400,42 @@ } #endif +int ISC_map_mutex(sh_mem* shmem_data, mtx* mutex, mtx** mapped) +{ +#ifdef HAVE_MAP_OBJECT + Arg::StatusVector temp; + mutex = reinterpret_cast<mtx*>(ISC_map_object(temp, shmem_data, + reinterpret_cast<UCHAR*>(mutex) - shmem_data->sh_mem_address, sizeof(mtx))); + if (!mutex) + { + iscLogStatus("ISC_map_mutex()", temp.value()); + return -1; + } +#endif // HAVE_MAP_OBJECT + *mapped = mutex; + return 0; +} + +void ISC_unmap_mutex(mtx* mutex) +{ +#ifdef HAVE_MAP_OBJECT + Arg::StatusVector temp; + ISC_unmap_object(temp, reinterpret_cast<UCHAR**>(&mutex), sizeof(mtx)); + if (mutex) + { + iscLogStatus("ISC_unmap_mutex()", temp.value()); + } +#endif // HAVE_MAP_OBJECT + +} + + #ifdef USE_POSIX_THREADS #ifdef USE_SYS5SEMAPHORE -int ISC_mutex_init(struct mtx* mutex) +int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped) { /************************************** * @@ -2411,6 +2447,13 @@ * Initialize a mutex. * **************************************/ + + if (ISC_map_mutex(shmem_data, mutex, mapped) != 0) + { + return -1; // no errno known here... + } + mutex = *mapped; + if (!getSem5(mutex)) { return FB_FAILURE; @@ -2442,7 +2485,7 @@ * Destroy a mutex. * **************************************/ - // no-op for SystemV semaphores + ISC_unmap_mutex(mutex); } @@ -2548,7 +2591,7 @@ static volatile bool staticBugFlag = false; #endif -int ISC_mutex_init(struct mtx* mutex) +int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped) { /************************************** * @@ -2560,6 +2603,13 @@ * Initialize a mutex. * **************************************/ + + if (ISC_map_mutex(shmem_data, mutex, mapped) != 0) + { + return -1; // no errno known here... + } + mutex = *mapped; + #ifdef BUGGY_LINUX_MUTEX do { @@ -2648,7 +2698,7 @@ * Destroy a mutex. * **************************************/ - // no-op for posix threads + ISC_unmap_mutex(mutex); } Modified: firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp =================================================================== --- firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp 2010-06-17 07:34:15 UTC (rev 51262) @@ -166,7 +166,8 @@ fb_assert(storage); #ifdef WIN_NT - checkMutex("init", ISC_mutex_init(&storage->m_mutex, shmemData->sh_mem_name)); + checkMutex("init", ISC_mutex_init(&storage->m_winMutex, shmemData->sh_mem_name)); + storage->m_mutex = &storage->m_winMutex; #endif ShMemHeader* const header = (ShMemHeader*) shmemData->sh_mem_address; @@ -181,7 +182,11 @@ header->cnt_uses = 0; memset(header->cfg_file_name, 0, sizeof(header->cfg_file_name)); #ifndef WIN_NT - checkMutex("init", ISC_mutex_init(&header->mutex)); + checkMutex("init", ISC_mutex_init(shmemData, &header->mutex, &storage->m_mutex)); + } + else + { + checkMutex("map", ISC_map_mutex(shmemData, &header->mutex, &storage->m_mutex)); #endif } } @@ -288,22 +293,13 @@ void ConfigStorage::acquire() { -#ifdef WIN_NT - checkMutex("lock", ISC_mutex_lock(&m_mutex)); -#else - checkMutex("lock", ISC_mutex_lock(&m_base->mutex)); -#endif + checkMutex("lock", ISC_mutex_lock(m_mutex)); } void ConfigStorage::release() { checkDirty(); - -#ifdef WIN_NT - checkMutex("unlock", ISC_mutex_unlock(&m_mutex)); -#else - checkMutex("unlock", ISC_mutex_unlock(&m_base->mutex)); -#endif + checkMutex("unlock", ISC_mutex_unlock(m_mutex)); } void ConfigStorage::addSession(TraceSession& session) Modified: firebird/trunk/src/jrd/trace/TraceConfigStorage.h =================================================================== --- firebird/trunk/src/jrd/trace/TraceConfigStorage.h 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/trace/TraceConfigStorage.h 2010-06-17 07:34:15 UTC (rev 51262) @@ -110,8 +110,9 @@ sh_mem m_handle; ShMemHeader* m_base; #ifdef WIN_NT - struct mtx m_mutex; + struct mtx m_winMutex; #endif + struct mtx* m_mutex; int m_cfg_file; bool m_dirty; }; Modified: firebird/trunk/src/jrd/trace/TraceLog.cpp =================================================================== --- firebird/trunk/src/jrd/trace/TraceLog.cpp 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/trace/TraceLog.cpp 2010-06-17 07:34:15 UTC (rev 51262) @@ -245,7 +245,8 @@ TraceLog* log = (TraceLog*) arg; #ifdef WIN_NT - checkMutex("init", ISC_mutex_init(&log->m_mutex, shmemData->sh_mem_name)); + checkMutex("init", ISC_mutex_init(&log->m_winMutex, shmemData->sh_mem_name)); + log->m_mutex = &log->m_winMutex; #endif ShMemHeader* const header = (ShMemHeader*) shmemData->sh_mem_address; @@ -256,27 +257,23 @@ header->readFileNum = 0; header->writeFileNum = 0; #ifndef WIN_NT - checkMutex("init", ISC_mutex_init(&header->mutex)); + checkMutex("init", ISC_mutex_init(shmemData, &header->mutex, &log->m_mutex)); + } + else + { + checkMutex("map", ISC_map_mutex(shmemData, &header->mutex, &log->m_mutex)); #endif } } void TraceLog::lock() { -#ifdef WIN_NT - checkMutex("lock", ISC_mutex_lock(&m_mutex)); -#else - checkMutex("lock", ISC_mutex_lock(&m_base->mutex)); -#endif + checkMutex("lock", ISC_mutex_lock(m_mutex)); } void TraceLog::unlock() { -#ifdef WIN_NT - checkMutex("unlock", ISC_mutex_unlock(&m_mutex)); -#else - checkMutex("unlock", ISC_mutex_unlock(&m_base->mutex)); -#endif + checkMutex("unlock", ISC_mutex_unlock(m_mutex)); } } // namespace Jrd Modified: firebird/trunk/src/jrd/trace/TraceLog.h =================================================================== --- firebird/trunk/src/jrd/trace/TraceLog.h 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/jrd/trace/TraceLog.h 2010-06-17 07:34:15 UTC (rev 51262) @@ -67,8 +67,9 @@ sh_mem m_handle; ShMemHeader* m_base; #ifdef WIN_NT - struct mtx m_mutex; + struct mtx m_winMutex; #endif + struct mtx* m_mutex; Firebird::PathName m_baseFileName; unsigned int m_fileNum; Modified: firebird/trunk/src/lock/lock.cpp =================================================================== --- firebird/trunk/src/lock/lock.cpp 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/lock/lock.cpp 2010-06-17 07:34:15 UTC (rev 51262) @@ -94,7 +94,7 @@ #include <process.h> #define MUTEX &m_shmemMutex #else -#define MUTEX &m_header->lhb_mutex +#define MUTEX m_lhb_mutex #endif #ifdef DEV_BUILD @@ -2303,6 +2303,7 @@ * to have an exclusive lock on the lock file. * **************************************/ + #ifdef WIN_NT if (ISC_mutex_init(MUTEX, shmem_data->sh_mem_name)) { bug(NULL, "mutex init failed"); @@ -2322,6 +2323,11 @@ #endif if (!initializeMemory) { +#ifndef WIN_NT + if (ISC_map_mutex(shmem_data, &m_header->lhb_mutex, &(MUTEX))) { + bug(NULL, "mutex map failed"); + } +#endif return; } @@ -2340,7 +2346,7 @@ SRQ_INIT(m_header->lhb_free_requests); #ifndef WIN_NT - if (ISC_mutex_init(MUTEX)) { + if (ISC_mutex_init(shmem_data, &m_header->lhb_mutex, &(MUTEX))) { bug(NULL, "mutex init failed"); } #endif Modified: firebird/trunk/src/lock/lock_proto.h =================================================================== --- firebird/trunk/src/lock/lock_proto.h 2010-06-17 01:57:41 UTC (rev 51261) +++ firebird/trunk/src/lock/lock_proto.h 2010-06-17 07:34:15 UTC (rev 51262) @@ -441,6 +441,8 @@ #ifdef WIN_NT struct mtx m_shmemMutex; +#else + struct mtx* m_lhb_mutex; #endif #ifdef USE_SHMEM_EXT This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-06-22 00:53:42
|
Revision: 51277 http://firebird.svn.sourceforge.net/firebird/?rev=51277&view=rev Author: asfernandes Date: 2010-06-22 00:53:35 +0000 (Tue, 22 Jun 2010) Log Message: ----------- Misc/cleanup Modified Paths: -------------- firebird/trunk/src/dsql/AggNodes.cpp firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/dsql.h firebird/trunk/src/dsql/gen.cpp firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/jrd/DatabaseSnapshot.h firebird/trunk/src/jrd/isc_sync.cpp firebird/trunk/src/jrd/met.epp firebird/trunk/src/lock/lock.cpp Modified: firebird/trunk/src/dsql/AggNodes.cpp =================================================================== --- firebird/trunk/src/dsql/AggNodes.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/AggNodes.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -274,8 +274,6 @@ void AggNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (aggInfo.blr) // Is this a standard aggregate function? dsqlScratch->appendUChar((distinct ? aggInfo.distinctBlr : aggInfo.blr)); else // This is a new window function. Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-06-22 00:53:35 UTC (rev 51277) @@ -129,8 +129,6 @@ } #endif - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (type.notNull) dsqlScratch->appendUChar(blr_not_nullable); @@ -894,7 +892,6 @@ bool secondPass, bool runTriggers) { Attachment* attachment = transaction->getAttachment(); - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); bool modified = false; @@ -2462,8 +2459,6 @@ } else if (body) { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - TRG.RDB$TRIGGER_BLR.NULL = FALSE; attachment->storeBinaryBlob(tdbb, transaction, &TRG.RDB$TRIGGER_BLR, dsqlScratch->getBlrData().begin(), Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-06-22 00:53:35 UTC (rev 51277) @@ -475,7 +475,6 @@ dropNode.silent = true; } - protected: virtual CreateAlterTriggerNode* getCreateAlterNode() { Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -898,8 +898,6 @@ void SysFuncCallNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - dsqlScratch->appendUChar(blr_sys_function); dsqlScratch->appendMetaString(function->name.c_str()); dsqlScratch->appendUChar(dsqlArgs->nod_count); @@ -1124,8 +1122,6 @@ void UdfCallNode::genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (dsqlFunction->udf_name.package.isEmpty()) dsqlScratch->appendUChar(blr_function); else Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -67,8 +67,6 @@ } #endif - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (field->fld_not_nullable) dsqlScratch->appendUChar(blr_not_nullable); @@ -213,7 +211,6 @@ void BlockNode::putLocalVariable(DsqlCompilerScratch* dsqlScratch, dsql_var* variable, dsql_nod* hostParam, const dsql_str* collationName) { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); dsql_fld* field = variable->var_field; dsqlScratch->appendUChar(blr_dcl_variable); @@ -365,8 +362,6 @@ void SavepointEncloseNode::genBlr() { - DsqlCompiledStatement* const statement = dsqlScratch->getStatement(); - dsqlScratch->appendUChar(blr_begin); dsqlScratch->appendUChar(blr_start_savepoint); stmt->genBlr(); @@ -1375,7 +1370,7 @@ if (dsqlAction) { dsqlScratch->appendUChar(blr_label); - dsqlScratch->appendUChar((int) (IPTR) dsqlLabel->nod_arg[Dsql::e_label_number]); + dsqlScratch->appendUChar((int)(IPTR) dsqlLabel->nod_arg[Dsql::e_label_number]); } // Generate FOR loop @@ -1900,8 +1895,6 @@ void ReturnNode::genBlr() { - DsqlCompiledStatement* const statement = dsqlScratch->getStatement(); - dsqlScratch->appendUChar(blr_assignment); GEN_expr(dsqlScratch, value); dsqlScratch->appendUChar(blr_variable); Modified: firebird/trunk/src/dsql/ddl.cpp =================================================================== --- firebird/trunk/src/dsql/ddl.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/ddl.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -2981,9 +2981,10 @@ dsqlScratch->appendNullString(isc_dyn_def_local_fld, field_string); dsqlScratch->appendString(isc_dyn_fld_base_fld, field->fld_name); - if (field->fld_dtype <= dtype_any_text) { + + if (field->fld_dtype <= dtype_any_text) dsqlScratch->appendNumber(isc_dyn_fld_collation, field->fld_collation_id); - } + dsqlScratch->appendNumber(isc_dyn_view_context, context->ctx_context); } else @@ -3299,7 +3300,6 @@ } } - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); dsqlScratch->appendNullString(isc_dyn_del_exception, string->str_data); dsqlScratch->appendUChar(isc_dyn_end); } @@ -3354,7 +3354,6 @@ } if (relation) { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); dsqlScratch->appendNullString(isc_dyn_delete_rel, string->str_data); dsqlScratch->appendUChar(isc_dyn_end); } @@ -3867,8 +3866,6 @@ if (string) index_name = string->str_data; - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (element->nod_type == nod_primary) dsqlScratch->appendNullString(isc_dyn_def_primary_key, index_name); else if (element->nod_type == nod_unique) @@ -4076,9 +4073,8 @@ drop_difference = true; } - if (drop_difference) { + if (drop_difference) dsqlScratch->appendUChar(isc_dyn_drop_difference); - } SLONG start = 0; @@ -4104,7 +4100,7 @@ break; case nod_difference_file: dsqlScratch->appendNullString(isc_dyn_def_difference, - ((dsql_str*) element->nod_arg[0])->str_data); + ((dsql_str*) element->nod_arg[0])->str_data); break; case nod_begin_backup: dsqlScratch->appendUChar(isc_dyn_begin_backup); @@ -4211,7 +4207,7 @@ { fb_assert(string->str_length <= MAX_USHORT); dsqlScratch->appendString(isc_dyn_fld_validation_source, - string->str_data, string->str_length); + string->str_data, string->str_length); } break; @@ -4269,12 +4265,10 @@ dsqlScratch->appendNullString(isc_dyn_mod_idx, index_name->str_data); - if (index_node->nod_type == nod_idx_active) { + if (index_node->nod_type == nod_idx_active) dsqlScratch->appendNumber(isc_dyn_idx_inactive, 0); - } - else if (index_node->nod_type == nod_idx_inactive) { + else if (index_node->nod_type == nod_idx_inactive) dsqlScratch->appendNumber(isc_dyn_idx_inactive, 1); - } dsqlScratch->appendUChar(isc_dyn_end); } @@ -4292,7 +4286,6 @@ * Stuff a user/role/obj option in grant/revoke * **************************************/ - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); const dsql_str* name = (dsql_str*) user->nod_arg[0]; switch (user->nod_type) @@ -4302,12 +4295,10 @@ break; case nod_user_name: - if (user->nod_count == 2) { + if (user->nod_count == 2) dsqlScratch->appendNullString(isc_dyn_grant_user_explicit, name->str_data); - } - else { + else dsqlScratch->appendNullString(isc_dyn_grant_user, name->str_data); - } break; case nod_package_obj: @@ -4363,8 +4354,6 @@ * **************************************/ - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (type == nod_grant) dsqlScratch->appendUChar(isc_dyn_grant); else @@ -4374,6 +4363,7 @@ SSHORT priv_count = 0; dsqlScratch->appendUShort(0); + for (; *privs; privs++) { priv_count++; @@ -4381,9 +4371,8 @@ } UCHAR* dynsave = dsqlScratch->getBlrData().end(); - for (SSHORT i = priv_count + 2; i; i--) { + for (SSHORT i = priv_count + 2; i; i--) --dynsave; - } *dynsave++ = (UCHAR) priv_count; *dynsave = (UCHAR) (priv_count >> 8); @@ -4408,14 +4397,11 @@ put_user_grant(dsqlScratch, user); - if (field_name) { + if (field_name) dsqlScratch->appendNullString(isc_dyn_fld_name, field_name->str_data); - } if (option) - { dsqlScratch->appendNumber(isc_dyn_grant_options, option); - } put_grantor(dsqlScratch, grantor); @@ -4808,14 +4794,10 @@ * Build req_blr for grant & revoke role stmt * **************************************/ - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - - if (type == nod_grant) { + if (type == nod_grant) dsqlScratch->appendUChar(isc_dyn_grant); - } - else { + else dsqlScratch->appendUChar(isc_dyn_revoke); - } dsqlScratch->appendUShort(1); dsqlScratch->appendUChar('M'); @@ -4850,7 +4832,6 @@ **************************************/ if (grantor) { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); fb_assert(grantor->nod_type == nod_user_name); const dsql_str* name = (const dsql_str*) grantor->nod_arg[0]; dsqlScratch->appendNullString(isc_dyn_grant_grantor, name->str_data); @@ -4872,8 +4853,6 @@ * **************************************/ - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - dsqlScratch->appendNumber(isc_dyn_fld_type, blr_dtypes[desc->dsc_dtype]); if (desc->dsc_dtype == dtype_varying) { dsqlScratch->appendNumber(isc_dyn_fld_length, (SSHORT) (desc->dsc_length - sizeof(USHORT))); @@ -4918,8 +4897,6 @@ * **************************************/ - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - if (field->fld_not_nullable) dsqlScratch->appendUChar(isc_dyn_fld_not_null); Modified: firebird/trunk/src/dsql/dsql.h =================================================================== --- firebird/trunk/src/dsql/dsql.h 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/dsql.h 2010-06-22 00:53:35 UTC (rev 51277) @@ -369,7 +369,7 @@ // Compiled statement - shared by multiple requests. class DsqlCompiledStatement : public Firebird::PermanentStorage { - friend class DsqlCompilerScratch; + ///friend class DsqlCompilerScratch; public: enum Type // statement type @@ -626,13 +626,13 @@ virtual bool isVersion4() { - return statement->flags & DsqlCompiledStatement::FLAG_BLR_VERSION4; + return statement->getFlags() & DsqlCompiledStatement::FLAG_BLR_VERSION4; } virtual bool isDdlDyn() { - return (statement->type == DsqlCompiledStatement::TYPE_DDL || statement->ddlNode) && - !statement->blockNode; + return (statement->getType() == DsqlCompiledStatement::TYPE_DDL || statement->getDdlNode()) && + !statement->getBlockNode(); } public: Modified: firebird/trunk/src/dsql/gen.cpp =================================================================== --- firebird/trunk/src/dsql/gen.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/gen.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -232,8 +232,8 @@ case nod_dom_value: dsqlScratch->appendUChar(blr_fid); - dsqlScratch->appendUChar(0); // Context - dsqlScratch->appendUShort(0); // Field id + dsqlScratch->appendUChar(0); // Context + dsqlScratch->appendUShort(0); // Field id return; case nod_field: @@ -1111,14 +1111,14 @@ case nod_while: dsqlScratch->appendUChar(blr_label); - dsqlScratch->appendUChar((int) (IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]); + dsqlScratch->appendUChar((int)(IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]); dsqlScratch->appendUChar(blr_loop); dsqlScratch->appendUChar(blr_begin); dsqlScratch->appendUChar(blr_if); GEN_expr(dsqlScratch, node->nod_arg[e_while_cond]); GEN_statement(dsqlScratch, node->nod_arg[e_while_action]); dsqlScratch->appendUChar(blr_leave); - dsqlScratch->appendUChar((int) (IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]); + dsqlScratch->appendUChar((int)(IPTR) node->nod_arg[e_while_label]->nod_arg[e_label_number]); dsqlScratch->appendUChar(blr_end); return; @@ -1130,7 +1130,7 @@ case nod_cursor: dsqlScratch->appendUChar(blr_dcl_cursor); - dsqlScratch->appendUShort((int) (IPTR) node->nod_arg[e_cur_number]); + dsqlScratch->appendUShort((int)(IPTR) node->nod_arg[e_cur_number]); if (node->nod_arg[e_cur_scroll]) { dsqlScratch->appendUChar(blr_scrollable); @@ -1394,7 +1394,7 @@ { case dtype_short: GEN_descriptor(dsqlScratch, desc, true); - value = *(SSHORT *) p; + value = *(SSHORT*) p; if (negate_value) value = -value; dsqlScratch->appendUShort(value); @@ -1402,7 +1402,7 @@ case dtype_long: GEN_descriptor(dsqlScratch, desc, true); - value = *(SLONG *) p; + value = *(SLONG*) p; if (negate_value) value = -value; //printf("gen.cpp = %p %d\n", *((void**)p), value); @@ -1413,7 +1413,7 @@ case dtype_sql_time: case dtype_sql_date: GEN_descriptor(dsqlScratch, desc, true); - value = *(SLONG *) p; + value = *(SLONG*) p; dsqlScratch->appendUShort(value); dsqlScratch->appendUShort(value >> 16); break; @@ -1441,7 +1441,7 @@ break; case dtype_int64: - i64value = *(SINT64 *) p; + i64value = *(SINT64*) p; if (negate_value) i64value = -i64value; @@ -1488,10 +1488,10 @@ case dtype_array: case dtype_timestamp: GEN_descriptor(dsqlScratch, desc, true); - value = *(SLONG *) p; + value = *(SLONG*) p; dsqlScratch->appendUShort(value); dsqlScratch->appendUShort(value >> 16); - value = *(SLONG *) (p + 4); + value = *(SLONG*) (p + 4); dsqlScratch->appendUShort(value); dsqlScratch->appendUShort(value >> 16); break; @@ -1782,6 +1782,7 @@ GEN_expr(dsqlScratch, temp->nod_arg[i]); } } + dsqlScratch->appendUChar(blr_end); } Modified: firebird/trunk/src/dsql/pass1.cpp =================================================================== --- firebird/trunk/src/dsql/pass1.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/dsql/pass1.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -6323,7 +6323,6 @@ virtual void genBlr() { - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); dsql_msg* message = dsqlScratch->getStatement()->getReceiveMsg(); if (!dsqlScratch->isPsql() && message) Modified: firebird/trunk/src/jrd/DatabaseSnapshot.h =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-06-22 00:53:35 UTC (rev 51277) @@ -235,7 +235,7 @@ #ifdef WIN_NT struct mtx winMutex; #endif - struct mtx *mutex; + struct mtx* mutex; Header* base; const SLONG process_id; Modified: firebird/trunk/src/jrd/isc_sync.cpp =================================================================== --- firebird/trunk/src/jrd/isc_sync.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/jrd/isc_sync.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -2405,7 +2405,7 @@ #ifdef HAVE_MAP_OBJECT Arg::StatusVector temp; mutex = reinterpret_cast<mtx*>(ISC_map_object(temp, shmem_data, - reinterpret_cast<UCHAR*>(mutex) - shmem_data->sh_mem_address, sizeof(mtx))); + reinterpret_cast<UCHAR*>(mutex) - shmem_data->sh_mem_address, sizeof(mtx))); if (!mutex) { iscLogStatus("ISC_map_mutex()", temp.value()); @@ -2429,8 +2429,8 @@ #endif // HAVE_MAP_OBJECT } - + #ifdef USE_POSIX_THREADS #ifdef USE_SYS5SEMAPHORE @@ -2452,6 +2452,7 @@ { return -1; // no errno known here... } + mutex = *mapped; if (!getSem5(mutex)) @@ -2608,6 +2609,7 @@ { return -1; // no errno known here... } + mutex = *mapped; #ifdef BUGGY_LINUX_MUTEX Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/jrd/met.epp 2010-06-22 00:53:35 UTC (rev 51277) @@ -5046,7 +5046,7 @@ int dpdo_type = (int) (IPTR) node->nod_arg[e_dep_object_type]; jrd_rel* relation = NULL; jrd_prc* procedure = NULL; - const MetaName* dpdo_name = 0; + const MetaName* dpdo_name = NULL; MetaName packageName; SubtypeInfo info; Modified: firebird/trunk/src/lock/lock.cpp =================================================================== --- firebird/trunk/src/lock/lock.cpp 2010-06-21 15:10:25 UTC (rev 51276) +++ firebird/trunk/src/lock/lock.cpp 2010-06-22 00:53:35 UTC (rev 51277) @@ -2322,7 +2322,8 @@ } #endif - if (!initializeMemory) { + if (!initializeMemory) + { #ifndef WIN_NT if (ISC_map_mutex(shmem_data, &m_header->lhb_mutex, &(MUTEX))) { bug(NULL, "mutex map failed"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ale...@us...> - 2010-06-25 11:55:18
|
Revision: 51284 http://firebird.svn.sourceforge.net/firebird/?rev=51284&view=rev Author: alexpeshkoff Date: 2010-06-25 11:55:11 +0000 (Fri, 25 Jun 2010) Log Message: ----------- Introduced class SharedMemory - base class for everything, using IPC. Related to CORE-3035. Modified Paths: -------------- firebird/trunk/src/jrd/DatabaseSnapshot.cpp firebird/trunk/src/jrd/DatabaseSnapshot.h firebird/trunk/src/jrd/cch.h firebird/trunk/src/jrd/dbt.cpp firebird/trunk/src/jrd/event.cpp firebird/trunk/src/jrd/event.h firebird/trunk/src/jrd/event_proto.h firebird/trunk/src/jrd/isc_s_proto.h firebird/trunk/src/jrd/isc_sync.cpp firebird/trunk/src/jrd/os/win32/isc_ipc.cpp firebird/trunk/src/jrd/trace/TraceConfigStorage.cpp firebird/trunk/src/jrd/trace/TraceConfigStorage.h firebird/trunk/src/jrd/trace/TraceLog.cpp firebird/trunk/src/jrd/trace/TraceLog.h firebird/trunk/src/jrd/trace/TraceObjects.h firebird/trunk/src/lock/driver.cpp firebird/trunk/src/lock/lock.cpp firebird/trunk/src/lock/lock_proto.h firebird/trunk/src/lock/print.cpp firebird/trunk/src/remote/os/win32/property.cpp firebird/trunk/src/remote/os/win32/window.cpp firebird/trunk/src/utilities/drop.cpp Removed Paths: ------------- firebird/trunk/src/jrd/isc.h Modified: firebird/trunk/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-06-25 11:55:11 UTC (rev 51284) @@ -80,14 +80,14 @@ name.printf(MONITOR_FILE, dbb->getUniqueFileId().c_str()); Arg::StatusVector statusVector; - base = (Header*) ISC_map_file(statusVector, name.c_str(), init, this, DEFAULT_SIZE, &handle); - if (!base) + mapFile(statusVector, name.c_str(), DEFAULT_SIZE); + if (!sh_mem_header) { iscLogStatus("Cannot initialize the shared memory region", statusVector.value()); status_exception::raise(statusVector); } - fb_assert(base->version == MONITOR_VERSION); + fb_assert(sh_mem_header->mhb_version == MONITOR_VERSION); } @@ -97,27 +97,25 @@ DumpGuard guard(this); cleanup(); - if (base->used == sizeof(Header)) - ISC_remove_map_file(&handle); + if (sh_mem_header->used == sizeof(Header)) + removeMapFile(); } - ISC_mutex_fini(mutex); - Arg::StatusVector statusVector; - ISC_unmap_file(statusVector, &handle); + unmapFile(statusVector); } void DatabaseSnapshot::SharedData::acquire() { - checkMutex("lock", ISC_mutex_lock(mutex)); + mutexLock(); - if (base->allocated > handle.sh_mem_length_mapped) + if (sh_mem_header->allocated > sh_mem_length_mapped) { -#if (defined HAVE_MMAP || defined WIN_NT) +#ifdef HAVE_OBJECT_MAP Arg::StatusVector statusVector; - base = (Header*) ISC_remap_file(statusVector, &handle, base->allocated, false); - if (!base) + remapFile(statusVector, sh_mem_header->allocated, false); + if (!remapFile(statusVector, sh_mem_header->allocated, false)) { status_exception::raise(statusVector); } @@ -130,7 +128,7 @@ void DatabaseSnapshot::SharedData::release() { - checkMutex("unlock", ISC_mutex_unlock(mutex)); + mutexUnlock(); } @@ -145,9 +143,9 @@ // and copy the data there, starting with our own dbb. // First pass - for (ULONG offset = alignOffset(sizeof(Header)); offset < base->used;) + for (ULONG offset = alignOffset(sizeof(Header)); offset < sh_mem_header->used;) { - UCHAR* const ptr = (UCHAR*) base + offset; + UCHAR* const ptr = (UCHAR*) sh_mem_header + offset; const Element* const element = (Element*) ptr; const ULONG length = alignOffset(sizeof(Element) + element->length); @@ -163,9 +161,9 @@ } else { - fb_assert(base->used >= offset + length); - memmove(ptr, ptr + length, base->used - offset - length); - base->used -= length; + fb_assert(sh_mem_header->used >= offset + length); + memmove(ptr, ptr + length, sh_mem_header->used - offset - length); + sh_mem_header->used -= length; } } @@ -175,14 +173,14 @@ fb_assert(self_dbb_offset); - UCHAR* const ptr = (UCHAR*) base + self_dbb_offset; + UCHAR* const ptr = (UCHAR*) sh_mem_header + self_dbb_offset; const Element* const element = (Element*) ptr; memcpy(bufferPtr, ptr + sizeof(Element), element->length); bufferPtr += element->length; - for (ULONG offset = alignOffset(sizeof(Header)); offset < base->used;) + for (ULONG offset = alignOffset(sizeof(Header)); offset < sh_mem_header->used;) { - UCHAR* const ptr = (UCHAR*) base + offset; + UCHAR* const ptr = (UCHAR*) sh_mem_header + offset; const Element* const element = (Element*) ptr; const ULONG length = alignOffset(sizeof(Element) + element->length); @@ -205,13 +203,13 @@ ensureSpace(sizeof(Element)); // Put an up-to-date element at the tail - const ULONG offset = base->used; - UCHAR* const ptr = (UCHAR*) base + offset; + const ULONG offset = sh_mem_header->used; + UCHAR* const ptr = (UCHAR*) sh_mem_header + offset; Element* const element = (Element*) ptr; element->processId = process_id; element->localId = local_id; element->length = 0; - base->used += alignOffset(sizeof(Element)); + sh_mem_header->used += alignOffset(sizeof(Element)); return offset; } @@ -221,30 +219,30 @@ ensureSpace(length); // Put an up-to-date element at the tail - UCHAR* const ptr = (UCHAR*) base + offset; + UCHAR* const ptr = (UCHAR*) sh_mem_header + offset; Element* const element = (Element*) ptr; memcpy(ptr + sizeof(Element) + element->length, buffer, length); ULONG previous = alignOffset(sizeof(Element) + element->length); element->length += length; ULONG current = alignOffset(sizeof(Element) + element->length); - base->used += (current - previous); + sh_mem_header->used += (current - previous); } void DatabaseSnapshot::SharedData::cleanup() { // Remove information about our dbb - for (ULONG offset = alignOffset(sizeof(Header)); offset < base->used;) + for (ULONG offset = alignOffset(sizeof(Header)); offset < sh_mem_header->used;) { - UCHAR* const ptr = (UCHAR*) base + offset; + UCHAR* const ptr = (UCHAR*) sh_mem_header + offset; const Element* const element = (Element*) ptr; const ULONG length = alignOffset(sizeof(Element) + element->length); if (element->processId == process_id && element->localId == local_id) { - fb_assert(base->used >= offset + length); - memmove(ptr, ptr + length, base->used - offset - length); - base->used -= length; + fb_assert(sh_mem_header->used >= offset + length); + memmove(ptr, ptr + length, sh_mem_header->used - offset - length); + sh_mem_header->used -= length; } else { @@ -256,20 +254,19 @@ void DatabaseSnapshot::SharedData::ensureSpace(ULONG length) { - ULONG newSize = base->used + length; + ULONG newSize = sh_mem_header->used + length; - if (newSize > base->allocated) + if (newSize > sh_mem_header->allocated) { newSize = FB_ALIGN(newSize, DEFAULT_SIZE); -#if (defined HAVE_MMAP || defined WIN_NT) +#ifdef HAVE_OBJECT_MAP Arg::StatusVector statusVector; - base = (Header*) ISC_remap_file(statusVector, &handle, newSize, true); - if (!base) + if (!remapFile(statusVector, newSize, true)) { status_exception::raise(statusVector); } - base->allocated = handle.sh_mem_length_mapped; + sh_mem_header->allocated = sh_mem_length_mapped; #else status_exception::raise(Arg::Gds(isc_montabexh)); #endif @@ -277,49 +274,28 @@ } -void DatabaseSnapshot::SharedData::checkMutex(const TEXT* string, int state) +void DatabaseSnapshot::SharedData::mutexBug(int osErrorCode, const char* string) { - if (state) - { - TEXT msg[BUFFER_TINY]; + gds__log("MONITOR: mutex %s error, status = %d", string, osErrorCode); - sprintf(msg, "MONITOR: mutex %s error, status = %d", string, state); - gds__log(msg); - - //fprintf(stderr, "%s\n", msg); - exit(FINI_ERROR); - } + //fprintf(stderr, "%s\n", msg); + exit(FINI_ERROR); } -void DatabaseSnapshot::SharedData::init(void* arg, sh_mem* shmemData, bool initialize) +bool DatabaseSnapshot::SharedData::initialize(bool initialize) { - SharedData* const shmem = (SharedData*) arg; - fb_assert(shmem); - -#ifdef WIN_NT - checkMutex("init", ISC_mutex_init(&shmem->winMutex, shmemData->sh_mem_name)); - shmem->mutex = &shmem->winMutex; -#endif - - Header* const header = (Header*) shmemData->sh_mem_address; - - if (!initialize) + if (initialize) { -#ifndef WIN_NT - checkMutex("map", ISC_map_mutex(shmemData, &header->mutex, &shmem->mutex)); -#endif - return; + // Initialize the shared data header + sh_mem_header->mhb_type = SRAM_DATABASE_SNAPSHOT; + sh_mem_header->mhb_version = MONITOR_VERSION; + + sh_mem_header->used = alignOffset(sizeof(Header)); + sh_mem_header->allocated = sh_mem_length_mapped; } - // Initialize the shared data header - header->version = MONITOR_VERSION; - header->used = alignOffset(sizeof(Header)); - header->allocated = shmemData->sh_mem_length_mapped; - -#ifndef WIN_NT - checkMutex("init", ISC_mutex_init(shmemData, &header->mutex, &shmem->mutex)); -#endif + return true; } Modified: firebird/trunk/src/jrd/DatabaseSnapshot.h =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-06-25 11:55:11 UTC (rev 51284) @@ -25,6 +25,7 @@ #include "../common/classes/array.h" #include "../common/classes/init.h" +#include "../jrd/isc_s_proto.h" namespace Jrd { @@ -184,20 +185,19 @@ }; public: - class SharedData + class SnapshotHeader : public MemoryHeader { + public: + ULONG used; + ULONG allocated; + }; + + class SharedData : public SharedMemory<SnapshotHeader> + { static const ULONG MONITOR_VERSION = 3; static const ULONG DEFAULT_SIZE = 1048576; - struct Header - { - ULONG version; - ULONG used; - ULONG allocated; -#ifndef WIN_NT - struct mtx mutex; -#endif - }; + typedef SnapshotHeader Header; struct Element { @@ -212,6 +212,9 @@ explicit SharedData(const Database*); ~SharedData(); + bool initialize(bool); + void mutexBug(int osErrorCode, const char* text); + void acquire(); void release(); @@ -228,16 +231,6 @@ void ensureSpace(ULONG); - static void checkMutex(const TEXT*, int); - static void init(void*, sh_mem*, bool); - - sh_mem handle; -#ifdef WIN_NT - struct mtx winMutex; -#endif - struct mtx* mutex; - Header* base; - const SLONG process_id; const SLONG local_id; }; Modified: firebird/trunk/src/jrd/cch.h =================================================================== --- firebird/trunk/src/jrd/cch.h 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/cch.h 2010-06-25 11:55:11 UTC (rev 51284) @@ -35,7 +35,6 @@ #include "../jrd/que.h" #include "../jrd/lls.h" #include "../jrd/pag.h" -#include "../jrd/isc.h" //#define CCH_DEBUG Modified: firebird/trunk/src/jrd/dbt.cpp =================================================================== --- firebird/trunk/src/jrd/dbt.cpp 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/dbt.cpp 2010-06-25 11:55:11 UTC (rev 51284) @@ -28,7 +28,6 @@ // here when the file was removed. // Most probably only a few of the includes are needed #include "../jrd/common.h" -#include "../jrd/isc.h" #include "../jrd/jrd.h" #include "../jrd/lck.h" #include "../jrd/ods.h" Modified: firebird/trunk/src/jrd/event.cpp =================================================================== --- firebird/trunk/src/jrd/event.cpp 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/event.cpp 2010-06-25 11:55:11 UTC (rev 51284) @@ -64,7 +64,7 @@ #define MUTEX m_mutex #endif -#define SRQ_BASE ((UCHAR*) m_header) +#define SRQ_BASE ((UCHAR*) sh_mem_header) using namespace Firebird; @@ -97,7 +97,6 @@ EventManager::EventManager(const Firebird::string& id, Firebird::RefPtr<Config> conf) : PID(getpid()), - m_header(NULL), m_process(NULL), m_processOffset(0), m_dbId(getPool(), id), @@ -130,8 +129,8 @@ ISC_event_post(&m_process->prb_event); m_cleanupSemaphore.tryEnter(5); -#if (defined HAVE_MMAP || defined WIN_NT) - ISC_unmap_object(localStatus, (UCHAR**) &m_process, sizeof(prb)); +#ifdef HAVE_OBJECT_MAP + unmapObject(localStatus, &m_process); #else m_process = NULL; #endif @@ -143,11 +142,9 @@ { delete_process(process_offset); } - if (m_header && SRQ_EMPTY(m_header->evh_processes)) + if (sh_mem_header && SRQ_EMPTY(sh_mem_header->evh_processes)) { - Firebird::PathName name; - get_shared_file_name(name); - ISC_remove_map_file(name.c_str()); + removeMapFile(); } release_shmem(); @@ -168,27 +165,24 @@ get_shared_file_name(name); Arg::StatusVector localStatus; - if (!(m_header = (evh*) ISC_map_file(localStatus, - name.c_str(), - init_shmem, this, - m_config->getEventMemSize(), - &m_shmemData))) + mapFile(localStatus, name.c_str(), m_config->getEventMemSize()); + if (!sh_mem_header) { localStatus.raise(); } - fb_assert(m_header->evh_version == EVENT_VERSION); + fb_assert(sh_mem_header->mhb_type == SRAM_EVENT_MANAGER); + fb_assert(sh_mem_header->mhb_version == EVENT_VERSION); } void EventManager::detach_shared_file() { Arg::StatusVector localStatus; - if (m_header) + if (sh_mem_header) { - ISC_mutex_fini(MUTEX); - ISC_unmap_file(localStatus, &m_shmemData); - m_header = NULL; + unmapFile(localStatus); + sh_mem_header = NULL; } } @@ -283,7 +277,7 @@ request->req_process = m_processOffset; request->req_ast = ast_routine; request->req_ast_arg = ast_arg; - const SLONG id = ++m_header->evh_request_id; + const SLONG id = ++sh_mem_header->evh_request_id; request->req_request_id = id; const SLONG request_offset = SRQ_REL_PTR(request); @@ -498,7 +492,7 @@ { flag = false; srq* event_srq; - SRQ_LOOP (m_header->evh_processes, event_srq) + SRQ_LOOP (sh_mem_header->evh_processes, event_srq) { prb* const process = (prb*) ((UCHAR*) event_srq - OFFSET (prb*, prb_processes)); if (process->prb_flags & PRB_wakeup) @@ -514,7 +508,7 @@ } -evh* EventManager::acquire_shmem() +void EventManager::acquire_shmem() { /************************************** * @@ -527,29 +521,22 @@ * **************************************/ - int mutex_state = ISC_mutex_lock(MUTEX); - if (mutex_state) - mutex_bugcheck("mutex lock", mutex_state); + mutexLock(); // Check for shared memory state consistency - while (SRQ_EMPTY(m_header->evh_processes)) + while (SRQ_EMPTY(sh_mem_header->evh_processes)) { if (! m_sharedFileCreated) { // Someone is going to delete shared file? Reattach. - mutex_state = ISC_mutex_unlock(MUTEX); - if (mutex_state) - mutex_bugcheck("mutex unlock", mutex_state); + mutexUnlock(); detach_shared_file(); THD_yield(); attach_shared_file(); - mutex_state = ISC_mutex_lock(MUTEX); - if (mutex_state) { - mutex_bugcheck("mutex lock", mutex_state); - } + mutexLock(); } else { @@ -561,29 +548,22 @@ } fb_assert(!m_sharedFileCreated); - m_header->evh_current_process = m_processOffset; + sh_mem_header->evh_current_process = m_processOffset; - if (m_header->evh_length > m_shmemData.sh_mem_length_mapped) + if (sh_mem_header->evh_length > sh_mem_length_mapped) { - const ULONG length = m_header->evh_length; + const ULONG length = sh_mem_header->evh_length; - evh* header = NULL; - -#if (defined HAVE_MMAP || defined WIN_NT) +#ifdef HAVE_OBJECT_MAP Arg::StatusVector localStatus; - header = (evh*) ISC_remap_file(localStatus, &m_shmemData, length, false); + if (remapFile(localStatus, length, false)) #endif - if (!header) { release_shmem(); gds__log("Event table remap failed"); exit(FINI_ERROR); } - - m_header = header; } - - return m_header; } @@ -605,7 +585,7 @@ length = FB_ALIGN(length, FB_ALIGNMENT); SRQ_PTR* best = NULL; - for (SRQ_PTR* ptr = &m_header->evh_free; (free = (frb*) SRQ_ABS_PTR(*ptr)) && *ptr; + for (SRQ_PTR* ptr = &sh_mem_header->evh_free; (free = (frb*) SRQ_ABS_PTR(*ptr)) && *ptr; ptr = &free->frb_next) { const SLONG tail = free->frb_header.hdr_length - length; @@ -618,25 +598,24 @@ if (!best && !recurse) { - const ULONG old_length = m_shmemData.sh_mem_length_mapped; + const ULONG old_length = sh_mem_length_mapped; const ULONG ev_length = old_length + m_config->getEventMemSize(); evh* header = NULL; -#if (defined HAVE_MMAP || defined WIN_NT) +#ifdef HAVE_OBJECT_MAP Arg::StatusVector localStatus; - header = (evh*) ISC_remap_file(localStatus, &m_shmemData, ev_length, true); + if (remapFile(localStatus, ev_length, true)) #endif - if (header) { free = (frb*) ((UCHAR*) header + old_length); //free->frb_header.hdr_length = EVENT_EXTEND_SIZE - sizeof (struct evh); - free->frb_header.hdr_length = m_shmemData.sh_mem_length_mapped - old_length; + free->frb_header.hdr_length = sh_mem_length_mapped - old_length; free->frb_header.hdr_type = type_frb; free->frb_next = 0; - m_header = header; - m_header->evh_length = m_shmemData.sh_mem_length_mapped; + sh_mem_header = header; + sh_mem_header->evh_length = sh_mem_length_mapped; free_global(free); @@ -687,16 +666,16 @@ prb* const process = (prb*) alloc_global(type_prb, sizeof(prb), false); process->prb_process_id = PID; - insert_tail(&m_header->evh_processes, &process->prb_processes); + insert_tail(&sh_mem_header->evh_processes, &process->prb_processes); SRQ_INIT(process->prb_sessions); ISC_event_init(&process->prb_event); m_processOffset = SRQ_REL_PTR(process); -#if (defined HAVE_MMAP || defined WIN_NT) +#ifdef HAVE_OBJECT_MAP Arg::StatusVector localStatus; - m_process = (prb*) ISC_map_object(localStatus, &m_shmemData, m_processOffset, sizeof(prb)); + m_process = mapObject<prb>(localStatus, m_processOffset); if (!m_process) { @@ -1002,7 +981,7 @@ const SRQ_PTR parent_offset = parent ? SRQ_REL_PTR(parent) : 0; srq* event_srq; - SRQ_LOOP(m_header->evh_events, event_srq) + SRQ_LOOP(sh_mem_header->evh_events, event_srq) { evnt* const event = (evnt*) ((UCHAR*) event_srq - OFFSET(evnt*, evnt_events)); if (event->evnt_parent == parent_offset && event->evnt_length == length && @@ -1035,14 +1014,14 @@ const SRQ_PTR offset = SRQ_REL_PTR(block); block->frb_header.hdr_type = type_frb; - for (ptr = &m_header->evh_free; (free = (frb*) SRQ_ABS_PTR(*ptr)) && *ptr; + for (ptr = &sh_mem_header->evh_free; (free = (frb*) SRQ_ABS_PTR(*ptr)) && *ptr; prior = free, ptr = &free->frb_next) { if ((SCHAR *) block < (SCHAR *) free) break; } - if (offset <= 0 || static_cast<ULONG>(offset) > m_header->evh_length || + if (offset <= 0 || static_cast<ULONG>(offset) > sh_mem_header->evh_length || (prior && (UCHAR*) block < (UCHAR*) prior + prior->frb_header.hdr_length)) { punt("free_global: bad block"); @@ -1097,8 +1076,14 @@ } -void EventManager::init_shmem(sh_mem* shmem_data, bool initialize) +void EventManager::mutexBug(int osErrorCode, const char* text) { + mutex_bugcheck(text, osErrorCode); +} + + +bool EventManager::initialize(bool initialize) +{ /************************************** * * i n i t _ s h m e m @@ -1109,43 +1094,28 @@ * Initialize global region header. * **************************************/ - int mutex_state; -#ifdef WIN_NT - if ( (mutex_state = ISC_mutex_init(MUTEX, shmem_data->sh_mem_name)) ) - mutex_bugcheck("mutex init", mutex_state); -#endif - m_sharedFileCreated = initialize; - m_header = (evh*) shmem_data->sh_mem_address; - if (!initialize) + if (initialize) { -#ifndef WIN_NT - if ( (mutex_state = ISC_map_mutex(shmem_data, &m_header->evh_mutex, &MUTEX)) ) - mutex_bugcheck("mutex map", mutex_state); -#endif - return; - } + sh_mem_header->evh_length = sh_mem_length_mapped; + sh_mem_header->mhb_version = EVENT_VERSION; + sh_mem_header->mhb_type = SRAM_EVENT_MANAGER; + sh_mem_header->evh_request_id = 0; - m_header->evh_length = m_shmemData.sh_mem_length_mapped; - m_header->evh_version = EVENT_VERSION; - m_header->evh_request_id = 0; + SRQ_INIT(sh_mem_header->evh_processes); + SRQ_INIT(sh_mem_header->evh_events); - SRQ_INIT(m_header->evh_processes); - SRQ_INIT(m_header->evh_events); + frb* const free = (frb*) ((UCHAR*) sh_mem_header + sizeof(evh)); + free->frb_header.hdr_length = sh_mem_length_mapped - sizeof(evh); + free->frb_header.hdr_type = type_frb; + free->frb_next = 0; -#ifndef WIN_NT - if ( (mutex_state = ISC_mutex_init(shmem_data, &m_header->evh_mutex, &MUTEX)) ) - mutex_bugcheck("mutex init", mutex_state); -#endif + sh_mem_header->evh_free = (UCHAR*) free - (UCHAR*) sh_mem_header; + } - frb* const free = (frb*) ((UCHAR*) m_header + sizeof(evh)); - free->frb_header.hdr_length = m_shmemData.sh_mem_length_mapped - sizeof(evh); - free->frb_header.hdr_type = type_frb; - free->frb_next = 0; - - m_header->evh_free = (UCHAR*) free - (UCHAR*) m_header; + return true; } @@ -1183,7 +1153,7 @@ * **************************************/ evnt* const event = (evnt*) alloc_global(type_evnt, sizeof(evnt) + length, false); - insert_tail(&m_header->evh_events, &event->evnt_events); + insert_tail(&sh_mem_header->evh_events, &event->evnt_events); SRQ_INIT(event->evnt_interests); if (parent_offset) @@ -1255,7 +1225,7 @@ * **************************************/ srq* event_srq; - SRQ_LOOP(m_header->evh_processes, event_srq) + SRQ_LOOP(sh_mem_header->evh_processes, event_srq) { prb* const process = (prb*) ((UCHAR*) event_srq - OFFSET(prb*, prb_processes)); const SLONG process_offset = SRQ_REL_PTR(process); @@ -1301,11 +1271,8 @@ validate(); #endif - m_header->evh_current_process = 0; - - const int mutex_state = ISC_mutex_unlock(MUTEX); - if (mutex_state) - mutex_bugcheck("mutex unlock", mutex_state); + sh_mem_header->evh_current_process = 0; + mutexUnlock(); } @@ -1373,7 +1340,7 @@ SRQ_PTR next_free = 0; ULONG offset; - for (offset = sizeof(evh); offset < m_header->evh_length; + for (offset = sizeof(evh); offset < sh_mem_header->evh_length; offset += block->frb_header.hdr_length) { const event_hdr* block = (event_hdr*) SRQ_ABS_PTR(offset); @@ -1393,12 +1360,12 @@ if (block->frb_header.hdr_type == type_frb) { next_free = ((frb*) block)->frb_next; - if (next_free >= m_header->evh_length) + if (next_free >= sh_mem_header->evh_length) punt("bad frb_next"); } } - if (offset != m_header->evh_length) + if (offset != sh_mem_header->evh_length) punt("bad block length"); } #endif Modified: firebird/trunk/src/jrd/event.h =================================================================== --- firebird/trunk/src/jrd/event.h 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/event.h 2010-06-25 11:55:11 UTC (rev 51284) @@ -26,23 +26,23 @@ #ifndef JRD_EVENT_H #define JRD_EVENT_H -#include "../jrd/isc.h" +#include "../jrd/isc_s_proto.h" #include "../jrd/file_params.h" #include "../jrd/que.h" +#include "../jrd/isc_s_proto.h" // Global section header const int EVENT_VERSION = 4; -struct evh +class evh : public Jrd::MemoryHeader { +public: ULONG evh_length; // Current length of global section - UCHAR evh_version; // Version number of global section srq evh_events; // Known events srq evh_processes; // Known processes SRQ_PTR evh_free; // Free blocks SRQ_PTR evh_current_process; // Current process, if any - struct mtx evh_mutex; // Mutex controlling access SLONG evh_request_id; // Next request id }; Modified: firebird/trunk/src/jrd/event_proto.h =================================================================== --- firebird/trunk/src/jrd/event_proto.h 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/event_proto.h 2010-06-25 11:55:11 UTC (rev 51284) @@ -30,6 +30,7 @@ #include "../common/classes/RefCounted.h" #include "../jrd/ThreadData.h" #include "../jrd/event.h" +#include "../jrd/isc_s_proto.h" class Config; @@ -37,7 +38,7 @@ class Database; -class EventManager : public Firebird::RefCounted, public Firebird::GlobalStorage +class EventManager : public Firebird::RefCounted, public Firebird::GlobalStorage, public SharedMemory<evh> { typedef Firebird::GenericMap<Firebird::Pair<Firebird::Left<Firebird::string, EventManager*> > > DbEventMgrMap; @@ -61,8 +62,11 @@ void postEvent(USHORT, const TEXT*, USHORT, const TEXT*, USHORT); void deliverEvents(); + bool initialize(bool); + void mutexBug(int osErrorCode, const char* text); + private: - evh* acquire_shmem(); + void acquire_shmem(); frb* alloc_global(UCHAR type, ULONG length, bool recurse); void create_process(); void delete_event(evnt*); @@ -75,7 +79,6 @@ evnt* find_event(USHORT, const TEXT*, evnt*); void free_global(frb*); req_int* historical_interest(ses*, SLONG); - void init_shmem(sh_mem*, bool); void insert_tail(srq*, srq*); evnt* make_event(USHORT, const TEXT*, SLONG); void post_process(prb*); @@ -95,19 +98,17 @@ return 0; } - static void init_shmem(void* arg, sh_mem* shmem, bool init) +/* static void init_shmem(void* arg, sh_mem* shmem, bool init) { EventManager* const eventMgr = static_cast<EventManager*>(arg); eventMgr->init_shmem(shmem, init); } - +*/ static void mutex_bugcheck(const TEXT*, int); static void punt(const TEXT*); - evh* m_header; prb* m_process; SLONG m_processOffset; - sh_mem m_shmemData; Firebird::string m_dbId; Firebird::RefPtr<Config> m_config; Deleted: firebird/trunk/src/jrd/isc.h =================================================================== --- firebird/trunk/src/jrd/isc.h 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/isc.h 2010-06-25 11:55:11 UTC (rev 51284) @@ -1,195 +0,0 @@ -/* - * PROGRAM: JRD access method - * MODULE: isc.h - * DESCRIPTION: Common descriptions for general-purpose but non-user routines - * - * The contents of this file are subject to the Interbase 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.Inprise.com/IPL.html - * - * Software distributed under the License is distributed on an - * "AS IS" basis, 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 Inprise Corporation - * and its predecessors. Portions created by Inprise Corporation are - * Copyright (C) Inprise Corporation. - * - * All Rights Reserved. - * Contributor(s): ______________________________________. - * - * 26-Sept-2001 Paul Beach - External File Directory Config. Parameter - * 17-Oct-2001 Mike Nordell - CPU affinity - * 2002.10.29 Sean Leyne - Removed obsolete "Netware" port - * - * 2002.10.30 Sean Leyne - Removed support for obsolete "PC_PLATFORM" define - * - */ - -#ifndef JRD_ISC_H -#define JRD_ISC_H - -// Firebird platform-specific synchronization data structures - -#if defined(DARWIN) || defined(FREEBSD) -#define USE_SYS5SEMAPHORE -#endif - -#ifdef LINUX -// This hack fixes CORE-2896 - embedded connections fail on linux. -// Looks like a lot of linux kernels are buggy when working with PRIO_INHERIT mutexes. -#undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL -#endif - -#ifdef UNIX - -#if defined(USE_POSIX_THREADS) - -#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT_NP) - -#define USE_ROBUST_MUTEX - -#if defined(LINUX) && (!defined(__USE_GNU)) -#define __USE_GNU 1 // required on this OS to have this stuff declared -#endif // LINUX // should be defined before include <pthread.h> - AP 2009 - -#endif // ROBUST mutex - -#include <pthread.h> - -#ifdef USE_SYS5SEMAPHORE - -struct Sys5Semaphore -{ - int semSet; // index in shared memory table - unsigned short semNum; // number in semset - int getId(); -}; - -struct mtx : public Sys5Semaphore -{ -}; - -struct event_t : public Sys5Semaphore -{ - SLONG event_count; -}; - -#else - -struct mtx -{ - pthread_mutex_t mtx_mutex[1]; -}; - -struct event_t -{ - SLONG event_count; - int pid; - pthread_mutex_t event_mutex[1]; - pthread_cond_t event_cond[1]; -}; - -#endif // USE_SYS5SEMAPHORE - -#else -#error: Do not know how to declare shared mutex and event on this system. -#endif - -#define SH_MEM_STRUCTURE_DEFINED - -struct sh_mem -{ - UCHAR *sh_mem_address; - ULONG sh_mem_length_mapped; - SLONG sh_mem_handle; - TEXT sh_mem_name[MAXPATHLEN]; -}; - -#endif // UNIX - - -#ifdef WIN_NT -#include <windows.h> - -struct FAST_MUTEX_SHARED_SECTION -{ - SLONG fInitialized; - SLONG lSpinLock; - SLONG lThreadsWaiting; - SLONG lAvailable; -#ifdef _DEBUG - DWORD dwThreadId; -#endif -}; - -struct FAST_MUTEX -{ - HANDLE hEvent; - HANDLE hFileMap; - SLONG lSpinCount; - volatile FAST_MUTEX_SHARED_SECTION* lpSharedInfo; -}; - -struct mtx -{ - FAST_MUTEX mtx_fast; -}; - -struct event_t -{ - SLONG event_pid; - SLONG event_id; - SLONG event_count; - void* event_handle; -}; - -#define SH_MEM_STRUCTURE_DEFINED -struct sh_mem -{ - UCHAR* sh_mem_address; - ULONG sh_mem_length_mapped; - void* sh_mem_handle; - void* sh_mem_object; - void* sh_mem_interest; - void* sh_mem_hdr_object; - ULONG* sh_mem_hdr_address; - TEXT sh_mem_name[MAXPATHLEN]; -}; - -#endif // WIN_NT - -#ifndef SH_MEM_STRUCTURE_DEFINED - -#define SH_MEM_STRUCTURE_DEFINED -struct sh_mem -{ - UCHAR* sh_mem_address; - ULONG sh_mem_length_mapped; - SLONG sh_mem_handle; -}; - -#endif -#undef SH_MEM_STRUCTURE_DEFINED - - -// Interprocess communication configuration structure -// This was used to read to and write from the Config dialog when the server -// or the guardian is showing an icon in the tray. - -/* -struct ipccfg -{ - const char* ipccfg_keyword; - SCHAR ipccfg_key; - SLONG* ipccfg_variable; - SSHORT ipccfg_parent_offset; // Relative offset of parent keyword - USHORT ipccfg_found; // TRUE when keyword has been set -}; - -typedef ipccfg *IPCCFG; -*/ - -#endif // JRD_ISC_H Modified: firebird/trunk/src/jrd/isc_s_proto.h =================================================================== --- firebird/trunk/src/jrd/isc_s_proto.h 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/isc_s_proto.h 2010-06-25 11:55:11 UTC (rev 51284) @@ -29,9 +29,122 @@ #ifndef JRD_ISC_S_PROTO_H #define JRD_ISC_S_PROTO_H -#include "../jrd/isc.h" -// If that file wouldn't be included, we do a FW declaration of struct event_t here. +#include "../common/classes/alloc.h" +// Firebird platform-specific synchronization data structures + +#if defined(DARWIN) || defined(FREEBSD) +#define USE_SYS5SEMAPHORE // TODO: remap system objects to separate pages in System V case +#endif + +#ifdef LINUX +// This hack fixes CORE-2896 - embedded connections fail on linux. +// Looks like a lot of linux kernels are buggy when working with PRIO_INHERIT mutexes. +#undef HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL +#endif + +#if defined HAVE_MMAP || defined WIN_NT +#define HAVE_OBJECT_MAP +#endif + + +#ifdef UNIX + +#if defined(USE_POSIX_THREADS) + +#if defined(HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP) && defined(HAVE_PTHREAD_MUTEX_CONSISTENT_NP) + +#define USE_ROBUST_MUTEX + +#if defined(LINUX) && (!defined(__USE_GNU)) +#define __USE_GNU 1 // required on this OS to have this stuff declared +#endif // LINUX // should be defined before include <pthread.h> - AP 2009 + +#endif // ROBUST mutex + +#include <pthread.h> + +#ifdef USE_SYS5SEMAPHORE + +struct Sys5Semaphore +{ + int semSet; // index in shared memory table + unsigned short semNum; // number in semset + int getId(); +}; + +struct mtx : public Sys5Semaphore +{ +}; + +struct event_t : public Sys5Semaphore +{ + SLONG event_count; +}; + +#else + +struct mtx +{ + pthread_mutex_t mtx_mutex[1]; +}; + +struct event_t +{ + SLONG event_count; + int pid; + pthread_mutex_t event_mutex[1]; + pthread_cond_t event_cond[1]; +}; + +#endif // USE_SYS5SEMAPHORE + +#else // USE_POSIX_THREADS +#error: Do not know how to declare shared mutex and event on this system. +#endif // USE_POSIX_THREADS + +#define SH_MEM_STRUCTURE_DEFINED + +#endif // UNIX + + +#ifdef WIN_NT +#include <windows.h> + +struct FAST_MUTEX_SHARED_SECTION +{ + SLONG fInitialized; + SLONG lSpinLock; + SLONG lThreadsWaiting; + SLONG lAvailable; +#ifdef _DEBUG + DWORD dwThreadId; +#endif +}; + +struct FAST_MUTEX +{ + HANDLE hEvent; + HANDLE hFileMap; + SLONG lSpinCount; + volatile FAST_MUTEX_SHARED_SECTION* lpSharedInfo; +}; + +struct mtx +{ + FAST_MUTEX mtx_fast; +}; + +struct event_t +{ + SLONG event_pid; + SLONG event_id; + SLONG event_count; + void* event_handle; +}; + +#endif // WIN_NT + SLONG ISC_event_clear(event_t*); void ISC_event_fini(event_t*); int ISC_event_init(event_t*); @@ -39,42 +152,142 @@ int ISC_event_post(event_t*); int ISC_event_wait(event_t*, const SLONG, const SLONG); -typedef void (*FPTR_INIT_GLOBAL_REGION)(void*, struct sh_mem*, bool); -UCHAR* ISC_map_file(Firebird::Arg::StatusVector&, const TEXT*, FPTR_INIT_GLOBAL_REGION, - void*, ULONG, struct sh_mem*); -#if defined(WIN_NT) +#ifdef UNIX +int ISC_mutex_init(struct mtx*); +#endif + +#ifdef WIN_NT int ISC_mutex_init(struct mtx*, const TEXT*); -#else -int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped); +void ISC_mutex_fini(struct mtx*); #endif int ISC_mutex_lock(struct mtx*); int ISC_mutex_lock_cond(struct mtx*); int ISC_mutex_unlock(struct mtx*); -void ISC_mutex_fini(struct mtx*); -#if defined HAVE_MMAP || defined WIN_NT -UCHAR* ISC_map_object(Firebird::Arg::StatusVector&, sh_mem*, ULONG, ULONG); -void ISC_unmap_object(Firebird::Arg::StatusVector&, UCHAR**, ULONG); -#endif -int ISC_map_mutex(sh_mem* shmem_data, mtx* mutex, mtx** mapped); -void ISC_unmap_mutex(mtx* mutex); - #ifdef UNIX -void ISC_exception_post(ULONG, const TEXT*); void ISC_sync_signals_set(void*); void ISC_sync_signals_reset(); #endif -#ifdef WIN_NT ULONG ISC_exception_post(ULONG, const TEXT*); + +namespace Jrd { + +class MemoryHeader +{ +public: + USHORT mhb_type; + USHORT mhb_version; +#ifndef WIN_NT + struct mtx mhb_mutex; +#endif +}; + +class SharedMemoryBase +{ +public: + SharedMemoryBase(); + virtual ~SharedMemoryBase(); + + virtual bool initialize(bool) = 0; + + virtual void setHeader(MemoryHeader*) = 0; + virtual MemoryHeader* getHeader() const = 0; + + bool mapFile(Firebird::Arg::StatusVector& status, const TEXT* fileName, ULONG size); +#ifdef HAVE_OBJECT_MAP + UCHAR* mapObject(Firebird::Arg::StatusVector& status, ULONG offset, ULONG size); + void unmapObject(Firebird::Arg::StatusVector& status, UCHAR** object, ULONG size); #endif + bool remapFile(Firebird::Arg::StatusVector& status, ULONG newSize, bool truncateFlag); + void unmapFile(Firebird::Arg::StatusVector& status); + void removeMapFile(); -UCHAR* ISC_remap_file(Firebird::Arg::StatusVector&, struct sh_mem*, ULONG, bool); -void ISC_unmap_file(Firebird::Arg::StatusVector&, struct sh_mem*); + virtual void mutexBug(int osErrorCode, const char* text) = 0; + void mutexLock(); + bool mutexLockCond(); + void mutexUnlock(); -void ISC_remove_map_file(const TEXT* filename); -void ISC_remove_map_file(const struct sh_mem*); +public: +#ifdef WIN_NT + struct mtx sh_mem_winMutex; +#endif + struct mtx* sh_mem_mutex; + ULONG sh_mem_length_mapped; +#ifdef WIN_NT + void* sh_mem_handle; + void* sh_mem_object; + void* sh_mem_interest; + void* sh_mem_hdr_object; + ULONG* sh_mem_hdr_address; +#else + int sh_mem_handle; +#endif + TEXT sh_mem_name[MAXPATHLEN]; + +public: + enum MemoryTypes + { + SRAM_LOCK_MANAGER = 0xFF, // To avoid mixing with old files no matter of endianness + SRAM_DATABASE_SNAPSHOT = 0xFE, // use downcount for shared memeory types + SRAM_EVENT_MANAGER = 0xFD, + SRAM_TRACE_CONFIG = 0xFC, + SRAM_TRACE_LOG = 0xFB + }; + +protected: + void logError(const char* text, const Firebird::Arg::StatusVector& status); +}; + +template <class Header> // Header must be "public MemoryHeader" +class SharedMemory : public SharedMemoryBase +{ +public: + SharedMemory() + : SharedMemoryBase(), sh_mem_header(NULL) { } + ~SharedMemory() + { + if (sh_mem_header) + { + Firebird::Arg::StatusVector status; + unmapFile(status); + if (status.hasData()) + { + logError("Failed unmapFile() in SharedMemory's dtor", status); + } + } + } + +#ifdef HAVE_OBJECT_MAP + template <class Object> Object* mapObject(Firebird::Arg::StatusVector& status, ULONG offset) + { + return (Object*) SharedMemoryBase::mapObject(status, offset, sizeof(Object)); + } + + template <class Object> void unmapObject(Firebird::Arg::StatusVector& status, Object** object) + { + SharedMemoryBase::unmapObject(status, (UCHAR**) object, sizeof(Object)); + } +#endif + +private: + void setHeader(MemoryHeader* hdr) + { + sh_mem_header = (Header*) hdr; + } + + MemoryHeader* getHeader() const + { + return sh_mem_header; + } + +public: + Header* volatile sh_mem_header; +}; + +} // namespace Jrd + #endif // JRD_ISC_S_PROTO_H Modified: firebird/trunk/src/jrd/isc_sync.cpp =================================================================== --- firebird/trunk/src/jrd/isc_sync.cpp 2010-06-25 09:06:55 UTC (rev 51283) +++ firebird/trunk/src/jrd/isc_sync.cpp 2010-06-25 11:55:11 UTC (rev 51284) @@ -53,7 +53,6 @@ //#include "../common/classes/timestamp.h" #include "../jrd/common.h" #include "gen/iberror.h" -#include "../jrd/isc.h" #include "../jrd/gds_proto.h" #include "../jrd/isc_proto.h" #include "../jrd/os/isc_i_proto.h" @@ -68,6 +67,7 @@ #include "../common/config/config.h" #include "../common/utils_proto.h" #include "../common/StatusArg.h" +#include "../jrd/jrd_pwd.h" #ifdef UNIX #include <setjmp.h> @@ -515,8 +515,8 @@ class SharedFile { public: - SharedFile(const char* pName, UCHAR* address, int length) - : fileNum(semTable->addFileByName(pName)), from(address), to(address + length) + SharedFile(const char* pName, void* address, int length) + : fileNum(semTable->addFileByName(pName)), from((UCHAR*) address), to(from + length) { } SharedFile() : fileNum(0), from(0), to(0) { } @@ -557,15 +557,16 @@ } } - static void remap(UCHAR* const from, UCHAR* to, int newLength) + static void remap(void* const f, void* const to, int newLength) { MutexLockGuard guard(mutex); + UCHAR* const from = (UCHAR*) f; for (unsigned int n = 0; n < sharedFiles.getCount(); ++n) { if (from == sharedFiles[n].from) { - sharedFiles[n].from = to; - sharedFiles[n].to = to + newLength; + sharedFiles[n].from = (UCHAR*) to; + sharedFiles[n].to = sharedFiles[n].from + newLength; return; } } @@ -1416,7 +1417,7 @@ #ifdef UNIX -void ISC_exception_post(ULONG sig_num, const TEXT* err_msg) +ULONG ISC_exception_post(ULONG sig_num, const TEXT* err_msg) { /************************************** * @@ -1492,6 +1493,8 @@ gds__free(log_msg); } abort(); + + return 0; // compiler silencer } #endif // UNIX @@ -1676,11 +1679,11 @@ } #endif // WIN_NT -void ISC_remove_map_file(const TEXT* filename) +void SharedMemoryBase::removeMapFile() { #ifndef WIN_NT TEXT expanded_filename[MAXPATHLEN]; - gds__prefix_lock(expanded_filename, filename); + gds__prefix_lock(expanded_filename, sh_mem_name); // We can't do much (specially in dtors) when it fails // therefore do not check for errors - at least it's just /tmp. @@ -1688,19 +1691,10 @@ #endif // WIN_NT } -void ISC_remove_map_file(const struct sh_mem* shmem_data) -{ - ISC_remove_map_file(shmem_data->sh_mem_name); -} - #ifdef UNIX -UCHAR* ISC_map_file(Arg::StatusVector& statusVector, - const TEXT* filename, - FPTR_INIT_GLOBAL_REGION init_routine, - void* init_arg, - ULONG length, - sh_mem* shmem_data) +bool SharedMemoryBase::mapFile(Firebird::Arg::StatusVector& statusVector, + const TEXT* filename, ULONG length) { /************************************** * @@ -1715,6 +1709,8 @@ * **************************************/ + setHeader(NULL); + TEXT expanded_filename[MAXPATHLEN]; gds__prefix_lock(expanded_filename, filename); @@ -1740,7 +1736,7 @@ if (fd_init == -1) { error(statusVector, "open", errno); - return NULL; + return false; } // get an exclusive lock on the INIT file with blocking @@ -1749,7 +1745,9 @@ initLock.setDtorMode(FileLock::OPENED); #endif if (!initLock.exclusive()) - return NULL; + { + return false; + } // init file is locked - no races possible later in this function @@ -1762,13 +1760,13 @@ if (f == -1) { error(statusVector, "open", errno); - return NULL; + return false; } void* sTab = mmap(0, sizeof(SemTable), PROT_READ | PROT_WRITE, MAP_SHARED, f, 0); if ((U_IPTR) sTab == (U_IPTR) -1) { error(statusVector, "mmap", errno); - return NULL; + return false; } fdSem = f; @@ -1784,7 +1782,9 @@ semTable->init(); } if (!semLock.shared()) - return NULL; + { + return false; + } #endif // open the file to be inited @@ -1792,7 +1792,7 @@ if (fd == -1) { error(statusVector, "open", errno); - return NULL; + return false; } // create lock in order to have file autoclosed on error @@ -1805,7 +1805,7 @@ if (fstat(fd, &file_stat) == -1) { error(statusVector, "fstat", errno); - return NULL; + return false; } length = file_stat.st_size; @@ -1813,23 +1813,18 @@ { // keep old text of message here - will be assigned a bit later error(statusVector, "shmem_data->sh_mem_length_mapped is 0", 0); - return NULL; + return false; } } // map file to memory - UCHAR* const address = (UCHAR *) mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); + void* const address = mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if ((U_IPTR) address == (U_IPTR) -1) { error(statusVector, "mmap", errno); - return NULL; + return false; } - shmem_data->sh_mem_address = address; - shmem_data->sh_mem_length_mapped = length; - shmem_data->sh_mem_handle = fd; - strcpy(shmem_data->sh_mem_name, filename); - #ifdef USE_SYS5SEMAPHORE // register mapped file // this class is needed to auto-unregister it in case of failure @@ -1859,40 +1854,59 @@ sfHolder holder(SharedFile(expanded_filename, address, length)); #endif + MemoryHeader* hdr = (MemoryHeader*) address; + setHeader(hdr); + sh_mem_length_mapped = length; + sh_mem_handle = fd; + strcpy(sh_mem_name, filename); +#if defined(HAVE_OBJECT_MAP) && (!defined(USE_SYS5SEMAPHORE)) + sh_mem_mutex = (mtx*) mapObject(statusVector, OFFSET(MemoryHeader*, mhb_mutex), sizeof(mtx)); + if (!sh_mem_mutex) + { + munmap(address, length); + setHeader(NULL); + return false; + } +#else + sh_mem_mutex = &hdr->mhb_mutex; +#endif + // Try to get an exclusive lock on the lock file. This will // fail if somebody else has the exclusive or shared lock if (mainLock.tryExclusive()) { - if (!init_routine) - { - munmap((char *) address, length); - statusVector << Arg::Gds(isc_unavailable); - return NULL; - } - if (trunc_flag) ftruncate(fd, length); - (*init_routine) (init_arg, shmem_data, true); - - if (!mainLock.tryShared()) + if (initialize(true)) { - munmap((char *) address, length); - return NULL; + int mtxState = ISC_mutex_init(sh_mem_mutex); + if (mtxState != 0) + { + mutexBug(mtxState, "ISC_init_mutex"); + } + + if (!mainLock.tryShared()) + { + munmap(address, length); + setHeader(NULL); + return false; + } } } else { - if (!mainLock.tryShared()) + if (initialize(false)) { - munmap((char *) address, length); - return NULL; + if (!mainLock.tryShared()) + { + munmap(address, length); + setHeader(NULL); + return false; + } } - - if (init_routine) - (*init_routine) (init_arg, shmem_data, false); } // keep opened the shared file_decriptor @@ -1905,19 +1919,15 @@ holder.materialize(); #endif - return address; + return true; } #endif // UNIX #ifdef WIN_NT -UCHAR* ISC_map_file(Arg::StatusVector& statusVector, - const TEXT* filename, - FPTR_INIT_GLOBAL_REGION init_routine, - void* init_arg, - ULONG length, - sh_mem* shmem_data) +bool SharedMemoryBase::mapFile(Firebird::Arg::StatusVector& statusVector, + const TEXT* filename, ULONG length) { /************************************** * @@ -1931,6 +1941,12 @@ * routine (if given) or punt (leaving the file unmapped). * **************************************/ + + setHeader(NULL); + + ISC_mutex_init(&sh_mem_winMutex, filename); + sh_mem_mutex = &sh_mem_winMutex; + HANDLE file_handle; HANDLE event_handle = 0; int retry_count = 0; @@ -1961,7 +1977,7 @@ goto retry; error(statusVector, "CreateFile", GetLastError()); - return NULL; + return false; } // Check if file already exists @@ -1976,7 +1992,7 @@ { error(statusVector, "make_object_name", GetLastError()); CloseHandle(file_handle); - return NULL; + return false; } if (!init_flag) @@ -1986,17 +2002,17 @@ { error(statusVector, "CreateEvent", GetLastError()); CloseHandle(file_handle); - return NULL; + return false; } init_flag = (GetLastError() != ERROR_ALREADY_EXISTS); - if (init_flag && !init_routine) + if (init_flag && false) { CloseHandle(event_handle); CloseHandle(file_handle); statusVector << Arg::Gds(isc_unavailable); - return NULL; + return false; } } @@ -2009,7 +2025,7 @@ error(statusVector, "GetFileSize", GetLastError()); CloseHandle(event_handle); CloseHandle(file_handle); - return NULL; + return false; } } @@ -2035,7 +2051,7 @@ if (retry_count > 10) { error(statusVector, "WaitForSingleObject", 0); - return NULL; + return false; } goto retry; } @@ -2072,7 +2088,7 @@ error(statusVector, "CreateFile", err); CloseHandle(event_handle); - return NULL; + return false; } // Create a file mapping object that will be used to make remapping possible. @@ -2083,7 +2099,7 @@ error(statusVector, "make_object_name", GetLastError()); CloseHandle(event_handle); CloseHandle(file_handle); - return NULL; + return false; } HANDLE header_obj = CreateFileMapping(INVALID_HANDLE_VALUE, @@ -2096,7 +2112,7 @@ error(statusVector, "CreateFileMapping", GetLastError()); CloseHandle(event_handle); CloseHandle(file_handle); - return NULL; + return false; } if (!init_flag && GetLastError() != ERROR_ALREADY_EXISTS) @@ -2118,7 +2134,7 @@ CloseHandle(header_obj); CloseHandle(event_handle); CloseHandle(file_handle); - return NULL; + return false; } // Set or get the true length of the file depending on whether or not we are the first user. @@ -2143,7 +2159,7 @@ CloseHandle(header_obj); CloseHandle(event_handle); CloseHandle(file_handle); - return NULL; + return false; } HANDLE file_obj = CreateFileMapping(file_handle, @@ -2158,7 +2174,7 @@ CloseHandle(header_obj); CloseHandle(event_handle); CloseHandle(file_handle); - return NULL; + return false; } UCHAR* const address = (UCHAR*) MapViewOfFile(file_obj, FILE_MAP_WRITE, 0, 0, 0); @@ -2171,54 +2187,49 @@ CloseHandle(header_obj); CloseHandle(event_handle); CloseHandle(file_handle); - return NULL; + return false; } - shmem_data->sh_mem_address = address; - shmem_data->sh_mem_length_mapped = length; + MemoryHeader* hdr = (MemoryHeader*) address; + setHeader(hdr); + sh_mem_length_mapped = length; - if (!shmem_data->sh_mem_length_mapped) + if (!sh_mem_length_mapped) { - error(statusVector, "shmem_data->sh_mem_length_mapped is 0", 0); - return NULL; + error(statusVector, "sh_mem_length_mapped is 0", 0); + return false; } - shmem_data->sh_mem_handle = file_handle; - shmem_data->sh_mem_object = file_obj; - shmem_data->sh_mem_interest = event_handle; - shmem_data->sh_mem_hdr_object = header_obj; - shmem_data->sh_mem_hdr_address = header_address; - strcpy(shmem_data->sh_mem_name, filename); + sh_mem_handle = file_handle; + sh_mem_object = file_obj; + sh_mem_interest = event_handle; + sh_mem_hdr_object = header_obj; + sh_mem_hdr_address = header_address; + strcpy(sh_mem_name, filename); - if (init_routine) - (*init_routine) (init_arg, shmem_data, init_flag); + initialize(init_flag); if (init_flag) { FlushViewOfFile(address, 0); SetEvent(event_handle); - if (SetFilePointer(shmem_data->sh_mem_handle, length, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER || - !SetEndOfFile(shmem_data->sh_mem_handle) || - !FlushViewOfFile(shmem_data->sh_mem_address, 0)) + if (SetFilePointer(sh_mem_handle, length, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER || + !SetEndOfFile(sh_mem_handle) || + !FlushViewOfFile(address, 0)) { error(statusVector, "SetFilePointer", GetLastError()); - return NULL; + return false; } } - return address; + return true; } #endif #ifdef HAVE_MMAP -#define HAVE_MAP_OBJECT 1 - -UCHAR* ISC_map_object(Arg::StatusVector& statusVector, - sh_mem* shmem_data, - ULONG object_offset, - ULONG object_length) +UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector, ULONG object_offset, ULONG object_length) { /************************************** * @@ -2230,6 +2241,7 @@ * Try to map an object given a file mapping. * **************************************/ + // Get system page size as this is the unit of mapping. #ifdef SOLARIS @@ -2254,7 +2266,7 @@ const ULONG start = (object_offset / page_size) * page_size; const ULONG end = FB_ALIGN(object_offset + object_length, page_size); const ULONG length = end - start; - int fd = shmem_data->sh_mem_handle; + int fd = sh_mem_handle; UCHAR* address = (UCHAR*) mmap(0, length, PROT_READ | PROT_WRITE, MAP_SHARED, fd, start); @@ -2268,11 +2280,11 @@ IPC_TRACE(("ISC_map_object in %p to %p %p\n", shmem_data->sh_mem_address, address, address + length)); - return (address + (object_offset - start)); + return address + (object_offset - start); } -void ISC_unmap_object(Arg::StatusVector& statusVector, UCHAR** object_pointer, ULONG object_length) +void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, UCHAR** object_pointer, ULONG object_length) { /************************************** * @@ -2325,12 +2337,9 @@ #ifdef WIN_NT -#define HAVE_MAP_OBJECT 1 - -UCHAR* ISC_map_object(Arg::StatusVector& statusVector, - sh_mem* shmem_data, - ULONG object_offset, - ULONG object_length) +UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector, + ULONG object_offset, + ULONG object_length) { /************************************** * @@ -2353,7 +2362,7 @@ const ULONG start = (object_offset / page_size) * page_size; const ULONG end = FB_ALIGN(object_offset + object_length, page_size); const ULONG length = end - start; - const HANDLE handle = shmem_data->sh_mem_object; + const HANDLE handle = sh_mem_object; UCHAR* address = (UCHAR*) MapViewOfFile(handle, FILE_MAP_WRITE, 0, start, length); @@ -2369,7 +2378,8 @@ } -void ISC_unmap_object(Arg::StatusVector& statusVector, UCHAR** object_pointer, ULONG /*object_length*/) +void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, + UCHAR** object_pointer, ULONG object_length) { /************************************** * @@ -2400,42 +2410,14 @@ } #endif -int ISC_map_mutex(sh_mem* shmem_data, mtx* mutex, mtx** mapped) -{ -#ifdef HAVE_MAP_OBJECT - Arg::StatusVector temp; - mutex = reinterpret_cast<mtx*>(ISC_map_object(temp, shmem_data, - reinterpret_cast<UCHAR*>(mutex) - shmem_data->sh_mem_address, sizeof(mtx))); - if (!mutex) - { - iscLogStatus("ISC_map_mutex()", temp.value()); - return -1; - } -#endif // HAVE_MAP_OBJECT - *mapped = mutex; - return 0; -} - -void ISC_unmap_mutex(mtx* mutex) -{ -#ifdef HAVE_MAP_OBJECT - Arg::StatusVector temp; - ISC_unmap_object(temp, reinterpret_cast<UCHAR**>(&mutex), sizeof(mtx)); - if (mutex) - { - iscLogStatus("ISC_unmap_mutex()", temp.value()); - } -#endif // HAVE_MAP_OBJECT - -} - - #ifdef USE_POSIX_THREADS #ifdef USE_SYS5SEMAPHORE -int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped) + + +int ISC_mutex_init(struct mtx* mutex) { /************************************** * @@ -2448,13 +2430,6 @@ * **************************************/ - if (ISC_map_mutex(shmem_data, mutex, mapped) != 0) - { - return -1; // no errno known here... - } - - mutex = *mapped; - if (!getSem5(mutex)) { return FB_FAILURE; @@ -2465,31 +2440,13 @@ int state = semctl(mutex->getId(), mutex->semNum, SETVAL, arg); if (state == -1) { - iscLogStatus("ISC_mutex_init()", - (Arg::Gds(isc_sys_request) << Arg::Str("semctl") << SYS_ERR(errno)).value()); - return FB_FAILURE; + return errno; } return 0; } -void ISC_mutex_fini(struct mtx *mutex) -{ -/************************************** - * - * m u t e x _ f i n i ( S Y S V ) - * - ************************************** - * - * Functional description - * Destroy a mutex. - * - **************************************/ - ISC_unmap_mutex(mutex); -} - - int ISC_mutex_lock(struct mtx* mutex) { /************************************** @@ -2592,7 +2549,7 @@ static volatile bool staticBugFlag = false; #endif -int ISC_mutex_init(sh_mem* shmem_data, struct mtx* mutex, struct mtx** mapped) +int ISC_mutex_init(struct mtx* mutex) { /************************************** * @@ -2605,13 +2562,6 @@ * **************************************/ - if (ISC_map_mutex(shmem_data, mutex, mapped) != 0) - { - return -1; // no errno known here... - } - - mutex = *mapped; - #ifdef BUGGY_LINUX_MUTEX do { @@ -2688,22 +2638,6 @@ } -void ISC_mutex_fini(struct mtx *mutex) -{ -/************************************** - * - * m u t e x _ f i n i ( P O S I X _ T H R E A D S ) - * - ************************************** - * - * Functional description - * Destroy a mutex. - * - **************************************/ - ISC_unmap_mutex(mutex); -} - - int ISC_mutex_lock(struct mtx* mutex) { /************************************** @@ -3177,10 +3111,7 @@ #ifdef UNIX #ifdef HAVE_MMAP #define ISC_REMAP_FILE_DEFINED -UCHAR* ISC_remap_file(Arg::StatusVector& statusVector, - sh_mem* shmem_data, - ULONG new_length, - bool flag) +bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG new_length, bool flag) { /************************************** * @@ -3192,29 +3123,36 @@ * Try to re-map a given file. * **************************************/ + if (!new_length) + { + error(statusVector, "Zero new_length is requested", 0); + return false; + } + if (flag) - ftruncate(shmem_data->sh_mem_handle, new_length); + ftruncate(sh_mem_handle, new_length); - UCHAR* const address = (UCHAR*) - mmap(0, new_length, PROT_READ | PROT_WRITE, MAP_SHARED, shmem_data->sh_mem_handle, 0); + MemoryHeader* const address = (MemoryHeader*) + mmap(0, new_length, PROT_READ | PROT_WRITE, MAP_SHARED, sh_mem_handle, 0); if ((U_IPTR) address == (U_IPTR) -1) - return NULL; + { + error(statusVector, "mmap() failed", errno); + return false; + } - munmap((char *) shmem_data->sh_mem_address, shmem_data->sh_mem_length_mapped); + munmap((char *) getHeader(), sh_mem_length_mapped); #ifdef USE_SYS5SEMAPHORE - SharedFile::remap(shmem_data->sh_mem_address, address, new_length); + SharedFile::remap(getHeader(), address, new_length); #endif - IPC_TRACE(("ISC_remap_file %p to %p %p\n", shmem_data->sh_mem_address, address, address + new_length)); + IPC_TRACE(("ISC_remap_file %p to %p %d\n", getHeader(), address, new_length)); - shmem_data->sh_mem_address = address; - shmem_data->sh_mem_length_mapped = new_length; + setHeader(address); + sh_mem_length_mapped = new_length; - if (!shmem_data->sh_mem_length_mapped) - { - error(statusVector, "shmem_data->sh_mem_length_mapped is 0", 0); - return NULL; - } +#if (!defined(HAVE_OBJECT_MAP)) || defined(USE_SYS5SEMAPHORE) + sh_mem_mutex = &getHeader()->mhb_mutex; +#endif return address; } @@ -3224,10 +3162,8 @@ #ifdef WIN_NT #define ISC_REMAP_FILE_DEFINED -UCHAR* ISC_remap_file(Arg::StatusVector& statusVector, - sh_mem* shmem_data, - ULONG new_length, - bool flag) +bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, + ULONG new_length, bool flag) { /************************************** * @@ -3242,9 +3178,9 @@ if (flag) { - if (SetFilePointer(shmem_data->sh_mem_handle, new_length, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER || - !SetEndOfFile(shmem_data->sh_mem_handle) || - !FlushViewOfFile(shmem_data->sh_mem_address, 0)) + if (SetFilePointer(sh_mem_handle, new_length, NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER || + !SetEndOfFile(sh_mem_handle) || + !FlushViewOfFile(getHeader(), 0)) { error(statusVector, "SetFilePointer", GetLastError()); return NULL; @@ -3267,13 +3203,13 @@ while (true) { TEXT mapping_name[64]; // enough for int32 as text - sprintf(mapping_name, "_mapping_%"ULONGFORMAT, shmem_data->sh_mem_hdr_address[1] + 1); + sprintf(mapping_name, "_mapping_%"ULONGFORMAT, sh_mem_hdr_address[1] + 1); TEXT object_name[MAXPATHLEN]; - if (!make_object_name(object_name, sizeof(object_name), shmem_data->sh_mem_name, mapping_name)) + if (!make_object_name(object_name, sizeof(object_name), sh_mem_name, mapping_name)) break; - file_obj = CreateFileMapping(shmem_data->sh_mem_handle, + file_obj = CreateFileMapping(sh_mem_handle, ISC_get_security_desc(), PAGE_READWRITE, 0, new_length, @@ -3284,7 +3220,7 @@ CloseHandle(file_obj); file_obj = NULL; - shmem_data->sh_mem_hdr_address[1]++; + sh_mem_hdr_address[1]++; } if (file_obj == NULL) @@ -3293,7 +3229,7 @@ return NULL; } - void* const address = MapViewOfFile(file_obj, FILE_MAP_WRITE, 0, 0, 0); + MemoryHeader* const address = (MemoryHeader*) MapViewOfFile(file_obj, FILE_MAP_WRITE, 0, 0, 0); if (address == NULL) { @@ -3304,33 +3240,30 @@ if (flag) { - shmem_data->sh_mem_hdr_address[0] = new_length; - shmem_data->sh_mem_hdr_address[1]++; + sh_mem_hdr_address[0] = new_length; + sh_mem_hdr_address[1]++; } - UnmapViewOfFile(shmem_data->sh_mem_address); - CloseHandle(shmem_data->sh_mem_object); + UnmapViewOfFile(getHeader()); + CloseHandle(sh_mem_object); - shmem_data->sh_mem_address = static_cast<UCHAR*>(address); - shmem_data->sh_mem_length_mapped = new_length; - shmem_data->sh_mem_object = file_obj; + setHeader(address); + sh_mem_length_mapped = new_length; + sh_mem_object = file_obj; - if (!shmem_data->sh_mem_length_mapped) + if (!sh_mem_length_mapped) { - error(statusVector, "shmem_data->sh_mem_length_mapped is 0", 0); + error(statusVector, "sh_mem_length_mapped is 0", 0); return NULL; } - return static_cast<UCHAR*>(address); + return (address); } #endif #ifndef ISC_REMAP_FILE_DEFINED -UCHAR* ISC_remap_file(Arg::StatusVector& statusVector, - sh_mem* shmem_data, - ULONG new_length, - bool flag) +bool SharedMemoryBase::remapFile(Firebird::Arg::StatusVector& statusVector, ULONG, bool) { /************************************** * @@ -3343,7 +3276,8 @@ * **************************************/ - statusVector << Arg::Gds(isc_unavailable); + statusVector << Arg::Gds(isc_unavailable) << + Arg::Gds(isc_random) << "SharedMemory::remapFile"; return NULL; } @@ -3397,7 +3331,7 @@ #endif // UNIX #ifdef UNIX -void ISC_unmap_file(Arg::StatusVector& statusVector, sh_mem* shmem_data) +void SharedMemoryBase::unmapFile(Arg::StatusVector& statusVector) { /************************************** * @@ -3418,24 +3352,28 @@ } else { - SharedFile* sf = SharedFile::locate(shmem_data->sh_mem_address); + SharedFile* sf = SharedFile::locate(getHeader()); - FileLock lock(statusVector, shmem_data->sh_mem_handle); + FileLock lock(statusVector, sh_mem_handle); lock.setLevel(FileLock::LCK_SHARED); semTable->cleanup(sf->getNum(), lock.tryExclusive()); - SharedFile::remove(shmem_data->sh_mem_address); + SharedFile::remove(getHeader()); } --sharedCount; #endif - munmap((char *) shmem_data->sh_mem_address, shmem_data->sh_mem_length_mapped); +#if defined(HAVE_OBJECT_MAP) && (!defined(USE_SYS5SEMAPHORE)) + unmapObject(statusVector, (UCHAR**) sh_mem_mutex, sizeof(mtx)); +... [truncated message content] |
From: <asf...@us...> - 2010-06-26 01:19:00
|
Revision: 51286 http://firebird.svn.sourceforge.net/firebird/?rev=51286&view=rev Author: asfernandes Date: 2010-06-26 01:18:53 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/jrd/event_proto.h firebird/trunk/src/jrd/isc_s_proto.h firebird/trunk/src/jrd/isc_sync.cpp firebird/trunk/src/jrd/trace/TraceConfigStorage.h firebird/trunk/src/lock/lock.cpp firebird/trunk/src/lock/lock_proto.h firebird/trunk/src/lock/print.cpp Modified: firebird/trunk/src/jrd/event_proto.h =================================================================== --- firebird/trunk/src/jrd/event_proto.h 2010-06-25 12:16:28 UTC (rev 51285) +++ firebird/trunk/src/jrd/event_proto.h 2010-06-26 01:18:53 UTC (rev 51286) @@ -98,12 +98,14 @@ return 0; } -/* static void init_shmem(void* arg, sh_mem* shmem, bool init) + /* + static void init_shmem(void* arg, sh_mem* shmem, bool init) { EventManager* const eventMgr = static_cast<EventManager*>(arg); eventMgr->init_shmem(shmem, init); } -*/ + */ + static void mutex_bugcheck(const TEXT*, int); static void punt(const TEXT*); Modified: firebird/trunk/src/jrd/isc_s_proto.h =================================================================== --- firebird/trunk/src/jrd/isc_s_proto.h 2010-06-25 12:16:28 UTC (rev 51285) +++ firebird/trunk/src/jrd/isc_s_proto.h 2010-06-26 01:18:53 UTC (rev 51286) @@ -113,12 +113,12 @@ struct FAST_MUTEX_SHARED_SECTION { - SLONG fInitialized; - SLONG lSpinLock; - SLONG lThreadsWaiting; - SLONG lAvailable; + SLONG fInitialized; + SLONG lSpinLock; + SLONG lThreadsWaiting; + SLONG lAvailable; #ifdef _DEBUG - DWORD dwThreadId; + DWORD dwThreadId; #endif }; @@ -126,7 +126,7 @@ { HANDLE hEvent; HANDLE hFileMap; - SLONG lSpinCount; + SLONG lSpinCount; volatile FAST_MUTEX_SHARED_SECTION* lpSharedInfo; }; @@ -137,10 +137,10 @@ struct event_t { - SLONG event_pid; - SLONG event_id; - SLONG event_count; - void* event_handle; + SLONG event_pid; + SLONG event_id; + SLONG event_count; + void* event_handle; }; #endif // WIN_NT @@ -182,7 +182,7 @@ USHORT mhb_version; #ifndef WIN_NT struct mtx mhb_mutex; -#endif +#endif }; class SharedMemoryBase @@ -232,7 +232,7 @@ enum MemoryTypes { SRAM_LOCK_MANAGER = 0xFF, // To avoid mixing with old files no matter of endianness - SRAM_DATABASE_SNAPSHOT = 0xFE, // use downcount for shared memeory types + SRAM_DATABASE_SNAPSHOT = 0xFE, // use downcount for shared memory types SRAM_EVENT_MANAGER = 0xFD, SRAM_TRACE_CONFIG = 0xFC, SRAM_TRACE_LOG = 0xFB @@ -247,7 +247,9 @@ { public: SharedMemory() - : SharedMemoryBase(), sh_mem_header(NULL) { } + : SharedMemoryBase(), sh_mem_header(NULL) + { } + ~SharedMemory() { if (sh_mem_header) Modified: firebird/trunk/src/jrd/isc_sync.cpp =================================================================== --- firebird/trunk/src/jrd/isc_sync.cpp 2010-06-25 12:16:28 UTC (rev 51285) +++ firebird/trunk/src/jrd/isc_sync.cpp 2010-06-26 01:18:53 UTC (rev 51286) @@ -1617,7 +1617,7 @@ "\tto terminate abnormally.", err_msg); break; case EXCEPTION_STACK_OVERFLOW: - Firebird::status_exception::raise(Firebird::Arg::Gds(isc_exception_stack_overflow)); + status_exception::raise(Arg::Gds(isc_exception_stack_overflow)); // This will never be called, but to be safe it's here result = (ULONG) EXCEPTION_CONTINUE_EXECUTION; is_critical = false; @@ -1693,7 +1693,7 @@ #ifdef UNIX -bool SharedMemoryBase::mapFile(Firebird::Arg::StatusVector& statusVector, +bool SharedMemoryBase::mapFile(Arg::StatusVector& statusVector, const TEXT* filename, ULONG length) { /************************************** @@ -1926,7 +1926,7 @@ #ifdef WIN_NT -bool SharedMemoryBase::mapFile(Firebird::Arg::StatusVector& statusVector, +bool SharedMemoryBase::mapFile(Arg::StatusVector& statusVector, const TEXT* filename, ULONG length) { /************************************** @@ -2337,8 +2337,8 @@ #ifdef WIN_NT -UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector, - ULONG object_offset, +UCHAR* SharedMemoryBase::mapObject(Arg::StatusVector& statusVector, + ULONG object_offset, ULONG object_length) { /************************************** @@ -2378,7 +2378,7 @@ } -void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, +void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, UCHAR** object_pointer, ULONG object_length) { /************************************** @@ -3140,7 +3140,7 @@ return false; } - munmap((char *) getHeader(), sh_mem_length_mapped); + munmap((char*) getHeader(), sh_mem_length_mapped); #ifdef USE_SYS5SEMAPHORE SharedFile::remap(getHeader(), address, new_length); @@ -3162,7 +3162,7 @@ #ifdef WIN_NT #define ISC_REMAP_FILE_DEFINED -bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, +bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG new_length, bool flag) { /************************************** @@ -3263,7 +3263,7 @@ #ifndef ISC_REMAP_FILE_DEFINED -bool SharedMemoryBase::remapFile(Firebird::Arg::StatusVector& statusVector, ULONG, bool) +bool SharedMemoryBase::remapFile(Arg::StatusVector& statusVector, ULONG, bool) { /************************************** * @@ -3276,7 +3276,7 @@ * **************************************/ - statusVector << Arg::Gds(isc_unavailable) << + statusVector << Arg::Gds(isc_unavailable) << Arg::Gds(isc_random) << "SharedMemory::remapFile"; return NULL; @@ -3628,7 +3628,7 @@ } SharedMemoryBase::SharedMemoryBase() - : sh_mem_mutex(0), sh_mem_length_mapped(0), + : sh_mem_mutex(0), sh_mem_length_mapped(0), #ifdef WIN_NT sh_mem_handle(0), sh_mem_object(0), sh_mem_interest(0), sh_mem_hdr_object(0), sh_mem_hdr_address(0) @@ -3643,7 +3643,7 @@ { } -void SharedMemoryBase::logError(const char* text, const Firebird::Arg::StatusVector& status) +void SharedMemoryBase::logError(const char* text, const Arg::StatusVector& status) { iscLogStatus(text, status.value()); } Modified: firebird/trunk/src/jrd/trace/TraceConfigStorage.h =================================================================== --- firebird/trunk/src/jrd/trace/TraceConfigStorage.h 2010-06-25 12:16:28 UTC (rev 51285) +++ firebird/trunk/src/jrd/trace/TraceConfigStorage.h 2010-06-26 01:18:53 UTC (rev 51286) @@ -41,7 +41,7 @@ volatile ULONG change_number; volatile ULONG session_number; ULONG cnt_uses; - char cfg_file_name[MAXPATHLEN]; + char cfg_file_name[MAXPATHLEN]; }; class ConfigStorage : public Firebird::GlobalStorage, public SharedMemory<TraceCSHeader> Modified: firebird/trunk/src/lock/lock.cpp =================================================================== --- firebird/trunk/src/lock/lock.cpp 2010-06-25 12:16:28 UTC (rev 51285) +++ firebird/trunk/src/lock/lock.cpp 2010-06-26 01:18:53 UTC (rev 51286) @@ -1061,7 +1061,7 @@ ULONG spins = 0; while (spins++ < m_acquireSpins) { - if (mutexLockCond()) + if (mutexLockCond()) { status = FB_SUCCESS; break; @@ -1199,7 +1199,7 @@ #ifdef USE_SHMEM_EXT -bool LockManager::Extent::initialize(bool) +bool LockManager::Extent::initialize(bool) { return false; } @@ -2310,7 +2310,7 @@ } #endif - if (!initializeMemory) + if (!initializeMemory) { return true; } Modified: firebird/trunk/src/lock/lock_proto.h =================================================================== --- firebird/trunk/src/lock/lock_proto.h 2010-06-25 12:16:28 UTC (rev 51285) +++ firebird/trunk/src/lock/lock_proto.h 2010-06-26 01:18:53 UTC (rev 51286) @@ -311,8 +311,8 @@ class Database; -class LockManager : public Firebird::RefCounted, - public Firebird::GlobalStorage, +class LockManager : public Firebird::RefCounted, + public Firebird::GlobalStorage, public SharedMemory<lhb> { typedef Firebird::GenericMap<Firebird::Pair<Firebird::Left<Firebird::string, LockManager*> > > DbLockMgrMap; @@ -446,30 +446,34 @@ public: Extent() { } Extent(Firebird::MemoryPool&) { } - Extent(const SharedMemoryBase& p) - { + + Extent(const SharedMemoryBase& p) + { assign(p); } - Extent(Firebird::MemoryPool&, const SharedMemoryBase& p) - { + + Extent(Firebird::MemoryPool&, const SharedMemoryBase& p) + { assign(p); } - Extent& operator=(const SharedMemoryBase& p) - { - assign(p); - return *this; - } ~Extent() { sh_mem_header = NULL; // avoid unmapping in dtor } + Extent& operator=(const SharedMemoryBase& p) + { + assign(p); + return *this; + } + void assign(const SharedMemoryBase& p); bool initialize(bool init); void mutexBug(int osErrorCode, const char* text); }; + Firebird::ObjectsArray<Extent> m_extents; ULONG getTotalMapped() const Modified: firebird/trunk/src/lock/print.cpp =================================================================== --- firebird/trunk/src/lock/print.cpp 2010-06-25 12:16:28 UTC (rev 51285) +++ firebird/trunk/src/lock/print.cpp 2010-06-26 01:18:53 UTC (rev 51286) @@ -86,7 +86,8 @@ SRQ_PTR waitque_entry[30]; }; -namespace { +namespace +{ class sh_mem : public Jrd::SharedMemory<lhb> { public: @@ -94,7 +95,7 @@ : sh_mem_consistency(p_consistency) { } - bool initialize(bool) + bool initialize(bool) { // Initialize a lock table to looking -- i.e. don't do nuthin. return sh_mem_consistency; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-06-26 02:50:13
|
Revision: 51290 http://firebird.svn.sourceforge.net/firebird/?rev=51290&view=rev Author: asfernandes Date: 2010-06-26 02:50:07 +0000 (Sat, 26 Jun 2010) Log Message: ----------- Cleanup Modified Paths: -------------- firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/metd.epp firebird/trunk/src/dsql/metd_proto.h firebird/trunk/src/jrd/irq.h Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-06-26 02:30:01 UTC (rev 51289) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-06-26 02:50:07 UTC (rev 51290) @@ -781,9 +781,8 @@ if (alter) { // Update DSQL cache - AutoPtr<dsql_str> str(MAKE_string(name.c_str(), name.length())); - METD_drop_function(transaction, str, package); - MET_dsql_cache_release(tdbb, SYM_udf, str->str_data, package); + METD_drop_function(transaction, QualifiedName(name, package)); + MET_dsql_cache_release(tdbb, SYM_udf, name.c_str(), package); } } @@ -1382,9 +1381,8 @@ savePoint.release(); // everything is ok // Update DSQL cache - AutoPtr<dsql_str> str(MAKE_string(name.c_str(), name.length())); - METD_drop_function(transaction, str, package); - MET_dsql_cache_release(tdbb, SYM_udf, str->str_data, package); + METD_drop_function(transaction, QualifiedName(name, package)); + MET_dsql_cache_release(tdbb, SYM_udf, name.c_str(), package); } @@ -1579,9 +1577,8 @@ if (alter) { // Update DSQL cache - AutoPtr<dsql_str> str(MAKE_string(name.c_str(), name.length())); - METD_drop_procedure(transaction, str, package); - MET_dsql_cache_release(tdbb, SYM_procedure, str->str_data, package); + METD_drop_procedure(transaction, QualifiedName(name, package)); + MET_dsql_cache_release(tdbb, SYM_procedure, name.c_str(), package); } } @@ -2191,9 +2188,8 @@ savePoint.release(); // everything is ok // Update DSQL cache - AutoPtr<dsql_str> str(MAKE_string(name.c_str(), name.length())); - METD_drop_procedure(transaction, str, package); - MET_dsql_cache_release(tdbb, SYM_procedure, str->str_data, package); + METD_drop_procedure(transaction, QualifiedName(name, package)); + MET_dsql_cache_release(tdbb, SYM_procedure, name.c_str(), package); } Modified: firebird/trunk/src/dsql/ddl.cpp =================================================================== --- firebird/trunk/src/dsql/ddl.cpp 2010-06-26 02:30:01 UTC (rev 51289) +++ firebird/trunk/src/dsql/ddl.cpp 2010-06-26 02:50:07 UTC (rev 51290) @@ -273,7 +273,7 @@ // Signal UDF for obsolescence string = (dsql_str*) statement->getDdlNode()->nod_arg[e_udf_name]; sym_type = SYM_udf; - METD_drop_function(request->getTransaction(), string, ""); + METD_drop_function(request->getTransaction(), QualifiedName(string->str_data, "")); break; } Modified: firebird/trunk/src/dsql/metd.epp =================================================================== --- firebird/trunk/src/dsql/metd.epp 2010-06-26 02:30:01 UTC (rev 51289) +++ firebird/trunk/src/dsql/metd.epp 2010-06-26 02:50:07 UTC (rev 51290) @@ -148,7 +148,7 @@ } -void METD_drop_function(jrd_tra* transaction, const dsql_str* name, const MetaName& packageName) +void METD_drop_function(jrd_tra* transaction, const QualifiedName& name) { /************************************** * @@ -169,20 +169,19 @@ thread_db* tdbb = JRD_get_thread_data(); dsql_dbb* dbb = transaction->getDsqlAttachment(); - const QualifiedName metaName(MetaName(name->str_data, name->str_length), packageName); dsql_udf* function; - if (dbb->dbb_functions.get(metaName, function)) + if (dbb->dbb_functions.get(name, function)) { - MET_dsql_cache_use(tdbb, SYM_udf, metaName.identifier, metaName.package); + MET_dsql_cache_use(tdbb, SYM_udf, name.identifier, name.package); function->udf_flags |= UDF_dropped; - dbb->dbb_functions.remove(metaName); + dbb->dbb_functions.remove(name); } } -void METD_drop_procedure(jrd_tra* transaction, const dsql_str* name, const MetaName& packageName) +void METD_drop_procedure(jrd_tra* transaction, const QualifiedName& name) { /************************************** * @@ -203,14 +202,13 @@ thread_db* tdbb = JRD_get_thread_data(); dsql_dbb* dbb = transaction->getDsqlAttachment(); - const QualifiedName metaName(MetaName(name->str_data, name->str_length), packageName); dsql_prc* procedure; - if (dbb->dbb_procedures.get(metaName, procedure)) + if (dbb->dbb_procedures.get(name, procedure)) { - MET_dsql_cache_use(tdbb, SYM_procedure, metaName.identifier, metaName.package); + MET_dsql_cache_use(tdbb, SYM_procedure, name.identifier, name.package); procedure->prc_flags |= PRC_dropped; - dbb->dbb_procedures.remove(metaName); + dbb->dbb_procedures.remove(name); } } @@ -1515,50 +1513,6 @@ } -bool METD_get_trigger(jrd_tra* transaction, const dsql_str* name, dsql_str** relation, USHORT* trig_type) -{ -/************************************** - * - * M E T D _ g e t _ t r i g g e r - * - ************************************** - * - * Functional description - * Look up a trigger's relation and it's current type - * - **************************************/ - thread_db* tdbb = JRD_get_thread_data(); - - validateTransaction(transaction); - - bool found = false; - - if (relation) - *relation = NULL; - - AutoCacheRequest handle(tdbb, irq_trigger, IRQ_REQUESTS); - - FOR(REQUEST_HANDLE handle TRANSACTION_HANDLE transaction) - X IN RDB$TRIGGERS WITH X.RDB$TRIGGER_NAME EQ name->str_data - { - found = true; - *trig_type = X.RDB$TRIGGER_TYPE; - - if (!X.RDB$RELATION_NAME.NULL) - { - if (relation) - { - fb_utils::exact_name(X.RDB$RELATION_NAME); - *relation = MAKE_string(X.RDB$RELATION_NAME, strlen(X.RDB$RELATION_NAME)); - } - } - } - END_FOR - - return found; -} - - bool METD_get_type(jrd_tra* transaction, const dsql_str* name, const char* field, SSHORT* value) { /************************************** Modified: firebird/trunk/src/dsql/metd_proto.h =================================================================== --- firebird/trunk/src/dsql/metd_proto.h 2010-06-26 02:30:01 UTC (rev 51289) +++ firebird/trunk/src/dsql/metd_proto.h 2010-06-26 02:50:07 UTC (rev 51290) @@ -48,8 +48,8 @@ void METD_drop_charset(Jrd::jrd_tra*, const Firebird::MetaName&); void METD_drop_collation(Jrd::jrd_tra*, const Firebird::MetaName&); -void METD_drop_function(Jrd::jrd_tra*, const Jrd::dsql_str*, const Firebird::MetaName&); -void METD_drop_procedure(Jrd::jrd_tra*, const Jrd::dsql_str*, const Firebird::MetaName&); +void METD_drop_function(Jrd::jrd_tra*, const Firebird::QualifiedName&); +void METD_drop_procedure(Jrd::jrd_tra*, const Firebird::QualifiedName&); void METD_drop_relation(Jrd::jrd_tra*, const Jrd::dsql_str*); Jrd::dsql_intlsym* METD_get_charset(Jrd::jrd_tra*, USHORT, const char* name); @@ -67,7 +67,6 @@ Jrd::dsql_prc* METD_get_procedure(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*, const Jrd::dsql_str*, const Jrd::dsql_str*); Jrd::dsql_rel* METD_get_relation(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*, const Jrd::dsql_str*); -bool METD_get_trigger(Jrd::jrd_tra*, const Jrd::dsql_str*, Jrd::dsql_str**, USHORT*); bool METD_get_type(Jrd::jrd_tra*, const Jrd::dsql_str*, const char*, SSHORT*); Jrd::dsql_rel* METD_get_view_base(Jrd::jrd_tra*, Jrd::DsqlCompilerScratch*, const char* view_name, Jrd::MetaNamePairMap& fields); Modified: firebird/trunk/src/jrd/irq.h =================================================================== --- firebird/trunk/src/jrd/irq.h 2010-06-26 02:30:01 UTC (rev 51289) +++ firebird/trunk/src/jrd/irq.h 2010-06-26 02:50:07 UTC (rev 51290) @@ -137,7 +137,6 @@ irq_parameters, // DSQL/METD: lookup a procedure's parameters irq_collation, // DSQL/METD: lookup a collation name irq_charset, // DSQL/METD: lookup a character set - irq_trigger, // DSQL/METD: lookup a trigger irq_domain, // DSQL/METD: lookup a domain irq_type, // DSQL/METD: lookup a symbolic name in RDB$TYPES irq_col_default, // DSQL/METD: lookup default for a column This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2010-06-30 08:55:23
|
Revision: 51303 http://firebird.svn.sourceforge.net/firebird/?rev=51303&view=rev Author: robocop Date: 2010-06-30 08:55:16 +0000 (Wed, 30 Jun 2010) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/dsql/gen.cpp firebird/trunk/src/jrd/event.h firebird/trunk/src/jrd/isc_file.cpp firebird/trunk/src/jrd/isc_sync.cpp firebird/trunk/src/lock/lock_proto.h firebird/trunk/src/lock/print.cpp firebird/trunk/src/msgs/facilities2.sql Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2010-06-30 08:55:16 UTC (rev 51303) @@ -62,7 +62,7 @@ { SCHAR buffer[100]; - sprintf(buffer, "Invalid dtype %d in put_dtype", field->fld_dtype); + sprintf(buffer, "Invalid dtype %d in BlockNode::putDtype", field->fld_dtype); ERRD_bugcheck(buffer); } #endif Modified: firebird/trunk/src/dsql/gen.cpp =================================================================== --- firebird/trunk/src/dsql/gen.cpp 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/dsql/gen.cpp 2010-06-30 08:55:16 UTC (rev 51303) @@ -2551,7 +2551,7 @@ dsql_nod* rse = NULL; const dsql_msg* message = NULL; bool innerSend = dsqlScratch->flags & DsqlCompilerScratch::FLAG_UPDATE_OR_INSERT; - bool merge = dsqlScratch->flags & DsqlCompilerScratch::FLAG_MERGE; + const bool merge = dsqlScratch->flags & DsqlCompilerScratch::FLAG_MERGE; switch (node->nod_type) { Modified: firebird/trunk/src/jrd/event.h =================================================================== --- firebird/trunk/src/jrd/event.h 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/jrd/event.h 2010-06-30 08:55:16 UTC (rev 51303) @@ -29,7 +29,6 @@ #include "../jrd/isc_s_proto.h" #include "../jrd/file_params.h" #include "../jrd/que.h" -#include "../jrd/isc_s_proto.h" // Global section header Modified: firebird/trunk/src/jrd/isc_file.cpp =================================================================== --- firebird/trunk/src/jrd/isc_file.cpp 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/jrd/isc_file.cpp 2010-06-30 08:55:16 UTC (rev 51303) @@ -1694,7 +1694,7 @@ // Escape Unicode characters from a string -void ISC_escape(AbstractString& str) +void ISC_escape(AbstractString& /*str*/) { #if 0 // CORE-2929 size_t pos = 0; @@ -1736,7 +1736,7 @@ // Unescape Unicode characters from a string -void ISC_unescape(AbstractString& str) +void ISC_unescape(AbstractString& /*str*/) { #if 0 // CORE-2929 size_t pos = 0; Modified: firebird/trunk/src/jrd/isc_sync.cpp =================================================================== --- firebird/trunk/src/jrd/isc_sync.cpp 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/jrd/isc_sync.cpp 2010-06-30 08:55:16 UTC (rev 51303) @@ -2379,7 +2379,7 @@ void SharedMemoryBase::unmapObject(Arg::StatusVector& statusVector, - UCHAR** object_pointer, ULONG object_length) + UCHAR** object_pointer, ULONG /*object_length*/) { /************************************** * Modified: firebird/trunk/src/lock/lock_proto.h =================================================================== --- firebird/trunk/src/lock/lock_proto.h 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/lock/lock_proto.h 2010-06-30 08:55:16 UTC (rev 51303) @@ -445,7 +445,7 @@ { public: Extent() { } - Extent(Firebird::MemoryPool&) { } + explicit Extent(Firebird::MemoryPool&) { } Extent(const SharedMemoryBase& p) { Modified: firebird/trunk/src/lock/print.cpp =================================================================== --- firebird/trunk/src/lock/print.cpp 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/lock/print.cpp 2010-06-30 08:55:16 UTC (rev 51303) @@ -91,7 +91,7 @@ class sh_mem : public Jrd::SharedMemory<lhb> { public: - sh_mem(bool p_consistency) + explicit sh_mem(bool p_consistency) : sh_mem_consistency(p_consistency) { } @@ -101,7 +101,7 @@ return sh_mem_consistency; } - void mutexBug(int osErrorCode, const char* text) + void mutexBug(int /*osErrorCode*/, const char* /*text*/) { // Do nothing - lock print always ignored mutex errors } Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2010-06-30 08:54:18 UTC (rev 51302) +++ firebird/trunk/src/msgs/facilities2.sql 2010-06-30 08:55:16 UTC (rev 51303) @@ -13,7 +13,7 @@ --('1996-11-07 13:39:40', 'GRST', 6, 1) -- ('2005-11-05 13:09:00', 'DSQL', 7, 32) -('2010-01-13 15:04:00', 'DYN', 8, 278) +('2010-06-26 01:52:06', 'DYN', 8, 278) -- --('1996-11-07 13:39:40', 'FRED', 9, 1) -- This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2010-07-10 08:33:26
|
Revision: 51327 http://firebird.svn.sourceforge.net/firebird/?rev=51327&view=rev Author: robocop Date: 2010-07-10 08:33:19 +0000 (Sat, 10 Jul 2010) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/jrd/DatabaseSnapshot.h firebird/trunk/src/jrd/svc.cpp firebird/trunk/src/msgs/facilities2.sql Modified: firebird/trunk/src/jrd/DatabaseSnapshot.h =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-07-10 08:32:50 UTC (rev 51326) +++ firebird/trunk/src/jrd/DatabaseSnapshot.h 2010-07-10 08:33:19 UTC (rev 51327) @@ -43,7 +43,7 @@ public: enum ValueType {VALUE_GLOBAL_ID, VALUE_INTEGER, VALUE_TIMESTAMP, VALUE_STRING}; - DataDump(MemoryPool& pool) + explicit DataDump(MemoryPool& pool) : idMap(pool), idCounter(0) { } struct DumpField Modified: firebird/trunk/src/jrd/svc.cpp =================================================================== --- firebird/trunk/src/jrd/svc.cpp 2010-07-10 08:32:50 UTC (rev 51326) +++ firebird/trunk/src/jrd/svc.cpp 2010-07-10 08:33:19 UTC (rev 51327) @@ -1925,7 +1925,7 @@ // Only need to add username and password information to those calls which need // to make a database connection - bool flNeedUser = (svc_id == isc_action_svc_backup || + const bool flNeedUser = (svc_id == isc_action_svc_backup || svc_id == isc_action_svc_restore || svc_id == isc_action_svc_nbak || svc_id == isc_action_svc_nrest || @@ -1938,7 +1938,7 @@ svc_id == isc_action_svc_trace_resume || svc_id == isc_action_svc_trace_list); - bool flGsecUser = (svc_id == isc_action_svc_add_user || + const bool flGsecUser = (svc_id == isc_action_svc_add_user || svc_id == isc_action_svc_delete_user || svc_id == isc_action_svc_modify_user || svc_id == isc_action_svc_display_user || Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2010-07-10 08:32:50 UTC (rev 51326) +++ firebird/trunk/src/msgs/facilities2.sql 2010-07-10 08:33:19 UTC (rev 51327) @@ -27,7 +27,7 @@ --('1996-11-07 13:38:43', 'GJRN', 16, 241) -- ('2009-12-21 04:00:05', 'ISQL', 17, 173) -('2009-11-13 17:49:54', 'GSEC', 18, 105) +('2010-07-10 10:50:30', 'GSEC', 18, 105) -- --('2002-03-05 02:30:12', 'LICENSE', 19, 60) --('2002-03-05 02:31:54', 'DOS', 20, 74) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-11 18:21:49
|
Revision: 51329 http://firebird.svn.sourceforge.net/firebird/?rev=51329&view=rev Author: asfernandes Date: 2010-07-11 18:21:42 +0000 (Sun, 11 Jul 2010) Log Message: ----------- Refactor CREATE/ALTER/CREATE OR ALTER/RECREATE/DROP EXCEPTION commands Modified Paths: -------------- firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/ddl.cpp firebird/trunk/src/dsql/metd.epp firebird/trunk/src/dsql/metd_proto.h firebird/trunk/src/dsql/node.h firebird/trunk/src/dsql/parse.y firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/jrd/dyn.epp firebird/trunk/src/jrd/dyn_def.epp firebird/trunk/src/jrd/dyn_del.epp firebird/trunk/src/jrd/dyn_df_proto.h firebird/trunk/src/jrd/dyn_dl_proto.h firebird/trunk/src/jrd/dyn_md_proto.h firebird/trunk/src/jrd/dyn_mod.epp Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-07-11 18:21:42 UTC (rev 51329) @@ -308,7 +308,7 @@ } -MetaName DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, const TypeClause& field, +void DdlNode::storeGlobalField(thread_db* tdbb, jrd_tra* transaction, const TypeClause& field, MetaName& name) { bool endStore = false; @@ -346,8 +346,6 @@ // STORE RDB$FIELDS failed rethrowMetaException(ex, ENCODE_ISC_MSG(13, DYN_MSG_FAC), endStore); } - - return name; } @@ -815,7 +813,7 @@ { // Update DSQL cache METD_drop_function(transaction, QualifiedName(name, package)); - MET_dsql_cache_release(tdbb, SYM_udf, name.c_str(), package); + MET_dsql_cache_release(tdbb, SYM_udf, name, package); } } @@ -1006,9 +1004,9 @@ { FUN.RDB$PRIVATE_FLAG.NULL = TRUE; } + + modified = true; END_MODIFY - - modified = true; } END_FOR @@ -1279,6 +1277,9 @@ } +//---------------------- + + void DropFunctionNode::dropArguments(thread_db* tdbb, jrd_tra* transaction, const MetaName& functionName, const MetaName& packageName) { @@ -1413,7 +1414,7 @@ // Update DSQL cache METD_drop_function(transaction, QualifiedName(name, package)); - MET_dsql_cache_release(tdbb, SYM_udf, name.c_str(), package); + MET_dsql_cache_release(tdbb, SYM_udf, name, package); } @@ -1609,7 +1610,7 @@ { // Update DSQL cache METD_drop_procedure(transaction, QualifiedName(name, package)); - MET_dsql_cache_release(tdbb, SYM_procedure, name.c_str(), package); + MET_dsql_cache_release(tdbb, SYM_procedure, name, package); } } @@ -1799,9 +1800,9 @@ prc_selectable : prc_executable); } } + + modified = true; END_MODIFY - - modified = true; } END_FOR @@ -2218,7 +2219,7 @@ // Update DSQL cache METD_drop_procedure(transaction, QualifiedName(name, package)); - MET_dsql_cache_release(tdbb, SYM_procedure, name.c_str(), package); + MET_dsql_cache_release(tdbb, SYM_procedure, name, package); } @@ -2501,9 +2502,9 @@ } TRG.RDB$VALID_BLR = TRUE; + + modified = true; END_MODIFY - - modified = true; } END_FOR } @@ -2975,7 +2976,7 @@ // Update DSQL cache METD_drop_collation(transaction, name); - MET_dsql_cache_release(tdbb, SYM_intlsym_collation, name.c_str()); + MET_dsql_cache_release(tdbb, SYM_intlsym_collation, name); } DdlNode* CreateCollationNode::internalDsqlPass() @@ -3125,7 +3126,7 @@ // Update DSQL cache METD_drop_collation(transaction, name); - MET_dsql_cache_release(tdbb, SYM_intlsym_collation, name.c_str()); + MET_dsql_cache_release(tdbb, SYM_intlsym_collation, name); } @@ -4153,6 +4154,210 @@ //---------------------- +void CreateAlterExceptionNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const +{ + text.printf( + "CreateAlterExceptionNode\n" + " name: '%s' create: %d alter: %d\n" + " message: '%s'\n", + name.c_str(), create, alter, message.c_str()); +} + +void CreateAlterExceptionNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + fb_assert(create || alter); + + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + + if (alter) + { + if (!executeAlter(tdbb, transaction)) + { + if (create) // create or alter + executeCreate(tdbb, transaction); + else + { + // msg 144: "Exception not found" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(144, DYN_MSG_FAC))); + } + } + } + else + executeCreate(tdbb, transaction); + + savePoint.release(); // everything is ok +} + +void CreateAlterExceptionNode::executeCreate(thread_db* tdbb, jrd_tra* transaction) +{ + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_EXCEPTION, name); + + DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_exception); + + AutoCacheRequest request(tdbb, drq_s_xcp, DYN_REQUESTS); + bool endStore = false; + int faults = 0; + + while (true) + { + try + { + SINT64 id = DYN_UTIL_gen_unique_id(tdbb, drq_g_nxt_xcp_id, "RDB$EXCEPTIONS"); + id %= (MAX_SSHORT + 1); + + if (!id) + continue; + + STORE (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$EXCEPTIONS + { + X.RDB$EXCEPTION_NUMBER = id; + X.RDB$SYSTEM_FLAG = 0; + strcpy(X.RDB$EXCEPTION_NAME, name.c_str()); + + fb_assert(message.length() < sizeof(X.RDB$MESSAGE)); + strcpy(X.RDB$MESSAGE, message.c_str()); + + endStore = true; + } + END_STORE + + break; + } + catch (const status_exception& ex) + { + if (ex.value()[1] != isc_no_dup || ++faults > MAX_SSHORT) + { + // msg 142: "DEFINE EXCEPTION failed" + rethrowMetaException(ex, ENCODE_ISC_MSG(142, DYN_MSG_FAC), endStore); + } + + fb_utils::init_status(tdbb->tdbb_status_vector); + } + } + + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_EXCEPTION, name); +} + +bool CreateAlterExceptionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction) +{ + AutoCacheRequest request(tdbb, drq_m_xcp, DYN_REQUESTS); + bool modified = false; + + try + { + FOR (REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$EXCEPTIONS + WITH X.RDB$EXCEPTION_NAME EQ name.c_str() + { + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_EXCEPTION, name); + + MODIFY X + fb_assert(message.length() < sizeof(X.RDB$MESSAGE)); + strcpy(X.RDB$MESSAGE, message.c_str()); + + modified = true; + END_MODIFY + } + END_FOR + } + catch (const status_exception& ex) + { + // msg 145: "MODIFY EXCEPTION failed" + rethrowMetaException(ex, ENCODE_ISC_MSG(145, DYN_MSG_FAC), modified); + } + + if (modified) + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_EXCEPTION, name); + + return modified; +} + + +//---------------------- + + +void DropExceptionNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const +{ + text.printf( + "DropExceptionNode\n" + " name: '%s'\n", + name.c_str()); +} + +void DropExceptionNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + bool found = false; + + try + { + AutoCacheRequest request(tdbb, drq_e_xcp, DYN_REQUESTS); + + FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) + X IN RDB$EXCEPTIONS + WITH X.RDB$EXCEPTION_NAME EQ name.c_str() + { + executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_EXCEPTION, name); + ERASE X; + found = true; + } + END_FOR + } + catch (const status_exception& ex) + { + // msg 143: "ERASE EXCEPTION failed" + rethrowMetaException(ex, ENCODE_ISC_MSG(143, DYN_MSG_FAC), found); + } + + if (found) + executeDdlTrigger(tdbb, transaction, DTW_AFTER, DDL_TRIGGER_DROP_EXCEPTION, name); + else if (!silent) + { + // msg 144: "Exception not found" + status_exception::raise( + Arg::Gds(isc_no_meta_update) << + Arg::Gds(ENCODE_ISC_MSG(144, DYN_MSG_FAC))); + } + + savePoint.release(); // everything is ok +} + + +//---------------------- + + +void RecreateExceptionNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const +{ + text.printf("RecreateExceptionNode\n"); +} + +DdlNode* RecreateExceptionNode::internalDsqlPass() +{ + createNode->dsqlPass(dsqlScratch); + dropNode.dsqlPass(dsqlScratch); + return DdlNode::internalDsqlPass(); +} + +void RecreateExceptionNode::execute(thread_db* tdbb, jrd_tra* transaction) +{ + // run all statements under savepoint control + AutoSavePoint savePoint(tdbb, transaction); + + dropNode.executeDdl(tdbb, transaction); + createNode->executeDdl(tdbb, transaction); + + savePoint.release(); // everything is ok +} + + +//---------------------- + + void CreateSequenceNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const { text.printf( Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-07-11 18:21:42 UTC (rev 51329) @@ -670,6 +670,81 @@ }; +class CreateAlterExceptionNode : public DdlNode +{ +public: + explicit CreateAlterExceptionNode(MemoryPool& p, const Firebird::string& sqlText, + const Firebird::MetaName& aName, const Firebird::string& aMessage) + : DdlNode(p, sqlText), + name(p, aName), + message(p, aMessage), + create(true), + alter(false) + { + } + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +private: + void executeCreate(thread_db* tdbb, jrd_tra* transaction); + bool executeAlter(thread_db* tdbb, jrd_tra* transaction); + +public: + Firebird::MetaName name; + Firebird::string message; + bool create; + bool alter; +}; + + +class DropExceptionNode : public DdlNode +{ +public: + explicit DropExceptionNode(MemoryPool& p, const Firebird::string& sqlText, + const Firebird::MetaName& aName) + : DdlNode(p, sqlText), + name(p, aName), + silent(false) + { + } + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +public: + Firebird::MetaName name; + bool silent; +}; + + +class RecreateExceptionNode : public DdlNode +{ +public: + explicit RecreateExceptionNode(MemoryPool& p, const Firebird::string& sqlText, + CreateAlterExceptionNode* aCreateNode) + : DdlNode(p, sqlText), + createNode(aCreateNode), + dropNode(p, sqlText, createNode->name) + { + dropNode.silent = true; + } + +public: + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const; + virtual void execute(thread_db* tdbb, jrd_tra* transaction); + +protected: + virtual DdlNode* internalDsqlPass(); + +private: + CreateAlterExceptionNode* createNode; + DropExceptionNode dropNode; +}; + + class CreateSequenceNode : public DdlNode { public: Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/Nodes.h 2010-07-11 18:21:42 UTC (rev 51329) @@ -121,8 +121,8 @@ DdlTriggerWhen when, int action, const Firebird::MetaName& objectName); void putType(const TypeClause& type, bool useSubType); void resetContextStack(); - Firebird::MetaName storeGlobalField(thread_db* tdbb, jrd_tra* transaction, - const TypeClause& field, Firebird::MetaName& name); + void storeGlobalField(thread_db* tdbb, jrd_tra* transaction, const TypeClause& field, + Firebird::MetaName& name); protected: virtual DdlNode* internalDsqlPass() Modified: firebird/trunk/src/dsql/ddl.cpp =================================================================== --- firebird/trunk/src/dsql/ddl.cpp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/ddl.cpp 2010-07-11 18:21:42 UTC (rev 51329) @@ -126,7 +126,6 @@ const dsql_nod*, const char*, const char*); //static void define_del_default_trg(DsqlCompilerScratch*, dsql_nod*, dsql_nod*, dsql_nod*, TEXT*, TEXT*); static void define_dimensions(DsqlCompilerScratch*, const dsql_fld*); -static void define_exception(DsqlCompilerScratch*, NOD_TYPE); static void define_field(DsqlCompilerScratch*, dsql_nod*, SSHORT, const dsql_str*, const dsql_nod* pkcols); static void define_filter(DsqlCompilerScratch*); static SSHORT getBlobFilterSubType(DsqlCompilerScratch* dsqlScratch, const dsql_nod* node); @@ -145,7 +144,6 @@ const dsql_nod*, const char*, const char*); static void define_view(DsqlCompilerScratch*, NOD_TYPE); static void define_view_trigger(DsqlCompilerScratch*, dsql_nod*, dsql_nod*, dsql_nod*); -static void delete_exception(DsqlCompilerScratch*, dsql_nod*, bool); static void delete_relation_view(DsqlCompilerScratch*, dsql_nod*, bool); static const dsql_nod* find_pk_columns(const dsql_nod* def_rel_elements); static ULONG find_start_of_body(const dsql_str* string); @@ -261,7 +259,7 @@ if (!string) string = (dsql_str*) statement->getDdlNode()->nod_arg[e_alt_name]; sym_type = SYM_relation; - METD_drop_relation(request->getTransaction(), string); + METD_drop_relation(request->getTransaction(), string->str_data); break; case nod_del_udf: @@ -1423,53 +1421,6 @@ } -static void define_exception( DsqlCompilerScratch* dsqlScratch, NOD_TYPE op) -{ -/************************************** - * - * d e f i n e _ e x c e p t i o n - * - ************************************** - * - * Function - * Generate ddl to create an exception code. - * - **************************************/ - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); - const dsql_nod* ddl_node = statement->getDdlNode(); - const dsql_str* name = (dsql_str*) ddl_node->nod_arg[e_xcp_name]; - - switch (op) - { - case nod_replace_exception: - if (METD_get_exception(dsqlScratch->getTransaction(), name)) { - define_exception(dsqlScratch, nod_mod_exception); - } - else { - define_exception(dsqlScratch, nod_def_exception); - } - break; - - case nod_def_exception: - case nod_redef_exception: - dsqlScratch->appendNullString(isc_dyn_def_exception, name->str_data); - break; - - case nod_mod_exception: - dsqlScratch->appendNullString(isc_dyn_mod_exception, name->str_data); - break; - - default: - fb_assert(false); - } - - const dsql_str* text = (dsql_str*) ddl_node->nod_arg[e_xcp_text]; - fb_assert(text->str_length <= MAX_USHORT); - dsqlScratch->appendString(isc_dyn_xcp_msg, text->str_data, text->str_length); - dsqlScratch->appendUChar(isc_dyn_end); -} - - static void define_field(DsqlCompilerScratch* dsqlScratch, dsql_nod* element, SSHORT position, const dsql_str* relation_name, @@ -3010,33 +2961,6 @@ } -static void delete_exception (DsqlCompilerScratch* dsqlScratch, dsql_nod* node, bool silent_deletion) -{ -/************************************** - * - * d e l e t e _ e x c e p t i o n - * - ************************************** - * - * Function - * Do nothing and don't throw error if the exception doesn't exist - * and silent_deletion is true. - * - **************************************/ - const dsql_str* string = (dsql_str*) node->nod_arg[0]; - fb_assert(string); - if (node->nod_type == nod_redef_exception || silent_deletion) - { - if (!METD_get_exception(dsqlScratch->getTransaction(), string)) { - return; - } - } - - dsqlScratch->appendNullString(isc_dyn_del_exception, string->str_data); - dsqlScratch->appendUChar(isc_dyn_end); -} - - static void delete_relation_view (DsqlCompilerScratch* dsqlScratch, dsql_nod* node, bool silent_deletion) { /************************************** @@ -3284,23 +3208,6 @@ dsqlScratch->appendUChar(isc_dyn_end); break; - case nod_def_exception: - case nod_mod_exception: - case nod_replace_exception: - define_exception(dsqlScratch, node->nod_type); - break; - - case nod_redef_exception: - dsqlScratch->appendUChar(isc_dyn_begin); - delete_exception(dsqlScratch, node, true); // silent - define_exception(dsqlScratch, node->nod_type); - dsqlScratch->appendUChar(isc_dyn_end); - break; - - case nod_del_exception: - delete_exception(dsqlScratch, node, false); // no silent - break; - case nod_def_constraint: define_constraint_trigger(dsqlScratch, node); break; @@ -4228,7 +4135,7 @@ } // try catch (const Exception&) { - METD_drop_relation(dsqlScratch->getTransaction(), relation_name); + METD_drop_relation(dsqlScratch->getTransaction(), relation_name->str_data); dsqlScratch->relation = 0; throw; } Modified: firebird/trunk/src/dsql/metd.epp =================================================================== --- firebird/trunk/src/dsql/metd.epp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/metd.epp 2010-07-11 18:21:42 UTC (rev 51329) @@ -213,7 +213,7 @@ } -void METD_drop_relation(jrd_tra* transaction, const dsql_str* name) +void METD_drop_relation(jrd_tra* transaction, const MetaName& name) { /************************************** * @@ -234,14 +234,13 @@ thread_db* tdbb = JRD_get_thread_data(); dsql_dbb* dbb = transaction->getDsqlAttachment(); - MetaName metaName(name->str_data, name->str_length); dsql_rel* relation; - if (dbb->dbb_relations.get(metaName, relation)) + if (dbb->dbb_relations.get(name, relation)) { - MET_dsql_cache_use(tdbb, SYM_relation, metaName); + MET_dsql_cache_use(tdbb, SYM_relation, name); relation->rel_flags |= REL_dropped; - dbb->dbb_relations.remove(metaName); + dbb->dbb_relations.remove(name); } } Modified: firebird/trunk/src/dsql/metd_proto.h =================================================================== --- firebird/trunk/src/dsql/metd_proto.h 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/metd_proto.h 2010-07-11 18:21:42 UTC (rev 51329) @@ -50,7 +50,7 @@ void METD_drop_collation(Jrd::jrd_tra*, const Firebird::MetaName&); void METD_drop_function(Jrd::jrd_tra*, const Firebird::QualifiedName&); void METD_drop_procedure(Jrd::jrd_tra*, const Firebird::QualifiedName&); -void METD_drop_relation(Jrd::jrd_tra*, const Jrd::dsql_str*); +void METD_drop_relation(Jrd::jrd_tra*, const Firebird::MetaName&); Jrd::dsql_intlsym* METD_get_charset(Jrd::jrd_tra*, USHORT, const char* name); USHORT METD_get_charset_bpc(Jrd::jrd_tra*, SSHORT); Modified: firebird/trunk/src/dsql/node.h =================================================================== --- firebird/trunk/src/dsql/node.h 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/node.h 2010-07-11 18:21:42 UTC (rev 51329) @@ -73,9 +73,6 @@ nod_del_index, nod_def_view, nod_def_constraint, - nod_def_exception, - nod_mod_exception, - nod_del_exception, nod_del_generator, nod_def_filter, nod_del_filter, @@ -259,8 +256,6 @@ nod_rows, // ROWS support nod_query_spec, nod_equiv, // IS DISTINCT FROM - nod_redef_exception, // RECREATE EXCEPTION - nod_replace_exception, // CREATE OR ALTER EXCEPTION nod_mod_udf, nod_strlen, nod_trim, @@ -331,10 +326,6 @@ e_ary_indices, e_ary_count, - e_xcp_name = 0, // nod_exception - e_xcp_text, - e_xcp_count, - e_blk_action = 0, // nod_block e_blk_errs, e_blk_count, Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/parse.y 2010-07-11 18:21:42 UTC (rev 51329) @@ -1288,21 +1288,44 @@ // CREATE EXCEPTION -exception_clause : symbol_exception_name sql_string - { $$ = make_node (nod_def_exception, (int) e_xcp_count, $1, $2); } - ; +exception_clause + : symbol_exception_name sql_string + { + $$ = makeClassNode(FB_NEW(getPool()) CreateAlterExceptionNode( + getPool(), compilingText, toName($1), toString($2))); + } + ; -rexception_clause : symbol_exception_name sql_string - { $$ = make_node (nod_redef_exception, (int) e_xcp_count, $1, $2); } - ; +rexception_clause + : symbol_exception_name sql_string + { + CreateAlterExceptionNode* createNode = FB_NEW(getPool()) CreateAlterExceptionNode( + getPool(), compilingText, toName($1), toString($2)); + $$ = makeClassNode(FB_NEW(getPool()) RecreateExceptionNode( + getPool(), compilingText, createNode)); + } + ; -replace_exception_clause : symbol_exception_name sql_string - { $$ = make_node (nod_replace_exception, (int) e_xcp_count, $1, $2); } - ; +replace_exception_clause + : symbol_exception_name sql_string + { + CreateAlterExceptionNode* node = FB_NEW(getPool()) CreateAlterExceptionNode( + getPool(), compilingText, toName($1), toString($2)); + node->alter = true; + $$ = makeClassNode(node); + } + ; -alter_exception_clause : symbol_exception_name sql_string - { $$ = make_node (nod_mod_exception, (int) e_xcp_count, $1, $2); } - ; +alter_exception_clause + : symbol_exception_name sql_string + { + CreateAlterExceptionNode* node = FB_NEW(getPool()) CreateAlterExceptionNode( + getPool(), compilingText, toName($1), toString($2)); + node->create = false; + node->alter = true; + $$ = makeClassNode(node); + } + ; // CREATE INDEX @@ -3373,43 +3396,44 @@ { $$ = $2; } ; -drop_clause : EXCEPTION symbol_exception_name - { $$ = make_node (nod_del_exception, 1, $2); } - | INDEX symbol_index_name - { $$ = make_node (nod_del_index, (int) 1, $2); } - | PROCEDURE symbol_procedure_name - { $$ = makeClassNode(FB_NEW(getPool()) DropProcedureNode(getPool(), compilingText, toName($2))); } - | TABLE symbol_table_name - { $$ = make_node (nod_del_relation, (int) 1, $2); } - | TRIGGER symbol_trigger_name - { $$ = makeClassNode(FB_NEW(getPool()) DropTriggerNode(getPool(), compilingText, toName($2))); } - | VIEW symbol_view_name - { $$ = make_node (nod_del_view, (int) 1, $2); } - | FILTER symbol_filter_name - { $$ = make_node (nod_del_filter, (int) 1, $2); } - | DOMAIN symbol_domain_name - { $$ = makeClassNode(FB_NEW(getPool()) DropDomainNode(getPool(), compilingText, toName($2))); } - | EXTERNAL FUNCTION symbol_UDF_name - { $$ = makeClassNode(FB_NEW(getPool()) DropFunctionNode(getPool(), compilingText, toName($3))); } - | FUNCTION symbol_UDF_name - { $$ = makeClassNode(FB_NEW(getPool()) DropFunctionNode(getPool(), compilingText, toName($2))); } - | SHADOW pos_short_integer - { $$ = make_node (nod_del_shadow, (int) 1, (dsql_nod*)(IPTR) $2); } - | ROLE symbol_role_name - { $$ = make_node (nod_del_role, (int) 1, $2); } - | GENERATOR symbol_generator_name - { $$ = make_node (nod_del_generator, (int) 1, $2); } - | SEQUENCE symbol_generator_name - { $$ = make_node (nod_del_generator, (int) 1, $2); } - | COLLATION symbol_collation_name - { $$ = makeClassNode(FB_NEW(getPool()) DropCollationNode(getPool(), compilingText, toName($2))); } - | USER drop_user_clause - { $$ = $2; } - | PACKAGE symbol_package_name - { $$ = makeClassNode(FB_NEW(getPool()) DropPackageNode(getPool(), compilingText, toName($2))); } - | PACKAGE BODY symbol_package_name - { $$ = makeClassNode(FB_NEW(getPool()) DropPackageBodyNode(getPool(), compilingText, toName($3))); } - ; +drop_clause + : EXCEPTION symbol_exception_name + { $$ = makeClassNode(FB_NEW(getPool()) DropExceptionNode(getPool(), compilingText, toName($2))); } + | INDEX symbol_index_name + { $$ = make_node (nod_del_index, (int) 1, $2); } + | PROCEDURE symbol_procedure_name + { $$ = makeClassNode(FB_NEW(getPool()) DropProcedureNode(getPool(), compilingText, toName($2))); } + | TABLE symbol_table_name + { $$ = make_node (nod_del_relation, (int) 1, $2); } + | TRIGGER symbol_trigger_name + { $$ = makeClassNode(FB_NEW(getPool()) DropTriggerNode(getPool(), compilingText, toName($2))); } + | VIEW symbol_view_name + { $$ = make_node (nod_del_view, (int) 1, $2); } + | FILTER symbol_filter_name + { $$ = make_node (nod_del_filter, (int) 1, $2); } + | DOMAIN symbol_domain_name + { $$ = makeClassNode(FB_NEW(getPool()) DropDomainNode(getPool(), compilingText, toName($2))); } + | EXTERNAL FUNCTION symbol_UDF_name + { $$ = makeClassNode(FB_NEW(getPool()) DropFunctionNode(getPool(), compilingText, toName($3))); } + | FUNCTION symbol_UDF_name + { $$ = makeClassNode(FB_NEW(getPool()) DropFunctionNode(getPool(), compilingText, toName($2))); } + | SHADOW pos_short_integer + { $$ = make_node (nod_del_shadow, (int) 1, (dsql_nod*)(IPTR) $2); } + | ROLE symbol_role_name + { $$ = make_node (nod_del_role, (int) 1, $2); } + | GENERATOR symbol_generator_name + { $$ = make_node (nod_del_generator, (int) 1, $2); } + | SEQUENCE symbol_generator_name + { $$ = make_node (nod_del_generator, (int) 1, $2); } + | COLLATION symbol_collation_name + { $$ = makeClassNode(FB_NEW(getPool()) DropCollationNode(getPool(), compilingText, toName($2))); } + | USER drop_user_clause + { $$ = $2; } + | PACKAGE symbol_package_name + { $$ = makeClassNode(FB_NEW(getPool()) DropPackageNode(getPool(), compilingText, toName($2))); } + | PACKAGE BODY symbol_package_name + { $$ = makeClassNode(FB_NEW(getPool()) DropPackageBodyNode(getPool(), compilingText, toName($3))); } + ; // these are the allowable datatypes Modified: firebird/trunk/src/dsql/pass1.cpp =================================================================== --- firebird/trunk/src/dsql/pass1.cpp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/dsql/pass1.cpp 2010-07-11 18:21:42 UTC (rev 51329) @@ -1897,11 +1897,6 @@ case nod_replace_view: case nod_del_view: case nod_def_constraint: - case nod_def_exception: - case nod_redef_exception: - case nod_mod_exception: - case nod_replace_exception: - case nod_del_exception: case nod_grant: case nod_revoke: case nod_mod_database: @@ -10291,21 +10286,6 @@ verb = "del_trigger_msg"; break; */ - case nod_def_exception: - verb = "def_exception"; - break; - case nod_redef_exception: - verb = "redef_exception"; - break; - case nod_mod_exception: - verb = "mod_exception"; - break; - case nod_replace_exception: - verb = "replace_exception"; - break; - case nod_del_exception: - verb = "del_exception"; - break; case nod_def_shadow: verb = "def_shadow"; break; Modified: firebird/trunk/src/jrd/dyn.epp =================================================================== --- firebird/trunk/src/jrd/dyn.epp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/jrd/dyn.epp 2010-07-11 18:21:42 UTC (rev 51329) @@ -395,18 +395,6 @@ DYN_delete_relation(gbl, ptr, relation_name); break; - case isc_dyn_def_exception: - DYN_define_exception(gbl, ptr); - break; - - case isc_dyn_mod_exception: - DYN_modify_exception(gbl, ptr); - break; - - case isc_dyn_del_exception: - DYN_delete_exception(gbl, ptr); - break; - case isc_dyn_def_filter: DYN_define_filter(gbl, ptr); break; Modified: firebird/trunk/src/jrd/dyn_def.epp =================================================================== --- firebird/trunk/src/jrd/dyn_def.epp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/jrd/dyn_def.epp 2010-07-11 18:21:42 UTC (rev 51329) @@ -558,112 +558,6 @@ } -void DYN_define_exception( Global* gbl, const UCHAR** ptr) -{ -/************************************** - * - * D Y N _ d e f i n e _ e x c e p t i o n - * - ************************************** - * - * Functional description - * Define an exception. - * - **************************************/ - Firebird::MetaName exception_name; - - thread_db* tdbb = JRD_get_thread_data(); - - GET_STRING(ptr, exception_name); - - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, - DDL_TRIGGER_CREATE_EXCEPTION, exception_name, gbl->sqlText); - - bool b_ending_store = false; - - try { - - DYN_UTIL_check_unique_name(tdbb, gbl->gbl_transaction, exception_name, obj_exception); - - AutoCacheRequest request(tdbb, drq_s_xcp, DYN_REQUESTS); - - const UCHAR* message_ptr = NULL; - - UCHAR verb; - while ((verb = *(*ptr)++) != isc_dyn_end) - { - switch (verb) - { - case isc_dyn_xcp_msg: - message_ptr = *ptr; - DYN_skip_attribute(ptr); - break; - - default: - DYN_unsupported_verb(); - } - } - - int faults = 0; - - while (true) - { - try - { - SINT64 xcp_id = DYN_UTIL_gen_unique_id(tdbb, drq_g_nxt_xcp_id, "RDB$EXCEPTIONS"); - - xcp_id %= (MAX_SSHORT + 1); - - if (!xcp_id) - continue; - - STORE(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - X IN RDB$EXCEPTIONS - { - X.RDB$EXCEPTION_NUMBER = xcp_id; - strcpy(X.RDB$EXCEPTION_NAME, exception_name.c_str()); - - X.RDB$SYSTEM_FLAG = 0; - X.RDB$SYSTEM_FLAG.NULL = FALSE; - X.RDB$MESSAGE.NULL = TRUE; - - if (message_ptr) - { - X.RDB$MESSAGE.NULL = FALSE; - const UCHAR* temp_ptr = message_ptr; - GET_BYTES(&temp_ptr, X.RDB$MESSAGE); - } - - b_ending_store = true; - } - END_STORE - - break; - } - catch (const Firebird::status_exception& ex) - { - if (ex.value()[1] != isc_no_dup) - throw; - - if (++faults > MAX_SSHORT) - throw; - - b_ending_store = false; - fb_utils::init_status(tdbb->tdbb_status_vector); - } - } - } // try - catch (const Firebird::Exception& ex) - { - Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); - throw; - } - - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER, - DDL_TRIGGER_CREATE_EXCEPTION, exception_name, gbl->sqlText); -} - - void DYN_define_file(Global* gbl, const UCHAR** ptr, SLONG shadow_number, Modified: firebird/trunk/src/jrd/dyn_del.epp =================================================================== --- firebird/trunk/src/jrd/dyn_del.epp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/jrd/dyn_del.epp 2010-07-11 18:21:42 UTC (rev 51329) @@ -144,69 +144,6 @@ } -void DYN_delete_exception( Global* gbl, const UCHAR** ptr) -{ -/************************************** - * - * D Y N _ d e l e t e _ e x c e p t i o n - * - ************************************** - * - * Functional description - * Execute a dynamic ddl statement that - * deletes an exception. - * - **************************************/ - Firebird::MetaName t; - - thread_db* tdbb = JRD_get_thread_data(); - - GET_STRING(ptr, t); - - AutoCacheRequest request(tdbb, drq_e_xcp, DYN_REQUESTS); - - bool found = false; - - try - { - found = false; - FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - X IN RDB$EXCEPTIONS - WITH X.RDB$EXCEPTION_NAME EQ t.c_str() - { - found = true; - - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, - DDL_TRIGGER_DROP_EXCEPTION, t, gbl->sqlText); - - ERASE X; - } - END_FOR - } // try - catch (const Firebird::Exception& ex) - { - Firebird::stuff_exception(tdbb->tdbb_status_vector, ex); - DYN_error_punt(true, 143); - // msg 143: "ERASE EXCEPTION failed" - } - - if (found) - { - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER, - DDL_TRIGGER_DROP_EXCEPTION, t, gbl->sqlText); - } - else - { - DYN_error_punt(false, 144); - // msg 144: "Exception not found" - } - - if (*(*ptr)++ != isc_dyn_end) { - DYN_unsupported_verb(); - } -} - - void DYN_delete_filter( Global* gbl, const UCHAR** ptr) { /************************************** Modified: firebird/trunk/src/jrd/dyn_df_proto.h =================================================================== --- firebird/trunk/src/jrd/dyn_df_proto.h 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/jrd/dyn_df_proto.h 2010-07-11 18:21:42 UTC (rev 51329) @@ -26,7 +26,6 @@ void DYN_define_constraint(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*); void DYN_define_dimension(Jrd::Global*, const UCHAR**, const Firebird::MetaName*, Firebird::MetaName*); -void DYN_define_exception(Jrd::Global*, const UCHAR**); void DYN_define_file(Jrd::Global*, const UCHAR**, SLONG, SLONG*, USHORT); void DYN_define_filter(Jrd::Global*, const UCHAR**); void DYN_define_function(Jrd::Global*, const UCHAR**); Modified: firebird/trunk/src/jrd/dyn_dl_proto.h =================================================================== --- firebird/trunk/src/jrd/dyn_dl_proto.h 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/jrd/dyn_dl_proto.h 2010-07-11 18:21:42 UTC (rev 51329) @@ -26,7 +26,6 @@ void DYN_delete_constraint(Jrd::Global*, const UCHAR**, const Firebird::MetaName*); void DYN_delete_dimensions(Jrd::Global*, const UCHAR**); //, const Firebird::MetaName*, Firebird::MetaName*); -void DYN_delete_exception(Jrd::Global*, const UCHAR**); void DYN_delete_filter(Jrd::Global*, const UCHAR**); void DYN_delete_generator(Jrd::Global*, const UCHAR**); void DYN_delete_index(Jrd::Global*, const UCHAR**); Modified: firebird/trunk/src/jrd/dyn_md_proto.h =================================================================== --- firebird/trunk/src/jrd/dyn_md_proto.h 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/jrd/dyn_md_proto.h 2010-07-11 18:21:42 UTC (rev 51329) @@ -25,7 +25,6 @@ #define JRD_DYN_MD_PROTO_H void DYN_modify_database(Jrd::Global*, const UCHAR**); -void DYN_modify_exception(Jrd::Global*, const UCHAR**); void DYN_modify_function(Jrd::Global*, const UCHAR**); void DYN_modify_index(Jrd::Global*, const UCHAR**); void DYN_modify_local_field(Jrd::Global*, const UCHAR**, const Firebird::MetaName*); Modified: firebird/trunk/src/jrd/dyn_mod.epp =================================================================== --- firebird/trunk/src/jrd/dyn_mod.epp 2010-07-10 08:35:00 UTC (rev 51328) +++ firebird/trunk/src/jrd/dyn_mod.epp 2010-07-11 18:21:42 UTC (rev 51329) @@ -207,76 +207,6 @@ } -void DYN_modify_exception( Global* gbl, const UCHAR** ptr) -{ -/************************************** - * - * D Y N _ m o d i f y _ e x c e p t i o n - * - ************************************** - * - * Functional description - * Modify an exception. - * - **************************************/ - thread_db* tdbb = JRD_get_thread_data(); - - AutoCacheRequest request(tdbb, drq_m_xcp, DYN_REQUESTS); - bool found = false; - - MetaName t; - GET_STRING(ptr, t); - - try { - - found = false; - FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction) - X IN RDB$EXCEPTIONS - WITH X.RDB$EXCEPTION_NAME EQ t.c_str() - { - found = true; - - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE, - DDL_TRIGGER_ALTER_EXCEPTION, t, gbl->sqlText); - - MODIFY X - UCHAR verb; - while ((verb = *(*ptr)++) != isc_dyn_end) - switch (verb) - { - case isc_dyn_xcp_msg: - GET_BYTES(ptr, X.RDB$MESSAGE); - X.RDB$MESSAGE.NULL = FALSE; - break; - - default: - DYN_unsupported_verb(); - } - END_MODIFY - } - END_FOR - - } // try - catch (const Exception& ex) - { - stuff_exception(tdbb->tdbb_status_vector, ex); - DYN_error_punt(true, 145); - // msg 145: "MODIFY EXCEPTION failed" - } - - if (found) - { - DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER, - DDL_TRIGGER_ALTER_EXCEPTION, t, gbl->sqlText); - } - else - { - DYN_error_punt(false, 144); - // msg 144: "Exception not found" - } -} - - // ************************************* // D Y N _ m o d i f y _ f u n c t i o n // ************************************* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2010-07-23 14:39:28
|
Revision: 51363 http://firebird.svn.sourceforge.net/firebird/?rev=51363&view=rev Author: hvlad Date: 2010-07-23 14:39:21 +0000 (Fri, 23 Jul 2010) Log Message: ----------- Forgotten changes Modified Paths: -------------- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp firebird/trunk/src/remote/interface.cpp Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2010-07-23 14:31:04 UTC (rev 51362) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2010-07-23 14:39:21 UTC (rev 51363) @@ -48,8 +48,10 @@ Firebird::GlobalPtr<Firebird::Mutex> execLineMutex; // protects various gpre generated structures // register plugin +#ifndef WIN_NT char name[] = "LEGACY_AUTH"; Firebird::PluginHelper<Auth::SecurityDatabaseManagement, Firebird::Plugin::UserManagement, name> manage; +#endif bool grantRevokeAdmin(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, const internal_user_data* io_user_data) Modified: firebird/trunk/src/remote/interface.cpp =================================================================== --- firebird/trunk/src/remote/interface.cpp 2010-07-23 14:31:04 UTC (rev 51362) +++ firebird/trunk/src/remote/interface.cpp 2010-07-23 14:39:21 UTC (rev 51363) @@ -68,6 +68,9 @@ //#include "../auth/trusted/AuthSspi.h" #include "../common/classes/ImplementHelper.h" +// hvlad: following code registering plugins is temporary and should be +// moved at appropriate places + #ifdef WIN_NT #include "../auth/trusted/AuthSspi.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-24 02:43:35
|
Revision: 51364 http://firebird.svn.sourceforge.net/firebird/?rev=51364&view=rev Author: asfernandes Date: 2010-07-24 02:43:28 +0000 (Sat, 24 Jul 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/auth/AuthDbg.cpp firebird/trunk/src/auth/AuthInterface.h firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h firebird/trunk/src/auth/trusted/AuthSspi.cpp firebird/trunk/src/common/classes/ImplementHelper.h firebird/trunk/src/common/classes/Interface.h firebird/trunk/src/dbs/security.sql firebird/trunk/src/jrd/gds.cpp firebird/trunk/src/jrd/os/posix/mod_loader.cpp firebird/trunk/src/remote/server.cpp firebird/trunk/src/utilities/gsec/security.cpp Modified: firebird/trunk/src/auth/AuthDbg.cpp =================================================================== --- firebird/trunk/src/auth/AuthDbg.cpp 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/auth/AuthDbg.cpp 2010-07-24 02:43:28 UTC (rev 51364) @@ -42,7 +42,7 @@ ServerInstance* DebugServer::instance() { - return Firebird::interfaceAlloc<DebugServerInstance>(); + return Firebird::interfaceAlloc<DebugServerInstance>(); } ClientInstance* DebugClient::instance() @@ -101,8 +101,8 @@ str = "HAND"; if (dpb) { - dpb->add(isService ? isc_spb_trusted_auth : isc_dpb_trusted_auth, - str.c_str(), str.length()); + dpb->add((isService ? isc_spb_trusted_auth : isc_dpb_trusted_auth), + str.c_str(), str.length()); return AUTH_SUCCESS; } return AUTH_MORE_DATA; Modified: firebird/trunk/src/auth/AuthInterface.h =================================================================== --- firebird/trunk/src/auth/AuthInterface.h 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/auth/AuthInterface.h 2010-07-24 02:43:28 UTC (rev 51364) @@ -89,9 +89,9 @@ { public: // work in progress - we must avoid both internal_user_data and callback function - virtual int execLine(ISC_STATUS* isc_status, const char *realUser, + virtual int execLine(ISC_STATUS* isc_status, const char *realUser, FB_API_HANDLE db, FB_API_HANDLE trans, - internal_user_data* io_user_data, + internal_user_data* io_user_data, FPTR_SECURITY_CALLBACK display_func, void* callback_arg) = 0; }; Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.epp 2010-07-24 02:43:28 UTC (rev 51364) @@ -1,5 +1,4 @@ /* - * * PROGRAM: Security data base manager * MODULE: security.epp * DESCRIPTION: Security routines @@ -95,7 +94,7 @@ } /* -bool storePasswd(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, +bool storePasswd(ISC_STATUS* isc_status, FB_API_HANDLE DB, FB_API_HANDLE trans, ISC_QUAD& blobId, const Firebird::string& passwd) { UserBlob blob(isc_status); @@ -122,7 +121,7 @@ // work in progress - we must avoid both internal_user_data and callback function int SecurityDatabaseManagement::execLine(ISC_STATUS* isc_status, - const char *realUser, + const char* realUser, FB_API_HANDLE DB, FB_API_HANDLE trans, internal_user_data* io_user_data, Modified: firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h =================================================================== --- firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/auth/SecurityDatabase/LegacyManagement.h 2010-07-24 02:43:28 UTC (rev 51364) @@ -36,9 +36,9 @@ { public: // work in progress - we must avoid both internal_user_data and callback function - int execLine(ISC_STATUS* isc_status, const char *realUser, + int execLine(ISC_STATUS* isc_status, const char* realUser, FB_API_HANDLE db, FB_API_HANDLE trans, - internal_user_data* io_user_data, + internal_user_data* io_user_data, FPTR_SECURITY_CALLBACK display_func, void* callback_arg); }; Modified: firebird/trunk/src/auth/trusted/AuthSspi.cpp =================================================================== --- firebird/trunk/src/auth/trusted/AuthSspi.cpp 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/auth/trusted/AuthSspi.cpp 2010-07-24 02:43:28 UTC (rev 51364) @@ -33,16 +33,16 @@ #include "../common/classes/Interface.h" #include "../common/classes/ImplementHelper.h" +using namespace Firebird; + namespace { #ifndef WIN_NT - char name[] = "WIN_SSPI"; - Firebird::PluginHelper<Auth::WinSspiServer, Firebird::Plugin::AuthServer, name> server; - Firebird::PluginHelper<Auth::WinSspiClient, Firebird::Plugin::AuthClient, name> client; + char name[] = "WIN_SSPI"; + PluginHelper<Auth::WinSspiServer, Plugin::AuthServer, name> server; + PluginHelper<Auth::WinSspiClient, Plugin::AuthClient, name> client; #endif } -using namespace Firebird; - namespace { void makeDesc(SecBufferDesc& d, SecBuffer& b, size_t len, void* p) Modified: firebird/trunk/src/common/classes/ImplementHelper.h =================================================================== --- firebird/trunk/src/common/classes/ImplementHelper.h 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/common/classes/ImplementHelper.h 2010-07-24 02:43:28 UTC (rev 51364) @@ -70,7 +70,7 @@ delete ptr; } -// Template to create statis instance of plugin +// Template to create static instance of plugin template <typename C, unsigned int T, char NM[]> class PluginHelper : public C { @@ -79,10 +79,12 @@ { fb_register_plugin(this); } + virtual const char* name() const { return NM; } + virtual unsigned int type() const { return T; @@ -92,6 +94,7 @@ { pp = chain; } + virtual Plugin* next() const { return pp; Modified: firebird/trunk/src/common/classes/Interface.h =================================================================== --- firebird/trunk/src/common/classes/Interface.h 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/common/classes/Interface.h 2010-07-24 02:43:28 UTC (rev 51364) @@ -66,8 +66,8 @@ extern "C" { // additional API functions - void ISC_EXPORT fb_register_plugin ( Firebird::Plugin* plugin ); - Firebird::Plugin* ISC_EXPORT fb_query_plugin (unsigned int type, const char* name); + void ISC_EXPORT fb_register_plugin(Plugin* plugin); + Plugin* ISC_EXPORT fb_query_plugin(unsigned int type, const char* name); } #endif // FB_COMMON_CLASSES_INTERFACE Modified: firebird/trunk/src/dbs/security.sql =================================================================== --- firebird/trunk/src/dbs/security.sql 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/dbs/security.sql 2010-07-24 02:43:28 UTC (rev 51364) @@ -15,7 +15,7 @@ * * All Rights Reserved. * Contributor(s): ______________________________________. - * + * * 2004.09.14 Alex Peshkoff - security changes, preventing ordinary users * from access to other users crypted passwords and enabling modification * of there own password. Originally suggested by Ivan Prenosil Modified: firebird/trunk/src/jrd/gds.cpp =================================================================== --- firebird/trunk/src/jrd/gds.cpp 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/jrd/gds.cpp 2010-07-24 02:43:28 UTC (rev 51364) @@ -3851,7 +3851,7 @@ Firebird::Plugin* prev = NULL; for (Firebird::Plugin* p = pluginChain; p; prev = p, p = p->next()) { - if (p->type() == type && ((!name) || (!strcmp(name, p->name())))) + if (p->type() == type && (!name || !strcmp(name, p->name()))) { if (prev) prev->link(p->next()); Modified: firebird/trunk/src/jrd/os/posix/mod_loader.cpp =================================================================== --- firebird/trunk/src/jrd/os/posix/mod_loader.cpp 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/jrd/os/posix/mod_loader.cpp 2010-07-24 02:43:28 UTC (rev 51364) @@ -45,10 +45,10 @@ {} ~DlfcnModule(); - void *findSymbol(const Firebird::string&); + void* findSymbol(const Firebird::string&); private: - void *module; + void* module; }; bool ModuleLoader::isLoadableModule(const Firebird::PathName& module) @@ -81,7 +81,7 @@ } } -ModuleLoader::Module *ModuleLoader::loadModule(const Firebird::PathName& modPath) +ModuleLoader::Module* ModuleLoader::loadModule(const Firebird::PathName& modPath) { void* module = dlopen(modPath.nullStr(), RTLD_LAZY); if (module == NULL) @@ -101,10 +101,10 @@ dlclose(module); } -void *DlfcnModule::findSymbol(const Firebird::string& symName) +void* DlfcnModule::findSymbol(const Firebird::string& symName) { - void *result = dlsym(module, symName.c_str()); - if (result == NULL) + void* result = dlsym(module, symName.c_str()); + if (!result) { Firebird::string newSym = '_' + symName; Modified: firebird/trunk/src/remote/server.cpp =================================================================== --- firebird/trunk/src/remote/server.cpp 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/remote/server.cpp 2010-07-24 02:43:28 UTC (rev 51364) @@ -223,8 +223,8 @@ explicit InitList(MemoryPool& p) : HalfStaticArray<Auth::ServerPlugin*, 8>(p) { - Firebird::Plugin* plugin; - while ( (plugin = fb_query_plugin(Firebird::Plugin::AuthServer, NULL)) ) + Plugin* plugin; + while ( (plugin = fb_query_plugin(Plugin::AuthServer, NULL)) ) { push(reinterpret_cast<Auth::ServerPlugin*>(plugin)); } Modified: firebird/trunk/src/utilities/gsec/security.cpp =================================================================== --- firebird/trunk/src/utilities/gsec/security.cpp 2010-07-23 14:39:21 UTC (rev 51363) +++ firebird/trunk/src/utilities/gsec/security.cpp 2010-07-24 02:43:28 UTC (rev 51364) @@ -46,7 +46,7 @@ using namespace Firebird; SSHORT SECURITY_exec_line(ISC_STATUS* isc_status, - const char *realUser, + const char* realUser, FB_API_HANDLE db, FB_API_HANDLE trans, internal_user_data* io_user_data, @@ -54,20 +54,23 @@ void* callback_arg) { static Auth::ManagementPlugin* volatile plugin = NULL; + if (!plugin) { static GlobalPtr<Mutex> mutex; MutexLockGuard g(mutex); + if (!plugin) { // temporary measure before PluginManager integration - Firebird::PathName plugFile(fb_utils::getPrefix(fb_utils::FB_DIR_PLUGINS, "user_management")); + PathName plugFile(fb_utils::getPrefix(fb_utils::FB_DIR_PLUGINS, "user_management")); ModuleLoader::doctorModuleExtension(plugFile); ModuleLoader::loadModule(plugFile); - plugin = reinterpret_cast<Auth::ManagementPlugin*> - (fb_query_plugin(Firebird::Plugin::UserManagement, NULL)); + plugin = reinterpret_cast<Auth::ManagementPlugin*>( + fb_query_plugin(Plugin::UserManagement, NULL)); } + if (!plugin) { (Arg::Gds(isc_random) << "Missing user management plugin").copyTo(isc_status); @@ -79,7 +82,7 @@ } SSHORT SECURITY_exec_line(ISC_STATUS* isc_status, - const char *realUser, + const char* realUser, FB_API_HANDLE db, internal_user_data* io_user_data, FPTR_SECURITY_CALLBACK display_func, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-26 02:14:54
|
Revision: 51367 http://firebird.svn.sourceforge.net/firebird/?rev=51367&view=rev Author: asfernandes Date: 2010-07-26 02:14:48 +0000 (Mon, 26 Jul 2010) Log Message: ----------- Create system constraints for better error reporting. Change to GBAK must be backported to avoid future problems. Modified Paths: -------------- firebird/trunk/src/burp/backup.epp firebird/trunk/src/jrd/ini.epp Modified: firebird/trunk/src/burp/backup.epp =================================================================== --- firebird/trunk/src/burp/backup.epp 2010-07-24 11:22:57 UTC (rev 51366) +++ firebird/trunk/src/burp/backup.epp 2010-07-26 02:14:48 UTC (rev 51367) @@ -3739,7 +3739,10 @@ BurpGlobals* tdgbl = BurpGlobals::getSpecific(); FOR (REQUEST_HANDLE req_handle1) - X IN RDB$RELATION_CONSTRAINTS + X IN RDB$RELATION_CONSTRAINTS CROSS + REL IN RDB$RELATIONS + WITH REL.RDB$RELATION_NAME EQ X.RDB$RELATION_NAME AND + (REL.RDB$SYSTEM_FLAG MISSING OR REL.RDB$SYSTEM_FLAG NE 1) put(tdgbl, rec_rel_constraint); const SSHORT l = PUT_TEXT (att_rel_constraint_name, X.RDB$CONSTRAINT_NAME); MISC_terminate (X.RDB$CONSTRAINT_NAME, temp, l, sizeof(temp)); Modified: firebird/trunk/src/jrd/ini.epp =================================================================== --- firebird/trunk/src/jrd/ini.epp 2010-07-24 11:22:57 UTC (rev 51366) +++ firebird/trunk/src/jrd/ini.epp 2010-07-26 02:14:48 UTC (rev 51367) @@ -800,30 +800,32 @@ SET_TDBB(tdbb); Jrd::Attachment* attachment = tdbb->getAttachment(); - Firebird::MetaName string; index_desc idx; - AutoRequest handle1, handle2; + AutoRequest handle1, handle2, handle3; for (int n = 0; n < SYSTEM_INDEX_COUNT; n++) { const ini_idx_t* index = &indices[n]; + jrd_rel* relation = MET_relation(tdbb, index->ini_idx_relid); + Firebird::MetaName indexName; + indexName.printf("RDB$INDEX_%d", index->ini_idx_index_id); + STORE(REQUEST_HANDLE handle1) X IN RDB$INDICES - jrd_rel* relation = MET_relation(tdbb, index->ini_idx_relid); PAD(relation->rel_name.c_str(), X.RDB$RELATION_NAME); - string.printf("RDB$INDEX_%d", index->ini_idx_index_id); - PAD(string.c_str(), X.RDB$INDEX_NAME); + PAD(indexName.c_str(), X.RDB$INDEX_NAME); X.RDB$UNIQUE_FLAG = index->ini_idx_flags & idx_unique; X.RDB$SEGMENT_COUNT = index->ini_idx_segment_count; + if (index->ini_idx_flags & idx_descending) { X.RDB$INDEX_TYPE.NULL = FALSE; X.RDB$INDEX_TYPE = 1; } - else { + else X.RDB$INDEX_TYPE.NULL = TRUE; - } + X.RDB$SYSTEM_FLAG = RDB_system; X.RDB$SYSTEM_FLAG.NULL = FALSE; X.RDB$INDEX_INACTIVE = 0; @@ -842,16 +844,30 @@ tail->idx_field = segment->ini_idx_rfld_id; tail->idx_itype = segment->ini_idx_type; tail->idx_selectivity = 0; - END_STORE; + END_STORE } + idx.idx_count = index->ini_idx_segment_count; idx.idx_flags = index->ini_idx_flags; SelectivityList selectivity(*tdbb->getDefaultPool()); - IDX_create_index(tdbb, relation, &idx, string.c_str(), NULL, + + IDX_create_index(tdbb, relation, &idx, indexName.c_str(), NULL, attachment->getSysTransaction(), selectivity); + X.RDB$INDEX_ID = idx.idx_id + 1; - END_STORE; + END_STORE + if (index->ini_idx_flags & idx_unique) + { + STORE(REQUEST_HANDLE handle3) RC IN RDB$RELATION_CONSTRAINTS + PAD(indexName.c_str(), RC.RDB$CONSTRAINT_NAME); + PAD(indexName.c_str(), RC.RDB$INDEX_NAME); + PAD(relation->rel_name.c_str(), RC.RDB$RELATION_NAME); + strcpy(RC.RDB$CONSTRAINT_TYPE, UNIQUE_CNSTRT); + strcpy(RC.RDB$DEFERRABLE, "NO"); + strcpy(RC.RDB$INITIALLY_DEFERRED, "NO"); + END_STORE + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-28 16:14:27
|
Revision: 51375 http://firebird.svn.sourceforge.net/firebird/?rev=51375&view=rev Author: asfernandes Date: 2010-07-28 16:14:20 +0000 (Wed, 28 Jul 2010) Log Message: ----------- Improvement CORE-3085 - Add clause ALTER DOMAIN <name> [NOT] NULL Modified Paths: -------------- firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/Parser.h firebird/trunk/src/dsql/parse.y firebird/trunk/src/jrd/dfw.epp firebird/trunk/src/jrd/tra.h firebird/trunk/src/jrd/vio.cpp Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-07-27 09:27:44 UTC (rev 51374) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-07-28 16:14:20 UTC (rev 51375) @@ -4136,6 +4136,12 @@ dsqlScratch->getBlrData()); } + if (nullFlag.specified) + { + FLD.RDB$NULL_FLAG.NULL = FALSE; + FLD.RDB$NULL_FLAG = nullFlag.value ? 0 : 1; + } + if (type) { type->resolve(dsqlScratch); Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-07-27 09:27:44 UTC (rev 51374) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-07-28 16:14:20 UTC (rev 51375) @@ -791,6 +791,7 @@ dsql_nod* setDefault; Firebird::MetaName renameTo; Firebird::AutoPtr<TypeClause> type; + TriStateType<bool> nullFlag; // true = NULL / false = NOT NULL }; Modified: firebird/trunk/src/dsql/Parser.h =================================================================== --- firebird/trunk/src/dsql/Parser.h 2010-07-27 09:27:44 UTC (rev 51374) +++ firebird/trunk/src/dsql/Parser.h 2010-07-28 16:14:20 UTC (rev 51375) @@ -166,6 +166,20 @@ clause = value; } + template <typename T> + void setClause(TriStateType<T>& clause, const char* duplicateMsg, const T& value) + { + using namespace Firebird; + if (clause.specified) + { + status_exception::raise( + Arg::Gds(isc_sqlerr) << Arg::Num(-637) << + Arg::Gds(isc_dsql_duplicate_spec) << duplicateMsg); + } + + clause = value; + } + void setClause(bool& clause, const char* duplicateMsg) { setClause(clause, duplicateMsg, true); Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-07-27 09:27:44 UTC (rev 51374) +++ firebird/trunk/src/dsql/parse.y 2010-07-28 16:14:20 UTC (rev 51375) @@ -3124,6 +3124,10 @@ { setClause($alterDomainNode->dropDefault, "DOMAIN DROP DEFAULT"); } | DROP CONSTRAINT { setClause($alterDomainNode->dropConstraint, "DOMAIN DROP CONSTRAINT"); } + | KW_NULL + { setClause($alterDomainNode->nullFlag, "[NOT] NULL", true); } + | NOT KW_NULL + { setClause($alterDomainNode->nullFlag, "[NOT] NULL", false); } | TO symbol_column_name { setClause($alterDomainNode->renameTo, "DOMAIN NAME", toName($2)); } | KW_TYPE init_data_type non_array_type Modified: firebird/trunk/src/jrd/dfw.epp =================================================================== --- firebird/trunk/src/jrd/dfw.epp 2010-07-27 09:27:44 UTC (rev 51374) +++ firebird/trunk/src/jrd/dfw.epp 2010-07-28 16:14:20 UTC (rev 51375) @@ -3341,9 +3341,31 @@ { const Firebird::MetaName depName(work->dfw_name); AutoRequest handle; + + // If a domain is being changed to NOT NULL, schedule validation for involved relations. + if (work->findArg(dfw_arg_field_null)) + { + FOR(REQUEST_HANDLE handle) + RFL IN RDB$RELATION_FIELDS + WITH RFL.RDB$FIELD_SOURCE EQ depName.c_str() + REDUCED TO RFL.RDB$RELATION_NAME, RFL.RDB$FIELD_ID + { + dsc desc; + desc.makeText(strlen(RFL.RDB$RELATION_NAME), CS_METADATA, + (UCHAR*) RFL.RDB$RELATION_NAME); + + DeferredWork* work = DFW_post_work(transaction, dfw_check_not_null, &desc, 0); + SortedArray<int>& ids = DFW_get_ids(work); + ids.add(RFL.RDB$FIELD_ID); + } + END_FOR + } + bid validation; validation.clear(); + handle.reset(); + FOR(REQUEST_HANDLE handle) FLD IN RDB$FIELDS WITH FLD.RDB$FIELD_NAME EQ depName.c_str() @@ -5124,7 +5146,7 @@ DeferredWork* work = DFW_post_work(transaction, dfw_check_not_null, &desc, 0); - Array<int>& ids = DFW_get_ids(work); + SortedArray<int>& ids = DFW_get_ids(work); ids.add(RFR.RDB$FIELD_ID); } } Modified: firebird/trunk/src/jrd/tra.h =================================================================== --- firebird/trunk/src/jrd/tra.h 2010-07-27 09:27:44 UTC (rev 51374) +++ firebird/trunk/src/jrd/tra.h 2010-07-28 16:14:20 UTC (rev 51375) @@ -455,7 +455,8 @@ dfw_arg_check_blr, // check if BLR is still compilable dfw_arg_rel_name, // relation name of a trigger dfw_arg_trg_type, // trigger type - dfw_arg_new_name // new name + dfw_arg_new_name, // new name + dfw_arg_field_null }; // Verb actions Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2010-07-27 09:27:44 UTC (rev 51374) +++ firebird/trunk/src/jrd/vio.cpp 2010-07-28 16:14:20 UTC (rev 51375) @@ -2344,7 +2344,7 @@ EVL_field(0, new_rpb->rpb_record, f_rfr_id, &desc2); DeferredWork* work = DFW_post_work(transaction, dfw_check_not_null, &desc1, 0); - Array<int>& ids = DFW_get_ids(work); + SortedArray<int>& ids = DFW_get_ids(work); ids.add(MOV_get_long(&desc2, 0)); } } @@ -2359,6 +2359,9 @@ MET_change_fields(tdbb, transaction, &desc1); EVL_field(0, new_rpb->rpb_record, f_fld_name, &desc2); DeferredWork* dw = MET_change_fields(tdbb, transaction, &desc2); + dsc desc3, desc4; + bool rc1, rc2; + if (dw) { // Did we convert computed field into physical, stored field? @@ -2366,9 +2369,8 @@ // Warning: getting the result of MET_change_fields is the last relation // that was affected, but for computed fields, it's an implicit domain // and hence it can be used only by a single field and therefore one relation. - dsc desc3, desc4; - bool rc1 = EVL_field(0, org_rpb->rpb_record, f_fld_computed, &desc3); - bool rc2 = EVL_field(0, new_rpb->rpb_record, f_fld_computed, &desc4); + rc1 = EVL_field(0, org_rpb->rpb_record, f_fld_computed, &desc3); + rc2 = EVL_field(0, new_rpb->rpb_record, f_fld_computed, &desc4); if (rc1 != rc2 || rc1 && MOV_compare(&desc3, &desc4)) { DFW_post_work_arg(transaction, dw, &desc1, 0, dfw_arg_force_computed); } @@ -2376,6 +2378,12 @@ dw = DFW_post_work(transaction, dfw_modify_field, &desc1, 0); DFW_post_work_arg(transaction, dw, &desc2, 0, dfw_arg_new_name); + + rc1 = EVL_field(NULL, org_rpb->rpb_record, f_fld_null_flag, &desc3); + rc2 = EVL_field(NULL, new_rpb->rpb_record, f_fld_null_flag, &desc4); + + if ((!rc1 || MOV_get_long(&desc3, 0) == 0) && rc2 && MOV_get_long(&desc4, 0) != 0) + DFW_post_work_arg(transaction, dw, &desc2, 0, dfw_arg_field_null); } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-29 00:21:00
|
Revision: 51376 http://firebird.svn.sourceforge.net/firebird/?rev=51376&view=rev Author: asfernandes Date: 2010-07-29 00:20:53 +0000 (Thu, 29 Jul 2010) Log Message: ----------- Rename misleading TriStateType class name to Nullable Modified Paths: -------------- firebird/trunk/src/common/classes/TriState.h firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/PackageNodes.epp firebird/trunk/src/dsql/Parser.h firebird/trunk/src/dsql/btyacc_fb.ske firebird/trunk/src/dsql/keywords.cpp firebird/trunk/src/dsql/parse.y firebird/trunk/src/jrd/PreparedStatement.h Added Paths: ----------- firebird/trunk/src/common/classes/Nullable.h Added: firebird/trunk/src/common/classes/Nullable.h =================================================================== --- firebird/trunk/src/common/classes/Nullable.h (rev 0) +++ firebird/trunk/src/common/classes/Nullable.h 2010-07-29 00:20:53 UTC (rev 51376) @@ -0,0 +1,132 @@ +/* + * 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 Adriano dos Santos Fernandes + * for the Firebird Open Source RDBMS project. + * + * Copyright (c) 2010 Adriano dos Santos Fernandes <adr...@gm...> + * and all contributors signed below. + * + * All Rights Reserved. + * Contributor(s): ______________________________________. + */ + +#ifndef CLASSES_NULLABLE_H +#define CLASSES_NULLABLE_H + +#include "firebird.h" +#include "../common/classes/fb_string.h" +#include "../common/classes/MetaName.h" + + +// Auxiliary template to build a empty value. +template <typename T> // Generic NullableClear +class NullableClear +{ +public: + static void clear(T& v) + { + v = 0; + } +}; + +// NullableClear specializations. + +template <> +class NullableClear<Firebird::string> // string especialization for NullableClear +{ +public: + static void clear(Firebird::string& v) + { + v = ""; + } +}; + +template <> +class NullableClear<Firebird::MetaName> // MetaName especialization for NullableClear +{ +public: + static void clear(Firebird::MetaName& v) + { + v = ""; + } +}; + + +// Nullable support without constructor, to allow usage in unions (used in the parser). +template <typename T> class BaseNullable +{ +public: + static BaseNullable<T> val(const T& v) + { + BaseNullable<T> nullable; + nullable.value = v; + nullable.specified = true; + return nullable; + } + + static BaseNullable<T> empty() + { + BaseNullable<T> nullable; + NullableClear<T>::clear(nullable.value); + nullable.specified = false; + return nullable; + } + + bool operator ==(const BaseNullable<T>& o) const + { + return (!specified && !o.specified) || (specified == o.specified && value == o.value); + } + +public: + T value; + bool specified; +}; + + +// Actual Nullable template. +template <typename T> class Nullable : public BaseNullable<T> +{ +public: + explicit Nullable<T>(const T& v) + { + this->value = v; + this->specified = true; + } + + Nullable<T>(const Nullable<T>& o) + { + this->value = o.value; + this->specified = o.specified; + } + + Nullable<T>() + { + NullableClear<T>::clear(this->value); + this->specified = false; + } + + void operator =(const BaseNullable<T>& o) + { + this->value = o.value; + this->specified = o.specified; + } + + void operator =(const T& v) + { + this->value = v; + this->specified = true; + } +}; + + +#endif // CLASSES_NULLABLE_H Property changes on: firebird/trunk/src/common/classes/Nullable.h ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + native Modified: firebird/trunk/src/common/classes/TriState.h =================================================================== --- firebird/trunk/src/common/classes/TriState.h 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/common/classes/TriState.h 2010-07-29 00:20:53 UTC (rev 51376) @@ -29,108 +29,7 @@ #ifndef CLASSES_TRISTATE_H #define CLASSES_TRISTATE_H -#include "firebird.h" -#include "../common/classes/fb_string.h" -#include "../common/classes/MetaName.h" - -// Do not have constructor to allow usage in unions (used in the parser). -template <typename T> class TriStateRawType -{ -public: - static TriStateRawType<T> val(const T& v) - { - TriStateRawType<T> triState; - triState.value = v; - triState.specified = true; - return triState; - } - - static TriStateRawType<T> empty() - { - TriStateRawType<T> triState; - triState.value = (T) 0; - triState.specified = false; - return triState; - } - - bool operator ==(const TriStateRawType<T>& o) const - { - return (!specified && !o.specified) || (specified == o.specified && value == o.value); - } - -public: - T value; - bool specified; -}; - - -template <typename T> // Generic TriStateClear -class TriStateClear -{ -public: - static void clear(T& v) - { - v = 0; - } -}; - -template <> -class TriStateClear<Firebird::string> // string especialization for TriStateClear -{ -public: - static void clear(Firebird::string& v) - { - v = ""; - } -}; - -template <> -class TriStateClear<Firebird::MetaName> // MetaName especialization for TriStateClear -{ -public: - static void clear(Firebird::MetaName& v) - { - v = ""; - } -}; - - -template <typename T> class TriStateType : public TriStateRawType<T> -{ -public: - explicit TriStateType<T>(const T& v) - { - this->value = v; - this->specified = true; - } - - TriStateType<T>(const TriStateType<T>& o) - { - this->value = o.value; - this->specified = o.specified; - } - - TriStateType<T>() - { - TriStateClear<T>::clear(this->value); - this->specified = false; - } - - void operator =(const TriStateRawType<T>& o) - { - this->value = o.value; - this->specified = o.specified; - } - - void operator =(const T& v) - { - this->value = v; - this->specified = true; - } -}; - - class TriState { public: Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-07-29 00:20:53 UTC (rev 51376) @@ -1079,7 +1079,7 @@ return; } - TriStateType<string> description; + Nullable<string> description; if (!text.isEmpty()) description = attachment->stringToMetaCharSet(tdbb, text, textCharSet); Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-07-29 00:20:53 UTC (rev 51376) @@ -33,7 +33,7 @@ #include "../dsql/Nodes.h" #include "../common/classes/array.h" #include "../common/classes/ByteChunk.h" -#include "../common/classes/TriState.h" +#include "../common/classes/Nullable.h" #include "../dsql/errd_proto.h" namespace Jrd { @@ -470,9 +470,9 @@ public: Firebird::MetaName name; Firebird::MetaName relationName; - TriStateType<FB_UINT64> type; - TriStateType<bool> active; - TriStateType<int> position; + Nullable<FB_UINT64> type; + Nullable<bool> active; + Nullable<int> position; ExternalClause* external; Firebird::string source; Firebird::ByteChunk blrData; @@ -791,7 +791,7 @@ dsql_nod* setDefault; Firebird::MetaName renameTo; Firebird::AutoPtr<TypeClause> type; - TriStateType<bool> nullFlag; // true = NULL / false = NOT NULL + Nullable<bool> nullFlag; // true = NULL / false = NOT NULL }; @@ -1199,9 +1199,9 @@ Firebird::MetaName relation; Firebird::ObjectsArray<Firebird::MetaName> columns; - TriStateType<bool> unique; - TriStateType<bool> descending; - TriStateType<bool> inactive; + Nullable<bool> unique; + Nullable<bool> descending; + Nullable<bool> inactive; SSHORT type; bid expressionBlr; bid expressionSource; Modified: firebird/trunk/src/dsql/PackageNodes.epp =================================================================== --- firebird/trunk/src/dsql/PackageNodes.epp 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/dsql/PackageNodes.epp 2010-07-29 00:20:53 UTC (rev 51376) @@ -99,19 +99,19 @@ MetaName fieldSource; MetaName fieldName; MetaName relationName; - TriStateType<SSHORT> collationId; - TriStateType<SSHORT> nullFlag; + Nullable<SSHORT> collationId; + Nullable<SSHORT> nullFlag; SSHORT mechanism; - TriStateType<SSHORT> fieldLength; - TriStateType<SSHORT> fieldScale; - TriStateType<SSHORT> fieldType; - TriStateType<SSHORT> fieldSubType; - TriStateType<SSHORT> fieldSegmentLength; - TriStateType<SSHORT> fieldNullFlag; - TriStateType<SSHORT> fieldCharLength; - TriStateType<SSHORT> fieldCollationId; - TriStateType<SSHORT> fieldCharSetId; - TriStateType<SSHORT> fieldPrecision; + Nullable<SSHORT> fieldLength; + Nullable<SSHORT> fieldScale; + Nullable<SSHORT> fieldType; + Nullable<SSHORT> fieldSubType; + Nullable<SSHORT> fieldSegmentLength; + Nullable<SSHORT> fieldNullFlag; + Nullable<SSHORT> fieldCharLength; + Nullable<SSHORT> fieldCollationId; + Nullable<SSHORT> fieldCharSetId; + Nullable<SSHORT> fieldPrecision; // Not compared bid defaultSource; Modified: firebird/trunk/src/dsql/Parser.h =================================================================== --- firebird/trunk/src/dsql/Parser.h 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/dsql/Parser.h 2010-07-29 00:20:53 UTC (rev 51376) @@ -32,7 +32,7 @@ #include "../dsql/WinNodes.h" #include "../dsql/PackageNodes.h" #include "../dsql/StmtNodes.h" -#include "../common/classes/TriState.h" +#include "../common/classes/Nullable.h" #include "../common/classes/stack.h" #define _yacc_defines_keywords @@ -167,7 +167,7 @@ } template <typename T> - void setClause(TriStateType<T>& clause, const char* duplicateMsg, const T& value) + void setClause(Nullable<T>& clause, const char* duplicateMsg, const T& value) { using namespace Firebird; if (clause.specified) Modified: firebird/trunk/src/dsql/btyacc_fb.ske =================================================================== --- firebird/trunk/src/dsql/btyacc_fb.ske 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/dsql/btyacc_fb.ske 2010-07-29 00:20:53 UTC (rev 51376) @@ -22,7 +22,7 @@ #include "../dsql/PackageNodes.h" #include "../dsql/StmtNodes.h" #include "../dsql/WinNodes.h" -#include "../common/classes/TriState.h" +#include "../common/classes/Nullable.h" #include "dsql.tab.h" #include "Parser.h" Modified: firebird/trunk/src/dsql/keywords.cpp =================================================================== --- firebird/trunk/src/dsql/keywords.cpp 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/dsql/keywords.cpp 2010-07-29 00:20:53 UTC (rev 51376) @@ -37,7 +37,7 @@ #include "../dsql/PackageNodes.h" #include "../dsql/StmtNodes.h" #include "../dsql/WinNodes.h" -#include "../common/classes/TriState.h" +#include "../common/classes/Nullable.h" #include "dsql.tab.h" #include "keywords.h" Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/dsql/parse.y 2010-07-29 00:20:53 UTC (rev 51376) @@ -609,15 +609,14 @@ %union { - TriStateRawType<int> triIntVal; - TriStateRawType<bool> triBoolVal; + BaseNullable<int> nullableIntVal; + BaseNullable<bool> nullableBoolVal; bool boolVal; int intVal; unsigned uintVal; SLONG int32Val; FB_UINT64 uint64Val; - TriStateRawType<unsigned> triUintVal; - TriStateRawType<FB_UINT64> triUint64Val; + BaseNullable<FB_UINT64> nullableUint64Val; Jrd::dsql_nod* legacyNode; Jrd::dsql_str* legacyStr; Jrd::dsql_fld* legacyField; @@ -848,12 +847,12 @@ %type alter_domain_ops(<alterDomainNode>) %type alter_domain_op(<alterDomainNode>) -%type <triBoolVal> trigger_active +%type <nullableBoolVal> trigger_active %type <uint64Val> trigger_db_type trigger_ddl_type trigger_ddl_type_items trigger_type %type <uint64Val> trigger_type_prefix trigger_type_suffix -%type <triUint64Val> trigger_type_opt +%type <nullableUint64Val> trigger_type_opt %type <createAlterTriggerNode> alter_trigger_clause replace_trigger_clause trigger_clause -%type <triIntVal> trigger_position +%type <nullableIntVal> trigger_position %type <legacyNode> symbol_package_name %type <createAlterPackageNode> alter_package_clause package_clause replace_package_clause @@ -2920,11 +2919,11 @@ trigger_active : ACTIVE - { $$ = TriStateRawType<bool>::val(true); } + { $$ = Nullable<bool>::val(true); } | INACTIVE - { $$ = TriStateRawType<bool>::val(false); } + { $$ = Nullable<bool>::val(false); } | - { $$ = TriStateRawType<bool>::empty(); } + { $$ = Nullable<bool>::empty(); } ; trigger_type @@ -3045,9 +3044,9 @@ trigger_position : POSITION nonneg_short_integer - { $$ = TriStateRawType<int>::val($2); } + { $$ = Nullable<int>::val($2); } | - { $$ = TriStateRawType<int>::empty(); } + { $$ = Nullable<int>::empty(); } ; // ALTER statement @@ -3424,9 +3423,9 @@ trigger_type_opt // we do not allow alter database triggers, hence we do not use trigger_type here : trigger_type_prefix trigger_type_suffix - { $$ = TriStateRawType<FB_UINT64>::val($1 + $2 - 1); } + { $$ = Nullable<FB_UINT64>::val($1 + $2 - 1); } | - { $$ = TriStateRawType<FB_UINT64>::empty(); } + { $$ = Nullable<FB_UINT64>::empty(); } ; Modified: firebird/trunk/src/jrd/PreparedStatement.h =================================================================== --- firebird/trunk/src/jrd/PreparedStatement.h 2010-07-28 16:14:20 UTC (rev 51375) +++ firebird/trunk/src/jrd/PreparedStatement.h 2010-07-29 00:20:53 UTC (rev 51376) @@ -32,7 +32,7 @@ #include "../common/classes/auto.h" #include "../common/classes/fb_string.h" #include "../common/classes/MetaName.h" -#include "../common/classes/TriState.h" +#include "../common/classes/Nullable.h" namespace Jrd { @@ -101,7 +101,7 @@ public: // Output variables. - template <typename T> OutputParam operator ()(const char* chunk, TriStateType<T>& param) + template <typename T> OutputParam operator ()(const char* chunk, Nullable<T>& param) { OutputParam ret = (*this)(chunk, param.value); outputSlots[outputSlots.getCount() - 1].specifiedAddress = ¶m.specified; @@ -132,7 +132,7 @@ return *this; } - template <typename T> Builder& operator <<(const TriStateType<T>& param) + template <typename T> Builder& operator <<(const Nullable<T>& param) { *this << param.value; inputSlots[inputSlots.getCount() - 1].specifiedAddress = ¶m.specified; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-07-29 00:36:37
|
Revision: 51377 http://firebird.svn.sourceforge.net/firebird/?rev=51377&view=rev Author: asfernandes Date: 2010-07-29 00:36:31 +0000 (Thu, 29 Jul 2010) Log Message: ----------- Better error reporting and adjustments Modified Paths: -------------- firebird/trunk/src/include/gen/msgs.h firebird/trunk/src/jrd/dfw.epp firebird/trunk/src/jrd/tra.h firebird/trunk/src/jrd/vio.cpp firebird/trunk/src/msgs/messages2.sql Modified: firebird/trunk/src/include/gen/msgs.h =================================================================== --- firebird/trunk/src/include/gen/msgs.h 2010-07-29 00:20:53 UTC (rev 51376) +++ firebird/trunk/src/include/gen/msgs.h 2010-07-29 00:36:31 UTC (rev 51377) @@ -693,7 +693,7 @@ {335544986, "Explicit transaction control is not allowed"}, /* eds_expl_tran_ctrl */ {335544987, "Use of TRUSTED switches in spb_command_line is prohibited"}, /* no_trusted_spb */ {335544988, "PACKAGE @1"}, /* package_name */ - {335544989, "Cannot make field @1 NOT NULL because there are NULLs present"}, /* cannot_make_not_null */ + {335544989, "Cannot make field @1 of table @2 NOT NULL because there are NULLs present"}, /* cannot_make_not_null */ {335544990, "Feature @1 is deprecated"}, /* feature_deprecated */ {335544991, "VIEW @1"}, /* view_name */ {335544992, "Can not access lock files directory @1"}, /* lock_dir_access */ Modified: firebird/trunk/src/jrd/dfw.epp =================================================================== --- firebird/trunk/src/jrd/dfw.epp 2010-07-29 00:20:53 UTC (rev 51376) +++ firebird/trunk/src/jrd/dfw.epp 2010-07-29 00:36:31 UTC (rev 51377) @@ -1630,7 +1630,8 @@ { hasError = true; errs << Arg::Gds(isc_cannot_make_not_null) << - Arg::Str((*relation->rel_fields)[fields[i]]->fld_name); + (*relation->rel_fields)[fields[i]]->fld_name << + relation->rel_name; } } @@ -3342,12 +3343,15 @@ const Firebird::MetaName depName(work->dfw_name); AutoRequest handle; - // If a domain is being changed to NOT NULL, schedule validation for involved relations. - if (work->findArg(dfw_arg_field_null)) + // If a domain is being changed to NOT NULL, schedule validation of involved relations. + if (work->findArg(dfw_arg_field_not_null)) { FOR(REQUEST_HANDLE handle) - RFL IN RDB$RELATION_FIELDS - WITH RFL.RDB$FIELD_SOURCE EQ depName.c_str() + RFL IN RDB$RELATION_FIELDS CROSS + REL IN RDB$RELATIONS + WITH REL.RDB$RELATION_NAME EQ RFL.RDB$RELATION_NAME AND + RFL.RDB$FIELD_SOURCE EQ depName.c_str() AND + REL.RDB$VIEW_BLR MISSING REDUCED TO RFL.RDB$RELATION_NAME, RFL.RDB$FIELD_ID { dsc desc; Modified: firebird/trunk/src/jrd/tra.h =================================================================== --- firebird/trunk/src/jrd/tra.h 2010-07-29 00:20:53 UTC (rev 51376) +++ firebird/trunk/src/jrd/tra.h 2010-07-29 00:36:31 UTC (rev 51377) @@ -456,7 +456,7 @@ dfw_arg_rel_name, // relation name of a trigger dfw_arg_trg_type, // trigger type dfw_arg_new_name, // new name - dfw_arg_field_null + dfw_arg_field_not_null // set domain to not nullable }; // Verb actions Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2010-07-29 00:20:53 UTC (rev 51376) +++ firebird/trunk/src/jrd/vio.cpp 2010-07-29 00:36:31 UTC (rev 51377) @@ -2383,7 +2383,7 @@ rc2 = EVL_field(NULL, new_rpb->rpb_record, f_fld_null_flag, &desc4); if ((!rc1 || MOV_get_long(&desc3, 0) == 0) && rc2 && MOV_get_long(&desc4, 0) != 0) - DFW_post_work_arg(transaction, dw, &desc2, 0, dfw_arg_field_null); + DFW_post_work_arg(transaction, dw, &desc2, 0, dfw_arg_field_not_null); } break; Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2010-07-29 00:20:53 UTC (rev 51376) +++ firebird/trunk/src/msgs/messages2.sql 2010-07-29 00:36:31 UTC (rev 51377) @@ -776,7 +776,7 @@ ('eds_expl_tran_ctrl', NULL, '', NULL, 0, 666, NULL, 'Explicit transaction control is not allowed', NULL, NULL) ('no_trusted_spb', NULL, 'svc.cpp', NULL, 0, 667, NULL, 'Use of TRUSTED switches in spb_command_line is prohibited', NULL, NULL) ('package_name', 'check_dependencies', 'dfw.epp', NULL, 0, 668, NULL, 'PACKAGE @1', NULL, NULL); -('cannot_make_not_null', 'check_not_null', 'dfw.epp', NULL, 0, 669, NULL, 'Cannot make field @1 NOT NULL because there are NULLs present', NULL, NULL); +('cannot_make_not_null', 'check_not_null', 'dfw.epp', NULL, 0, 669, NULL, 'Cannot make field @1 of table @2 NOT NULL because there are NULLs present', NULL, NULL); ('feature_deprecated', NULL, '', NULL, 0, 670, NULL, 'Feature @1 is deprecated', NULL, NULL); ('view_name', 'check_dependencies', 'dfw.epp', NULL, 0, 671, NULL, 'VIEW @1', NULL, NULL); ('lock_dir_access', 'createLockDirectory', 'os_utils.cpp', NULL, 0, 672, NULL, 'Can not access lock files directory @1', NULL, NULL); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-05 15:55:56
|
Revision: 51397 http://firebird.svn.sourceforge.net/firebird/?rev=51397&view=rev Author: asfernandes Date: 2010-08-05 15:55:49 +0000 (Thu, 05 Aug 2010) Log Message: ----------- 1) Better organization between request and statement. 2) Consts. Modified Paths: -------------- firebird/trunk/src/dsql/dsql.cpp firebird/trunk/src/jrd/DatabaseSnapshot.cpp firebird/trunk/src/jrd/JrdStatement.cpp firebird/trunk/src/jrd/JrdStatement.h firebird/trunk/src/jrd/SysFunction.cpp firebird/trunk/src/jrd/evl.cpp firebird/trunk/src/jrd/exe.cpp firebird/trunk/src/jrd/exe.h firebird/trunk/src/jrd/jrd.cpp firebird/trunk/src/jrd/opt.cpp firebird/trunk/src/jrd/req.h Modified: firebird/trunk/src/dsql/dsql.cpp =================================================================== --- firebird/trunk/src/dsql/dsql.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/dsql/dsql.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -2533,6 +2533,14 @@ ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) << Arg::Gds(isc_malformed_string)); } + + UCharBuffer temp; + + CsConvert conversor(charSet->getStruct(), + INTL_charset_lookup(tdbb, CS_METADATA)->getStruct()); + conversor.convert(transformedText.length(), (const UCHAR*) transformedText.c_str(), temp); + + transformedText.assign(temp.begin(), temp.getCount()); } statement->setSqlText(FB_NEW(pool) RefString(pool, transformedText)); Modified: firebird/trunk/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/DatabaseSnapshot.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -555,6 +555,11 @@ // generic logic that covers all other relations else if (record && dbb_allowed && att_allowed) { + // ASF: The statement text is always dumped in the metadata charset. + AutoSetRestore<int> autoAttCharSet(&attachment_charset, + rid == rel_mon_statements && fid == f_mon_stmt_sql_text ? + ttype_metadata : attachment_charset); + putField(tdbb, record, dumpField, attachment_charset); fields_processed = true; dbb_processed = true; Modified: firebird/trunk/src/jrd/JrdStatement.cpp =================================================================== --- firebird/trunk/src/jrd/JrdStatement.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/JrdStatement.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -52,7 +52,6 @@ fors(*p), execStmts(*p), invariants(*p), - charset(CS_dynamic), blr(*p), mapFieldInfo(*p), mapItemInfo(*p) @@ -61,7 +60,6 @@ accessList = csb->csb_access; externalList = csb->csb_external; mapFieldInfo.takeOwnership(csb->csb_map_field_info); - charset = tdbb->getAttachment()->att_charset; resources = csb->csb_resources; // Assign array contents impureSize = csb->csb_impure; @@ -238,10 +236,7 @@ } if (internalFlag) - { - statement->charset = CS_METADATA; statement->flags |= FLAG_INTERNAL; - } else tdbb->bumpStats(RuntimeStatistics::STMT_PREPARES); @@ -321,7 +316,7 @@ if (!clone) clone = getRequest(tdbb, n); - clone->req_attachment = attachment; + clone->setAttachment(attachment); clone->req_stats.reset(); clone->req_base_stats.reset(); clone->req_flags |= req_in_use; @@ -345,9 +340,8 @@ MemoryStats* const parentStats = (flags & FLAG_INTERNAL) ? &dbb->dbb_memory_stats : &attachment->att_memory_stats; - // Clone the request. - jrd_req* request = FB_NEW(*pool) jrd_req(this, parentStats); - request->req_attachment = attachment; + // Create the request. + jrd_req* request = FB_NEW(*pool) jrd_req(attachment, this, parentStats); request->req_id = fb_utils::genUniqueId(); requests[level] = request; Modified: firebird/trunk/src/jrd/JrdStatement.h =================================================================== --- firebird/trunk/src/jrd/JrdStatement.h 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/JrdStatement.h 2010-08-05 15:55:49 UTC (rev 51397) @@ -71,15 +71,14 @@ ExternalAccessList externalList; // Access to procedures/triggers to be checked AccessItemList accessList; // Access items to be checked ResourceList resources; // Resources (relations and indices) - jrd_prc* procedure; // procedure, if any - Function* function; // function, if any + const jrd_prc* procedure; // procedure, if any + const Function* function; // function, if any Firebird::MetaName triggerName; // name of request (trigger), if any jrd_nod* topNode; // top of execution tree - Firebird::Array<RecordSource*> fors; // record sources + Firebird::Array<const RecordSource*> fors; // record sources Firebird::Array<jrd_nod*> execStmts; // exec_into nodes Firebird::Array<jrd_nod*> invariants; // invariant nodes - SSHORT charset; // Client charset for this request - Firebird::RefStrPtr sqlText; // SQL text + Firebird::RefStrPtr sqlText; // SQL text (encoded in the metadata charset) Firebird::Array<UCHAR> blr; // BLR for non-SQL query MapFieldInfo mapFieldInfo; // Map field name to field info MapItemInfo mapItemInfo; // Map item to item info Modified: firebird/trunk/src/jrd/SysFunction.cpp =================================================================== --- firebird/trunk/src/jrd/SysFunction.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/SysFunction.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -2143,8 +2143,7 @@ BLB_close(tdbb, blob); dsc result; - result.makeBlob(isc_blob_text, attachment->att_charset, - (ISC_QUAD*) &impure->vlu_misc.vlu_bid); + result.makeBlob(isc_blob_text, ttype_metadata, (ISC_QUAD*) &impure->vlu_misc.vlu_bid); EVL_make_value(tdbb, &result, impure); request->req_flags &= ~req_null; Modified: firebird/trunk/src/jrd/evl.cpp =================================================================== --- firebird/trunk/src/jrd/evl.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/evl.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -1458,7 +1458,7 @@ if (item.type == nod_variable) { - jrd_prc* procedure = request->getStatement()->procedure; + const jrd_prc* procedure = request->getStatement()->procedure; if (procedure) { Modified: firebird/trunk/src/jrd/exe.cpp =================================================================== --- firebird/trunk/src/jrd/exe.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/exe.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -931,7 +931,7 @@ ERR_post(Arg::Gds(isc_req_no_trans)); JrdStatement* statement = request->getStatement(); - jrd_prc* proc = statement->procedure; + const jrd_prc* proc = statement->procedure; if (proc && proc->isUndefined()) { @@ -1042,7 +1042,7 @@ tdbb->setRequest(request); tdbb->setTransaction(request->req_transaction); - for (RecordSource* const* ptr = statement->fors.begin(); + for (const RecordSource* const* ptr = statement->fors.begin(); ptr != statement->fors.end(); ++ptr) { (*ptr)->close(tdbb); Modified: firebird/trunk/src/jrd/exe.h =================================================================== --- firebird/trunk/src/jrd/exe.h 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/exe.h 2010-08-05 15:55:49 UTC (rev 51397) @@ -794,7 +794,7 @@ vec<jrd_nod*>* csb_variables; // Vector of variables, if any ResourceList csb_resources; // Resources (relations and indexes) NodeStack csb_dependencies; // objects this request depends upon - Firebird::Array<RecordSource*> csb_fors; // record sources + Firebird::Array<const RecordSource*> csb_fors; // record sources Firebird::Array<jrd_nod*> csb_exec_sta; // Array of exec_into nodes Firebird::Array<jrd_nod*> csb_invariants; // stack of invariant nodes Firebird::Array<jrd_node_base*> csb_current_nodes; // RecordSelExpr's and other invariant Modified: firebird/trunk/src/jrd/jrd.cpp =================================================================== --- firebird/trunk/src/jrd/jrd.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/jrd.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -6464,8 +6464,8 @@ SSHORT thread_db::getCharSet() const { - if (request && request->getStatement()->charset != CS_dynamic) - return request->getStatement()->charset; + if (request && request->charSetId != CS_dynamic) + return request->charSetId; return attachment->att_charset; } Modified: firebird/trunk/src/jrd/opt.cpp =================================================================== --- firebird/trunk/src/jrd/opt.cpp 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/opt.cpp 2010-08-05 15:55:49 UTC (rev 51397) @@ -755,7 +755,7 @@ UCharBuffer infoBuffer; - Array<RecordSource*>& fors = request->getStatement()->fors; + Array<const RecordSource*>& fors = request->getStatement()->fors; for (size_t i = 0; i < fors.getCount(); i++) fors[i]->dump(tdbb, infoBuffer); Modified: firebird/trunk/src/jrd/req.h =================================================================== --- firebird/trunk/src/jrd/req.h 2010-08-05 00:47:06 UTC (rev 51396) +++ firebird/trunk/src/jrd/req.h 2010-08-05 15:55:49 UTC (rev 51397) @@ -32,6 +32,7 @@ #include "../jrd/exe.h" #include "../jrd/sort.h" +#include "../jrd/Attachment.h" #include "../jrd/JrdStatement.h" #include "../jrd/RecordNumber.h" #include "../jrd/ExtEngineManager.h" @@ -198,7 +199,8 @@ class jrd_req : public pool_alloc<type_req> { public: - jrd_req(/*const*/ JrdStatement* aStatement, Firebird::MemoryStats* parent_stats) + jrd_req(Attachment* attachment, /*const*/ JrdStatement* aStatement, + Firebird::MemoryStats* parent_stats) : statement(aStatement), req_pool(statement->pool), req_memory_stats(parent_stats), @@ -213,6 +215,7 @@ req_rpb(*req_pool), impureArea(*req_pool) { + setAttachment(attachment); req_rpb = statement->rpbsSetup; impureArea.grow(statement->impureSize); } @@ -222,6 +225,13 @@ return statement; } + void setAttachment(Attachment* newAttachment) + { + req_attachment = newAttachment; + charSetId = statement->flags & JrdStatement::FLAG_INTERNAL ? + CS_METADATA : req_attachment->att_charset; + } + private: /*const*/ JrdStatement* const statement; @@ -281,6 +291,7 @@ SortOwner req_sorts; Firebird::Array<record_param> req_rpb; // record parameter blocks Firebird::Array<UCHAR> impureArea; // impure area + USHORT charSetId; // "client" character set of the request enum req_ta { // Order should be maintained because the numbers are stored in BLR This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-07 02:10:14
|
Revision: 51404 http://firebird.svn.sourceforge.net/firebird/?rev=51404&view=rev Author: asfernandes Date: 2010-08-07 02:10:08 +0000 (Sat, 07 Aug 2010) Log Message: ----------- Frontport fix for CORE-3090 - Incorrect LEFT JOIN result using table and derived constant subquery Modified Paths: -------------- firebird/trunk/src/dsql/pass1.cpp firebird/trunk/src/jrd/Optimizer.cpp Modified: firebird/trunk/src/dsql/pass1.cpp =================================================================== --- firebird/trunk/src/dsql/pass1.cpp 2010-08-07 01:50:35 UTC (rev 51403) +++ firebird/trunk/src/dsql/pass1.cpp 2010-08-07 02:10:08 UTC (rev 51404) @@ -4646,14 +4646,22 @@ if (foundSubSelect) { + DsqlContextStack::const_iterator baseUnion(dsqlScratch->unionContext); + dsql_nod* union_expr = MAKE_node(nod_list, 1); union_expr->nod_arg[0] = select_expr; union_expr->nod_flags = NOD_UNION_ALL; rse = pass1_union(dsqlScratch, union_expr, NULL, NULL, NULL, 0); + + for (DsqlContextStack::const_iterator i(dsqlScratch->unionContext); + i.hasData() && i != baseUnion; + ++i) + { + temp.push(i.object()); + } } - else { + else rse = PASS1_rse(dsqlScratch, select_expr, NULL); - } USHORT minOuterJoin = MAX_USHORT; Modified: firebird/trunk/src/jrd/Optimizer.cpp =================================================================== --- firebird/trunk/src/jrd/Optimizer.cpp 2010-08-07 01:50:35 UTC (rev 51403) +++ firebird/trunk/src/jrd/Optimizer.cpp 2010-08-07 02:10:08 UTC (rev 51404) @@ -178,6 +178,32 @@ } return csb->csb_rpt[n].csb_flags & csb_active; + case nod_derived_expr: + { + const UCHAR streamCount = (UCHAR)(IPTR) node->nod_arg[e_derived_expr_stream_count]; + const USHORT* streamList = (USHORT*) node->nod_arg[e_derived_expr_stream_list]; + + for (unsigned i = 0; i < streamCount; ++i) + { + n = streamList[i]; + + if (allowOnlyCurrentStream) + { + if (n != stream && !(csb->csb_rpt[n].csb_flags & csb_sub_stream)) + return false; + } + else + { + if (n == stream) + return false; + } + + if (!(csb->csb_rpt[n].csb_flags & csb_active)) + return false; + } + } + return true; + case nod_rec_version: case nod_dbkey: n = (USHORT)(IPTR) node->nod_arg[0]; @@ -1130,6 +1156,25 @@ return; } + case nod_derived_expr: + { + const UCHAR count = (UCHAR)(IPTR) node->nod_arg[e_derived_expr_stream_count]; + const USHORT* list = (USHORT*) node->nod_arg[e_derived_expr_stream_list]; + + for (unsigned i = 0; i < count; ++i) + { + int derivedStream = list[i]; + + if (derivedStream != stream && (csb->csb_rpt[derivedStream].csb_flags & csb_active)) + { + if (!streamList->exist(derivedStream)) + streamList->add(derivedStream); + } + } + + return; + } + case nod_min: case nod_max: case nod_average: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hv...@us...> - 2010-08-07 21:18:29
|
Revision: 51411 http://firebird.svn.sourceforge.net/firebird/?rev=51411&view=rev Author: hvlad Date: 2010-08-07 21:18:23 +0000 (Sat, 07 Aug 2010) Log Message: ----------- Fixed bug CORE-3100 : Wait mode and lock timeout of external transaction of EXECUTE STATEMENT not matched to corresponding parameters of local transaction Modified Paths: -------------- firebird/trunk/src/common/classes/ClumpletReader.cpp firebird/trunk/src/jrd/extds/ExtDS.cpp Modified: firebird/trunk/src/common/classes/ClumpletReader.cpp =================================================================== --- firebird/trunk/src/common/classes/ClumpletReader.cpp 2010-08-07 15:49:53 UTC (rev 51410) +++ firebird/trunk/src/common/classes/ClumpletReader.cpp 2010-08-07 21:18:23 UTC (rev 51411) @@ -255,6 +255,7 @@ { case isc_tpb_lock_write: case isc_tpb_lock_read: + case isc_tpb_lock_timeout: return TraditionalDpb; } return SingleTpb; Modified: firebird/trunk/src/jrd/extds/ExtDS.cpp =================================================================== --- firebird/trunk/src/jrd/extds/ExtDS.cpp 2010-08-07 15:49:53 UTC (rev 51410) +++ firebird/trunk/src/jrd/extds/ExtDS.cpp 2010-08-07 21:18:23 UTC (rev 51411) @@ -583,7 +583,7 @@ tpb.insertTag(readOnly ? isc_tpb_read : isc_tpb_write); tpb.insertTag(wait ? isc_tpb_wait : isc_tpb_nowait); - if (wait && lockTimeout) + if (wait && lockTimeout && lockTimeout != DEFAULT_LOCK_TIMEOUT) tpb.insertInt(isc_tpb_lock_timeout, lockTimeout); } @@ -688,8 +688,8 @@ tra_scope, traMode, tran->tra_flags & TRA_readonly, - tran->getLockWait() == DEFAULT_LOCK_TIMEOUT, - tran->getLockWait() + tran->getLockWait() != 0, + -tran->getLockWait() ); } catch (const Exception&) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ro...@us...> - 2010-08-09 11:50:19
|
Revision: 51415 http://firebird.svn.sourceforge.net/firebird/?rev=51415&view=rev Author: robocop Date: 2010-08-09 11:50:12 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Misc. Modified Paths: -------------- firebird/trunk/src/common/classes/Nullable.h firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/DdlNodes.h firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/msgs/facilities2.sql Modified: firebird/trunk/src/common/classes/Nullable.h =================================================================== --- firebird/trunk/src/common/classes/Nullable.h 2010-08-08 17:07:53 UTC (rev 51414) +++ firebird/trunk/src/common/classes/Nullable.h 2010-08-09 11:50:12 UTC (rev 51415) @@ -28,7 +28,7 @@ #include "../common/classes/MetaName.h" -// Auxiliary template to build a empty value. +// Auxiliary template to build an empty value. template <typename T> // Generic NullableClear class NullableClear { Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-08-08 17:07:53 UTC (rev 51414) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-08-09 11:50:12 UTC (rev 51415) @@ -388,9 +388,7 @@ // the field, subtract 1 to move the fields to their new positions otherwise, // increase the value in RDB$FIELD_POSITION by one. - bool moveDown = false; - if (existingPosition < newPosition) - moveDown = true; + const bool moveDown = (existingPosition < newPosition); // Retrieve the records for the fields which have a position between the // existing field position and the new field position. @@ -836,7 +834,7 @@ setup(dsqlScratch); } -void TypeClause::setup(DsqlCompilerScratch* dsqlScratch) +void TypeClause::setup(DsqlCompilerScratch* /*dsqlScratch*/) { type = legacyField->fld_dtype; length = legacyField->fld_length; @@ -4591,7 +4589,7 @@ void RelationNode::FieldDefinition::modify(thread_db* tdbb, jrd_tra* transaction) { - Attachment* attachment = transaction->tra_attachment; + //Attachment* attachment = transaction->tra_attachment; AutoRequest request; @@ -4869,6 +4867,8 @@ } END_FOR + // Delete de automatically created generator for Identity columns. + request.reset(tdbb, drq_e_lfield, DYN_REQUESTS); found = false; @@ -4939,7 +4939,7 @@ void RelationNode::defineField(thread_db* tdbb, jrd_tra* transaction, const dsql_nod* element, SSHORT position, const dsql_nod* pkCols) { - Attachment* attachment = transaction->tra_attachment; + //Attachment* attachment = transaction->tra_attachment; dsql_fld* field = (dsql_fld*) element->nod_arg[Dsql::e_dfl_field]; // Add the field to the relation being defined for parsing purposes. @@ -5207,7 +5207,7 @@ } // Define a DEFAULT clause. Return true for DEFAULT NULL. -bool RelationNode::defineDefault(thread_db* tdbb, dsql_fld* field, dsql_nod* node, +bool RelationNode::defineDefault(thread_db* tdbb, dsql_fld* /*field*/, dsql_nod* node, string& source, BlrWriter::BlrData& value) { dsql_nod* input = PASS1_node(dsqlScratch, node->nod_arg[Dsql::e_dft_default]); @@ -5496,7 +5496,7 @@ fb_assert(false); } - // These constraints requires creation of an index. + // These constraints require creation of an index. switch (constraint.type) { case Constraint::TYPE_PK: @@ -6102,7 +6102,7 @@ // Generate blr to express: if (old.primary_key != new.primary_key). // Do a column by column comparison. -void RelationNode::stuffTriggerFiringCondition(Constraint& constraint, BlrWriter& blrWriter) +void RelationNode::stuffTriggerFiringCondition(const Constraint& constraint, BlrWriter& blrWriter) { blrWriter.appendUChar(blr_if); @@ -6140,7 +6140,7 @@ void CreateRelationNode::execute(thread_db* tdbb, jrd_tra* transaction) { - Attachment* attachment = transaction->tra_attachment; + //Attachment* attachment = transaction->tra_attachment; saveRelation(tdbb, dsqlScratch, name, false, true); @@ -6280,7 +6280,7 @@ void AlterRelationNode::execute(thread_db* tdbb, jrd_tra* transaction) { - Attachment* attachment = transaction->tra_attachment; + //Attachment* attachment = transaction->tra_attachment; saveRelation(tdbb, dsqlScratch, name, false, false); @@ -6566,7 +6566,7 @@ { Attachment* attachment = transaction->tra_attachment; - DsqlCompiledStatement* statement = dsqlScratch->getStatement(); + //DsqlCompiledStatement* statement = dsqlScratch->getStatement(); dsql_fld* field = (dsql_fld*) element->nod_arg[Dsql::e_mod_fld_type_field]; // Add the field to the relation being defined for parsing purposes. @@ -6634,11 +6634,11 @@ origDom.dyn_fld_source = RFR.RDB$FIELD_SOURCE; // If the original field type is an array, force its blr type to blr_blob. - bool hasDimensions = FLD.RDB$DIMENSIONS != 0; + const bool hasDimensions = FLD.RDB$DIMENSIONS != 0; if (hasDimensions) origDom.dyn_dtype = blr_blob; - bool wasInternalDomain = fb_utils::implicit_domain(origDom.dyn_fld_source.c_str()) && + const bool wasInternalDomain = fb_utils::implicit_domain(origDom.dyn_fld_source.c_str()) && RFR.RDB$BASE_FIELD.NULL; string computedSource; BlrWriter::BlrData computedValue; @@ -7730,7 +7730,7 @@ } // Generate triggers to implement the WITH CHECK OPTION clause for a VIEW. -void CreateAlterViewNode::createCheckTriggers(thread_db* tdbb, jrd_tra* transaction, dsql_nod* items) +void CreateAlterViewNode::createCheckTriggers(thread_db* tdbb, jrd_tra* /*transaction*/, dsql_nod* items) { // Specify that the trigger should abort if the condition is not met. dsql_nod* actionNode = MAKE_node(Dsql::nod_list, 1); @@ -8070,9 +8070,9 @@ // Store an index. void CreateIndexNode::store(thread_db* tdbb, jrd_tra* transaction, MetaName& name, - Definition& definition, MetaName* referredIndexName) + const Definition& definition, MetaName* referredIndexName) { - Attachment* attachment = transaction->tra_attachment; + //Attachment* attachment = transaction->tra_attachment; if (name.isEmpty()) DYN_UTIL_generate_index_name(tdbb, transaction, name, definition.type); Modified: firebird/trunk/src/dsql/DdlNodes.h =================================================================== --- firebird/trunk/src/dsql/DdlNodes.h 2010-08-08 17:07:53 UTC (rev 51414) +++ firebird/trunk/src/dsql/DdlNodes.h 2010-08-09 11:50:12 UTC (rev 51415) @@ -127,7 +127,7 @@ } public: - virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const + virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& /*nodes*/) const { text.printf("RecreateNode\n"); } @@ -439,7 +439,7 @@ class TriggerDefinition { public: - TriggerDefinition(MemoryPool& p) + explicit TriggerDefinition(MemoryPool& p) : name(p), relationName(p), external(NULL), @@ -453,11 +453,11 @@ bool modify(thread_db* tdbb, jrd_tra* transaction); protected: - virtual void preModify(thread_db* tdbb, jrd_tra* transaction) + virtual void preModify(thread_db* /*tdbb*/, jrd_tra* /*transaction*/) { } - virtual void postModify(thread_db* tdbb, jrd_tra* transaction) + virtual void postModify(thread_db* /*tdbb*/, jrd_tra* /*transaction*/) { } @@ -892,7 +892,7 @@ class FieldDefinition { public: - FieldDefinition(MemoryPool& p) + explicit FieldDefinition(MemoryPool& p) : name(p), relationName(p), fieldSource(p), @@ -927,7 +927,7 @@ class BlrWriter : public Jrd::BlrWriter { public: - BlrWriter(MemoryPool& p) + explicit BlrWriter(MemoryPool& p) : Jrd::BlrWriter(p), dsqlScratch(NULL) { @@ -956,7 +956,7 @@ DsqlCompilerScratch* dsqlScratch; }; - Constraint(MemoryPool& p) + explicit Constraint(MemoryPool& p) : PermanentStorage(p), type(TYPE_CHECK), // Just something to initialize. Do not assume it. name(p), @@ -1017,7 +1017,7 @@ void generateUnnamedTriggerBeginning(Constraint& constraint, bool onUpdate, BlrWriter& blrWriter); void stuffDefaultBlr(const Firebird::ByteChunk& defaultBlr, BlrWriter& blrWriter); void stuffMatchingBlr(Constraint& constraint, BlrWriter& blrWriter); - void stuffTriggerFiringCondition(Constraint& constraint, BlrWriter& blrWriter); + void stuffTriggerFiringCondition(const Constraint& constraint, BlrWriter& blrWriter); public: dsql_nod* dsqlNode; @@ -1200,7 +1200,7 @@ }; static void store(thread_db* tdbb, jrd_tra* transaction, Firebird::MetaName& name, - Definition& definition, Firebird::MetaName* referredIndexName = NULL); + const Definition& definition, Firebird::MetaName* referredIndexName = NULL); }; Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-08-08 17:07:53 UTC (rev 51414) +++ firebird/trunk/src/dsql/Nodes.h 2010-08-09 11:50:12 UTC (rev 51415) @@ -28,7 +28,7 @@ #include "../dsql/node.h" #include "../dsql/Visitors.h" #include "../common/classes/array.h" -#include "../common/classes/ByteChunk.h" +//#include "../common/classes/ByteChunk.h" namespace Jrd { @@ -145,15 +145,15 @@ { if (create && alter) return createOrAlterCode; - else if (create) + + if (create) return createCode; - else if (alter) + + if (alter) return alterCode; - else - { - fb_assert(false); - return 0; - } + + fb_assert(false); + return 0; } void executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction, Modified: firebird/trunk/src/msgs/facilities2.sql =================================================================== --- firebird/trunk/src/msgs/facilities2.sql 2010-08-08 17:07:53 UTC (rev 51414) +++ firebird/trunk/src/msgs/facilities2.sql 2010-08-09 11:50:12 UTC (rev 51415) @@ -1,7 +1,7 @@ /* MAX_NUMBER is the next number to be used, always one more than the highest message number. */ set bulk_insert INSERT INTO FACILITIES (LAST_CHANGE, FACILITY, FAC_CODE, MAX_NUMBER) VALUES (?, ?, ?, ?); -- -('2010-02-25 12:40:00', 'JRD', 0, 700) +('2010-08-01 12:40:00', 'JRD', 0, 700) ('2010-03-15 06:59:09', 'QLI', 1, 531) -- --('2008-11-28 20:27:04', 'GDEF', 2, 346) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-09 16:06:30
|
Revision: 51419 http://firebird.svn.sourceforge.net/firebird/?rev=51419&view=rev Author: asfernandes Date: 2010-08-09 16:06:23 +0000 (Mon, 09 Aug 2010) Log Message: ----------- Correct double indirection (jrd_nod**) so const cascades to every dereference Modified Paths: -------------- firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/Nodes.h firebird/trunk/src/dsql/WinNodes.cpp firebird/trunk/src/jrd/Optimizer.cpp Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-09 15:48:51 UTC (rev 51418) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-09 16:06:23 UTC (rev 51419) @@ -117,14 +117,14 @@ ExprNode* ExprNode::pass1(thread_db* tdbb, CompilerScratch* csb) { - for (NestConst<jrd_nod>** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) + for (NestConst<NestConst<jrd_nod> >* i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) **i = CMP_pass1(tdbb, csb, **i); return this; } ExprNode* ExprNode::pass2(thread_db* tdbb, CompilerScratch* csb) { - for (NestConst<jrd_nod>** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) + for (NestConst<NestConst<jrd_nod> >* i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) **i = CMP_pass2(tdbb, csb, **i, node); return this; } @@ -133,7 +133,7 @@ { bool ret = false; - for (NestConst<jrd_nod>** i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) + for (NestConst<NestConst<jrd_nod> >* i = jrdChildNodes.begin(); i != jrdChildNodes.end(); ++i) ret |= visitor.visit(**i); return ret; Modified: firebird/trunk/src/dsql/Nodes.h =================================================================== --- firebird/trunk/src/dsql/Nodes.h 2010-08-09 15:48:51 UTC (rev 51418) +++ firebird/trunk/src/dsql/Nodes.h 2010-08-09 16:06:23 UTC (rev 51419) @@ -365,7 +365,7 @@ const Type type; const char* dsqlCompatDialectVerb; Firebird::Array<dsql_nod**> dsqlChildNodes; - Firebird::Array<NestConst<jrd_nod>*> jrdChildNodes; + Firebird::Array<NestConst<NestConst<jrd_nod> > > jrdChildNodes; }; class AggNode : public TypedNode<ExprNode, ExprNode::TYPE_AGGREGATE> Modified: firebird/trunk/src/dsql/WinNodes.cpp =================================================================== --- firebird/trunk/src/dsql/WinNodes.cpp 2010-08-09 15:48:51 UTC (rev 51418) +++ firebird/trunk/src/dsql/WinNodes.cpp 2010-08-09 16:06:23 UTC (rev 51419) @@ -74,7 +74,7 @@ if (count != 0) { - NestConst<jrd_nod>** arg = node->jrdChildNodes.begin(); + NestConst<NestConst<jrd_nod> >* arg = node->jrdChildNodes.begin(); do { **arg++ = PAR_parse_node(tdbb, csb, VALUE); Modified: firebird/trunk/src/jrd/Optimizer.cpp =================================================================== --- firebird/trunk/src/jrd/Optimizer.cpp 2010-08-09 15:48:51 UTC (rev 51418) +++ firebird/trunk/src/jrd/Optimizer.cpp 2010-08-09 16:06:23 UTC (rev 51419) @@ -131,7 +131,7 @@ { ExprNode* exprNode = reinterpret_cast<ExprNode*>(node->nod_arg[0]); - for (NestConst<jrd_nod>** i = exprNode->jrdChildNodes.begin(); + for (NestConst<NestConst<jrd_nod> >* i = exprNode->jrdChildNodes.begin(); i != exprNode->jrdChildNodes.end(); ++i) { if (!OPT_computable(csb, **i, stream, idx_use, allowOnlyCurrentStream)) @@ -430,8 +430,8 @@ { ExprNode* exprNode1 = reinterpret_cast<ExprNode*>(node1->nod_arg[0]); ExprNode* exprNode2 = reinterpret_cast<ExprNode*>(node2->nod_arg[0]); - Array<NestConst<jrd_nod>*>& children1 = exprNode1->jrdChildNodes; - Array<NestConst<jrd_nod>*>& children2 = exprNode2->jrdChildNodes; + Array<NestConst<NestConst<jrd_nod> > >& children1 = exprNode1->jrdChildNodes; + Array<NestConst<NestConst<jrd_nod> > >& children2 = exprNode2->jrdChildNodes; if (exprNode1->type != exprNode2->type || children1.getCount() != children2.getCount()) return false; @@ -462,7 +462,7 @@ case ExprNode::TYPE_CONCATENATE: case ExprNode::TYPE_SUBSTRING_SIMILAR: - for (NestConst<jrd_nod>* const* i = children1.begin(), * const* j = children2.begin(); + for (NestConst<NestConst<jrd_nod> >* i = children1.begin(), *j = children2.begin(); i != children1.end(); ++i, ++j) { if (!OPT_expression_equal2(tdbb, csb, **i, **j, stream)) @@ -1107,7 +1107,7 @@ { ExprNode* exprNode = reinterpret_cast<ExprNode*>(node->nod_arg[0]); - for (NestConst<jrd_nod>* const* i = exprNode->jrdChildNodes.begin(); + for (NestConst<NestConst<jrd_nod> >* i = exprNode->jrdChildNodes.begin(); i != exprNode->jrdChildNodes.end(); ++i) { findDependentFromStreams(**i, streamList); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-10 00:37:33
|
Revision: 51420 http://firebird.svn.sourceforge.net/firebird/?rev=51420&view=rev Author: asfernandes Date: 2010-08-10 00:37:26 +0000 (Tue, 10 Aug 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/jrd/btr.cpp firebird/trunk/src/jrd/exe.h Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2010-08-09 16:06:23 UTC (rev 51419) +++ firebird/trunk/src/dsql/DdlNodes.epp 2010-08-10 00:37:26 UTC (rev 51420) @@ -4589,8 +4589,6 @@ void RelationNode::FieldDefinition::modify(thread_db* tdbb, jrd_tra* transaction) { - //Attachment* attachment = transaction->tra_attachment; - AutoRequest request; FOR(REQUEST_HANDLE request TRANSACTION_HANDLE transaction) @@ -4867,7 +4865,7 @@ } END_FOR - // Delete de automatically created generator for Identity columns. + // Delete the automatically created generator for Identity columns. request.reset(tdbb, drq_e_lfield, DYN_REQUESTS); @@ -4939,7 +4937,6 @@ void RelationNode::defineField(thread_db* tdbb, jrd_tra* transaction, const dsql_nod* element, SSHORT position, const dsql_nod* pkCols) { - //Attachment* attachment = transaction->tra_attachment; dsql_fld* field = (dsql_fld*) element->nod_arg[Dsql::e_dfl_field]; // Add the field to the relation being defined for parsing purposes. @@ -6140,8 +6137,6 @@ void CreateRelationNode::execute(thread_db* tdbb, jrd_tra* transaction) { - //Attachment* attachment = transaction->tra_attachment; - saveRelation(tdbb, dsqlScratch, name, false, true); if (externalFile) @@ -6280,8 +6275,6 @@ void AlterRelationNode::execute(thread_db* tdbb, jrd_tra* transaction) { - //Attachment* attachment = transaction->tra_attachment; - saveRelation(tdbb, dsqlScratch, name, false, false); if (!dsqlScratch->relation) @@ -6566,7 +6559,6 @@ { Attachment* attachment = transaction->tra_attachment; - //DsqlCompiledStatement* statement = dsqlScratch->getStatement(); dsql_fld* field = (dsql_fld*) element->nod_arg[Dsql::e_mod_fld_type_field]; // Add the field to the relation being defined for parsing purposes. @@ -8072,8 +8064,6 @@ void CreateIndexNode::store(thread_db* tdbb, jrd_tra* transaction, MetaName& name, const Definition& definition, MetaName* referredIndexName) { - //Attachment* attachment = transaction->tra_attachment; - if (name.isEmpty()) DYN_UTIL_generate_index_name(tdbb, transaction, name, definition.type); Modified: firebird/trunk/src/jrd/btr.cpp =================================================================== --- firebird/trunk/src/jrd/btr.cpp 2010-08-09 16:06:23 UTC (rev 51419) +++ firebird/trunk/src/jrd/btr.cpp 2010-08-10 00:37:26 UTC (rev 51420) @@ -175,7 +175,7 @@ static void copy_key(const temporary_key*, temporary_key*); static contents delete_node(thread_db*, WIN*, UCHAR*); static void delete_tree(thread_db*, USHORT, USHORT, PageNumber, PageNumber); -static DSC *eval(thread_db*, const jrd_nod*, DSC*, bool*); +static DSC* eval(thread_db*, const jrd_nod*, DSC*, bool*); static SLONG fast_load(thread_db*, jrd_rel*, index_desc*, USHORT, AutoPtr<Sort>&, SelectivityList&); static index_root_page* fetch_root(thread_db*, WIN*, const jrd_rel*, const RelationPages*); Modified: firebird/trunk/src/jrd/exe.h =================================================================== --- firebird/trunk/src/jrd/exe.h 2010-08-09 16:06:23 UTC (rev 51419) +++ firebird/trunk/src/jrd/exe.h 2010-08-10 00:37:26 UTC (rev 51420) @@ -160,7 +160,7 @@ NestConst<jrd_nod> rse_projection; NestConst<jrd_nod> rse_aggregate; // singleton aggregate for optimizing to index NestConst<jrd_nod> rse_plan; // user-specified access plan - VarInvariantArray *rse_invariants; // Invariant nodes bound to top-level RSE + VarInvariantArray* rse_invariants; // Invariant nodes bound to top-level RSE jrd_nod* rse_relation[1]; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fir...@us...> - 2010-08-10 11:05:05
|
Revision: 51426 http://firebird.svn.sourceforge.net/firebird/?rev=51426&view=rev Author: firebirds Date: 2010-08-10 11:04:59 +0000 (Tue, 10 Aug 2010) Log Message: ----------- nightly update Modified Paths: -------------- firebird/trunk/src/jrd/build_no.h firebird/trunk/src/misc/writeBuildNum.sh Modified: firebird/trunk/src/jrd/build_no.h =================================================================== --- firebird/trunk/src/jrd/build_no.h 2010-08-10 10:44:30 UTC (rev 51425) +++ firebird/trunk/src/jrd/build_no.h 2010-08-10 11:04:59 UTC (rev 51426) @@ -3,16 +3,16 @@ *** DO NOT EDIT *** TO CHANGE ANY INFORMATION IN HERE PLEASE EDIT src/misc/writeBuildNum.sh - FORMAL BUILD NUMBER:28557 + FORMAL BUILD NUMBER:28669 */ -#define PRODUCT_VER_STRING "3.0.0.28557" -#define FILE_VER_STRING "WI-T3.0.0.28557" -#define LICENSE_VER_STRING "WI-T3.0.0.28557" -#define FILE_VER_NUMBER 3, 0, 0, 28557 +#define PRODUCT_VER_STRING "3.0.0.28669" +#define FILE_VER_STRING "WI-T3.0.0.28669" +#define LICENSE_VER_STRING "WI-T3.0.0.28669" +#define FILE_VER_NUMBER 3, 0, 0, 28669 #define FB_MAJOR_VER "3" #define FB_MINOR_VER "0" #define FB_REV_NO "0" -#define FB_BUILD_NO "28557" +#define FB_BUILD_NO "28669" #define FB_BUILD_TYPE "T" #define FB_BUILD_SUFFIX "Firebird 3.0 Unstable" Modified: firebird/trunk/src/misc/writeBuildNum.sh =================================================================== --- firebird/trunk/src/misc/writeBuildNum.sh 2010-08-10 10:44:30 UTC (rev 51425) +++ firebird/trunk/src/misc/writeBuildNum.sh 2010-08-10 11:04:59 UTC (rev 51426) @@ -9,7 +9,7 @@ MajorVer=3 MinorVer=0 RevNo=0 -BuildNum=28557 +BuildNum=28669 if [ "$SPECIAL_BUILD_SUFFIX" = "" ]; then # Normal builds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-11 02:59:40
|
Revision: 51429 http://firebird.svn.sourceforge.net/firebird/?rev=51429&view=rev Author: asfernandes Date: 2010-08-11 02:59:33 +0000 (Wed, 11 Aug 2010) Log Message: ----------- Better internal handling of dependencies Modified Paths: -------------- firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/ExprNodes.h firebird/trunk/src/dsql/StmtNodes.cpp firebird/trunk/src/jrd/exe.h firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/nod.h firebird/trunk/src/jrd/par.cpp Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-10 15:20:20 UTC (rev 51428) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2010-08-11 02:59:33 UTC (rev 51429) @@ -1102,15 +1102,13 @@ node->args = node->function->parseArgs(tdbb, csb); - // CVC: I will track ufds only if a proc is not being dropped. - if (csb->csb_g_flags & csb_get_dependencies) - { - jrd_nod* dep_node = PAR_make_node(tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg [e_dep_object] = (jrd_nod*) node->function; - dep_node->nod_arg [e_dep_object_type] = (jrd_nod*)(IPTR) obj_udf; - csb->csb_dependencies.push(dep_node); - } + // CVC: I will track ufds only if a proc is not being dropped. + if (csb->csb_g_flags & csb_get_dependencies) + { + CompilerScratch::Dependency dependency(obj_udf); + dependency.function = node->function; + csb->csb_dependencies.push(dependency); + } return node; } Modified: firebird/trunk/src/dsql/ExprNodes.h =================================================================== --- firebird/trunk/src/dsql/ExprNodes.h 2010-08-10 15:20:20 UTC (rev 51428) +++ firebird/trunk/src/dsql/ExprNodes.h 2010-08-11 02:59:33 UTC (rev 51429) @@ -188,7 +188,7 @@ Firebird::QualifiedName name; dsql_nod* dsqlArgs; NestConst<jrd_nod> args; - /*const*/ Function* function; + NestConst<Function> function; private: dsql_udf* dsqlFunction; Modified: firebird/trunk/src/dsql/StmtNodes.cpp =================================================================== --- firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-10 15:20:20 UTC (rev 51428) +++ firebird/trunk/src/dsql/StmtNodes.cpp 2010-08-11 02:59:33 UTC (rev 51429) @@ -984,11 +984,10 @@ PAR_name(csb, node->name); if (!(item.xcp_code = MET_lookup_exception_number(tdbb, node->name))) PAR_error(csb, Arg::Gds(isc_xcpnotdef) << Arg::Str(node->name)); - jrd_nod* dep_node = PAR_make_node(tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg[e_dep_object] = (jrd_nod*)(IPTR) item.xcp_code; - dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_exception; - csb->csb_dependencies.push(dep_node); + + CompilerScratch::Dependency dependency(obj_exception); + dependency.number = item.xcp_code; + csb->csb_dependencies.push(dependency); } break; Modified: firebird/trunk/src/jrd/exe.h =================================================================== --- firebird/trunk/src/jrd/exe.h 2010-08-10 15:20:20 UTC (rev 51428) +++ firebird/trunk/src/jrd/exe.h 2010-08-11 02:59:33 UTC (rev 51429) @@ -371,11 +371,6 @@ const int e_dcl_desc = 1; const int e_dcl_length = (1 + sizeof (DSC) / sizeof(::Jrd::jrd_nod*)); // Room for descriptor -const int e_dep_object = 0; // node for registering dependencies -const int e_dep_object_type = 1; -const int e_dep_field = 2; -const int e_dep_length = 3; - const int e_scl_field = 0; // Scalar expression (blr_index) const int e_scl_subscripts = 1; const int e_scl_length = 2; @@ -771,6 +766,29 @@ {} public: + struct Dependency + { + Dependency(int aObjType) + { + memset(this, 0, sizeof(*this)); + objType = aObjType; + } + + int objType; + + union + { + jrd_rel* relation; + const Function* function; + const jrd_prc* procedure; + const Firebird::MetaName* name; + SLONG number; + }; + + const Firebird::MetaName* subName; + SLONG subNumber; + }; + static CompilerScratch* newCsb(MemoryPool& p, size_t len, const Firebird::MetaName& domain_validation = Firebird::MetaName()) { @@ -809,7 +827,7 @@ AccessItemList csb_access; // Access items to be checked vec<jrd_nod*>* csb_variables; // Vector of variables, if any ResourceList csb_resources; // Resources (relations and indexes) - NodeStack csb_dependencies; // objects this request depends upon + Firebird::Array<Dependency> csb_dependencies; // objects that this statement depends upon Firebird::Array<const RecordSource*> csb_fors; // record sources Firebird::Array<jrd_nod*> csb_exec_sta; // Array of exec_into nodes Firebird::Array<jrd_nod*> csb_invariants; // stack of invariant nodes Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2010-08-10 15:20:20 UTC (rev 51428) +++ firebird/trunk/src/jrd/met.epp 2010-08-11 02:59:33 UTC (rev 51429) @@ -5039,13 +5039,17 @@ while (csb->csb_dependencies.hasData()) { - jrd_nod* node = csb->csb_dependencies.pop(); - if (!node->nod_arg[e_dep_object]) + CompilerScratch::Dependency dependency = csb->csb_dependencies.pop(); + + if (!dependency.relation && !dependency.function && !dependency.procedure && + !dependency.name && !dependency.number) + { continue; + } - int dpdo_type = (int) (IPTR) node->nod_arg[e_dep_object_type]; + int dpdo_type = dependency.objType; jrd_rel* relation = NULL; - jrd_prc* procedure = NULL; + const jrd_prc* procedure = NULL; const MetaName* dpdo_name = NULL; MetaName packageName; SubtypeInfo info; @@ -5053,7 +5057,7 @@ switch (dpdo_type) { case obj_relation: - relation = (jrd_rel*) node->nod_arg[e_dep_object]; + relation = dependency.relation; dpdo_name = &relation->rel_name; fb_assert(dep_rel || !checkTableScope); @@ -5087,63 +5091,60 @@ } break; case obj_procedure: - procedure = (jrd_prc*) node->nod_arg[e_dep_object]; + procedure = dependency.procedure; dpdo_name = &procedure->getName().identifier; packageName = procedure->getName().package; break; case obj_collation: { - const USHORT number = (IPTR) node->nod_arg[e_dep_object]; + const USHORT number = dependency.number; MET_get_char_coll_subtype_info(tdbb, number, &info); dpdo_name = &info.collationName; } break; case obj_exception: { - const SLONG number = (IPTR) node->nod_arg[e_dep_object]; + const SLONG number = dependency.number; MET_lookup_exception(tdbb, number, name, NULL); dpdo_name = &name; } break; case obj_field: - dpdo_name = (MetaName*) node->nod_arg[e_dep_object]; + dpdo_name = dependency.name; break; // CVC: Here I'm going to track those pesky things named generators and UDFs. case obj_generator: { - const SLONG number = (IPTR) node->nod_arg[e_dep_object]; + const SLONG number = dependency.number; MET_lookup_generator_id (tdbb, number, name); dpdo_name = &name; } break; case obj_udf: { - Function* const udf = (Function*) node->nod_arg[e_dep_object]; + const Function* const udf = dependency.function; dpdo_name = &udf->getName().identifier; packageName = udf->getName().package; } break; case obj_index: - name = (TEXT*) node->nod_arg[e_dep_object]; + name = *dependency.name; dpdo_name = &name; break; } - const jrd_nod* field_node = node->nod_arg[e_dep_field]; - MetaName field_name; - if (field_node) + + if (dependency.subNumber || dependency.subName) { - if (field_node->nod_type == nod_field) + if (dependency.subNumber) { - const SSHORT fld_id = (SSHORT) (IPTR) field_node->nod_arg[0]; + const SSHORT fld_id = (SSHORT) dependency.subNumber; if (relation) { const jrd_fld* field = MET_get_field(relation, fld_id); if (field) - { field_name = field->fld_name; - } } else if (procedure) { @@ -5152,18 +5153,14 @@ // so I thought the missing code was to try to extract // the field name that's in this case an output var from a proc. if (param) - { field_name = param->prm_name; - } } } else - { - field_name = (TEXT *) field_node->nod_arg[0]; - } + field_name = *dependency.subName; } - if (field_name.length() > 0) + if (field_name.hasData()) { AutoCacheRequest request(tdbb, irq_c_deps_f, IRQ_REQUESTS); bool found = false; @@ -5214,7 +5211,7 @@ DEP.RDB$DEPENDED_ON_TYPE = dpdo_type; strcpy(DEP.RDB$DEPENDED_ON_NAME, dpdo_name->c_str()); - if (field_name.length() > 0) + if (field_name.hasData()) { DEP.RDB$FIELD_NAME.NULL = FALSE; strcpy(DEP.RDB$FIELD_NAME, field_name.c_str()); Modified: firebird/trunk/src/jrd/nod.h =================================================================== --- firebird/trunk/src/jrd/nod.h 2010-08-10 15:20:20 UTC (rev 51428) +++ firebird/trunk/src/jrd/nod.h 2010-08-11 02:59:33 UTC (rev 51429) @@ -98,7 +98,6 @@ NODE(nod_union, union, "") NODE(nod_aggregate, aggregate, "") NODE(nod_map, map, "") - NODE(nod_dependency, dependency, "") NODE(nod_exec_proc, exec_proc, "") NODE(nod_procedure, procedure, "") NODE(nod_block, block, "") Modified: firebird/trunk/src/jrd/par.cpp =================================================================== --- firebird/trunk/src/jrd/par.cpp 2010-08-10 15:20:20 UTC (rev 51428) +++ firebird/trunk/src/jrd/par.cpp 2010-08-11 02:59:33 UTC (rev 51429) @@ -396,11 +396,9 @@ } } - jrd_nod* dep_node = PAR_make_node(tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg[e_dep_object] = (jrd_nod*) name; - dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_field; - csb->csb_dependencies.push(dep_node); + CompilerScratch::Dependency dependency(obj_field); + dependency.name = name; + csb->csb_dependencies.push(dependency); break; } @@ -459,17 +457,11 @@ } } - jrd_nod* dep_node = PAR_make_node(tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg[e_dep_object] = (jrd_nod*) MET_lookup_relation(tdbb, *relationName); - dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_relation; + CompilerScratch::Dependency dependency(obj_relation); + dependency.relation = MET_lookup_relation(tdbb, *relationName); + dependency.subName = fieldName; + csb->csb_dependencies.push(dependency); - dep_node->nod_arg[e_dep_field] = PAR_make_node(tdbb, 1); - dep_node->nod_arg[e_dep_field]->nod_type = nod_literal; - dep_node->nod_arg[e_dep_field]->nod_arg[0] = (jrd_nod*) fieldName->c_str(); - - csb->csb_dependencies.push(dep_node); - break; } @@ -479,11 +471,9 @@ if (desc->getTextType() != CS_NONE) { - jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg [e_dep_object] = (jrd_nod*)(IPTR) INTL_TEXT_TYPE(*desc); - dep_node->nod_arg [e_dep_object_type] = (jrd_nod*)(IPTR) obj_collation; - csb->csb_dependencies.push(dep_node); + CompilerScratch::Dependency dependency(obj_collation); + dependency.number = INTL_TEXT_TYPE(*desc); + csb->csb_dependencies.push(dependency); } if (itemInfo) @@ -887,11 +877,9 @@ if (itemInfo.explicitCollation) { - jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg [e_dep_object] = (jrd_nod*)(IPTR) INTL_TEXT_TYPE(*desc); - dep_node->nod_arg [e_dep_object_type] = (jrd_nod*)(IPTR) obj_collation; - csb->csb_dependencies.push(dep_node); + CompilerScratch::Dependency dependency(obj_collation); + dependency.number = INTL_TEXT_TYPE(*desc); + csb->csb_dependencies.push(dependency); } return node; @@ -951,11 +939,10 @@ PAR_name(csb, name); if (!(item.xcp_code = MET_lookup_exception_number(tdbb, name))) PAR_error(csb, Arg::Gds(isc_xcpnotdef) << Arg::Str(name)); - jrd_nod* dep_node = PAR_make_node(tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg[e_dep_object] = (jrd_nod*)(IPTR) item.xcp_code; - dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_exception; - csb->csb_dependencies.push(dep_node); + + CompilerScratch::Dependency dependency(obj_exception); + dependency.number = item.xcp_code; + csb->csb_dependencies.push(dependency); } break; @@ -1039,40 +1026,30 @@ **************************************/ SET_TDBB(tdbb); - jrd_nod* node = PAR_make_node(tdbb, e_dep_length); - node->nod_type = nod_dependency; + CompilerScratch::Dependency dependency(0); + if (csb->csb_rpt[stream].csb_relation) { - node->nod_arg[e_dep_object] = (jrd_nod*) csb->csb_rpt[stream].csb_relation; + dependency.relation = csb->csb_rpt[stream].csb_relation; // How do I determine reliably this is a view? // At this time, rel_view_rse is still null. //if (is_view) - // node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_view; + // dependency.objType = obj_view; //else - node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_relation; + dependency.objType = obj_relation; } else if (csb->csb_rpt[stream].csb_procedure) { - node->nod_arg[e_dep_object] = (jrd_nod*) csb->csb_rpt[stream].csb_procedure; - node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_procedure; + dependency.procedure = csb->csb_rpt[stream].csb_procedure; + dependency.objType = obj_procedure; } if (field_name.length() > 0) - { - jrd_nod* field_node = PAR_make_node(tdbb, 1); - node->nod_arg[e_dep_field] = field_node; - field_node->nod_type = nod_literal; - field_node->nod_arg[0] = (jrd_nod*) stringDup(*tdbb->getDefaultPool(), field_name.c_str()); - } + dependency.subName = FB_NEW(*tdbb->getDefaultPool()) MetaName(*tdbb->getDefaultPool(), field_name); else if (id >= 0) - { - jrd_nod* field_node = PAR_make_node(tdbb, 1); - node->nod_arg[e_dep_field] = field_node; - field_node->nod_type = nod_field; - field_node->nod_arg[0] = (jrd_nod*) (IPTR) id; - } + dependency.subNumber = id; - csb->csb_dependencies.push(node); + csb->csb_dependencies.push(dependency); } @@ -1122,13 +1099,10 @@ par_procedure_parms(tdbb, csb, procedure, &node->nod_arg[e_esp_out_msg], &node->nod_arg[e_esp_outputs], false); - jrd_nod* dep_node = PAR_make_node(tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg[e_dep_object] = (jrd_nod*) procedure; - dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_procedure; + CompilerScratch::Dependency dependency(obj_procedure); + dependency.procedure = procedure; + csb->csb_dependencies.push(dependency); - csb->csb_dependencies.push(dep_node); - return node; } @@ -1804,9 +1778,9 @@ node_type = (USHORT) csb->csb_blr_reader.getByte(); USHORT extra_count = 0; - jrd_nod* access_type = 0; + jrd_nod* access_type = NULL; Firebird::MetaName name; - TEXT* idx_name = 0; + MetaName* idx_name = NULL; switch (node_type) { @@ -1847,16 +1821,14 @@ access_type->nod_arg[e_access_type_relation] = (jrd_nod*) (IPTR) relation_id; access_type->nod_arg[e_access_type_index] = (jrd_nod*) (IPTR) index_id; - idx_name = stringDup(*tdbb->getDefaultPool(), name.c_str()); + idx_name = FB_NEW(*tdbb->getDefaultPool()) MetaName(*tdbb->getDefaultPool(), name); access_type->nod_arg[e_access_type_index_name] = (jrd_nod*) idx_name; if (csb->csb_g_flags & csb_get_dependencies) { - jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg[e_dep_object] = (jrd_nod*) idx_name; - dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_index; - csb->csb_dependencies.push(dep_node); + CompilerScratch::Dependency dependency(obj_index); + dependency.name = idx_name; + csb->csb_dependencies.push(dependency); } if (csb->csb_blr_reader.peekByte() == blr_indices) @@ -1915,16 +1887,14 @@ *arg++ = (jrd_nod*) (IPTR) relation_id; *arg++ = (jrd_nod*) (IPTR) index_id; - idx_name = stringDup(*tdbb->getDefaultPool(), name.c_str()); + idx_name = FB_NEW(*tdbb->getDefaultPool()) MetaName(*tdbb->getDefaultPool(), name); *arg++ = (jrd_nod*) idx_name; if (csb->csb_g_flags & csb_get_dependencies) { - jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg[e_dep_object] = (jrd_nod*) idx_name; - dep_node->nod_arg[e_dep_object_type] = (jrd_nod*)(IPTR) obj_index; - csb->csb_dependencies.push(dep_node); + CompilerScratch::Dependency dependency(obj_index); + dependency.name = idx_name; + csb->csb_dependencies.push(dependency); } } } @@ -3033,11 +3003,9 @@ // track only gen_id() in both dialects. if ((blr_operator == blr_gen_id) && (csb->csb_g_flags & csb_get_dependencies)) { - jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg [e_dep_object] = (jrd_nod*) (IPTR) tmp; - dep_node->nod_arg [e_dep_object_type] = (jrd_nod*)(IPTR) obj_generator; - csb->csb_dependencies.push(dep_node); + CompilerScratch::Dependency dependency(obj_generator); + dependency.number = tmp; + csb->csb_dependencies.push(dependency); } } @@ -3107,11 +3075,9 @@ if (itemInfo.explicitCollation) { - jrd_nod* dep_node = PAR_make_node (tdbb, e_dep_length); - dep_node->nod_type = nod_dependency; - dep_node->nod_arg [e_dep_object] = (jrd_nod*)(IPTR) INTL_TEXT_TYPE(*desc); - dep_node->nod_arg [e_dep_object_type] = (jrd_nod*)(IPTR) obj_collation; - csb->csb_dependencies.push(dep_node); + CompilerScratch::Dependency dependency(obj_collation); + dependency.number = INTL_TEXT_TYPE(*desc); + csb->csb_dependencies.push(dependency); } } break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <asf...@us...> - 2010-08-11 15:33:12
|
Revision: 51435 http://firebird.svn.sourceforge.net/firebird/?rev=51435&view=rev Author: asfernandes Date: 2010-08-11 15:33:06 +0000 (Wed, 11 Aug 2010) Log Message: ----------- Misc Modified Paths: -------------- firebird/trunk/src/common/classes/NestConst.h firebird/trunk/src/dsql/StmtNodes.h Modified: firebird/trunk/src/common/classes/NestConst.h =================================================================== --- firebird/trunk/src/common/classes/NestConst.h 2010-08-11 15:22:48 UTC (rev 51434) +++ firebird/trunk/src/common/classes/NestConst.h 2010-08-11 15:33:06 UTC (rev 51435) @@ -39,6 +39,9 @@ return *this; } + T** getAddress() { return &ptr; } + const T* const* getAddress() const { return &ptr; } + operator T*() { return ptr; } operator const T*() const { return ptr; } Modified: firebird/trunk/src/dsql/StmtNodes.h =================================================================== --- firebird/trunk/src/dsql/StmtNodes.h 2010-08-11 15:22:48 UTC (rev 51434) +++ firebird/trunk/src/dsql/StmtNodes.h 2010-08-11 15:33:06 UTC (rev 51435) @@ -222,8 +222,8 @@ virtual void pass2Cursor(RecordSelExpr*& rsePtr, Cursor**& cursorPtr) { - rsePtr = (RecordSelExpr*)(jrd_nod*) rse; - cursorPtr = &cursor; + rsePtr = reinterpret_cast<RecordSelExpr*>(static_cast<jrd_nod*>(rse)); + cursorPtr = cursor.getAddress(); } virtual const jrd_nod* execute(thread_db* tdbb, jrd_req* request) const; @@ -238,7 +238,7 @@ NestConst<jrd_nod> stall; NestConst<jrd_nod> rse; NestConst<jrd_nod> statement; - Cursor* cursor; + NestConst<Cursor> cursor; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |