8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +01:00

- Remove *_THREAD_DATA definitions from thd.h, are unneeded and conflicts with definitions in providers/services main headers (which need to use undef).

- Use different names for each service/provider *_THREAD_DATA macros.
This commit is contained in:
brodsom 2004-05-19 18:14:29 +00:00
parent d3b58524d2
commit 68cb86b274
78 changed files with 716 additions and 755 deletions

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: alice.cpp,v 1.62 2004-05-15 00:52:43 brodsom Exp $ // $Id: alice.cpp,v 1.63 2004-05-19 18:04:41 brodsom Exp $
// //
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports
@ -198,7 +198,7 @@ int common_main(int argc,
return FINI_ERROR; return FINI_ERROR;
} }
SET_THREAD_DATA; ALICE_set_thread_data;
SVC_PUTSPECIFIC_DATA; SVC_PUTSPECIFIC_DATA;
memset((void *) tdgbl, 0, sizeof(Tgbl)); memset((void *) tdgbl, 0, sizeof(Tgbl));
tdgbl->output_proc = output_proc; tdgbl->output_proc = output_proc;
@ -632,7 +632,7 @@ int common_main(int argc,
// Free all unfreed memory used by Gfix itself // Free all unfreed memory used by Gfix itself
ALLA_fini(); ALLA_fini();
RESTORE_THREAD_DATA; ALICE_restore_thread_data;
gds__free(tdgbl); gds__free(tdgbl);
@ -697,7 +697,7 @@ void ALICE_print_status(const ISC_STATUS* status_vector)
const ISC_STATUS* vector = status_vector; const ISC_STATUS* vector = status_vector;
#ifdef SUPERSERVER #ifdef SUPERSERVER
int i = 0, j; int i = 0, j;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
ISC_STATUS* status = tdgbl->service_blk->svc_status; ISC_STATUS* status = tdgbl->service_blk->svc_status;
if (status != status_vector) { if (status != status_vector) {
while (*status && (++i < ISC_STATUS_LENGTH)) { while (*status && (++i < ISC_STATUS_LENGTH)) {
@ -736,7 +736,7 @@ void ALICE_error(USHORT number,
const TEXT* arg4, const TEXT* arg4,
const TEXT* arg5) const TEXT* arg5)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
TEXT buffer[256]; TEXT buffer[256];
#ifdef SUPERSERVER #ifdef SUPERSERVER
@ -779,7 +779,7 @@ static void alice_output(const SCHAR* format, ...)
UCHAR buf[1000]; UCHAR buf[1000];
int exit_code; int exit_code;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') { if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') {
exit_code = tdgbl->output_proc(tdgbl->output_data, (UCHAR *)("")); exit_code = tdgbl->output_proc(tdgbl->output_data, (UCHAR *)(""));

View File

@ -186,23 +186,20 @@ public:
}; };
#ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA
#endif
#ifdef SUPERSERVER #ifdef SUPERSERVER
#define GET_THREAD_DATA ((Tgbl*) THD_get_specific()) #define ALICE_get_thread_data ((Tgbl*) THD_get_specific())
#define SET_THREAD_DATA THD_put_specific ((THDD) tdgbl); \ #define ALICE_set_thread_data THD_put_specific ((THDD) tdgbl); \
tdgbl->tgbl_thd_data.thdd_type = \ tdgbl->tgbl_thd_data.thdd_type = \
THDD_TYPE_TALICE THDD_TYPE_TALICE
#define RESTORE_THREAD_DATA THD_restore_specific(); #define ALICE_restore_thread_data THD_restore_specific();
#else #else
extern Tgbl* gdgbl; extern Tgbl* gdgbl;
#define GET_THREAD_DATA (gdgbl) #define ALICE_get_thread_data (gdgbl)
#define SET_THREAD_DATA gdgbl = tdgbl; \ #define ALICE_set_thread_data gdgbl = tdgbl; \
tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL
#define RESTORE_THREAD_DATA #define ALICE_restore_thread_data
#endif #endif
#endif // ALICE_ALICE_H #endif // ALICE_ALICE_H

View File

@ -27,7 +27,7 @@
* *
*____________________________________________________________ *____________________________________________________________
* *
* $Id: alice_meta.epp,v 1.35 2004-05-02 23:03:22 skidder Exp $ * $Id: alice_meta.epp,v 1.36 2004-05-19 18:04:41 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -94,7 +94,7 @@ static inline void return_error(const ISC_STATUS* user_status)
void MET_disable_wal(ISC_STATUS* user_status, isc_db_handle handle) void MET_disable_wal(ISC_STATUS* user_status, isc_db_handle handle)
{ {
FB_API_HANDLE request = 0; FB_API_HANDLE request = 0;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (!(DB = handle)) if (!(DB = handle))
return; return;
@ -124,7 +124,7 @@ void MET_disable_wal(ISC_STATUS* user_status, isc_db_handle handle)
void MET_get_state(ISC_STATUS* user_status, TDR trans) void MET_get_state(ISC_STATUS* user_status, TDR trans)
{ {
FB_API_HANDLE request = 0; FB_API_HANDLE request = 0;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (!(DB = trans->tdr_db_handle) || if (!(DB = trans->tdr_db_handle) ||
!(trans->tdr_db_caps & CAP_transactions)) !(trans->tdr_db_caps & CAP_transactions))
@ -170,7 +170,7 @@ TDR MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id)
{ {
FB_API_HANDLE request = 0; FB_API_HANDLE request = 0;
TDR trans = NULL; TDR trans = NULL;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (!(DB = handle)) if (!(DB = handle))
return 0; return 0;
@ -219,7 +219,7 @@ TDR MET_get_transaction(ISC_STATUS* user_status, isc_db_handle handle, SLONG id)
void MET_set_capabilities(ISC_STATUS* user_status, TDR trans) void MET_set_capabilities(ISC_STATUS* user_status, TDR trans)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (!(DB = trans->tdr_db_handle)) if (!(DB = trans->tdr_db_handle))
return; return;
@ -245,7 +245,7 @@ void MET_set_capabilities(ISC_STATUS* user_status, TDR trans)
static alice_str* alloc_string(const TEXT** ptr) static alice_str* alloc_string(const TEXT** ptr)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
const TEXT* p = *ptr; const TEXT* p = *ptr;
@ -274,7 +274,7 @@ static alice_str* alloc_string(const TEXT** ptr)
static USHORT get_capabilities(ISC_STATUS* user_status) static USHORT get_capabilities(ISC_STATUS* user_status)
{ {
USHORT capabilities = CAP_none; USHORT capabilities = CAP_none;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
// Look for desired fields in system relations // Look for desired fields in system relations
FB_API_HANDLE req = 0; FB_API_HANDLE req = 0;
@ -312,7 +312,7 @@ static TDR get_description(ISC_QUAD* blob_id)
{ {
TEXT buffer[1024]; TEXT buffer[1024];
TEXT* bigger_buffer = 0; TEXT* bigger_buffer = 0;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
const TEXT* p = buffer; const TEXT* p = buffer;
const USHORT length = snarf_blob(blob_id, (USHORT) sizeof(buffer), buffer); const USHORT length = snarf_blob(blob_id, (USHORT) sizeof(buffer), buffer);
@ -394,7 +394,7 @@ static TDR get_description(ISC_QUAD* blob_id)
static void parse_fullpath(TDR trans) static void parse_fullpath(TDR trans)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
// start at the end of the full pathname // start at the end of the full pathname
@ -473,7 +473,7 @@ static void parse_fullpath(TDR trans)
static USHORT snarf_blob(ISC_QUAD* blob_id, static USHORT snarf_blob(ISC_QUAD* blob_id,
USHORT buffer_length, TEXT* buffer) USHORT buffer_length, TEXT* buffer)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (buffer_length) if (buffer_length)
buffer[0] = 0; buffer[0] = 0;

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: all.cpp,v 1.21 2004-05-15 00:52:07 brodsom Exp $ // $Id: all.cpp,v 1.22 2004-05-19 18:04:41 brodsom Exp $
// //
#include "firebird.h" #include "firebird.h"
@ -42,7 +42,7 @@
void ALLA_fini(void) void ALLA_fini(void)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
for (Tgbl::pool_vec_t::iterator curr = tdgbl->pools.begin(); for (Tgbl::pool_vec_t::iterator curr = tdgbl->pools.begin();
curr != tdgbl->pools.end(); ++curr) curr != tdgbl->pools.end(); ++curr)
@ -64,7 +64,7 @@ void ALLA_fini(void)
void ALLA_init(void) void ALLA_init(void)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool = tdgbl->ALICE_default_pool = tdgbl->ALICE_permanent_pool =
AliceMemoryPool::create_new_pool(); AliceMemoryPool::create_new_pool();
@ -90,7 +90,7 @@ void AliceMemoryPool::ALLA_push(blk* object, alice_lls** stack)
* Push an object on an LLS stack. * Push an object on an LLS stack.
* *
**************************************/ **************************************/
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
AliceMemoryPool* pool = tdgbl->ALICE_default_pool; AliceMemoryPool* pool = tdgbl->ALICE_default_pool;
alice_lls* node = pool->lls_cache.newBlock(); alice_lls* node = pool->lls_cache.newBlock();
@ -136,7 +136,7 @@ AliceMemoryPool* AliceMemoryPool::create_new_pool(MemoryPool* parent)
* *
**************************************/ **************************************/
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
// TMN: John, is this correct? // TMN: John, is this correct?
AliceMemoryPool* pool = new(0, parent) AliceMemoryPool(parent); AliceMemoryPool* pool = new(0, parent) AliceMemoryPool(parent);
@ -169,7 +169,7 @@ AliceMemoryPool* AliceMemoryPool::create_new_pool(MemoryPool* parent)
void AliceMemoryPool::deletePool(AliceMemoryPool* pool) void AliceMemoryPool::deletePool(AliceMemoryPool* pool)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
Tgbl::pool_vec_t::iterator curr; Tgbl::pool_vec_t::iterator curr;
for (curr = tdgbl->pools.begin(); curr != tdgbl->pools.end(); ++curr) for (curr = tdgbl->pools.begin(); curr != tdgbl->pools.end(); ++curr)

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: exe.cpp,v 1.32 2004-05-02 23:03:22 skidder Exp $ // $Id: exe.cpp,v 1.33 2004-05-19 18:04:41 brodsom Exp $
// //
// 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE" // 2001.07.06 Sean Leyne - Code Cleanup, removed "#ifdef READONLY_DATABASE"
// conditionals, as the engine now fully supports // conditionals, as the engine now fully supports
@ -84,7 +84,7 @@ static inline void stuff_dpb_long(UCHAR** d, int blr)
int EXE_action(const TEXT* database, const ULONG switches) int EXE_action(const TEXT* database, const ULONG switches)
{ {
UCHAR dpb[128]; UCHAR dpb[128];
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
ALLA_init(); ALLA_init();
@ -143,7 +143,7 @@ int EXE_action(const TEXT* database, const ULONG switches)
int EXE_two_phase(const TEXT* database, const ULONG switches) int EXE_two_phase(const TEXT* database, const ULONG switches)
{ {
UCHAR dpb[128]; UCHAR dpb[128];
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
ALLA_init(); ALLA_init();
@ -188,7 +188,7 @@ int EXE_two_phase(const TEXT* database, const ULONG switches)
static USHORT build_dpb(UCHAR* dpb, const ULONG switches) static USHORT build_dpb(UCHAR* dpb, const ULONG switches)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
UCHAR* dpb2 = dpb; UCHAR* dpb2 = dpb;
*dpb2++ = isc_dpb_version1; *dpb2++ = isc_dpb_version1;
@ -373,7 +373,7 @@ static USHORT build_dpb(UCHAR* dpb, const ULONG switches)
static void extract_db_info(const UCHAR* db_info_buffer) static void extract_db_info(const UCHAR* db_info_buffer)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
const UCHAR* p = db_info_buffer; const UCHAR* p = db_info_buffer;

View File

@ -24,7 +24,7 @@
// //
//____________________________________________________________ //____________________________________________________________
// //
// $Id: tdr.cpp,v 1.35 2004-05-02 23:03:22 skidder Exp $ // $Id: tdr.cpp,v 1.36 2004-05-19 18:04:41 brodsom Exp $
// //
// 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port // 2002.02.15 Sean Leyne - Code Cleanup, removed obsolete "Apollo" port
// //
@ -183,7 +183,7 @@ bool TDR_attach_database(ISC_STATUS* status_vector,
const TEXT* pathname) const TEXT* pathname)
{ {
UCHAR dpb[128]; UCHAR dpb[128];
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (tdgbl->ALICE_data.ua_debug) if (tdgbl->ALICE_data.ua_debug)
ALICE_print(68, pathname, 0, 0, 0, 0); ALICE_print(68, pathname, 0, 0, 0, 0);
@ -291,7 +291,7 @@ void TDR_list_limbo(FB_API_HANDLE handle, const TEXT* name, const ULONG switches
{ {
UCHAR buffer[1024]; UCHAR buffer[1024];
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (isc_database_info(status_vector, &handle, sizeof(limbo_info), if (isc_database_info(status_vector, &handle, sizeof(limbo_info),
reinterpret_cast<const char*>(limbo_info), reinterpret_cast<const char*>(limbo_info),
@ -518,7 +518,7 @@ bool TDR_reconnect_multiple(FB_API_HANDLE handle,
static void print_description(const tdr* trans) static void print_description(const tdr* trans)
{ {
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
if (!trans) if (!trans)
{ {
@ -712,7 +712,7 @@ static ULONG ask(void)
{ {
UCHAR response[32]; UCHAR response[32];
char* const resp_ptr = reinterpret_cast<char*>(response); char* const resp_ptr = reinterpret_cast<char*>(response);
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
ULONG switches = 0; ULONG switches = 0;
@ -758,7 +758,7 @@ static void reattach_database(TDR trans)
UCHAR buffer[1024]; UCHAR buffer[1024];
// sizeof(buffer) - 1 => leave space for the terminator. // sizeof(buffer) - 1 => leave space for the terminator.
const UCHAR* const end = buffer + sizeof(buffer) - 1; const UCHAR* const end = buffer + sizeof(buffer) - 1;
Tgbl* tdgbl = GET_THREAD_DATA; Tgbl* tdgbl = ALICE_get_thread_data;
ISC_get_host(reinterpret_cast<char*>(buffer), sizeof(buffer)); ISC_get_host(reinterpret_cast<char*>(buffer), sizeof(buffer));

View File

@ -37,7 +37,7 @@
*/ */
/* /*
$Id: backup.epp,v 1.57 2004-05-09 05:47:41 robocop Exp $ $Id: backup.epp,v 1.58 2004-05-19 18:05:49 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -253,7 +253,7 @@ int BACKUP_backup(const TEXT* dbb_file, const TEXT* file_name)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
tdgbl->gbl_database_file_name = dbb_file; tdgbl->gbl_database_file_name = dbb_file;
@ -522,7 +522,7 @@ void compress(const UCHAR* data, ULONG length)
* Write out data in compressed form. * Write out data in compressed form.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const UCHAR* p = data; const UCHAR* p = data;
const UCHAR* end = p + length; const UCHAR* end = p + length;
@ -602,7 +602,7 @@ void general_on_error(void)
* Handle any general ON_ERROR clause during backup. * Handle any general ON_ERROR clause during backup.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
BURP_print_status(isc_status); BURP_print_status(isc_status);
BURP_abort(); BURP_abort();
@ -625,7 +625,7 @@ burp_fld* get_fields( burp_rel* relation)
burp_fld* field; burp_fld* field;
ISC_QUAD* blob_id; ISC_QUAD* blob_id;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
USHORT count = 1; USHORT count = 1;
burp_fld* fields = NULL; burp_fld* fields = NULL;
@ -910,7 +910,7 @@ SINT64 get_gen_id( const TEXT* name, SSHORT name_len)
**************************************/ **************************************/
UCHAR blr_buffer[100]; // enough to fit blr UCHAR blr_buffer[100]; // enough to fit blr
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FB_API_HANDLE gen_id_reqh = 0; FB_API_HANDLE gen_id_reqh = 0;
UCHAR* blr = blr_buffer; UCHAR* blr = blr_buffer;
@ -1046,7 +1046,7 @@ void get_ranges( burp_fld* field)
* the ranges in rdb$field_dimensions. * the ranges in rdb$field_dimensions.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
SLONG* rp = field->fld_ranges; SLONG* rp = field->fld_ranges;
USHORT count = 0; USHORT count = 0;
@ -1091,7 +1091,7 @@ void put_array( burp_fld* field, burp_rel* relation, ISC_QUAD* blob_id)
SLONG range_buffer[16]; // enough for 16 dimensions SLONG range_buffer[16]; // enough for 16 dimensions
UCHAR blr_buffer[200]; // enough for a sdl with 16 dimensions UCHAR blr_buffer[200]; // enough for a sdl with 16 dimensions
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If the array is null, don't store it. It will be restored as null. // If the array is null, don't store it. It will be restored as null.
@ -1300,7 +1300,7 @@ void put_asciz( const SCHAR attribute, const TEXT* string)
* Write an attribute starting with a null terminated string. * Write an attribute starting with a null terminated string.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ULONG l = strlen(string); ULONG l = strlen(string);
@ -1326,7 +1326,7 @@ void put_blob( burp_fld* field, ISC_QUAD* blob_id, ULONG count)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
UCHAR blob_info[32], static_buffer[1024]; UCHAR blob_info[32], static_buffer[1024];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If the blob is null, don't store it. It will be restored as null. // If the blob is null, don't store it. It will be restored as null.
@ -1443,7 +1443,7 @@ bool put_blr_blob( SCHAR attribute, ISC_QUAD * blob_id)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
UCHAR blob_info[32], static_buffer[1024]; UCHAR blob_info[32], static_buffer[1024];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If the blob is null, don't store it. It will be restored as null. // If the blob is null, don't store it. It will be restored as null.
@ -1557,7 +1557,7 @@ void put_data(burp_rel* relation)
burp_fld* field; burp_fld* field;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// CVC: A signed short isn't enough if the engine allows near 32K fields, // CVC: A signed short isn't enough if the engine allows near 32K fields,
// each being char(1) ASCII in the worst case. Looking at BLR generation // each being char(1) ASCII in the worst case. Looking at BLR generation
@ -1891,7 +1891,7 @@ void put_index( burp_rel* relation)
ULONG count; ULONG count;
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
/* if we have all capabilities, use the first request to get the /* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't most performance out of the latest engine; if we don't
@ -2084,7 +2084,7 @@ int put_message( SCHAR attribute, const TEXT* text, ULONG length)
* which function of the two you use). * which function of the two you use).
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ULONG l = 0; ULONG l = 0;
for (const TEXT* p = text; *p && l < length; p++) for (const TEXT* p = text; *p && l < length; p++)
@ -2113,7 +2113,7 @@ void put_numeric( SCHAR attribute, SLONG value)
* low byte first, high byte last, as in VAX. * low byte first, high byte last, as in VAX.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const SLONG vax_value = (SLONG) isc_vax_integer((const char*) &value, sizeof(value)); const SLONG vax_value = (SLONG) isc_vax_integer((const char*) &value, sizeof(value));
@ -2138,7 +2138,7 @@ void put_int64( SCHAR attribute, SINT64 value)
* INT64 value, while put_numeric handles a 32-bit value. * INT64 value, while put_numeric handles a 32-bit value.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const UINT64 le_value = const UINT64 le_value =
(UINT64) isc_portable_integer((const UCHAR*) &value, sizeof(value)); (UINT64) isc_portable_integer((const UCHAR*) &value, sizeof(value));
@ -2163,7 +2163,7 @@ void put_relation( burp_rel* relation)
**************************************/ **************************************/
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
/* Write local field information. This is made slightly more complicated /* Write local field information. This is made slightly more complicated
by the requirement that computational fields be aligned. */ by the requirement that computational fields be aligned. */
@ -2353,7 +2353,7 @@ bool put_source_blob(SCHAR attribute,
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
UCHAR blob_info[48], static_buffer[1024]; UCHAR blob_info[48], static_buffer[1024];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If the blob is null, don't store it. It will be restored as null. // If the blob is null, don't store it. It will be restored as null.
@ -2476,7 +2476,7 @@ int put_text( SCHAR attribute, const TEXT* text, SSHORT size_len)
* with quoted names and embedded spaces. * with quoted names and embedded spaces.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const SSHORT l = (SSHORT) symbol_length (text, (ULONG) size_len); const SSHORT l = (SSHORT) symbol_length (text, (ULONG) size_len);
@ -2504,7 +2504,7 @@ void set_capabilities(void)
* unpleasantness later. * unpleasantness later.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FB_API_HANDLE req = 0; FB_API_HANDLE req = 0;
@ -2581,7 +2581,7 @@ void write_character_sets(void)
**************************************/ **************************************/
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$CHARACTER_SETS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1 X IN RDB$CHARACTER_SETS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1
@ -2627,7 +2627,7 @@ void write_check_constraints(void)
**************************************/ **************************************/
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$CHECK_CONSTRAINTS X IN RDB$CHECK_CONSTRAINTS
@ -2661,7 +2661,7 @@ void write_collations(void)
**************************************/ **************************************/
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$COLLATIONS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1 X IN RDB$COLLATIONS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1
@ -2704,7 +2704,7 @@ void write_database( const TEXT* dbb_file)
SCHAR buffer[256]; SCHAR buffer[256];
isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0; isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
put(tdgbl, (UCHAR) (rec_physical_db)); put(tdgbl, (UCHAR) (rec_physical_db));
@ -2870,7 +2870,7 @@ void write_exceptions(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$EXCEPTIONS X IN RDB$EXCEPTIONS
@ -2906,7 +2906,7 @@ void write_field_dimensions(void)
**************************************/ **************************************/
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$FIELD_DIMENSIONS X IN RDB$FIELD_DIMENSIONS
@ -2941,7 +2941,7 @@ void write_filters(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$FILTERS X IN RDB$FILTERS
@ -2981,7 +2981,7 @@ void write_functions(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$FUNCTIONS X IN RDB$FUNCTIONS
@ -3022,7 +3022,7 @@ void write_function_args( GDS_NAME funcptr)
**************************************/ **************************************/
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
/* if we have all capabilities, use the first request to get the /* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't most performance out of the latest engine; if we don't
@ -3119,7 +3119,7 @@ void write_generators(void)
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$GENERATORS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1 X IN RDB$GENERATORS WITH X.RDB$SYSTEM_FLAG MISSING OR X.RDB$SYSTEM_FLAG NE 1
@ -3161,7 +3161,7 @@ void write_global_fields(void)
isc_req_handle req_handle1 = 0, req_handle2 = 0, isc_req_handle req_handle1 = 0, req_handle2 = 0,
req_handle3 = 0, req_handle4 = 0; req_handle3 = 0, req_handle4 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
/* if we have all capabilities, use the first request to get the /* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't most performance out of the latest engine; if we don't
@ -3358,7 +3358,7 @@ void write_procedures(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$PROCEDURES X IN RDB$PROCEDURES
@ -3404,7 +3404,7 @@ void write_procedure_prms( GDS_NAME procptr)
**************************************/ **************************************/
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE tdgbl->handles_write_procedure_prms_req_handle1) FOR (REQUEST_HANDLE tdgbl->handles_write_procedure_prms_req_handle1)
X IN RDB$PROCEDURE_PARAMETERS WITH X.RDB$PROCEDURE_NAME EQ procptr X IN RDB$PROCEDURE_PARAMETERS WITH X.RDB$PROCEDURE_NAME EQ procptr
@ -3441,7 +3441,7 @@ void write_ref_constraints(void)
**************************************/ **************************************/
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$REF_CONSTRAINTS X IN RDB$REF_CONSTRAINTS
@ -3476,7 +3476,7 @@ void write_rel_constraints(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$RELATION_CONSTRAINTS X IN RDB$RELATION_CONSTRAINTS
@ -3516,7 +3516,7 @@ void write_relations(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0, req_handle4 = 0; isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0, req_handle4 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
/* if we have all capabilities, use the first request to get the /* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't most performance out of the latest engine; if we don't
@ -3683,7 +3683,7 @@ void write_shadow_files(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$FILES X IN RDB$FILES
@ -3724,7 +3724,7 @@ void write_sql_roles(void)
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$ROLES X IN RDB$ROLES
@ -3760,7 +3760,7 @@ void write_triggers(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0, req_handle2 = 0; isc_req_handle req_handle1 = 0, req_handle2 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
/* if we have all capabilities, use the first request to get the /* if we have all capabilities, use the first request to get the
most performance out of the latest engine; if we don't most performance out of the latest engine; if we don't
@ -3866,7 +3866,7 @@ void write_trigger_messages(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
T IN RDB$TRIGGERS CROSS X IN RDB$TRIGGER_MESSAGES T IN RDB$TRIGGERS CROSS X IN RDB$TRIGGER_MESSAGES
@ -3904,7 +3904,7 @@ void write_types(void)
**************************************/ **************************************/
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
X IN RDB$TYPES WITH X.RDB$SYSTEM_FLAG NE 1 OR X IN RDB$TYPES WITH X.RDB$SYSTEM_FLAG NE 1 OR
@ -3944,7 +3944,7 @@ void write_user_privileges(void)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (tdgbl->BCK_capabilities & BCK_ods8) if (tdgbl->BCK_capabilities & BCK_ods8)
{ {

View File

@ -357,7 +357,7 @@ static int api_gbak(int argc,
**********************************************/ **********************************************/
tgbl ldgbl; tgbl ldgbl;
tgbl* tdgbl = &ldgbl; tgbl* tdgbl = &ldgbl;
SET_THREAD_DATA; BURP_set_thread_data;
memset((void *) tdgbl, 0, sizeof(tgbl)); memset((void *) tdgbl, 0, sizeof(tgbl));
tdgbl->output_proc = output_main; tdgbl->output_proc = output_main;
@ -572,7 +572,7 @@ int common_main(int argc,
JMP_BUF env; JMP_BUF env;
// TMN: This variable should probably be removed, but I left it in // TMN: This variable should probably be removed, but I left it in
// in case some platform should redefine the BURP SET_THREAD_DATA. // in case some platform should redefine the BURP BURP_set_thread_data.
//tgbl thd_context; //tgbl thd_context;
gbak_action action = QUIT; gbak_action action = QUIT;
@ -585,7 +585,7 @@ int common_main(int argc,
return FINI_ERROR; return FINI_ERROR;
} }
SET_THREAD_DATA; BURP_set_thread_data;
SVC_PUTSPECIFIC_DATA; SVC_PUTSPECIFIC_DATA;
memset((void *) tdgbl, 0, sizeof(tgbl)); memset((void *) tdgbl, 0, sizeof(tgbl));
tdgbl->burp_env = reinterpret_cast<UCHAR*>(env); tdgbl->burp_env = reinterpret_cast<UCHAR*>(env);
@ -1196,7 +1196,7 @@ int common_main(int argc,
gds__free(mem); gds__free(mem);
} }
RESTORE_THREAD_DATA; BURP_restore_thread_data;
if (tdgbl != NULL) { if (tdgbl != NULL) {
gds__free(tdgbl); gds__free(tdgbl);
} }
@ -1224,7 +1224,7 @@ void BURP_abort(void)
* Abandon a failed operation. * Abandon a failed operation.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
BURP_print(83, 0, 0, 0, 0, 0); BURP_print(83, 0, 0, 0, 0, 0);
// msg 83 Exiting before completion due to errors // msg 83 Exiting before completion due to errors
@ -1256,7 +1256,7 @@ void BURP_error(USHORT errcode, bool abort,
* *
**************************************/ **************************************/
#ifdef SUPERSERVER #ifdef SUPERSERVER
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ISC_STATUS *status = tdgbl->service_blk->svc_status; ISC_STATUS *status = tdgbl->service_blk->svc_status;
@ -1476,7 +1476,7 @@ void BURP_print_status(const ISC_STATUS* status_vector)
if (status_vector) { if (status_vector) {
const ISC_STATUS* vector = status_vector; const ISC_STATUS* vector = status_vector;
#ifdef SUPERSERVER #ifdef SUPERSERVER
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ISC_STATUS* status = tdgbl->service_blk->svc_status; ISC_STATUS* status = tdgbl->service_blk->svc_status;
if (status != status_vector) { if (status != status_vector) {
int i = 0; int i = 0;
@ -1555,7 +1555,7 @@ void BURP_verbose(USHORT number,
* user defined yieding function. * user defined yieding function.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (tdgbl->gbl_sw_verbose) if (tdgbl->gbl_sw_verbose)
BURP_print(number, arg1, arg2, arg3, arg4, arg5); BURP_print(number, arg1, arg2, arg3, arg4, arg5);
@ -1655,7 +1655,7 @@ static gbak_action open_files(const TEXT* file1,
* and db handle. * and db handle.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ISC_STATUS* status_vector = tdgbl->status; ISC_STATUS* status_vector = tdgbl->status;
// try to attach the database using the first file_name // try to attach the database using the first file_name
@ -2054,7 +2054,7 @@ static void burp_output( const SCHAR* format, ...)
UCHAR buf[1000]; UCHAR buf[1000];
int exit_code; int exit_code;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') { if (tdgbl->sw_redirect == NOOUTPUT || format[0] == '\0') {
exit_code = exit_code =

View File

@ -886,22 +886,19 @@ typedef struct tgbl
// in other modules. // in other modules.
void BURP_exit_local(int code, tgbl* tdgbl); void BURP_exit_local(int code, tgbl* tdgbl);
#ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA
#endif
#ifdef SUPERSERVER #ifdef SUPERSERVER
#define GET_THREAD_DATA ((TGBL) THD_get_specific()) #define BURP_get_thread_data ((TGBL) THD_get_specific())
#define SET_THREAD_DATA THD_put_specific ((THDD) tdgbl); \ #define BURP_set_thread_data THD_put_specific ((THDD) tdgbl); \
tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL
#define RESTORE_THREAD_DATA THD_restore_specific(); #define BURP_restore_thread_data THD_restore_specific();
#else #else
extern tgbl* gdgbl; extern tgbl* gdgbl;
#define GET_THREAD_DATA (gdgbl) #define BURP_get_thread_data (gdgbl)
#define SET_THREAD_DATA gdgbl = const_cast<tgbl*>(tdgbl); \ #define BURP_set_thread_data gdgbl = const_cast<tgbl*>(tdgbl); \
tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL tdgbl->tgbl_thd_data.thdd_type = THDD_TYPE_TGBL
#define RESTORE_THREAD_DATA #define BURP_restore_thread_data
#endif #endif

View File

@ -50,7 +50,7 @@ UCHAR *MISC_alloc_burp(ULONG size)
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Add some header space to store a list of blocks allocated for this gbak // Add some header space to store a list of blocks allocated for this gbak
size += ROUNDUP(sizeof(UCHAR *), ALIGNMENT); size += ROUNDUP(sizeof(UCHAR *), ALIGNMENT);
@ -90,7 +90,7 @@ void MISC_free_burp( void *free)
* Release an unwanted block. * Release an unwanted block.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (free != NULL) { if (free != NULL) {
// Point at the head of the allocated block // Point at the head of the allocated block

View File

@ -110,7 +110,7 @@ static DESC next_volume(DESC, ULONG, bool);
// //
UINT64 MVOL_fini_read() UINT64 MVOL_fini_read()
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (strcmp(tdgbl->mvol_old_file, "stdin") != 0) if (strcmp(tdgbl->mvol_old_file, "stdin") != 0)
{ {
@ -138,7 +138,7 @@ UINT64 MVOL_fini_read()
// //
UINT64 MVOL_fini_write(int* io_cnt, UCHAR** io_ptr) UINT64 MVOL_fini_write(int* io_cnt, UCHAR** io_ptr)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
MVOL_write(rec_end, io_cnt, io_ptr); MVOL_write(rec_end, io_cnt, io_ptr);
flush_platf(tdgbl->file_desc); flush_platf(tdgbl->file_desc);
@ -166,7 +166,7 @@ UINT64 MVOL_fini_write(int* io_cnt, UCHAR** io_ptr)
// //
void MVOL_init(ULONG io_buf_size) void MVOL_init(ULONG io_buf_size)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
tdgbl->mvol_io_buffer_size = io_buf_size; tdgbl->mvol_io_buffer_size = io_buf_size;
} }
@ -182,7 +182,7 @@ void MVOL_init_read(const UCHAR* database_name, // unused?
int* cnt, int* cnt,
UCHAR** ptr) UCHAR** ptr)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
tdgbl->mvol_volume_count = 1; tdgbl->mvol_volume_count = 1;
tdgbl->mvol_empty_file = TRUE; tdgbl->mvol_empty_file = TRUE;
@ -230,7 +230,7 @@ void MVOL_init_write(const UCHAR* database_name, // unused?
int* cnt, int* cnt,
UCHAR** ptr) UCHAR** ptr)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
tdgbl->mvol_volume_count = 1; tdgbl->mvol_volume_count = 1;
tdgbl->mvol_empty_file = TRUE; tdgbl->mvol_empty_file = TRUE;
@ -275,7 +275,7 @@ void MVOL_init_write(const UCHAR* database_name, // unused?
// //
int MVOL_read(int* cnt, UCHAR** ptr) int MVOL_read(int* cnt, UCHAR** ptr)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
for (;;) for (;;)
{ {
@ -332,7 +332,7 @@ int MVOL_read(int* cnt, UCHAR** ptr)
// //
int MVOL_read(int* cnt, UCHAR** ptr) int MVOL_read(int* cnt, UCHAR** ptr)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
for (;;) for (;;)
{ {
@ -460,7 +460,7 @@ DESC MVOL_open(const char * name, ULONG mode, ULONG create)
TAPE_GET_MEDIA_PARAMETERS param; TAPE_GET_MEDIA_PARAMETERS param;
DWORD size = sizeof(param); DWORD size = sizeof(param);
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (strnicmp(name, "\\\\.\\tape", 8)) if (strnicmp(name, "\\\\.\\tape", 8))
{ {
@ -523,7 +523,7 @@ UCHAR MVOL_write(UCHAR c, int *io_cnt, UCHAR ** io_ptr)
UCHAR *ptr; UCHAR *ptr;
ULONG left, cnt; ULONG left, cnt;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ULONG size_to_write = BURP_UP_TO_BLOCK(*io_ptr - tdgbl->mvol_io_buffer); ULONG size_to_write = BURP_UP_TO_BLOCK(*io_ptr - tdgbl->mvol_io_buffer);
@ -752,7 +752,7 @@ static void bad_attribute(USHORT attribute, USHORT type)
{ {
TEXT name[128]; TEXT name[128];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
gds__msg_format(0, 12, type, sizeof(name), name, 0, 0, 0, 0, 0); gds__msg_format(0, 12, type, sizeof(name), name, 0, 0, 0, 0, 0);
BURP_print(80, name, (void*) (IPTR) attribute, NULL, NULL, NULL); BURP_print(80, name, (void*) (IPTR) attribute, NULL, NULL, NULL);
@ -772,7 +772,7 @@ static void bad_attribute(USHORT attribute, USHORT type)
// //
static void file_not_empty(void) static void file_not_empty(void)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
tdgbl->mvol_empty_file = FALSE; tdgbl->mvol_empty_file = FALSE;
} }
@ -798,7 +798,7 @@ static SLONG get_numeric(void)
// //
static int get_text(UCHAR* text, SSHORT length) static int get_text(UCHAR* text, SSHORT length)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ULONG l = get(tdgbl); ULONG l = get(tdgbl);
length -= l; length -= l;
@ -829,7 +829,7 @@ static int get_text(UCHAR* text, SSHORT length)
// //
static DESC next_volume( DESC handle, ULONG mode, bool full_buffer) static DESC next_volume( DESC handle, ULONG mode, bool full_buffer)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// We must close the old handle before the user inserts // We must close the old handle before the user inserts
// another tape, or something. // another tape, or something.
@ -951,7 +951,7 @@ static void prompt_for_name(SCHAR* name, int length)
FILE* term_out = NULL; FILE* term_out = NULL;
TEXT msg[128]; TEXT msg[128];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Unless we are operating as a service, stdin can't necessarily be trusted. // Unless we are operating as a service, stdin can't necessarily be trusted.
// Get a location to read from. // Get a location to read from.
@ -1047,7 +1047,7 @@ static void prompt_for_name(SCHAR* name, int length)
// //
static void put_asciz( SCHAR attribute, const TEXT* string) static void put_asciz( SCHAR attribute, const TEXT* string)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
SSHORT l = 0; SSHORT l = 0;
for (const TEXT *p = string; *p; p++) for (const TEXT *p = string; *p; p++)
@ -1074,7 +1074,7 @@ static void put_asciz( SCHAR attribute, const TEXT* string)
// //
static void put_numeric( SCHAR attribute, int value) static void put_numeric( SCHAR attribute, int value)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const ULONG vax_value = gds__vax_integer(reinterpret_cast<const UCHAR*>(&value), sizeof(value)); const ULONG vax_value = gds__vax_integer(reinterpret_cast<const UCHAR*>(&value), sizeof(value));
const UCHAR* p = (UCHAR *) &vax_value; const UCHAR* p = (UCHAR *) &vax_value;
@ -1101,7 +1101,7 @@ static bool read_header(DESC handle,
ULONG temp_buffer_size; ULONG temp_buffer_size;
TEXT buffer[256], *p, msg[128]; TEXT buffer[256], *p, msg[128];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Headers are a version number, and a volume number // Headers are a version number, and a volume number
@ -1235,7 +1235,7 @@ static bool write_header(DESC handle,
ULONG backup_buffer_size, ULONG backup_buffer_size,
bool full_buffer) bool full_buffer)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (backup_buffer_size) if (backup_buffer_size)
{ {
@ -1318,7 +1318,7 @@ bool MVOL_split_hdr_write(void)
{ {
TEXT buffer[HDR_SPLIT_SIZE + 1]; TEXT buffer[HDR_SPLIT_SIZE + 1];
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
fb_assert(tdgbl->action->act_action == ACT_backup_split); fb_assert(tdgbl->action->act_action == ACT_backup_split);
fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE); fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE);
@ -1357,7 +1357,7 @@ bool MVOL_split_hdr_write(void)
// //
bool MVOL_split_hdr_read(void) bool MVOL_split_hdr_read(void)
{ {
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE); fb_assert(tdgbl->action->act_file->fil_fd != INVALID_HANDLE_VALUE);

View File

@ -24,7 +24,7 @@
* 2003.08.17 Claudio Valderrama: Fix SF Bug #750659. * 2003.08.17 Claudio Valderrama: Fix SF Bug #750659.
*/ */
/* /*
$Id: restore.epp,v 1.73 2004-05-02 23:03:43 skidder Exp $ $Id: restore.epp,v 1.74 2004-05-19 18:05:50 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -246,7 +246,7 @@ int RESTORE_restore (const TEXT* file_name,
isc_req_handle req_handle4 = 0; isc_req_handle req_handle4 = 0;
BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name; BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
tdgbl->io_ptr = NULL; tdgbl->io_ptr = NULL;
tdgbl->io_cnt = 0; tdgbl->io_cnt = 0;
@ -663,7 +663,7 @@ void add_files (const UCHAR* file_name)
**************************************/ **************************************/
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// store the RDB$FILES records // store the RDB$FILES records
@ -739,7 +739,7 @@ void bad_attribute (scan_attr_t scan_next_attr,
* look for next valid attribute to continue the process. * look for next valid attribute to continue the process.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
SLONG skip_count = 0; SLONG skip_count = 0;
@ -787,7 +787,7 @@ USHORT check_db_version()
**************************************/ **************************************/
isc_req_handle req_handle1 = 0, req_handle2 = 0; isc_req_handle req_handle1 = 0, req_handle2 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
USHORT db_version = DB_VERSION_DDL4; USHORT db_version = DB_VERSION_DDL4;
FOR (REQUEST_HANDLE req_handle1) FOR (REQUEST_HANDLE req_handle1)
@ -826,7 +826,7 @@ void create_database (const TEXT* file_name)
* things to do. * things to do.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Get (physical) database record // Get (physical) database record
@ -1045,7 +1045,7 @@ void decompress(UCHAR* buffer,
* Get a number of compressed bytes. * Get a number of compressed bytes.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
UCHAR* p = buffer; UCHAR* p = buffer;
const UCHAR* const end = p + length; const UCHAR* const end = p + length;
@ -1101,7 +1101,7 @@ void eat_blob()
* Discard a blob from backup file * Discard a blob from backup file
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const SLONG length = get_numeric(); const SLONG length = get_numeric();
@ -1121,7 +1121,7 @@ burp_rel* find_relation (const TEXT* name)
* one, produce a fatal error. * one, produce a fatal error.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Why isn't strcmp used here? // Why isn't strcmp used here?
for (burp_rel* relation = tdgbl->relations; relation; for (burp_rel* relation = tdgbl->relations; relation;
@ -1151,7 +1151,7 @@ void general_on_error()
* Handle any general ON_ERROR clause during restore. * Handle any general ON_ERROR clause during restore.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
BURP_print_status (isc_status); BURP_print_status (isc_status);
BURP_abort (); BURP_abort ();
@ -1182,7 +1182,7 @@ bool get_acl (const TEXT *owner_nm,
isc_info_blob_total_length, isc_info_blob_total_length,
isc_info_blob_num_segments}; isc_info_blob_num_segments};
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If the blob is null, don't store it. It will be restored as null. // If the blob is null, don't store it. It will be restored as null.
@ -1384,7 +1384,7 @@ void get_array (burp_rel* relation,
UCHAR blr_buffer[200]; // enough for a sdl with 16 dimensions UCHAR blr_buffer[200]; // enough for a sdl with 16 dimensions
lstring xdr_slice; lstring xdr_slice;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// don't free something you don't allocate // don't free something you don't allocate
lstring xdr_buffer; lstring xdr_buffer;
@ -1880,7 +1880,7 @@ void get_blob (const burp_fld* fields,
* shiny, new blob. * shiny, new blob.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Pick up attributes // Pick up attributes
@ -1997,7 +1997,7 @@ void get_blr_blob (ISC_QUAD *blob_id,
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
UCHAR *buffer, static_buffer[1024], *p; UCHAR *buffer, static_buffer[1024], *p;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ULONG length = (ULONG)get_numeric(); ULONG length = (ULONG)get_numeric();
@ -2067,7 +2067,7 @@ bool get_character_set()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_character_sets_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_character_sets_req_handle1)
X IN RDB$CHARACTER_SETS X IN RDB$CHARACTER_SETS
@ -2163,7 +2163,7 @@ bool get_chk_constraint()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_chk_constraint_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_chk_constraint_req_handle1)
X IN RDB$CHECK_CONSTRAINTS X IN RDB$CHECK_CONSTRAINTS
@ -2213,7 +2213,7 @@ bool get_collation()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_collation_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_collation_req_handle1)
X IN RDB$COLLATIONS X IN RDB$COLLATIONS
@ -2302,7 +2302,7 @@ rec_type get_data (burp_rel* relation)
isc_req_handle req_handle = 0; isc_req_handle req_handle = 0;
BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name; BASED_ON RDB$INDICES.RDB$INDEX_NAME index_name;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If we're only doing meta-data, ignore data records // If we're only doing meta-data, ignore data records
@ -2717,7 +2717,7 @@ bool get_exception(void)
ULONG l; ULONG l;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_exception_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_exception_req_handle1)
X IN RDB$EXCEPTIONS X IN RDB$EXCEPTIONS
@ -2780,7 +2780,7 @@ burp_fld* get_field (burp_rel* relation)
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If it is a view and there is a global transaction then use it // If it is a view and there is a global transaction then use it
bool global_tr = false; bool global_tr = false;
@ -3002,7 +3002,7 @@ bool get_field_dimensions()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_field_dimensions_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_field_dimensions_req_handle1)
X IN RDB$FIELD_DIMENSIONS X IN RDB$FIELD_DIMENSIONS
@ -3057,7 +3057,7 @@ bool get_files()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_files_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_files_req_handle1)
X IN RDB$FILES X IN RDB$FILES
@ -3125,7 +3125,7 @@ bool get_filter()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_filter_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_filter_req_handle1)
X IN RDB$FILTERS X IN RDB$FILTERS
@ -3199,7 +3199,7 @@ bool get_function()
SSHORT l; SSHORT l;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_function_req_handle1)
X IN RDB$FUNCTIONS X IN RDB$FUNCTIONS
@ -3279,7 +3279,7 @@ void get_function_arg()
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
if (tdgbl->RESTORE_format >= 6) if (tdgbl->RESTORE_format >= 6)
{ {
@ -3431,7 +3431,7 @@ bool get_generator()
name[0] = 0; // just in case. name[0] = 0; // just in case.
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
skip_init(&scan_next_attr); skip_init(&scan_next_attr);
while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end) while (skip_scan(&scan_next_attr), get_attribute(&attribute, tdgbl) != att_end)
@ -3481,7 +3481,7 @@ bool get_global_field()
SSHORT l; SSHORT l;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
GFLD gfield = NULL; GFLD gfield = NULL;
@ -4072,7 +4072,7 @@ bool get_index (const burp_rel* relation)
bool foreign_index = false; bool foreign_index = false;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
SSHORT count = 0, segments = 0; SSHORT count = 0, segments = 0;
@ -4231,7 +4231,7 @@ void get_misc_blob (ISC_QUAD *blob_id,
**************************************/ **************************************/
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const USHORT length = (USHORT)get_numeric(); const USHORT length = (USHORT)get_numeric();
@ -4349,7 +4349,7 @@ bool get_procedure()
SSHORT l; SSHORT l;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
isc_tr_handle local_trans = isc_tr_handle local_trans =
tdgbl->global_trans ? tdgbl->global_trans : gds_trans; tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
@ -4464,7 +4464,7 @@ bool get_procedure_prm (GDS_NAME procptr)
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
isc_tr_handle local_trans = isc_tr_handle local_trans =
tdgbl->global_trans ? tdgbl->global_trans : gds_trans; tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
@ -4537,7 +4537,7 @@ bool get_ref_constraint()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_ref_constraint_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_ref_constraint_req_handle1)
X IN RDB$REF_CONSTRAINTS X IN RDB$REF_CONSTRAINTS
@ -4630,7 +4630,7 @@ bool get_relation()
ext_file_name[0] = '\0'; ext_file_name[0] = '\0';
bool ext_file_name_null = true; bool ext_file_name_null = true;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Pick up relation attributes // Pick up relation attributes
@ -4854,7 +4854,7 @@ bool get_rel_constraint()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_rel_constraint_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_rel_constraint_req_handle1)
X IN RDB$RELATION_CONSTRAINTS X IN RDB$RELATION_CONSTRAINTS
@ -4931,7 +4931,7 @@ bool get_relation_data()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
burp_rel* relation = NULL; burp_rel* relation = NULL;
@ -5017,7 +5017,7 @@ bool get_sql_roles()
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
SSHORT l; SSHORT l;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_sql_roles_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_sql_roles_req_handle1)
X IN RDB$ROLES X IN RDB$ROLES
@ -5107,7 +5107,7 @@ bool get_security_class()
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
bool is_valid_sec_class = false; bool is_valid_sec_class = false;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_security_class_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_security_class_req_handle1)
X IN RDB$SECURITY_CLASSES X IN RDB$SECURITY_CLASSES
@ -5192,7 +5192,7 @@ void get_source_blob (
**************************************/ **************************************/
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
SLONG length = get_numeric(); SLONG length = get_numeric();
@ -5258,7 +5258,7 @@ USHORT get_text (
* Move a text attribute to a string and fill. * Move a text attribute to a string and fill.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
const ULONG l = get(tdgbl); const ULONG l = get(tdgbl);
@ -5292,7 +5292,7 @@ bool get_trigger_old (
TEXT name[GDS_NAME_LEN]; TEXT name[GDS_NAME_LEN];
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_trigger_old_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_trigger_old_req_handle1)
X IN RDB$TRIGGERS X IN RDB$TRIGGERS
@ -5412,7 +5412,7 @@ bool get_trigger()
BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name; BASED_ON RDB$TRIGGERS.RDB$TRIGGER_NAME name;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
isc_tr_handle local_trans = isc_tr_handle local_trans =
tdgbl->global_trans ? tdgbl->global_trans : gds_trans; tdgbl->global_trans ? tdgbl->global_trans : gds_trans;
@ -5539,7 +5539,7 @@ bool get_trigger_message()
BASED_ON RDB$TRIGGER_MESSAGES.RDB$MESSAGE_NUMBER number; BASED_ON RDB$TRIGGER_MESSAGES.RDB$MESSAGE_NUMBER number;
BASED_ON RDB$TRIGGER_MESSAGES.RDB$MESSAGE message; BASED_ON RDB$TRIGGER_MESSAGES.RDB$MESSAGE message;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
bool flag = false; bool flag = false;
skip_init(&scan_next_attr); skip_init(&scan_next_attr);
@ -5632,7 +5632,7 @@ bool get_type()
TEXT temp[GDS_NAME_LEN]; TEXT temp[GDS_NAME_LEN];
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_get_type_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_get_type_req_handle1)
X IN RDB$TYPES X IN RDB$TYPES
@ -5715,7 +5715,7 @@ bool get_user_privilege()
BASED_ON RDB$USER_PRIVILEGES.RDB$USER_TYPE user_type; BASED_ON RDB$USER_PRIVILEGES.RDB$USER_TYPE user_type;
BASED_ON RDB$USER_PRIVILEGES.RDB$OBJECT_TYPE object_type; BASED_ON RDB$USER_PRIVILEGES.RDB$OBJECT_TYPE object_type;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
user_type = obj_user; user_type = obj_user;
object_type = obj_relation; object_type = obj_relation;
@ -5907,7 +5907,7 @@ bool get_view (burp_rel* relation)
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// If there is a global transaction then use it // If there is a global transaction then use it
@ -5968,7 +5968,7 @@ void ignore_array (burp_rel* relation)
USHORT field_number; USHORT field_number;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Pick up attributes // Pick up attributes
@ -6056,7 +6056,7 @@ void ignore_blob()
ATT_TYPE attribute; ATT_TYPE attribute;
scan_attr_t scan_next_attr; scan_attr_t scan_next_attr;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Pick up attributes // Pick up attributes
@ -6113,7 +6113,7 @@ rec_type ignore_data (burp_rel* relation)
* Ignore data records for a relation. * Ignore data records for a relation.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
ULONG records = 0; ULONG records = 0;
rec_type record; rec_type record;
@ -6182,7 +6182,7 @@ void realign(UCHAR* buffer,
* than the new. * than the new.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
for (const burp_fld* field = relation->rel_fields; field; field = field->fld_next) for (const burp_fld* field = relation->rel_fields; field; field = field->fld_next)
{ {
@ -6243,7 +6243,7 @@ USHORT recompute_length (burp_rel* relation)
ULONG offset = 0; // there was garbage, possibly nobody uses sparc define? ULONG offset = 0; // there was garbage, possibly nobody uses sparc define?
const SSHORT* alignments = old_sparcs; const SSHORT* alignments = old_sparcs;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
for (burp_fld* field = relation->rel_fields; field; field = field->fld_next) for (burp_fld* field = relation->rel_fields; field; field = field->fld_next)
{ {
@ -6309,7 +6309,7 @@ bool restore (const TEXT* file_name,
isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0, isc_req_handle req_handle1 = 0, req_handle2 = 0, req_handle3 = 0,
req_handle5 = 0; req_handle5 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
// Read burp record first // Read burp record first
@ -6639,7 +6639,7 @@ void restore_security_class (const TEXT *owner_nm,
**************************************/ **************************************/
isc_req_handle req_handle2 = 0; isc_req_handle req_handle2 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
isc_tr_handle local_trans = gds_trans; isc_tr_handle local_trans = gds_trans;
FOR (REQUEST_HANDLE req_handle2) FOR (REQUEST_HANDLE req_handle2)
@ -6693,7 +6693,7 @@ USHORT get_view_base_relation_count (const TEXT* current_view_name,
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
USHORT result = 0; USHORT result = 0;
@ -6738,7 +6738,7 @@ void store_blr_gen_id (const TEXT* gen_name, // TEXT GDS_NAME[GDS_NAME_LEN]
* Store the blr_gen_id for the relation. * Store the blr_gen_id for the relation.
* *
**************************************/ **************************************/
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
STORE (REQUEST_HANDLE tdgbl->handles_store_blr_gen_id_req_handle1) STORE (REQUEST_HANDLE tdgbl->handles_store_blr_gen_id_req_handle1)
X IN RDB$GENERATORS X IN RDB$GENERATORS
@ -6873,7 +6873,7 @@ void update_global_field()
USHORT length; USHORT length;
isc_req_handle req_handle1 = 0; isc_req_handle req_handle1 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
for (gfld* gfield = tdgbl->gbl_global_fields; gfield; ) for (gfld* gfield = tdgbl->gbl_global_fields; gfield; )
{ {
@ -6960,7 +6960,7 @@ void update_view_dbkey_lengths()
**************************************/ **************************************/
isc_req_handle req_handle2 = 0; isc_req_handle req_handle2 = 0;
TGBL tdgbl = GET_THREAD_DATA; TGBL tdgbl = BURP_get_thread_data;
FOR (REQUEST_HANDLE req_handle2) FOR (REQUEST_HANDLE req_handle2)
R IN RDB$RELATIONS R IN RDB$RELATIONS

View File

@ -97,7 +97,7 @@ void ALLD_fini()
void ALLD_init() void ALLD_init()
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
if (!init_flag) if (!init_flag)
{ {
@ -112,7 +112,7 @@ void ALLD_init()
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
void DsqlMemoryPool::ALLD_push(BLK object, dsql_lls** stack) void DsqlMemoryPool::ALLD_push(BLK object, dsql_lls** stack)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
DsqlMemoryPool* pool = tdsql->tsql_default; DsqlMemoryPool* pool = tdsql->tsql_default;
dsql_lls* node = pool->lls_cache.newBlock(); dsql_lls* node = pool->lls_cache.newBlock();

View File

@ -20,7 +20,7 @@
* All Rights Reserved. * All Rights Reserved.
* Contributor(s): ______________________________________. * Contributor(s): ______________________________________.
* *
* $Id: ddl.cpp,v 1.101 2004-05-17 22:26:43 brodsom Exp $ * $Id: ddl.cpp,v 1.102 2004-05-19 18:06:44 brodsom Exp $
* 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash, * 2001.5.20 Claudio Valderrama: Stop null pointer that leads to a crash,
* caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET; * caused by incomplete yacc syntax that allows ALTER DOMAIN dom SET;
* *
@ -263,7 +263,7 @@ void DDL_execute(dsql_req* request)
* metadata updates. * metadata updates.
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
#ifdef DSQL_DEBUG #ifdef DSQL_DEBUG
if (DSQL_debug & 4) { if (DSQL_debug & 4) {
@ -2227,7 +2227,7 @@ static void define_procedure( dsql_req* request, NOD_TYPE op)
* Create DYN to store a procedure * Create DYN to store a procedure
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
SSHORT inputs = 0, defaults = 0; SSHORT inputs = 0, defaults = 0;
SSHORT outputs = 0; SSHORT outputs = 0;
@ -2496,7 +2496,7 @@ void DDL_gen_block(dsql_req* request, dsql_nod* node)
SSHORT inputs = 0, outputs = 0, locals = 0; SSHORT inputs = 0, outputs = 0, locals = 0;
request->req_blk_node = node; request->req_blk_node = node;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* parameters; dsql_nod* parameters;
@ -2856,7 +2856,7 @@ static void define_shadow(dsql_req* request)
// //
static void define_trigger( dsql_req* request, dsql_nod* node) static void define_trigger( dsql_req* request, dsql_nod* node)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// make the "define trigger" node the current request ddl node so // make the "define trigger" node the current request ddl node so
// that generating of BLR will be appropriate for trigger // that generating of BLR will be appropriate for trigger
@ -3761,7 +3761,7 @@ static void define_view_trigger( dsql_req* request, dsql_nod* node, dsql_nod* rs
* Create the ddl to define a trigger for a VIEW WITH CHECK OPTION. * Create the ddl to define a trigger for a VIEW WITH CHECK OPTION.
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* ddl_node = request->req_ddl_node; dsql_nod* ddl_node = request->req_ddl_node;
@ -5159,7 +5159,7 @@ static void modify_relation( dsql_req* request)
* global fields for the local fields. * global fields for the local fields.
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* ddl_node = request->req_ddl_node; dsql_nod* ddl_node = request->req_ddl_node;
@ -5773,7 +5773,7 @@ static void save_field(dsql_req* request, const TEXT* field_name)
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_rel* relation = request->req_relation; dsql_rel* relation = request->req_relation;
if (!relation) { if (!relation) {
@ -5803,7 +5803,7 @@ static void save_relation( dsql_req* request, const dsql_str* relation_name)
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
if (request->req_flags & REQ_save_metadata) { if (request->req_flags & REQ_save_metadata) {
return; return;

View File

@ -441,7 +441,7 @@ GDS_DSQL_ALLOCATE_CPP( ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -466,7 +466,7 @@ GDS_DSQL_ALLOCATE_CPP( ISC_STATUS* user_status,
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -515,7 +515,7 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP(
tsql* tdsql; tsql* tdsql;
ISC_STATUS sing_status; ISC_STATUS sing_status;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -615,11 +615,11 @@ ISC_STATUS GDS_DSQL_EXECUTE_CPP(
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return sing_status; return sing_status;
} }
@ -656,7 +656,7 @@ static ISC_STATUS dsql8_execute_immediate_common(ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -737,14 +737,14 @@ static ISC_STATUS dsql8_execute_immediate_common(ISC_STATUS* user_status,
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
status = error(); status = error();
release_request(request, true); release_request(request, true);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return status; return status;
} }
} }
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -963,7 +963,7 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -1116,15 +1116,15 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
reinterpret_cast<char*>(buffer)); reinterpret_cast<char*>(buffer));
THREAD_ENTER(); THREAD_ENTER();
if (!s) { if (!s) {
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return 0; return 0;
} }
else if (s == isc_segment) { else if (s == isc_segment) {
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return 101; return 101;
} }
else if (s == isc_segstr_eof) { else if (s == isc_segstr_eof) {
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return 100; return 100;
} }
else else
@ -1145,7 +1145,7 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
if (eof) if (eof)
{ {
if (!*((USHORT *) eof->par_desc.dsc_address)) { if (!*((USHORT *) eof->par_desc.dsc_address)) {
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return 100; return 100;
} }
} }
@ -1155,7 +1155,7 @@ ISC_STATUS GDS_DSQL_FETCH_CPP( ISC_STATUS* user_status,
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -1183,7 +1183,7 @@ ISC_STATUS GDS_DSQL_FREE_CPP(ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -1214,7 +1214,7 @@ ISC_STATUS GDS_DSQL_FREE_CPP(ISC_STATUS* user_status,
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -1249,7 +1249,7 @@ ISC_STATUS GDS_DSQL_INSERT_CPP( ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -1295,7 +1295,7 @@ ISC_STATUS GDS_DSQL_INSERT_CPP( ISC_STATUS* user_status,
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -1337,7 +1337,7 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -1451,7 +1451,7 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
*req_handle = request; *req_handle = request;
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return GDS_DSQL_SQL_INFO_CPP(user_status, return GDS_DSQL_SQL_INFO_CPP(user_status,
req_handle, req_handle,
@ -1465,14 +1465,14 @@ ISC_STATUS GDS_DSQL_PREPARE_CPP(ISC_STATUS* user_status,
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
status = error(); status = error();
release_request(request, true); release_request(request, true);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return status; return status;
} }
} }
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
} }
@ -1499,7 +1499,7 @@ ISC_STATUS GDS_DSQL_SET_CURSOR_CPP( ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -1574,7 +1574,7 @@ ISC_STATUS GDS_DSQL_SET_CURSOR_CPP( ISC_STATUS* user_status,
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -1609,7 +1609,7 @@ ISC_STATUS GDS_DSQL_SQL_INFO_CPP( ISC_STATUS* user_status,
tsql thd_context; tsql thd_context;
tsql* tdsql; tsql* tdsql;
SET_THREAD_DATA; DSQL_set_thread_data;
try try
{ {
@ -1804,7 +1804,7 @@ ISC_STATUS GDS_DSQL_SQL_INFO_CPP( ISC_STATUS* user_status,
catch(const std::exception& ex) catch(const std::exception& ex)
{ {
Firebird::stuff_exception(tdsql->tsql_status, ex); Firebird::stuff_exception(tdsql->tsql_status, ex);
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -3046,7 +3046,7 @@ static USHORT convert( SLONG number, UCHAR* buffer)
**/ **/
static ISC_STATUS error() static ISC_STATUS error()
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
return tdsql->tsql_status[1]; return tdsql->tsql_status[1];
} }
@ -3083,7 +3083,7 @@ static void execute_blob( dsql_req* request,
UCHAR bpb[24]; UCHAR bpb[24];
ISC_STATUS s; ISC_STATUS s;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_blb* blob = request->req_blob; dsql_blb* blob = request->req_blob;
map_in_out(request, blob->blb_open_in_msg, in_blr_length, in_blr, map_in_out(request, blob->blb_open_in_msg, in_blr_length, in_blr,
@ -3190,7 +3190,7 @@ static ISC_STATUS execute_request(dsql_req* request,
ISC_STATUS s; ISC_STATUS s;
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
request->req_trans = *trans_handle; request->req_trans = *trans_handle;
ISC_STATUS return_status = FB_SUCCESS; ISC_STATUS return_status = FB_SUCCESS;
@ -3623,7 +3623,7 @@ static USHORT get_plan_info(
ISC_STATUS s; ISC_STATUS s;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
memset(explain_buffer, 0, sizeof(explain_buffer)); memset(explain_buffer, 0, sizeof(explain_buffer));
SCHAR* explain_ptr = explain_buffer; SCHAR* explain_ptr = explain_buffer;
SCHAR* buffer_ptr = *out_buffer; SCHAR* buffer_ptr = *out_buffer;
@ -3739,7 +3739,7 @@ static USHORT get_request_info(
{ {
ISC_STATUS s; ISC_STATUS s;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// get the info for the request from the engine // get the info for the request from the engine
@ -4633,7 +4633,7 @@ static dsql_req* prepare(
{ {
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
MOVE_CLEAR(local_status, sizeof(ISC_STATUS) * ISC_STATUS_LENGTH); MOVE_CLEAR(local_status, sizeof(ISC_STATUS) * ISC_STATUS_LENGTH);
@ -4849,7 +4849,7 @@ static dsql_req* prepare(
**/ **/
static void punt(void) static void punt(void)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
Firebird::status_exception::raise(tdsql->tsql_status); Firebird::status_exception::raise(tdsql->tsql_status);
} }
@ -4914,7 +4914,7 @@ static void release_request(dsql_req* request, bool top_level)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// If request is parent, orphan the children and // If request is parent, orphan the children and
// release a portion of their requests // release a portion of their requests
@ -4992,7 +4992,7 @@ static void release_request(dsql_req* request, bool top_level)
static ISC_STATUS return_success(void) static ISC_STATUS return_success(void)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
ISC_STATUS* p = tdsql->tsql_status; ISC_STATUS* p = tdsql->tsql_status;
*p++ = isc_arg_gds; *p++ = isc_arg_gds;
@ -5003,7 +5003,7 @@ static ISC_STATUS return_success(void)
*p = isc_arg_end; *p = isc_arg_end;
} }
RESTORE_THREAD_DATA; DSQL_restore_thread_data;
return FB_SUCCESS; return FB_SUCCESS;
} }

View File

@ -625,11 +625,8 @@ struct tsql
}; };
#ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA
#endif
#define GET_THREAD_DATA ((tsql*) THD_get_specific()) #define DSQL_get_thread_data ((tsql*) THD_get_specific())
/*! \var unsigned DSQL_debug /*! \var unsigned DSQL_debug
\brief Debug level \brief Debug level
@ -643,12 +640,12 @@ struct tsql
64 Display BLR in dsql/prepare 64 Display BLR in dsql/prepare
> 256 Display yacc parser output level = DSQL_level>>8 > 256 Display yacc parser output level = DSQL_level>>8
*/ */
#define SET_THREAD_DATA {\ #define DSQL_set_thread_data {\
tdsql = &thd_context;\ tdsql = &thd_context;\
THD_put_specific ((THDD) tdsql);\ THD_put_specific ((THDD) tdsql);\
tdsql->tsql_thd_data.thdd_type = THDD_TYPE_TSQL;\ tdsql->tsql_thd_data.thdd_type = THDD_TYPE_TSQL;\
} }
#define RESTORE_THREAD_DATA THD_restore_specific() #define DSQL_restore_thread_data THD_restore_specific()
// macros for error generation // macros for error generation

View File

@ -125,7 +125,7 @@ void ERRD_error( int code, const char* text)
{ {
TEXT s[256]; TEXT s[256];
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
sprintf(s, "** DSQL error: %s **\n", text); sprintf(s, "** DSQL error: %s **\n", text);
TRACE(s); TRACE(s);
@ -166,7 +166,7 @@ bool ERRD_post_warning(ISC_STATUS status, ...)
VA_START(args, status); VA_START(args, status);
ISC_STATUS* status_vector = ((tsql*) GET_THREAD_DATA)->tsql_status; ISC_STATUS* status_vector = ((tsql*) DSQL_get_thread_data)->tsql_status;
int indx = 0; int indx = 0;
if (status_vector[0] != isc_arg_gds || if (status_vector[0] != isc_arg_gds ||
@ -264,7 +264,7 @@ void ERRD_post(ISC_STATUS status, ...)
{ {
int warning_indx = 0; int warning_indx = 0;
ISC_STATUS* status_vector = ((tsql*) GET_THREAD_DATA)->tsql_status; ISC_STATUS* status_vector = ((tsql*) DSQL_get_thread_data)->tsql_status;
// stuff the status into temp buffer // stuff the status into temp buffer
ISC_STATUS_ARRAY tmp_status; ISC_STATUS_ARRAY tmp_status;
@ -363,7 +363,7 @@ void ERRD_post(ISC_STATUS status, ...)
**/ **/
void ERRD_punt(void) void ERRD_punt(void)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// Save any strings in a permanent location // Save any strings in a permanent location

View File

@ -542,7 +542,7 @@ void GEN_expr( dsql_req* request, dsql_nod* node)
**/ **/
void GEN_port( dsql_req* request, dsql_msg* message) void GEN_port( dsql_req* request, dsql_msg* message)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// if (request->req_blr_string) { // if (request->req_blr_string) {
stuff(request, blr_message); stuff(request, blr_message);

View File

@ -86,7 +86,7 @@ static inline bool is_date_and_time(const dsc& d1, const dsc& d2)
**/ **/
dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag) dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default,
(numeric_flag == CONSTANT_TIMESTAMP || (numeric_flag == CONSTANT_TIMESTAMP ||
@ -233,7 +233,7 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
**/ **/
dsql_nod* MAKE_str_constant(dsql_str* constant, SSHORT character_set) dsql_nod* MAKE_str_constant(dsql_str* constant, SSHORT character_set)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
node->nod_type = nod_constant; node->nod_type = nod_constant;
@ -1526,7 +1526,7 @@ dsql_nod* MAKE_list(DsqlNodStack& stack)
**/ **/
dsql_nod* MAKE_node(NOD_TYPE type, int count) dsql_nod* MAKE_node(NOD_TYPE type, int count)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
node->nod_type = type; node->nod_type = type;
@ -1565,7 +1565,7 @@ dsql_par* MAKE_parameter(dsql_msg* message, bool sqlda_flag, bool null_flag,
} }
} }
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_par* parameter = FB_NEW(*tdsql->tsql_default) dsql_par; dsql_par* parameter = FB_NEW(*tdsql->tsql_default) dsql_par;
parameter->par_message = message; parameter->par_message = message;
@ -1643,7 +1643,7 @@ dsql_sym* MAKE_symbol(dsql_dbb* database,
fb_assert(name); fb_assert(name);
fb_assert(length > 0); fb_assert(length > 0);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_sym* symbol = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_sym; dsql_sym* symbol = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_sym;
symbol->sym_type = type; symbol->sym_type = type;
@ -1677,7 +1677,7 @@ dsql_sym* MAKE_symbol(dsql_dbb* database,
**/ **/
dsql_str* MAKE_tagged_string(const char* str_, size_t length, const char* charset) dsql_str* MAKE_tagged_string(const char* str_, size_t length, const char* charset)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_str* string = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_str; dsql_str* string = FB_NEW_RPT(*tdsql->tsql_default, length) dsql_str;
string->str_charset = charset; string->str_charset = charset;
@ -1731,7 +1731,7 @@ dsql_nod* MAKE_variable(dsql_fld* field,
{ {
DEV_BLKCHK(field, dsql_type_fld); DEV_BLKCHK(field, dsql_type_fld);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_var* variable = FB_NEW_RPT(*tdsql->tsql_default, strlen(name)) dsql_var; dsql_var* variable = FB_NEW_RPT(*tdsql->tsql_default, strlen(name)) dsql_var;
dsql_nod* node = MAKE_node(nod_variable, e_var_count); dsql_nod* node = MAKE_node(nod_variable, e_var_count);

View File

@ -1400,7 +1400,7 @@ dsql_rel* METD_get_relation(dsql_req* request, const dsql_str* name)
dsql_sym* symbol; dsql_sym* symbol;
tsql* tdsql; tsql* tdsql;
tdsql = GET_THREAD_DATA; tdsql = DSQL_get_thread_data;
metd_rec_lock(); metd_rec_lock();

View File

@ -72,7 +72,7 @@ static void post_error( ISC_STATUS status, ...)
ISC_STATUS *v, *v_end, *temp; ISC_STATUS *v, *v_end, *temp;
ISC_STATUS_ARRAY temp_status; ISC_STATUS_ARRAY temp_status;
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
/* copy into a temporary array any other arguments which may /* copy into a temporary array any other arguments which may
* have been handed to us, then post the error. * have been handed to us, then post the error.

View File

@ -9106,7 +9106,7 @@ static dsql_fld* make_field (dsql_nod* field_name)
* Make a field block of given name. * Make a field block of given name.
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
if (field_name == NULL) if (field_name == NULL)
{ {
@ -9136,7 +9136,7 @@ static dsql_fil* make_file()
* Make a file block * Make a file block
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_fil* temp_file = FB_NEW(*tdsql->tsql_default) dsql_fil; dsql_fil* temp_file = FB_NEW(*tdsql->tsql_default) dsql_fil;
@ -9156,7 +9156,7 @@ static dsql_nod* make_list (dsql_nod* node)
* Collapse nested list nodes into single list. * Collapse nested list nodes into single list.
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
if (!node) if (!node)
return node; return node;
@ -9192,7 +9192,7 @@ static dsql_nod* make_parameter (void)
* Any change should also be made to function below * Any change should also be made to function below
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
node->nod_type = nod_parameter; node->nod_type = nod_parameter;
@ -9220,7 +9220,7 @@ static dsql_nod* make_node (NOD_TYPE type,
* Any change should also be made to function below * Any change should also be made to function below
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
node->nod_type = type; node->nod_type = type;
@ -9253,7 +9253,7 @@ static dsql_nod* make_flag_node (NOD_TYPE type,
* Make a node of given type. Set flag field * Make a node of given type. Set flag field
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
node->nod_type = type; node->nod_type = type;

View File

@ -4323,7 +4323,7 @@ static dsql_fld* make_field (dsql_nod* field_name)
* Make a field block of given name. * Make a field block of given name.
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
if (field_name == NULL) if (field_name == NULL)
{ {
@ -4353,7 +4353,7 @@ static dsql_fil* make_file()
* Make a file block * Make a file block
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_fil* temp_file = FB_NEW(*tdsql->tsql_default) dsql_fil; dsql_fil* temp_file = FB_NEW(*tdsql->tsql_default) dsql_fil;
@ -4373,7 +4373,7 @@ static dsql_nod* make_list (dsql_nod* node)
* Collapse nested list nodes into single list. * Collapse nested list nodes into single list.
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
if (!node) if (!node)
return node; return node;
@ -4409,7 +4409,7 @@ static dsql_nod* make_parameter (void)
* Any change should also be made to function below * Any change should also be made to function below
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_nod;
node->nod_type = nod_parameter; node->nod_type = nod_parameter;
@ -4437,7 +4437,7 @@ static dsql_nod* make_node (NOD_TYPE type,
* Any change should also be made to function below * Any change should also be made to function below
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
node->nod_type = type; node->nod_type = type;
@ -4470,7 +4470,7 @@ static dsql_nod* make_flag_node (NOD_TYPE type,
* Make a node of given type. Set flag field * Make a node of given type. Set flag field
* *
**************************************/ **************************************/
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod; dsql_nod* node = FB_NEW_RPT(*tdsql->tsql_default, count) dsql_nod;
node->nod_type = type; node->nod_type = type;

View File

@ -285,7 +285,7 @@ dsql_ctx* PASS1_make_context(dsql_req* request, dsql_nod* relation_node)
DEV_BLKCHK(request, dsql_type_req); DEV_BLKCHK(request, dsql_type_req);
DEV_BLKCHK(relation_node, dsql_type_nod); DEV_BLKCHK(relation_node, dsql_type_nod);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_rel* relation = NULL; dsql_rel* relation = NULL;
dsql_prc* procedure = NULL; dsql_prc* procedure = NULL;
@ -2981,7 +2981,7 @@ static void pass1_blob( dsql_req* request, dsql_nod* input)
DEV_BLKCHK(request, dsql_type_req); DEV_BLKCHK(request, dsql_type_req);
DEV_BLKCHK(input, dsql_type_nod); DEV_BLKCHK(input, dsql_type_nod);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
PASS1_make_context(request, input->nod_arg[e_blb_relation]); PASS1_make_context(request, input->nod_arg[e_blb_relation]);
dsql_nod* field = pass1_field(request, input->nod_arg[e_blb_field], false); dsql_nod* field = pass1_field(request, input->nod_arg[e_blb_field], false);
@ -3135,7 +3135,7 @@ static dsql_nod* pass1_collate( dsql_req* request, dsql_nod* sub1,
DEV_BLKCHK(sub1, dsql_type_nod); DEV_BLKCHK(sub1, dsql_type_nod);
DEV_BLKCHK(collation, dsql_type_str); DEV_BLKCHK(collation, dsql_type_str);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = MAKE_node(nod_cast, e_cast_count); dsql_nod* node = MAKE_node(nod_cast, e_cast_count);
dsql_fld* field = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_fld; dsql_fld* field = FB_NEW_RPT(*tdsql->tsql_default, 1) dsql_fld;
@ -3570,7 +3570,7 @@ static dsql_nod* pass1_derived_table(dsql_req* request, dsql_nod* input, bool pr
DEV_BLKCHK(request, dsql_type_req); DEV_BLKCHK(request, dsql_type_req);
DEV_BLKCHK(input, dsql_type_nod); DEV_BLKCHK(input, dsql_type_nod);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_nod* node = MAKE_node (nod_derived_table, e_derived_table_count); dsql_nod* node = MAKE_node (nod_derived_table, e_derived_table_count);
dsql_str* alias = (dsql_str*) input->nod_arg[e_derived_table_alias]; dsql_str* alias = (dsql_str*) input->nod_arg[e_derived_table_alias];
@ -5081,7 +5081,7 @@ static dsql_nod* pass1_alias_list(dsql_req* request, dsql_nod* alias_list)
} }
// make up a dummy context to hold the resultant relation. // make up a dummy context to hold the resultant relation.
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
dsql_ctx* new_context = FB_NEW(*tdsql->tsql_default) dsql_ctx* new_context = FB_NEW(*tdsql->tsql_default)
dsql_ctx(*tdsql->tsql_default); dsql_ctx(*tdsql->tsql_default);
new_context->ctx_context = context->ctx_context; new_context->ctx_context = context->ctx_context;
@ -5193,7 +5193,7 @@ static dsql_ctx* pass1_alias(dsql_req* request, DsqlContextStack& stack, dsql_st
**/ **/
static dsql_str* pass1_alias_concat(const dsql_str* input1, const dsql_str* input2) static dsql_str* pass1_alias_concat(const dsql_str* input1, const dsql_str* input2)
{ {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
DEV_BLKCHK(input1, dsql_type_str); DEV_BLKCHK(input1, dsql_type_str);
DEV_BLKCHK(input2, dsql_type_str); DEV_BLKCHK(input2, dsql_type_str);
@ -5274,7 +5274,7 @@ static dsql_nod* pass1_rse( dsql_req* request, dsql_nod* input, dsql_nod* order,
DEV_BLKCHK(input, dsql_type_nod); DEV_BLKCHK(input, dsql_type_nod);
DEV_BLKCHK(order, dsql_type_nod); DEV_BLKCHK(order, dsql_type_nod);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// Handle implicit union case first. Maybe it's not a union // Handle implicit union case first. Maybe it's not a union
@ -6042,7 +6042,7 @@ static dsql_nod* pass1_union( dsql_req* request, dsql_nod* input,
DEV_BLKCHK(input, dsql_type_nod); DEV_BLKCHK(input, dsql_type_nod);
DEV_BLKCHK(order_list, dsql_type_nod); DEV_BLKCHK(order_list, dsql_type_nod);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// set up the rse node for the union. // set up the rse node for the union.
dsql_nod* union_rse = MAKE_node(nod_rse, e_rse_count); dsql_nod* union_rse = MAKE_node(nod_rse, e_rse_count);
@ -6285,7 +6285,7 @@ static void pass1_union_auto_cast(dsql_nod* input, const dsc& desc,
cast_node = select_item; cast_node = select_item;
} }
else { else {
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
cast_node = MAKE_node(nod_cast, e_cast_count); cast_node = MAKE_node(nod_cast, e_cast_count);
dsql_fld* afield = FB_NEW_RPT(*tdsql->tsql_default, 0) dsql_fld; dsql_fld* afield = FB_NEW_RPT(*tdsql->tsql_default, 0) dsql_fld;
cast_node->nod_arg[e_cast_target] = (dsql_nod*) afield; cast_node->nod_arg[e_cast_target] = (dsql_nod*) afield;
@ -6611,7 +6611,7 @@ static dsql_nod* post_map( dsql_nod* node, dsql_ctx* context)
DEV_BLKCHK(node, dsql_type_nod); DEV_BLKCHK(node, dsql_type_nod);
DEV_BLKCHK(context, dsql_type_ctx); DEV_BLKCHK(context, dsql_type_ctx);
tsql* tdsql = GET_THREAD_DATA; tsql* tdsql = DSQL_get_thread_data;
// Check to see if the item has already been posted // Check to see if the item has already been posted

View File

@ -139,7 +139,7 @@ TEXT* ALL_cstring(const Firebird::string& in_string)
* return to the user or where ever. * return to the user or where ever.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
JrdMemoryPool* pool = tdbb->tdbb_default; JrdMemoryPool* pool = tdbb->tdbb_default;
if (!pool) { if (!pool) {
@ -200,7 +200,7 @@ void ALL_init(void)
* have been locked before entry. * have been locked before entry.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
JrdMemoryPool* pool = tdbb->tdbb_default = dbb->dbb_permanent; JrdMemoryPool* pool = tdbb->tdbb_default = dbb->dbb_permanent;

View File

@ -33,7 +33,7 @@
* *
*/ */
/* /*
$Id: blb.cpp,v 1.75 2004-05-12 00:02:05 brodsom Exp $ $Id: blb.cpp,v 1.76 2004-05-19 18:11:09 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -1676,10 +1676,10 @@ static ISC_STATUS blob_filter( USHORT action,
* *
**************************************/ **************************************/
/* Note: Cannot remove this GET_THREAD_DATA without API change to /* Note: Cannot remove this JRD_get_thread_data without API change to
blob filter routines */ blob filter routines */
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_tra* transaction = (jrd_tra*) control->ctl_internal[1]; jrd_tra* transaction = (jrd_tra*) control->ctl_internal[1];
bid* blob_id = reinterpret_cast<bid*>(control->ctl_internal[2]); bid* blob_id = reinterpret_cast<bid*>(control->ctl_internal[2]);
@ -2312,9 +2312,9 @@ static void slice_callback(array_slice* arg, ULONG count, DSC* descriptors)
FB_ALIGN((U_IPTR) array_desc->dsc_address, FB_ALIGN((U_IPTR) array_desc->dsc_address,
(MIN(sizeof(USHORT), ALIGNMENT)))) (MIN(sizeof(USHORT), ALIGNMENT))))
{ {
/* Note: cannot remove this GET_THREAD_DATA without api change /* Note: cannot remove this JRD_get_thread_data without api change
to slice callback routines */ to slice callback routines */
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Firebird::HalfStaticArray<char, 1024> tmp_buffer; Firebird::HalfStaticArray<char, 1024> tmp_buffer;
const USHORT tmp_len = array_desc->dsc_length; const USHORT tmp_len = array_desc->dsc_length;

View File

@ -49,7 +49,7 @@ Bookmark* BKM_allocate(RecordSource* rsb, USHORT length)
* Allocate and initialize a bookmark structure. * Allocate and initialize a bookmark structure.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
irsb* impure = (irsb*) ((UCHAR *) request + rsb->rsb_impure); irsb* impure = (irsb*) ((UCHAR *) request + rsb->rsb_impure);
@ -125,7 +125,7 @@ Bookmark* BKM_lookup(jrd_nod* node)
bookmark = (Bookmark*) MOV_get_long(EVL_expr(tdbb, node), 0); bookmark = (Bookmark*) MOV_get_long(EVL_expr(tdbb, node), 0);
#else #else
{ {
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
bookmark = NULL; bookmark = NULL;
@ -158,7 +158,7 @@ void BKM_release(jrd_nod* node)
* Release a bookmark using a user supplied value. * Release a bookmark using a user supplied value.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
Bookmark* bookmark = BKM_lookup(node); Bookmark* bookmark = BKM_lookup(node);

View File

@ -889,7 +889,7 @@ USHORT BTR_key_length(jrd_rel* relation, index_desc* idx)
* Compute the maximum key length for an index. * Compute the maximum key length for an index.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
const Format* format = MET_current(tdbb, relation); const Format* format = MET_current(tdbb, relation);
index_desc::idx_repeat* tail = idx->idx_rpt; index_desc::idx_repeat* tail = idx->idx_rpt;

View File

@ -408,7 +408,7 @@ int CCH_down_grade_dbb(void* ast_object)
/* Since this routine will be called asynchronously, we must establish /* Since this routine will be called asynchronously, we must establish
a thread context. */ a thread context. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
ISC_STATUS_ARRAY ast_status; ISC_STATUS_ARRAY ast_status;
tdbb->tdbb_database = dbb; tdbb->tdbb_database = dbb;
@ -424,14 +424,14 @@ int CCH_down_grade_dbb(void* ast_object)
if (SHUT_blocking_ast(dbb)) { if (SHUT_blocking_ast(dbb)) {
dbb->dbb_ast_flags &= ~DBB_blocking; dbb->dbb_ast_flags &= ~DBB_blocking;
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }
/* /*
if (dbb->dbb_use_count) if (dbb->dbb_use_count)
{ {
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return; return;
} }
*/ */
@ -441,21 +441,21 @@ if (dbb->dbb_use_count)
and we can't give it anyway */ and we can't give it anyway */
if ((lock->lck_logical == LCK_SW) || (lock->lck_logical == LCK_SR)) { if ((lock->lck_logical == LCK_SW) || (lock->lck_logical == LCK_SR)) {
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }
if (dbb->dbb_flags & DBB_bugcheck) { if (dbb->dbb_flags & DBB_bugcheck) {
LCK_convert(tdbb, lock, LCK_SW, LCK_WAIT); LCK_convert(tdbb, lock, LCK_SW, LCK_WAIT);
dbb->dbb_ast_flags &= ~DBB_blocking; dbb->dbb_ast_flags &= ~DBB_blocking;
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }
/* If we are supposed to be exclusive, stay exclusive */ /* If we are supposed to be exclusive, stay exclusive */
if ((dbb->dbb_flags & DBB_exclusive) || (dbb->dbb_ast_flags & DBB_shutdown_single)) { if ((dbb->dbb_flags & DBB_exclusive) || (dbb->dbb_ast_flags & DBB_shutdown_single)) {
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }
@ -492,7 +492,7 @@ if (dbb->dbb_use_count)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }
@ -1866,7 +1866,7 @@ void CCH_must_write(WIN * window)
} }
bdb->bdb_flags |= (BDB_dirty | BDB_must_write); bdb->bdb_flags |= (BDB_dirty | BDB_must_write);
update_write_direction(GET_THREAD_DATA, bdb); update_write_direction(JRD_get_thread_data, bdb);
} }
@ -2327,7 +2327,7 @@ void CCH_shutdown_database(Database* dbb)
* Shutdown database physical page locks. * Shutdown database physical page locks.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
bcb_repeat* tail; bcb_repeat* tail;
BufferControl* bcb = dbb->dbb_bcb; BufferControl* bcb = dbb->dbb_bcb;
@ -2707,7 +2707,7 @@ static int blocking_ast_bdb(void* ast_object)
/* Since this routine will be called asynchronously, we must establish /* Since this routine will be called asynchronously, we must establish
a thread context. */ a thread context. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
BLKCHK(bdb, type_bdb); BLKCHK(bdb, type_bdb);
@ -2741,7 +2741,7 @@ static int blocking_ast_bdb(void* ast_object)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
ISC_ast_exit(); ISC_ast_exit();
@ -3076,7 +3076,7 @@ static void THREAD_ROUTINE cache_reader(Database* dbb)
Once we reach the end, the thread will die, thus implicitly Once we reach the end, the thread will die, thus implicitly
killing all its contexts. */ killing all its contexts. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
/* Dummy attachment needed for lock owner identification. */ /* Dummy attachment needed for lock owner identification. */
@ -3245,7 +3245,7 @@ static void THREAD_ROUTINE cache_writer(Database* dbb)
Once we reach the end, the thread will die, thus implicitly Once we reach the end, the thread will die, thus implicitly
killing all its contexts. */ killing all its contexts. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
/* Dummy attachment needed for lock owner identification. */ /* Dummy attachment needed for lock owner identification. */

View File

@ -543,7 +543,7 @@ jrd_req* CMP_compile(USHORT blr_length, const UCHAR* blr, USHORT internal_flag)
* 1997-Jan-20 David Schnepper * 1997-Jan-20 David Schnepper
* *
**************************************/ **************************************/
return CMP_compile2(GET_THREAD_DATA, blr, internal_flag); return CMP_compile2(JRD_get_thread_data, blr, internal_flag);
} }

View File

@ -1361,7 +1361,7 @@ void CVT_move(const dsc* from, dsc* to, FPTR_ERROR err)
portion to the current date */ portion to the current date */
{ {
time_t clock; time_t clock;
/** Cannot call GET_THREAD_DATA because that macro calls /** Cannot call JRD_get_thread_data because that macro calls
BUGCHECK i.e. ERR_bugcheck() which is not part of BUGCHECK i.e. ERR_bugcheck() which is not part of
client library **/ client library **/
thread_db* tdbb = PLATFORM_GET_THREAD_DATA; thread_db* tdbb = PLATFORM_GET_THREAD_DATA;
@ -1819,7 +1819,7 @@ static void datetime_to_text(const dsc* from, dsc* to, FPTR_ERROR err)
date.timestamp_time = 0; date.timestamp_time = 0;
break; break;
case dtype_timestamp: case dtype_timestamp:
/** Cannot call GET_THREAD_DATA because that macro calls /** Cannot call JRD_get_thread_data because that macro calls
BUGCHECK i.e. ERR_bugcheck() which is not part of BUGCHECK i.e. ERR_bugcheck() which is not part of
client library **/ client library **/
tdbb = PLATFORM_GET_THREAD_DATA; tdbb = PLATFORM_GET_THREAD_DATA;

View File

@ -858,7 +858,7 @@ USHORT CVT2_make_string2(const dsc* desc,
return from_len; return from_len;
} }
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
const USHORT cs1 = INTL_charset(tdbb, to_interp, err); const USHORT cs1 = INTL_charset(tdbb, to_interp, err);
const USHORT cs2 = INTL_charset(tdbb, from_interp, err); const USHORT cs2 = INTL_charset(tdbb, from_interp, err);
if (cs1 == cs2) { if (cs1 == cs2) {

View File

@ -256,7 +256,7 @@ USHORT DFW_assign_index_type(DeferredWork* work, SSHORT field_type, SSHORT ttype
* on the field's type and subtype. * on the field's type and subtype.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (field_type == dtype_varying || field_type == dtype_text) if (field_type == dtype_varying || field_type == dtype_text)
{ {
@ -460,7 +460,7 @@ void DFW_perform_work(jrd_tra* transaction)
* come. * come.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* If no deferred work or it's all deferred event posting /* If no deferred work or it's all deferred event posting
don't bother */ don't bother */
@ -676,7 +676,7 @@ void DFW_update_index(const TEXT* name, USHORT id, const SelectivityList& select
* of the index. * of the index.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
if (dbb->dbb_ods_version >= ODS_VERSION11) { if (dbb->dbb_ods_version >= ODS_VERSION11) {
@ -3148,7 +3148,7 @@ static void get_procedure_dependencies(DeferredWork* work)
* created or when it's modified. * created or when it's modified.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_prc* procedure = NULL; jrd_prc* procedure = NULL;
@ -3211,7 +3211,7 @@ static void get_trigger_dependencies( DeferredWork* work)
* created or when it's modified. * created or when it's modified.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_rel* relation = NULL; jrd_rel* relation = NULL;
@ -4068,7 +4068,7 @@ static void put_summary_blob(blb* blob, RSR_T type, bid* blob_id)
UCHAR temp[128]; UCHAR temp[128];
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* If blob is null, don't bother */ /* If blob is null, don't bother */
@ -4113,7 +4113,7 @@ static void put_summary_record(blb* blob,
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
UCHAR temp[129]; UCHAR temp[129];
UCHAR* buffer = ((size_t) (length + 1) > sizeof(temp)) ? UCHAR* buffer = ((size_t) (length + 1) > sizeof(temp)) ?

View File

@ -961,7 +961,7 @@ static void dmp_root(const index_root_page* page)
((PAG) page)->pag_checksum, ((PAG) page)->pag_generation, ((PAG) page)->pag_checksum, ((PAG) page)->pag_generation,
page->irt_relation, page->irt_count); page->irt_relation, page->irt_count);
const bool ods11plus = const bool ods11plus =
(GET_THREAD_DATA->tdbb_database->dbb_ods_version >= ODS_VERSION11); (JRD_get_thread_data->tdbb_database->dbb_ods_version >= ODS_VERSION11);
USHORT i = 0; USHORT i = 0;
for (const index_root_page::irt_repeat* desc = page->irt_rpt; for (const index_root_page::irt_repeat* desc = page->irt_rpt;
i < page->irt_count; i++, desc++) i < page->irt_count; i++, desc++)
@ -996,7 +996,7 @@ static void dmp_transactions(const tx_inv_page* page, ULONG sequence)
* Functional description * Functional description
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
const ULONG transactions_per_tip = dbb->dbb_pcontrol->pgc_tpt; const ULONG transactions_per_tip = dbb->dbb_pcontrol->pgc_tpt;

View File

@ -105,7 +105,7 @@ void DYN_ddl(Attachment* attachment, jrd_tra* transaction, USHORT length,
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
#if defined(V4_THREADING) || (defined(SUPERSERVER) && defined(WIN_NT)) #if defined(V4_THREADING) || (defined(SUPERSERVER) && defined(WIN_NT))
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
@ -211,7 +211,7 @@ void DYN_error(bool status_flag,
* DDL failed. * DDL failed.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (tdbb->tdbb_status_vector[1] == isc_no_meta_update) if (tdbb->tdbb_status_vector[1] == isc_no_meta_update)
return; return;
@ -713,7 +713,7 @@ USHORT DYN_put_blr_blob(Global* gbl, const UCHAR** ptr, bid* blob_id)
* Write out a blr blob. * Write out a blr blob.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
const UCHAR *p = *ptr; const UCHAR *p = *ptr;
USHORT length = *p++; USHORT length = *p++;
@ -752,7 +752,7 @@ USHORT DYN_put_text_blob(Global* gbl, const UCHAR** ptr, bid* blob_id)
* Write out a text blob. * Write out a text blob.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
const UCHAR* p = *ptr; const UCHAR* p = *ptr;
USHORT length = *p++; USHORT length = *p++;
@ -801,7 +801,7 @@ void DYN_rundown_request(jrd_req* handle, SSHORT id)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
#pragma FB_COMPILER_MESSAGE("TMN: FIXME! We do not have a jmp_buf anymore!") #pragma FB_COMPILER_MESSAGE("TMN: FIXME! We do not have a jmp_buf anymore!")
@ -863,7 +863,7 @@ static void grant( Global* gbl, const UCHAR** ptr)
TEXT* ptr1; TEXT* ptr1;
TEXT* ptr2; TEXT* ptr2;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
const USHORT major_version = dbb->dbb_ods_version; const USHORT major_version = dbb->dbb_ods_version;
@ -1196,7 +1196,7 @@ static bool grantor_can_grant( Global* gbl,
**************************************/ **************************************/
USHORT err_num; USHORT err_num;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* Verify that the input relation exists. */ /* Verify that the input relation exists. */
@ -1582,7 +1582,7 @@ static void revoke_permission(Global* gbl, const UCHAR** ptr)
SqlIdentifier revoking_user_name, dummy_name; SqlIdentifier revoking_user_name, dummy_name;
TEXT* ptr1; TEXT* ptr1;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
const USHORT major_version = dbb->dbb_ods_version; const USHORT major_version = dbb->dbb_ods_version;
@ -1838,7 +1838,7 @@ static void set_field_class_name(Global* gbl, const TEXT* relation, const TEXT*
* field has a unique class name. * field has a unique class name.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_s_f_class, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_s_f_class, DYN_REQUESTS);
@ -1902,7 +1902,7 @@ static void store_privilege(Global* gbl,
* routine should not. * routine should not.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_s_grant, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_s_grant, DYN_REQUESTS);

View File

@ -139,7 +139,7 @@ void DYN_define_cache( Global* gbl, const UCHAR** ptr)
jrd_req* request; jrd_req* request;
SSHORT id = -1; SSHORT id = -1;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
request = NULL; request = NULL;
@ -246,7 +246,7 @@ void DYN_define_constraint(Global* gbl,
bool primary_flag = false, foreign_flag = false; bool primary_flag = false, foreign_flag = false;
UCHAR ri_action = 0; UCHAR ri_action = 0;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
constraint_name[0] = 0; constraint_name[0] = 0;
@ -633,7 +633,7 @@ void DYN_define_dimension(Global* gbl,
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
UCHAR verb; UCHAR verb;
@ -717,7 +717,7 @@ void DYN_define_exception( Global* gbl, const UCHAR** ptr)
UCHAR verb; UCHAR verb;
SqlIdentifier exception_name; SqlIdentifier exception_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
exception_name[0] = 0; exception_name[0] = 0;
@ -795,7 +795,7 @@ void DYN_define_file(Global* gbl,
USHORT man_auto; USHORT man_auto;
SSHORT id; SSHORT id;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
request = NULL; request = NULL;
@ -902,7 +902,7 @@ void DYN_define_difference(Global* gbl,
jrd_req* request; jrd_req* request;
SSHORT id = -1; SSHORT id = -1;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
request = NULL; request = NULL;
@ -985,7 +985,7 @@ void DYN_define_filter( Global* gbl, const UCHAR** ptr)
SqlIdentifier filter_name; SqlIdentifier filter_name;
jrd_req* request; jrd_req* request;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
filter_name[0] = 0; filter_name[0] = 0;
@ -1080,7 +1080,7 @@ void DYN_define_function( Global* gbl, const UCHAR** ptr)
SqlIdentifier function_name; SqlIdentifier function_name;
jrd_req* request; jrd_req* request;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
function_name[0] = 0; function_name[0] = 0;
@ -1179,7 +1179,7 @@ void DYN_define_function_arg(Global* gbl, const UCHAR** ptr, TEXT* function_name
UCHAR verb; UCHAR verb;
jrd_req* request = NULL; jrd_req* request = NULL;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
const USHORT major_version = dbb->dbb_ods_version; const USHORT major_version = dbb->dbb_ods_version;
@ -1304,7 +1304,7 @@ void DYN_define_generator( Global* gbl, const UCHAR** ptr)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request; jrd_req* request;
@ -1371,7 +1371,7 @@ void DYN_define_global_field(Global* gbl,
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
UCHAR verb; UCHAR verb;
@ -1641,7 +1641,7 @@ void DYN_define_index(Global* gbl,
(*ri_actionP) = 0; (*ri_actionP) = 0;
} }
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
index_name[0] = 0; index_name[0] = 0;
@ -2195,7 +2195,7 @@ void DYN_define_local_field(Global* gbl,
SSHORT charset_id; SSHORT charset_id;
SLONG fld_pos; SLONG fld_pos;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
local_field_name[0] = 0; local_field_name[0] = 0;
@ -2508,7 +2508,7 @@ void DYN_define_log_file(
jrd_req* request; jrd_req* request;
SSHORT id; SSHORT id;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
request = NULL; request = NULL;
@ -2646,7 +2646,7 @@ void DYN_define_parameter( Global* gbl, const UCHAR** ptr, TEXT* procedure_name)
const UCHAR* default_value_ptr = NULL; const UCHAR* default_value_ptr = NULL;
const UCHAR* default_source_ptr = NULL; const UCHAR* default_source_ptr = NULL;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
parameter_name[0] = 0; parameter_name[0] = 0;
@ -2889,7 +2889,7 @@ void DYN_define_procedure( Global* gbl, const UCHAR** ptr)
SqlIdentifier procedure_name; SqlIdentifier procedure_name;
SqlIdentifier owner_name; SqlIdentifier owner_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
procedure_name[0] = 0; procedure_name[0] = 0;
@ -3046,7 +3046,7 @@ void DYN_define_relation( Global* gbl, const UCHAR** ptr)
SSHORT id; SSHORT id;
SqlIdentifier relation_name, owner_name, field_name; SqlIdentifier relation_name, owner_name, field_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
relation_name[0] = 0; relation_name[0] = 0;
@ -3269,7 +3269,7 @@ void DYN_define_role( Global* gbl, const UCHAR** ptr)
jrd_req* request = NULL; jrd_req* request = NULL;
SqlIdentifier dummy_name, owner_name, role_name; SqlIdentifier dummy_name, owner_name, role_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
const USHORT major_version = dbb->dbb_ods_version; const USHORT major_version = dbb->dbb_ods_version;
@ -3385,7 +3385,7 @@ void DYN_define_security_class( Global* gbl, const UCHAR** ptr)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request; jrd_req* request;
@ -3464,7 +3464,7 @@ void DYN_define_sql_field(Global* gbl,
USHORT dtype; USHORT dtype;
SLONG fld_pos; SLONG fld_pos;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
sql_field_name[0] = 0; sql_field_name[0] = 0;
@ -3743,7 +3743,7 @@ void DYN_define_shadow( Global* gbl, const UCHAR** ptr)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
UCHAR verb; UCHAR verb;
@ -3821,7 +3821,7 @@ void DYN_define_trigger(Global* gbl,
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request; jrd_req* request;
@ -3988,7 +3988,7 @@ void DYN_define_trigger_msg(Global* gbl, const UCHAR** ptr, const TEXT* trigger_
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request; jrd_req* request;
@ -4064,7 +4064,7 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const TEXT* view)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request; jrd_req* request;

View File

@ -157,7 +157,7 @@ void DYN_delete_exception( Global* gbl, const UCHAR** ptr)
**************************************/ **************************************/
SqlIdentifier t; SqlIdentifier t;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
GET_STRING(ptr, t); GET_STRING(ptr, t);
@ -211,7 +211,7 @@ void DYN_delete_filter( Global* gbl, const UCHAR** ptr)
**************************************/ **************************************/
SqlIdentifier f; SqlIdentifier f;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_filters, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_filters, DYN_REQUESTS);
@ -267,7 +267,7 @@ void DYN_delete_function( Global* gbl, const UCHAR** ptr)
**************************************/ **************************************/
SqlIdentifier f; SqlIdentifier f;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_func_args, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_func_args, DYN_REQUESTS);
@ -346,7 +346,7 @@ void DYN_delete_generator(Global* gbl, const UCHAR**ptr)
**************************************/ **************************************/
SqlIdentifier t; SqlIdentifier t;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = NULL; jrd_req* request = NULL;
@ -404,7 +404,7 @@ void DYN_delete_global_field( Global* gbl, const UCHAR** ptr)
**************************************/ **************************************/
SqlIdentifier f; SqlIdentifier f;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_l_fld_src, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_l_fld_src, DYN_REQUESTS);
@ -489,7 +489,7 @@ void DYN_delete_index( Global* gbl, const UCHAR** ptr)
**************************************/ **************************************/
SqlIdentifier idx_name, rel_name; SqlIdentifier idx_name, rel_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_indices, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_indices, DYN_REQUESTS);
@ -581,7 +581,7 @@ void DYN_delete_local_field(
**************************************/ **************************************/
SqlIdentifier tbl_nm, col_nm, constraint, index_name; SqlIdentifier tbl_nm, col_nm, constraint, index_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
GET_STRING(ptr, col_nm); GET_STRING(ptr, col_nm);
@ -803,7 +803,7 @@ void DYN_delete_parameter( Global* gbl, const UCHAR** ptr, TEXT* proc_name)
MAX_SQL_IDENTIFIER_SIZE, true); MAX_SQL_IDENTIFIER_SIZE, true);
} }
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_prm, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_prm, DYN_REQUESTS);
@ -893,7 +893,7 @@ void DYN_delete_procedure( Global* gbl, const UCHAR** ptr)
SqlIdentifier name; SqlIdentifier name;
GET_STRING(ptr, name); GET_STRING(ptr, name);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
tdbb->tdbb_flags |= TDBB_prc_being_dropped; tdbb->tdbb_flags |= TDBB_prc_being_dropped;
@ -1051,7 +1051,7 @@ void DYN_delete_relation( Global* gbl, const UCHAR** ptr, const TEXT* relation)
USHORT id; USHORT id;
SqlIdentifier relation_name; SqlIdentifier relation_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
if (relation) if (relation)
@ -1293,7 +1293,7 @@ void DYN_delete_role( Global* gbl, const UCHAR** ptr)
SqlIdentifier role_name, role_owner, user; SqlIdentifier role_name, role_owner, user;
TEXT *ptr1, *ptr2; TEXT *ptr1, *ptr2;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
const USHORT major_version = dbb->dbb_ods_version; const USHORT major_version = dbb->dbb_ods_version;
@ -1446,7 +1446,7 @@ void DYN_delete_shadow( Global* gbl, const UCHAR** ptr)
**************************************/ **************************************/
int shadow_number; int shadow_number;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/***** /*****
@ -1521,7 +1521,7 @@ void DYN_delete_trigger( Global* gbl, const UCHAR** ptr)
USHORT id; USHORT id;
SqlIdentifier r, t; SqlIdentifier r, t;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_trg_msgs, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_trg_msgs, DYN_REQUESTS);
@ -1658,7 +1658,7 @@ void DYN_delete_trigger_msg( Global* gbl, const UCHAR** ptr, TEXT* trigger_name)
int number; int number;
SqlIdentifier t; SqlIdentifier t;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
number = DYN_get_number(ptr); number = DYN_get_number(ptr);
@ -1726,7 +1726,7 @@ static bool delete_constraint_records(Global* gbl,
* based on a constraint name. * based on a constraint name.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_rel_con, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_rel_con, DYN_REQUESTS);
@ -1776,7 +1776,7 @@ static bool delete_dimension_records(Global* gbl, const TEXT* field_name)
* pertaining to a field. * pertaining to a field.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_dims, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_dims, DYN_REQUESTS);
@ -1900,7 +1900,7 @@ static void delete_gfield_for_lfield( Global* gbl, const TEXT* lfield_name)
* deletes a global field for a given local field. * deletes a global field for a given local field.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_l_gfld, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_l_gfld, DYN_REQUESTS);
@ -1941,7 +1941,7 @@ static bool delete_index_segment_records( Global* gbl, const TEXT* index_name)
* pertaining to an index. * pertaining to an index.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_idx_segs, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_idx_segs, DYN_REQUESTS);
@ -1989,7 +1989,7 @@ static bool delete_security_class2( Global* gbl, const TEXT* security_class)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_e_class, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_e_class, DYN_REQUESTS);

View File

@ -119,7 +119,7 @@ void DYN_modify_database( Global* gbl, const UCHAR** ptr)
**************************************/ **************************************/
UCHAR verb, s[128]; UCHAR verb, s[128];
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = NULL; jrd_req* request = NULL;
@ -267,7 +267,7 @@ void DYN_modify_exception( Global* gbl, const UCHAR** ptr)
UCHAR verb; UCHAR verb;
SqlIdentifier t; SqlIdentifier t;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_m_xcp, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_m_xcp, DYN_REQUESTS);
@ -341,7 +341,7 @@ void DYN_modify_global_field(
const TEXT* err_one_type_change_only = const TEXT* err_one_type_change_only =
"Only one data type change to the domain allowed at a time"; "Only one data type change to the domain allowed at a time";
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_m_gfield, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_m_gfield, DYN_REQUESTS);
@ -886,7 +886,7 @@ void DYN_modify_index( Global* gbl, const UCHAR** ptr)
UCHAR verb; UCHAR verb;
SqlIdentifier name; SqlIdentifier name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_m_index, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_m_index, DYN_REQUESTS);
@ -978,7 +978,7 @@ void DYN_modify_local_field(
const UCHAR *query_header, *description; const UCHAR *query_header, *description;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
GET_STRING(ptr, f); GET_STRING(ptr, f);
@ -1168,7 +1168,7 @@ void DYN_modify_procedure( Global* gbl, const UCHAR** ptr)
GET_STRING(ptr, procedure_name); GET_STRING(ptr, procedure_name);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = NULL; jrd_req* request = NULL;
@ -1274,7 +1274,7 @@ void DYN_modify_relation( Global* gbl, const UCHAR** ptr)
UCHAR verb; UCHAR verb;
SqlIdentifier name, field_name; SqlIdentifier name, field_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
field_name[0] = 0; field_name[0] = 0;
@ -1373,7 +1373,7 @@ void DYN_modify_trigger( Global* gbl, const UCHAR** ptr)
UCHAR verb; UCHAR verb;
SqlIdentifier trigger_name; SqlIdentifier trigger_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_m_trigger, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_m_trigger, DYN_REQUESTS);
@ -1507,7 +1507,7 @@ void DYN_modify_trigger_msg( Global* gbl, const UCHAR** ptr, TEXT* trigger_name)
UCHAR verb; UCHAR verb;
SqlIdentifier t; SqlIdentifier t;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_m_trg_msg, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_m_trg_msg, DYN_REQUESTS);
@ -1577,7 +1577,7 @@ void DYN_modify_view( Global* gbl, const UCHAR** ptr)
UCHAR verb; UCHAR verb;
SqlIdentifier view_name; SqlIdentifier view_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
view_name[0] = 0; view_name[0] = 0;
@ -1672,7 +1672,7 @@ static void drop_cache( Global* gbl)
* Drop the database cache * Drop the database cache
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_d_cache, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_d_cache, DYN_REQUESTS);
@ -1723,7 +1723,7 @@ static void change_backup_mode( Global* gbl, UCHAR verb)
**************************************/ **************************************/
bool invalid_state = false; bool invalid_state = false;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_d_difference, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_d_difference, DYN_REQUESTS);
@ -1838,7 +1838,7 @@ static void drop_log( Global* gbl)
* Delete all log files * Delete all log files
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, drq_d_log, DYN_REQUESTS); jrd_req* request = CMP_find_request(tdbb, drq_d_log, DYN_REQUESTS);
@ -2213,7 +2213,7 @@ void DYN_modify_sql_field(Global* gbl,
const TEXT* err_one_type_change_only = const TEXT* err_one_type_change_only =
"Only one data type change to the field allowed at a time"; "Only one data type change to the field allowed at a time";
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
dyn_fld* orig_fld = 0; dyn_fld* orig_fld = 0;

View File

@ -174,7 +174,7 @@ void ERR_duplicate_error(IDX_E code,
const TEXT* index_name; const TEXT* index_name;
const TEXT* constraint_name; const TEXT* constraint_name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
MET_lookup_index(tdbb, index, relation->rel_name, index_number + 1); MET_lookup_index(tdbb, index, relation->rel_name, index_number + 1);
if (index[0]) { if (index[0]) {
@ -276,7 +276,7 @@ void ERR_log(int facility, int number, const TEXT* message)
* *
**************************************/ **************************************/
TEXT errmsg[MAX_ERRMSG_LEN + 1]; TEXT errmsg[MAX_ERRMSG_LEN + 1];
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
DEBUG; DEBUG;
if (message) if (message)
@ -315,7 +315,7 @@ bool ERR_post_warning(ISC_STATUS status, ...)
ISC_STATUS* status_vector; ISC_STATUS* status_vector;
VA_START(args, status); VA_START(args, status);
status_vector = ((thread_db*) GET_THREAD_DATA)->tdbb_status_vector; status_vector = ((thread_db*) JRD_get_thread_data)->tdbb_status_vector;
if (status_vector[0] != isc_arg_gds || if (status_vector[0] != isc_arg_gds ||
(status_vector[0] == isc_arg_gds && status_vector[1] == 0 && (status_vector[0] == isc_arg_gds && status_vector[1] == 0 &&
@ -404,7 +404,7 @@ void ERR_post(ISC_STATUS status, ...)
int i, tmp_status_len = 0, status_len = 0, err_status_len = 0; int i, tmp_status_len = 0, status_len = 0, err_status_len = 0;
int warning_count = 0, warning_indx = 0; int warning_count = 0, warning_indx = 0;
ISC_STATUS* status_vector = ((thread_db*) GET_THREAD_DATA)->tdbb_status_vector; ISC_STATUS* status_vector = ((thread_db*) JRD_get_thread_data)->tdbb_status_vector;
/* stuff the status into temp buffer */ /* stuff the status into temp buffer */
MOVE_CLEAR(tmp_status, sizeof(tmp_status)); MOVE_CLEAR(tmp_status, sizeof(tmp_status));
@ -491,7 +491,7 @@ void ERR_punt(void)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
if (dbb && (dbb->dbb_flags & DBB_bugcheck)) if (dbb && (dbb->dbb_flags & DBB_bugcheck))
@ -546,7 +546,7 @@ void ERR_warning(ISC_STATUS status, ...)
* that subsequent errors can supersede this one. * that subsequent errors can supersede this one.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
STUFF_STATUS(tdbb->tdbb_status_vector, status); STUFF_STATUS(tdbb->tdbb_status_vector, status);
DEBUG; DEBUG;

View File

@ -1719,7 +1719,7 @@ static Lock* implicit_record_lock(jrd_tra* transaction, record_param* rpb)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
DEV_BLKCHK(transaction, type_tra); DEV_BLKCHK(transaction, type_tra);

View File

@ -234,7 +234,7 @@ bool EXT_get(RecordSource* rsb)
* Get a record from an external file. * Get a record from an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_rel* relation = rsb->rsb_relation; jrd_rel* relation = rsb->rsb_relation;
ExternalFile* file = relation->rel_file; ExternalFile* file = relation->rel_file;
@ -327,7 +327,7 @@ void EXT_open(RecordSource* rsb)
* Open a record stream for an external file. * Open a record stream for an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_rel* relation = rsb->rsb_relation; jrd_rel* relation = rsb->rsb_relation;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
@ -363,7 +363,7 @@ OptimizerBlk::opt_repeat *tail, *opt_end;
SSHORT i, size; SSHORT i, size;
*/ */
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
CompilerScratch* csb = opt->opt_csb; CompilerScratch* csb = opt->opt_csb;
CompilerScratch::csb_repeat* csb_tail = &csb->csb_rpt[stream]; CompilerScratch::csb_repeat* csb_tail = &csb->csb_rpt[stream];

View File

@ -30,7 +30,7 @@
* 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839. * 2003.08.10 Claudio Valderrama: Fix SF Bugs #544132 and #728839.
*/ */
/* /*
$Id: fun.epp,v 1.56 2004-05-18 01:20:04 brodsom Exp $ $Id: fun.epp,v 1.57 2004-05-19 18:11:17 brodsom Exp $
*/ */
#include "firebird.h" #include "firebird.h"
@ -129,7 +129,7 @@ void FUN_evaluate(UserFunction* function, jrd_nod* node, impure_value* value)
UDF_ARG args[MAX_UDF_ARGUMENTS + 1]; UDF_ARG args[MAX_UDF_ARGUMENTS + 1];
UCHAR temp[800]; UCHAR temp[800];
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// Start by constructing argument list // Start by constructing argument list
str* temp_string; str* temp_string;
@ -587,7 +587,7 @@ UserFunction* FUN_lookup_function(const Firebird::string& name, bool ShowAccessE
* Lookup function by name. * Lookup function by name.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* Start by looking for already defined symbol */ /* Start by looking for already defined symbol */
@ -745,7 +745,7 @@ UserFunction* FUN_resolve(CompilerScratch* csb, UserFunction* function, jrd_nod*
**************************************/ **************************************/
DSC arg; DSC arg;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
UserFunction* best = NULL; UserFunction* best = NULL;
int best_score = 0; int best_score = 0;
@ -819,7 +819,7 @@ static void blob_put_segment( blb* blob, const UCHAR* buffer, USHORT length)
engine mutex */ engine mutex */
THREAD_ENTER(); THREAD_ENTER();
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
BLB_put_segment(tdbb, blob, buffer, length); BLB_put_segment(tdbb, blob, buffer, length);
THREAD_EXIT(); THREAD_EXIT();
} }
@ -846,7 +846,7 @@ static SSHORT blob_get_segment(
**************************************/ **************************************/
/* add thread enter and thread_exit wrappers */ /* add thread enter and thread_exit wrappers */
THREAD_ENTER(); THREAD_ENTER();
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
*return_length = BLB_get_segment(tdbb, blob, buffer, length); *return_length = BLB_get_segment(tdbb, blob, buffer, length);
THREAD_EXIT(); THREAD_EXIT();
@ -877,7 +877,7 @@ static SLONG get_scalar_array(fun_repeat* arg,
* Return length of array desc. * Return length of array desc.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* Get first the array descriptor, then the array */ /* Get first the array descriptor, then the array */
@ -954,7 +954,7 @@ static void invoke(UserFunction* function,
* use CHECK_FOR_EXCEPTIONS macros without conflicts with destructors * use CHECK_FOR_EXCEPTIONS macros without conflicts with destructors
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
START_CHECK_FOR_EXCEPTIONS(function->fun_exception_message.c_str()); START_CHECK_FOR_EXCEPTIONS(function->fun_exception_message.c_str());
if (function->fun_return_arg) if (function->fun_return_arg)

View File

@ -686,7 +686,7 @@ static void purge_default_class( TEXT * object_name, SSHORT obj_type)
* default security class for this relation. * default security class for this relation.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = CMP_find_request(tdbb, irq_grant8, IRQ_REQUESTS); jrd_req* request = CMP_find_request(tdbb, irq_grant8, IRQ_REQUESTS);

View File

@ -1222,7 +1222,7 @@ static int index_block_flush(void* ast_object)
/* Since this routine will be called asynchronously, we must establish /* Since this routine will be called asynchronously, we must establish
a thread context. */ a thread context. */
SET_THREAD_DATA; JRD_set_thread_data;
Lock* lock = index_block->idb_lock; Lock* lock = index_block->idb_lock;
@ -1249,7 +1249,7 @@ static int index_block_flush(void* ast_object)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }

View File

@ -204,7 +204,7 @@ int INF_database_info(const SCHAR* items,
SLONG err_val; SLONG err_val;
bool header_refreshed = false; bool header_refreshed = false;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1022,7 +1022,7 @@ static USHORT get_counts(USHORT count_id, SCHAR* buffer, USHORT length)
* Return operation counts for relation. * Return operation counts for relation.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
vcl* vector = tdbb->tdbb_attachment->att_counts[count_id]; vcl* vector = tdbb->tdbb_attachment->att_counts[count_id];
if (!vector) if (!vector)

View File

@ -258,7 +258,7 @@ void INI_format(const TEXT* owner, const TEXT* charset)
* stored here. * stored here.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* Uppercase owner name */ /* Uppercase owner name */
@ -498,7 +498,7 @@ void INI_init(void)
* format descriptor. * format descriptor.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -568,7 +568,7 @@ void INI_init2(void)
* the database when it was created. * the database when it was created.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
const USHORT major_version = dbb->dbb_ods_version; const USHORT major_version = dbb->dbb_ods_version;
@ -731,7 +731,7 @@ void INI_update_database()
* %% Note %% Update the switch() statement to reflect new major ODS * %% Note %% Update the switch() statement to reflect new major ODS
* addition * addition
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -832,7 +832,7 @@ static void add_generator(TEXT* generator_name, jrd_req** handle)
**************************************/ **************************************/
const gen* generator = generators; const gen* generator = generators;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* find the new generator to be stored; assume it exists in the table */ /* find the new generator to be stored; assume it exists in the table */
/* TMN: If it doesn't exist in the table, we will CRASH here! */ /* TMN: If it doesn't exist in the table, we will CRASH here! */
@ -861,7 +861,7 @@ static void add_global_fields( USHORT minor_version)
* ODS change. * ODS change.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* add desired global fields to system relations */ /* add desired global fields to system relations */
@ -902,7 +902,7 @@ static void add_index_set(Database* dbb,
SqlIdentifier string; SqlIdentifier string;
index_desc idx; index_desc idx;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* handle1 = NULL; jrd_req* handle1 = NULL;
jrd_req* handle2 = NULL; jrd_req* handle2 = NULL;
@ -991,7 +991,7 @@ static void add_new_triggers(USHORT major_version, USHORT minor_version)
* This routine is used to upgrade ODS versions. * This routine is used to upgrade ODS versions.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* handle1 = NULL; jrd_req* handle1 = NULL;
@ -1040,7 +1040,7 @@ static void add_relation_fields( USHORT minor_version)
* ODS change. * ODS change.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* add desired fields to system relations, forcing a new format version */ /* add desired fields to system relations, forcing a new format version */
@ -1238,7 +1238,7 @@ static void add_trigger(TEXT* trigger_name, jrd_req** handle1, jrd_req** handle2
* now, since it will be used when we go to 8.1. * now, since it will be used when we go to 8.1.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* Find the new trigger to be stored; assume it exists in the table */ /* Find the new trigger to be stored; assume it exists in the table */

View File

@ -1045,8 +1045,8 @@ int INTL_convert_string(dsc* to, const dsc* from, FPTR_ERROR err)
**************************************/ **************************************/
/* Note: This function is called from outside the engine as /* Note: This function is called from outside the engine as
well as inside - we likely can't get rid of GET_THREAD_DATA here */ well as inside - we likely can't get rid of JRD_get_thread_data here */
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (tdbb == NULL) /* are we in the Engine? */ if (tdbb == NULL) /* are we in the Engine? */
return (1); /* no, then can't access intl gah */ return (1); /* no, then can't access intl gah */

View File

@ -1514,7 +1514,7 @@ ULONG ISC_exception_post(ULONG except_code, const TEXT* err_msg)
THREAD_ENTER(); THREAD_ENTER();
} }
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (!err_msg) if (!err_msg)
{ {
@ -4116,7 +4116,7 @@ void longjmp_sig_handler(int sig_num)
actually hang the sigsetjmp menber off of THDD, and actually hang the sigsetjmp menber off of THDD, and
make sure that it is set properly for all sub-systems. */ make sure that it is set properly for all sub-systems. */
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
siglongjmp(tdbb->tdbb_sigsetjmp, sig_num); siglongjmp(tdbb->tdbb_sigsetjmp, sig_num);
} }

View File

@ -435,7 +435,7 @@ inline static thread_db* set_thread_data(thread_db& thd_context)
} }
#undef GET_THREAD_DATA #undef JRD_get_thread_data
#undef CHECK_DBB #undef CHECK_DBB
#undef GET_DBB #undef GET_DBB
#undef SET_TDBB #undef SET_TDBB
@ -4098,7 +4098,7 @@ bool JRD_getdir(Firebird::PathName& buf)
{ {
thread_db* tdbb = get_thread_data(); thread_db* tdbb = get_thread_data();
/** If the server has not done a SET_THREAD_DATA prior to this call /** If the server has not done a JRD_set_thread_data prior to this call
(which will be the case when connecting via IPC), thread_db will (which will be the case when connecting via IPC), thread_db will
be NULL so do not attempt to get the attachment handle from be NULL so do not attempt to get the attachment handle from
thread_db. Just return false as described below. thread_db. Just return false as described below.
@ -4106,7 +4106,7 @@ bool JRD_getdir(Firebird::PathName& buf)
this code is entered via IPC is if the database name = "". this code is entered via IPC is if the database name = "".
**/ **/
/** In case of backup/restore APIs, SET_THREAD_DATA has been done but /** In case of backup/restore APIs, JRD_set_thread_data has been done but
the thread's context is a 'gbak' specific, so don't try extract the thread's context is a 'gbak' specific, so don't try extract
attachment from there. attachment from there.
**/ **/

View File

@ -974,10 +974,6 @@ typedef str *STR;
/* Threading macros */ /* Threading macros */
#ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA
#endif
#ifdef V4_THREADING #ifdef V4_THREADING
#define PLATFORM_GET_THREAD_DATA ((thread_db*) THD_get_specific()) #define PLATFORM_GET_THREAD_DATA ((thread_db*) THD_get_specific())
#endif #endif
@ -997,7 +993,7 @@ extern Jrd::thread_db* gdbb;
#define PLATFORM_GET_THREAD_DATA (gdbb) #define PLATFORM_GET_THREAD_DATA (gdbb)
#endif #endif
/* Define GET_THREAD_DATA off the platform specific version. /* Define JRD_get_thread_data off the platform specific version.
* If we're in DEV mode, also do consistancy checks on the * If we're in DEV mode, also do consistancy checks on the
* retrieved memory structure. This was originally done to * retrieved memory structure. This was originally done to
* track down cases of no "PUT_THREAD_DATA" on the NLM. * track down cases of no "PUT_THREAD_DATA" on the NLM.
@ -1012,7 +1008,7 @@ extern Jrd::thread_db* gdbb;
* there is no tdbb_database set up. * there is no tdbb_database set up.
*/ */
#ifdef DEV_BUILD #ifdef DEV_BUILD
#define GET_THREAD_DATA (((PLATFORM_GET_THREAD_DATA) && \ #define JRD_get_thread_data (((PLATFORM_GET_THREAD_DATA) && \
(((THDD)(PLATFORM_GET_THREAD_DATA))->thdd_type == THDD_TYPE_TDBB) && \ (((THDD)(PLATFORM_GET_THREAD_DATA))->thdd_type == THDD_TYPE_TDBB) && \
(((thread_db*)(PLATFORM_GET_THREAD_DATA))->tdbb_database)) \ (((thread_db*)(PLATFORM_GET_THREAD_DATA))->tdbb_database)) \
? ((MemoryPool::blk_type(((thread_db*)(PLATFORM_GET_THREAD_DATA))->tdbb_database) == type_dbb) \ ? ((MemoryPool::blk_type(((thread_db*)(PLATFORM_GET_THREAD_DATA))->tdbb_database) == type_dbb) \
@ -1026,18 +1022,18 @@ extern Jrd::thread_db* gdbb;
((!(tdbb)->tdbb_database)||MemoryPool::blk_type((tdbb)->tdbb_database) == type_dbb)) ((!(tdbb)->tdbb_database)||MemoryPool::blk_type((tdbb)->tdbb_database) == type_dbb))
#else #else
/* PROD_BUILD */ /* PROD_BUILD */
#define GET_THREAD_DATA (PLATFORM_GET_THREAD_DATA) #define JRD_get_thread_data (PLATFORM_GET_THREAD_DATA)
#define CHECK_TDBB(tdbb) /* nothing */ #define CHECK_TDBB(tdbb) /* nothing */
#define CHECK_DBB(dbb) /* nothing */ #define CHECK_DBB(dbb) /* nothing */
#endif #endif
#define GET_DBB (((thread_db*) (GET_THREAD_DATA))->tdbb_database) #define GET_DBB (((thread_db*) (JRD_get_thread_data))->tdbb_database)
/*-------------------------------------------------------------------------* /*-------------------------------------------------------------------------*
* macros used to set thread_db and Database pointers when there are not set already * * macros used to set thread_db and Database pointers when there are not set already *
*-------------------------------------------------------------------------*/ *-------------------------------------------------------------------------*/
#define SET_TDBB(tdbb) if ((tdbb) == NULL) { (tdbb) = GET_THREAD_DATA; }; CHECK_TDBB (tdbb) #define SET_TDBB(tdbb) if ((tdbb) == NULL) { (tdbb) = JRD_get_thread_data; }; CHECK_TDBB (tdbb)
#define SET_DBB(dbb) if ((dbb) == NULL) { (dbb) = GET_DBB; }; CHECK_DBB(dbb); #define SET_DBB(dbb) if ((dbb) == NULL) { (dbb) = GET_DBB; }; CHECK_DBB(dbb);
#ifdef V4_THREADING #ifdef V4_THREADING
@ -1079,12 +1075,12 @@ extern int debug;
so in this case we define the macro as calling that function. */ so in this case we define the macro as calling that function. */
#ifndef JRD_MAIN #ifndef JRD_MAIN
#define SET_THREAD_DATA tdbb = &thd_context;\ #define JRD_set_thread_data tdbb = &thd_context;\
MOVE_CLEAR (tdbb, sizeof (*tdbb));\ MOVE_CLEAR (tdbb, sizeof (*tdbb));\
THD_put_specific (reinterpret_cast<struct thdd*>(tdbb));\ THD_put_specific (reinterpret_cast<struct thdd*>(tdbb));\
tdbb->tdbb_thd_data.thdd_type = THDD_TYPE_TDBB tdbb->tdbb_thd_data.thdd_type = THDD_TYPE_TDBB
#define RESTORE_THREAD_DATA THD_restore_specific() #define JRD_restore_thread_data THD_restore_specific()
#endif /* !JRD_MAIN */ #endif /* !JRD_MAIN */

View File

@ -37,7 +37,7 @@
* 2004.01.16 Vlad Horsun: added support for default parameters * 2004.01.16 Vlad Horsun: added support for default parameters
*/ */
/* /*
$Id: met.epp,v 1.121 2004-05-18 16:40:20 brodsom Exp $ $Id: met.epp,v 1.122 2004-05-19 18:12:32 brodsom Exp $
*/ */
// This MUST be at the top of the file // This MUST be at the top of the file
#ifdef DARWIN #ifdef DARWIN
@ -3666,7 +3666,7 @@ static int blocking_ast_procedure(void* ast_object)
/* Since this routine will be called asynchronously, we must establish /* Since this routine will be called asynchronously, we must establish
a thread context. */ a thread context. */
SET_THREAD_DATA; JRD_set_thread_data;
tdbb->tdbb_database = procedure->prc_existence_lock->lck_dbb; tdbb->tdbb_database = procedure->prc_existence_lock->lck_dbb;
tdbb->tdbb_attachment = procedure->prc_existence_lock->lck_attachment; tdbb->tdbb_attachment = procedure->prc_existence_lock->lck_attachment;
@ -3682,7 +3682,7 @@ static int blocking_ast_procedure(void* ast_object)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }
@ -3709,7 +3709,7 @@ static int blocking_ast_relation(void* ast_object)
/* Since this routine will be called asynchronously, we must establish /* Since this routine will be called asynchronously, we must establish
a thread context. */ a thread context. */
SET_THREAD_DATA; JRD_set_thread_data;
tdbb->tdbb_database = relation->rel_existence_lock->lck_dbb; tdbb->tdbb_database = relation->rel_existence_lock->lck_dbb;
tdbb->tdbb_attachment = relation->rel_existence_lock->lck_attachment; tdbb->tdbb_attachment = relation->rel_existence_lock->lck_attachment;
@ -3730,7 +3730,7 @@ static int blocking_ast_relation(void* ast_object)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }

View File

@ -179,7 +179,7 @@ bool NAV_find_record(RecordSource* rsb,
search_flags = 0; search_flags = 0;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure); irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure);
WIN window(-1); WIN window(-1);
@ -804,7 +804,7 @@ bool NAV_reset_position(RecordSource* rsb, record_param* new_rpb)
* rsb to the record indicated by the passed rpb. * rsb to the record indicated by the passed rpb.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure); irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure);
WIN window(-1); WIN window(-1);
@ -1080,7 +1080,7 @@ static bool find_dbkey(RecordSource* rsb, ULONG record_number)
* record within a set of equivalent keys. * record within a set of equivalent keys.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure); irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure);
record_param* rpb = request->req_rpb + rsb->rsb_stream; record_param* rpb = request->req_rpb + rsb->rsb_stream;
@ -1164,7 +1164,7 @@ static bool find_record(
* must handle CRACK semantics. * must handle CRACK semantics.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure); irsb_nav* impure = (IRSB_NAV) ((UCHAR *) request + rsb->rsb_impure);
record_param* rpb = request->req_rpb + rsb->rsb_stream; record_param* rpb = request->req_rpb + rsb->rsb_stream;
@ -1362,7 +1362,7 @@ static bool find_saved_node(RecordSource* rsb, IRSB_NAV impure,
* the actual node, return TRUE. * the actual node, return TRUE.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
index_desc* idx = (index_desc*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]); index_desc* idx = (index_desc*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
Ods::btree_page* page = (Ods::btree_page*) CCH_FETCH(tdbb, window, LCK_read, pag_index); Ods::btree_page* page = (Ods::btree_page*) CCH_FETCH(tdbb, window, LCK_read, pag_index);
@ -1573,7 +1573,7 @@ static bool get_record(
* This routine must set or clear the CRACK flag. * This routine must set or clear the CRACK flag.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
index_desc* idx = (index_desc*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]); index_desc* idx = (index_desc*) ((SCHAR*) impure + (IPTR) rsb->rsb_arg[RSB_NAV_idx_offset]);
@ -1875,7 +1875,7 @@ static void setup_bitmaps(RecordSource* rsb, IRSB_NAV impure)
* with a stream. * with a stream.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// Start a bitmap which tells us we have already visited // Start a bitmap which tells us we have already visited
// this record; this is to handle the case where there is more // this record; this is to handle the case where there is more

View File

@ -32,7 +32,7 @@
* Contributor(s): * Contributor(s):
* *
* *
* $Id: nbak.cpp,v 1.33 2004-05-17 22:27:56 brodsom Exp $ * $Id: nbak.cpp,v 1.34 2004-05-19 18:12:32 brodsom Exp $
* *
*/ */
@ -99,7 +99,7 @@ bool BackupManager::get_sw_database_lock(bool enable_signals) throw()
return true; return true;
#else #else
NBAK_TRACE(("get_sw_database_lock %d", database_use_count)); NBAK_TRACE(("get_sw_database_lock %d", database_use_count));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
database_use_count++; database_use_count++;
if (enable_signals) if (enable_signals)
LCK_ast_enable(); LCK_ast_enable();
@ -125,7 +125,7 @@ void BackupManager::release_sw_database_lock() throw()
#else #else
NBAK_TRACE(("release_sw_database_lock %d", database_use_count)); NBAK_TRACE(("release_sw_database_lock %d", database_use_count));
fb_assert(database_use_count > 0); fb_assert(database_use_count > 0);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
database_use_count--; database_use_count--;
if (ast_flags & NBAK_database_blocking) { if (ast_flags & NBAK_database_blocking) {
LCK_release(tdbb, database_lock); LCK_release(tdbb, database_lock);
@ -144,7 +144,7 @@ void BackupManager::lock_state_write(bool thread_exit)
THREAD_ENTER(); THREAD_ENTER();
#else #else
fb_assert(!(flags & NBAK_state_in_use)); fb_assert(!(flags & NBAK_state_in_use));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
flags |= NBAK_state_in_use; flags |= NBAK_state_in_use;
bool locked = false; bool locked = false;
// Release shared lock to prevent possible deadlocks // Release shared lock to prevent possible deadlocks
@ -177,7 +177,7 @@ bool BackupManager::try_lock_state_write()
return false; return false;
#else #else
fb_assert(!(flags & NBAK_state_in_use)); fb_assert(!(flags & NBAK_state_in_use));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
flags |= NBAK_state_in_use; flags |= NBAK_state_in_use;
bool result; bool result;
if (state_lock->lck_physical == LCK_none) if (state_lock->lck_physical == LCK_none)
@ -209,7 +209,7 @@ void BackupManager::unlock_state_write() throw()
state_lock->endWrite(); state_lock->endWrite();
#else #else
fb_assert(flags & NBAK_state_in_use); fb_assert(flags & NBAK_state_in_use);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// ASTs are going to be reposted after CONVERT // ASTs are going to be reposted after CONVERT
ast_flags &= ~NBAK_state_blocking; ast_flags &= ~NBAK_state_blocking;
LCK_convert(tdbb, state_lock, LCK_SR, LCK_WAIT); LCK_convert(tdbb, state_lock, LCK_SR, LCK_WAIT);
@ -232,7 +232,7 @@ bool BackupManager::lock_alloc_write(bool thread_exit) throw()
THREAD_ENTER(); THREAD_ENTER();
#else #else
fb_assert(!(flags & NBAK_alloc_in_use)); fb_assert(!(flags & NBAK_alloc_in_use));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
flags |= NBAK_alloc_in_use; flags |= NBAK_alloc_in_use;
// Release shared lock to prevent possible deadlocks // Release shared lock to prevent possible deadlocks
bool locked = false; bool locked = false;
@ -264,7 +264,7 @@ void BackupManager::unlock_alloc_write() throw()
alloc_lock->endWrite(); alloc_lock->endWrite();
#else #else
fb_assert(flags & NBAK_alloc_in_use); fb_assert(flags & NBAK_alloc_in_use);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// ASTs are going to be reposted after CONVERT // ASTs are going to be reposted after CONVERT
ast_flags &= ~NBAK_alloc_blocking; ast_flags &= ~NBAK_alloc_blocking;
LCK_convert(tdbb, alloc_lock, LCK_SR, LCK_WAIT); LCK_convert(tdbb, alloc_lock, LCK_SR, LCK_WAIT);
@ -279,7 +279,7 @@ void BackupManager::unlock_alloc_write() throw()
bool BackupManager::lock_state(bool thread_exit) throw() bool BackupManager::lock_state(bool thread_exit) throw()
{ {
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// If we own exlock here no need to do anything else // If we own exlock here no need to do anything else
if (tdbb->tdbb_flags & TDBB_set_backup_state) if (tdbb->tdbb_flags & TDBB_set_backup_state)
return true; return true;
@ -309,7 +309,7 @@ bool BackupManager::lock_state(bool thread_exit) throw()
void BackupManager::unlock_state() throw() void BackupManager::unlock_state() throw()
{ {
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// If we own exlock here no need to do anything else // If we own exlock here no need to do anything else
if (tdbb->tdbb_flags & TDBB_set_backup_state) if (tdbb->tdbb_flags & TDBB_set_backup_state)
return; return;
@ -335,7 +335,7 @@ bool BackupManager::lock_alloc(bool thread_exit) throw() {
THREAD_ENTER(); THREAD_ENTER();
#else #else
fb_assert(!(flags & NBAK_alloc_in_use)); fb_assert(!(flags & NBAK_alloc_in_use));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
flags |= NBAK_alloc_in_use; flags |= NBAK_alloc_in_use;
if (alloc_lock->lck_physical < LCK_SR) { if (alloc_lock->lck_physical < LCK_SR) {
if (!LCK_lock(tdbb, alloc_lock, LCK_SR, LCK_WAIT)) { if (!LCK_lock(tdbb, alloc_lock, LCK_SR, LCK_WAIT)) {
@ -357,7 +357,7 @@ void BackupManager::unlock_alloc() throw() {
alloc_lock->endRead(); alloc_lock->endRead();
#else #else
fb_assert(flags & NBAK_alloc_in_use); fb_assert(flags & NBAK_alloc_in_use);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
flags &= ~NBAK_alloc_in_use; flags &= ~NBAK_alloc_in_use;
if (ast_flags & NBAK_alloc_blocking) { if (ast_flags & NBAK_alloc_blocking) {
LCK_release(tdbb, alloc_lock); LCK_release(tdbb, alloc_lock);
@ -396,7 +396,7 @@ int BackupManager::backup_state_ast(void *ast_object) throw()
a thread context. */ a thread context. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
tdbb->tdbb_database = new_dbb; tdbb->tdbb_database = new_dbb;
tdbb->tdbb_attachment = lock->lck_attachment; tdbb->tdbb_attachment = lock->lck_attachment;
@ -416,7 +416,7 @@ int BackupManager::backup_state_ast(void *ast_object) throw()
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
ISC_ast_exit(); ISC_ast_exit();
return 0; return 0;
@ -447,7 +447,7 @@ int BackupManager::alloc_table_ast(void *ast_object) throw()
a thread context. */ a thread context. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
tdbb->tdbb_database = new_dbb; tdbb->tdbb_database = new_dbb;
tdbb->tdbb_attachment = lock->lck_attachment; tdbb->tdbb_attachment = lock->lck_attachment;
@ -466,7 +466,7 @@ int BackupManager::alloc_table_ast(void *ast_object) throw()
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
ISC_ast_exit(); ISC_ast_exit();
return 0; return 0;
@ -499,7 +499,7 @@ int BackupManager::backup_database_ast(void *ast_object) throw()
a thread context. */ a thread context. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
tdbb->tdbb_database = new_dbb; tdbb->tdbb_database = new_dbb;
tdbb->tdbb_attachment = lock->lck_attachment; tdbb->tdbb_attachment = lock->lck_attachment;
@ -520,7 +520,7 @@ int BackupManager::backup_database_ast(void *ast_object) throw()
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
ISC_ast_exit(); ISC_ast_exit();
return 0; return 0;
@ -540,7 +540,7 @@ void BackupManager::generate_filename() throw()
void BackupManager::begin_backup() void BackupManager::begin_backup()
{ {
NBAK_TRACE(("begin_backup")); NBAK_TRACE(("begin_backup"));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// Lock header page first to prevent possible deadlock // Lock header page first to prevent possible deadlock
WIN window(HEADER_PAGE); WIN window(HEADER_PAGE);
@ -635,7 +635,7 @@ void BackupManager::begin_backup()
// does nothing (so it can be used for recovery on database startup). // does nothing (so it can be used for recovery on database startup).
void BackupManager::end_backup(bool recover) { void BackupManager::end_backup(bool recover) {
NBAK_TRACE(("end_backup")); NBAK_TRACE(("end_backup"));
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
ULONG adjusted_scn; // We use this value to prevent race conditions. ULONG adjusted_scn; // We use this value to prevent race conditions.
// They are possible because we release state lock // They are possible because we release state lock
// for some instants and anything is possible at // for some instants and anything is possible at
@ -804,7 +804,7 @@ bool BackupManager::actualize_alloc() throw()
&& !(ast_flags & NBAK_alloc_dirty) && !(ast_flags & NBAK_alloc_dirty)
#endif #endif
) return true; ) return true;
ISC_STATUS *status_vector = GET_THREAD_DATA->tdbb_status_vector; ISC_STATUS *status_vector = JRD_get_thread_data->tdbb_status_vector;
try { try {
NBAK_TRACE(("actualize_alloc last_allocated_page=%d alloc_table=%p", NBAK_TRACE(("actualize_alloc last_allocated_page=%d alloc_table=%p",
last_allocated_page, alloc_table)); last_allocated_page, alloc_table));
@ -877,7 +877,7 @@ ULONG BackupManager::get_page_index(ULONG db_page) const throw()
ULONG BackupManager::allocate_difference_page(ULONG db_page) throw() { ULONG BackupManager::allocate_difference_page(ULONG db_page) throw() {
fb_assert(last_allocated_page % (database->dbb_page_size / sizeof(ULONG)) == alloc_buffer[0]); fb_assert(last_allocated_page % (database->dbb_page_size / sizeof(ULONG)) == alloc_buffer[0]);
ISC_STATUS* status_vector = GET_THREAD_DATA->tdbb_status_vector; ISC_STATUS* status_vector = JRD_get_thread_data->tdbb_status_vector;
// Grow file first. This is done in such order to keep difference // Grow file first. This is done in such order to keep difference
// file consistent in case of write error. We should always be able // file consistent in case of write error. We should always be able
// to read next alloc page when previous one is full. // to read next alloc page when previous one is full.
@ -944,7 +944,7 @@ bool BackupManager::read_difference(ULONG diff_page, Ods::pag* page) throw()
temp_bdb.bdb_page = diff_page; temp_bdb.bdb_page = diff_page;
temp_bdb.bdb_dbb = database; temp_bdb.bdb_dbb = database;
temp_bdb.bdb_buffer = page; temp_bdb.bdb_buffer = page;
if (!PIO_read(diff_file, &temp_bdb, page, GET_THREAD_DATA->tdbb_status_vector)) if (!PIO_read(diff_file, &temp_bdb, page, JRD_get_thread_data->tdbb_status_vector))
return false; return false;
return true; return true;
} }
@ -954,7 +954,7 @@ BackupManager::BackupManager(Database* _database, int ini_state) :
backup_state(ini_state), last_allocated_page(0), backup_state(ini_state), last_allocated_page(0),
current_scn(0), backup_pages(0), diff_pending_close(false) current_scn(0), backup_pages(0), diff_pending_close(false)
{ {
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
diff_name[0] = 0; diff_name[0] = 0;
// Allocate various database page buffers needed for operation // Allocate various database page buffers needed for operation
@ -1013,7 +1013,7 @@ BackupManager::BackupManager(Database* _database, int ini_state) :
void BackupManager::shutdown_locks() throw() void BackupManager::shutdown_locks() throw()
{ {
#ifndef SUPERSERVER #ifndef SUPERSERVER
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (state_lock) if (state_lock)
LCK_release(tdbb, state_lock); LCK_release(tdbb, state_lock);
if (alloc_lock) if (alloc_lock)
@ -1040,7 +1040,7 @@ BackupManager::~BackupManager()
} }
void BackupManager::set_difference(const char* filename) { void BackupManager::set_difference(const char* filename) {
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (filename) { if (filename) {
WIN window(HEADER_PAGE); WIN window(HEADER_PAGE);
@ -1066,7 +1066,7 @@ bool BackupManager::actualize_state() throw() {
// We cannot use CCH for this because of likely recursion. // We cannot use CCH for this because of likely recursion.
NBAK_TRACE(("actualize_state")); NBAK_TRACE(("actualize_state"));
ISC_STATUS *status = GET_THREAD_DATA->tdbb_status_vector; ISC_STATUS *status = JRD_get_thread_data->tdbb_status_vector;
// Read original page from database file or shadows. // Read original page from database file or shadows.
SSHORT retryCount = 0; SSHORT retryCount = 0;

View File

@ -847,7 +847,7 @@ jrd_nod* OPT_make_dbkey(OptimizerBlk* opt, jrd_nod* boolean, USHORT stream)
* concatenations of primitive dbkeys. * concatenations of primitive dbkeys.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
DEV_BLKCHK(opt, type_opt); DEV_BLKCHK(opt, type_opt);
DEV_BLKCHK(boolean, type_nod); DEV_BLKCHK(boolean, type_nod);
@ -1019,7 +1019,7 @@ int OPT_match_index(OptimizerBlk* opt, USHORT stream, index_desc* idx)
* Return the number of matching items. * Return the number of matching items.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
DEV_BLKCHK(opt, type_opt); DEV_BLKCHK(opt, type_opt);
/* If there are not conjunctions, don't waste our time */ /* If there are not conjunctions, don't waste our time */
@ -1268,7 +1268,7 @@ static UINT64 calculate_priority_level(const OptimizerBlk* opt, const index_desc
// Note: dbb->dbb_max_idx = 1022 for the largest supported page of 16K and // Note: dbb->dbb_max_idx = 1022 for the largest supported page of 16K and
// 62 for the smallest page of 1K // 62 for the smallest page of 1K
const UINT64 max_idx = GET_THREAD_DATA->tdbb_database->dbb_max_idx + 1; const UINT64 max_idx = JRD_get_thread_data->tdbb_database->dbb_max_idx + 1;
UINT64 unique_prefix = 0; UINT64 unique_prefix = 0;
if ((idx->idx_flags & idx_unique) && (idx_eql_count == idx->idx_count)) { if ((idx->idx_flags & idx_unique) && (idx_eql_count == idx->idx_count)) {
unique_prefix = (max_idx - idx->idx_count) * max_idx * max_idx * max_idx; unique_prefix = (max_idx - idx->idx_count) * max_idx * max_idx * max_idx;
@ -1297,7 +1297,7 @@ static void check_indices(const CompilerScratch::csb_repeat* csb_tail)
* indices were actually utilized by the optimizer. * indices were actually utilized by the optimizer.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
const jrd_nod* plan = csb_tail->csb_plan; const jrd_nod* plan = csb_tail->csb_plan;
if (!plan) { if (!plan) {
@ -2262,7 +2262,7 @@ static bool dump_index(const jrd_nod* node,
* an info buffer. * an info buffer.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
DEV_BLKCHK(node, type_nod); DEV_BLKCHK(node, type_nod);
@ -5831,7 +5831,7 @@ static jrd_nod* make_binary_node(NOD_T type, jrd_nod* arg1, jrd_nod* arg2, bool
* Make a binary node. * Make a binary node.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
DEV_BLKCHK(arg1, type_nod); DEV_BLKCHK(arg1, type_nod);
DEV_BLKCHK(arg2, type_nod); DEV_BLKCHK(arg2, type_nod);
jrd_nod* node = PAR_make_node(tdbb, 2); jrd_nod* node = PAR_make_node(tdbb, 2);
@ -5957,7 +5957,7 @@ static jrd_nod* make_inference_node(CompilerScratch* csb, jrd_nod* boolean,
* *
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
DEV_BLKCHK(csb, type_csb); DEV_BLKCHK(csb, type_csb);
DEV_BLKCHK(boolean, type_nod); DEV_BLKCHK(boolean, type_nod);
DEV_BLKCHK(arg1, type_nod); DEV_BLKCHK(arg1, type_nod);
@ -7180,7 +7180,7 @@ static void sort_indices_by_selectivity(CompilerScratch::csb_repeat* csb_tail)
index_desc* selected_idx = NULL; index_desc* selected_idx = NULL;
USHORT i, j; USHORT i, j;
Firebird::Array<index_desc> idx_sort(*GET_THREAD_DATA->tdbb_default, csb_tail->csb_indices); Firebird::Array<index_desc> idx_sort(*JRD_get_thread_data->tdbb_default, csb_tail->csb_indices);
bool same_selectivity = false; bool same_selectivity = false;
// Walk through the indices and sort them into into idx_sort // Walk through the indices and sort them into into idx_sort
@ -7249,7 +7249,7 @@ static SSHORT sort_indices_by_priority(CompilerScratch::csb_repeat* csb_tail,
* Sort indices based on the priority level. * Sort indices based on the priority level.
* *
***************************************************/ ***************************************************/
Firebird::HalfStaticArray<index_desc*, OPT_STATIC_ITEMS> idx_csb(*GET_THREAD_DATA->tdbb_default); Firebird::HalfStaticArray<index_desc*, OPT_STATIC_ITEMS> idx_csb(*JRD_get_thread_data->tdbb_default);
idx_csb.grow(csb_tail->csb_indices); idx_csb.grow(csb_tail->csb_indices);
memcpy(idx_csb.begin(), idx_walk, csb_tail->csb_indices * sizeof(index_desc*)); memcpy(idx_csb.begin(), idx_walk, csb_tail->csb_indices * sizeof(index_desc*));

View File

@ -1022,7 +1022,7 @@ static jrd_file* setup_file(Database* dbb, const TEXT* file_name, USHORT file_le
dbb->dbb_flags |= DBB_exclusive; dbb->dbb_flags |= DBB_exclusive;
if (!LCK_lock(NULL, lock, LCK_EX, LCK_NO_WAIT)) { if (!LCK_lock(NULL, lock, LCK_EX, LCK_NO_WAIT)) {
dbb->dbb_flags &= ~DBB_exclusive; dbb->dbb_flags &= ~DBB_exclusive;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
while (!LCK_lock(tdbb, lock, LCK_SW, -1)) { while (!LCK_lock(tdbb, lock, LCK_SW, -1)) {
tdbb->tdbb_status_vector[0] = 0; // Clean status vector from lock manager error code tdbb->tdbb_status_vector[0] = 0; // Clean status vector from lock manager error code

View File

@ -79,7 +79,7 @@ void EXT_close(RecordSource* rsb)
* Close a record stream for an external file. * Close a record stream for an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_rel* relation = rsb->rsb_relation; jrd_rel* relation = rsb->rsb_relation;
ExternalFile* file = relation->rel_file; ExternalFile* file = relation->rel_file;
@ -141,7 +141,7 @@ ExternalFile* EXT_file(jrd_rel* relation, TEXT* file_name, bid* description)
**************************************/ **************************************/
UCHAR index_buffer[MAX_KEYS * sizeof(index_desc)]; UCHAR index_buffer[MAX_KEYS * sizeof(index_desc)];
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* Allocate and fill out an external file block. Get the /* Allocate and fill out an external file block. Get the
@ -289,7 +289,7 @@ bool EXT_get(RecordSource* rsb)
* Get a record from an external file. * Get a record from an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (tdbb->tdbb_request->req_flags & req_abort) if (tdbb->tdbb_request->req_flags & req_abort)
return false; return false;
@ -360,7 +360,7 @@ EXT_open(RecordSource* rsb)
* Open a record stream for an external file. * Open a record stream for an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_rel* relation = rsb->rsb_relation; jrd_rel* relation = rsb->rsb_relation;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
@ -406,7 +406,7 @@ RecordSource* EXT_optimize(OptimizerBlk* opt, SSHORT stream, jrd_nod** sort_ptr)
* set of record source blocks (rsb's). * set of record source blocks (rsb's).
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* Start by chasing around finding pointers to the various /* Start by chasing around finding pointers to the various
data structures */ data structures */
@ -838,7 +838,7 @@ static bool get_dbkey(RecordSource* rsb)
* Get a record from an external file. * Get a record from an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* Chase down misc pointers */ /* Chase down misc pointers */
@ -899,7 +899,7 @@ static bool get_indexed(RecordSource* rsb)
**************************************/ **************************************/
UCHAR key_buffer[256]; UCHAR key_buffer[256];
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* Start by finding the signficant data structures for the stream. These /* Start by finding the signficant data structures for the stream. These
are mainly used to initialize the stream at some particular key value */ are mainly used to initialize the stream at some particular key value */
@ -1016,7 +1016,7 @@ static bool get_sequential(RecordSource* rsb)
* Get a record from an external file. * Get a record from an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_rel* relation = rsb->rsb_relation; jrd_rel* relation = rsb->rsb_relation;
ExternalFile* file = relation->rel_file; ExternalFile* file = relation->rel_file;
@ -1118,7 +1118,7 @@ static open_indexed(RecordSource* rsb)
* Open a record stream for an external file. * Open a record stream for an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_rel* relation = rsb->rsb_relation; jrd_rel* relation = rsb->rsb_relation;
ExternalFile* file = relation->rel_file; ExternalFile* file = relation->rel_file;
@ -1148,7 +1148,7 @@ static open_sequential(RecordSource* rsb)
* Open a record stream for an external file. * Open a record stream for an external file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_rel* relation = rsb->rsb_relation; jrd_rel* relation = rsb->rsb_relation;
ExternalFile* file = relation->rel_file; ExternalFile* file = relation->rel_file;

View File

@ -1097,7 +1097,7 @@ static jrd_file* setup_file(Database* dbb,
dbb->dbb_flags |= DBB_exclusive; dbb->dbb_flags |= DBB_exclusive;
if (!LCK_lock(NULL, lock, LCK_EX, LCK_NO_WAIT)) { if (!LCK_lock(NULL, lock, LCK_EX, LCK_NO_WAIT)) {
dbb->dbb_flags &= ~DBB_exclusive; dbb->dbb_flags &= ~DBB_exclusive;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
while (!LCK_lock(tdbb, lock, LCK_SW, -1)) { while (!LCK_lock(tdbb, lock, LCK_SW, -1)) {
tdbb->tdbb_status_vector[0] = 0; // Clean status vector from lock manager error code tdbb->tdbb_status_vector[0] = 0; // Clean status vector from lock manager error code

View File

@ -222,7 +222,7 @@ void PAG_add_clump(
* false - nothing done => nobody checks this function's result. * false - nothing done => nobody checks this function's result.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -343,7 +343,7 @@ USHORT PAG_add_file(const TEXT* file_name, SLONG start)
* number for the new file. * number for the new file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -460,7 +460,7 @@ int PAG_add_header_entry(header_page* header, USHORT type, SSHORT len, const UCH
* FALSE - nothing done * FALSE - nothing done
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -529,7 +529,7 @@ int PAG_replace_entry_first(header_page* header, USHORT type, SSHORT len, const
* FALSE - nothing done * FALSE - nothing done
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -583,7 +583,7 @@ PAG PAG_allocate(WIN * window)
* the universal sequence when allocating pages. * the universal sequence when allocating pages.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -682,7 +682,7 @@ SLONG PAG_attachment_id(void)
* effect, get a lock on it as well. * effect, get a lock on it as well.
* *
******************************************/ ******************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
@ -735,7 +735,7 @@ int PAG_delete_clump_entry(SLONG page_num, USHORT type)
* Gets rid on the entry 'type' from page. * Gets rid on the entry 'type' from page.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -800,7 +800,7 @@ void PAG_format_header(void)
* Create the header page for a new file. * Create the header page for a new file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -852,7 +852,7 @@ void PAG_format_log(void)
* Set all parameters to 0 * Set all parameters to 0
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
WIN window(LOG_PAGE); WIN window(LOG_PAGE);
log_info_page* logp = (log_info_page*) CCH_fake(tdbb, &window, 1); log_info_page* logp = (log_info_page*) CCH_fake(tdbb, &window, 1);
@ -876,7 +876,7 @@ void PAG_format_pip(void)
* into a rudimentary database. * into a rudimentary database.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -918,7 +918,7 @@ bool PAG_get_clump(SLONG page_num, USHORT type, USHORT* len, UCHAR* entry)
* length in len * length in len
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
*len = 0; *len = 0;
WIN window(page_num); WIN window(page_num);
@ -965,7 +965,7 @@ void PAG_header(const TEXT* file_name, USHORT file_length)
* Checkout database header page. * Checkout database header page.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* allocate a spare buffer which is large enough, /* allocate a spare buffer which is large enough,
@ -1135,7 +1135,7 @@ void PAG_init(void)
* Initialize stuff for page handling. * Initialize stuff for page handling.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1205,7 +1205,7 @@ void PAG_init2(USHORT shadow_number)
* search for additional files. * search for additional files.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
ISC_STATUS* status = tdbb->tdbb_status_vector; ISC_STATUS* status = tdbb->tdbb_status_vector;
@ -1363,7 +1363,7 @@ SLONG PAG_last_page(void)
* shadow stuff to dump a database. * shadow stuff to dump a database.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1409,7 +1409,7 @@ void PAG_release_page(SLONG number, SLONG prior_page)
* Release a page to the free page page. * Release a page to the free page page.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1451,7 +1451,7 @@ void PAG_set_force_write(Database* dbb, SSHORT flag)
* The value 2 for flag means set to default. * The value 2 for flag means set to default.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
ERR_POST_IF_DATABASE_IS_READONLY(dbb); ERR_POST_IF_DATABASE_IS_READONLY(dbb);
@ -1501,7 +1501,7 @@ void PAG_set_no_reserve(Database* dbb, USHORT flag)
* Turn on/off reserving space for versions * Turn on/off reserving space for versions
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
ERR_POST_IF_DATABASE_IS_READONLY(dbb); ERR_POST_IF_DATABASE_IS_READONLY(dbb);
@ -1534,7 +1534,7 @@ void PAG_set_db_readonly(Database* dbb, bool flag)
* Set database access mode to readonly OR readwrite * Set database access mode to readonly OR readwrite
* *
*********************************************/ *********************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
WIN window(HEADER_PAGE); WIN window(HEADER_PAGE);
header_page* header = (header_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_header); header_page* header = (header_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_header);
@ -1572,7 +1572,7 @@ void PAG_set_db_SQL_dialect(Database* dbb, SSHORT flag)
* Set database SQL dialect to SQL_DIALECT_V5 or SQL_DIALECT_V6 * Set database SQL dialect to SQL_DIALECT_V5 or SQL_DIALECT_V6
* *
*********************************************/ *********************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
const USHORT major_version = dbb->dbb_ods_version; const USHORT major_version = dbb->dbb_ods_version;
const USHORT minor_original = dbb->dbb_minor_original; const USHORT minor_original = dbb->dbb_minor_original;
@ -1627,7 +1627,7 @@ void PAG_set_page_buffers(ULONG buffers)
* Set database-specific page buffer cache * Set database-specific page buffer cache
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1672,7 +1672,7 @@ int PAG_unlicensed(void)
* sort of non-sense. * sort of non-sense.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
WIN window(HEADER_PAGE); WIN window(HEADER_PAGE);
CCH_FETCH(tdbb, &window, LCK_write, pag_header); CCH_FETCH(tdbb, &window, LCK_write, pag_header);
@ -1715,7 +1715,7 @@ static void find_clump_space(
* Allocate a new page if required. * Allocate a new page if required.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1862,7 +1862,7 @@ static bool find_type(
* false - Not present * false - Not present
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
while (true) { while (true) {
header_page* header = 0; header_page* header = 0;

View File

@ -603,7 +603,7 @@ static void error(CompilerScratch* csb, ...)
va_list args; va_list args;
/* Don't bother to pass tdbb for error handling */ /* Don't bother to pass tdbb for error handling */
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
VA_START(args, csb); VA_START(args, csb);
@ -2995,7 +2995,7 @@ static void warning(CompilerScratch* csb, ...)
int type; int type;
va_list args; va_list args;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
VA_START(args, csb); VA_START(args, csb);

View File

@ -214,7 +214,7 @@ void PCMET_lookup_index( jrd_rel* relation, index_desc* idx)
**************************************/ **************************************/
CompilerScratch* csb = NULL; CompilerScratch* csb = NULL;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* check the index blocks for the relation to see if we /* check the index blocks for the relation to see if we

View File

@ -154,7 +154,7 @@ int QATEST_entrypoint(ULONG * function, void *arg1, void *arg2, void *arg3)
/* Parameters: NONE */ /* Parameters: NONE */
/* Close current database file & delete */ /* Close current database file & delete */
tdbb = GET_THREAD_DATA; tdbb = JRD_get_thread_data;
if (!(file = tdbb->tdbb_attachment->att_database->dbb_file)) if (!(file = tdbb->tdbb_attachment->att_database->dbb_file))
return -1; return -1;
@ -183,7 +183,7 @@ int QATEST_entrypoint(ULONG * function, void *arg1, void *arg2, void *arg3)
/* Parameter 1: ULONG *shadow_number */ /* Parameter 1: ULONG *shadow_number */
/* Close & delete specified shadow file */ /* Close & delete specified shadow file */
tdbb = GET_THREAD_DATA; tdbb = JRD_get_thread_data;
if (!(shadow = tdbb->tdbb_attachment->att_database->dbb_shadow)) if (!(shadow = tdbb->tdbb_attachment->att_database->dbb_shadow))
return -1; return -1;
for (; shadow; shadow = shadow->sdw_next) for (; shadow; shadow = shadow->sdw_next)

View File

@ -82,7 +82,7 @@ Lock* RLCK_lock_record(record_param* rpb,
if (!lock) if (!lock)
return NULL; return NULL;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* /*
if the record is trying to be locked, check if the record is trying to be locked, check
@ -243,7 +243,7 @@ Lock* RLCK_range_relation(jrd_tra* transaction,
* Lock a relation for a refresh range. * Lock a relation for a refresh range.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
if (transaction->tra_flags & TRA_system) if (transaction->tra_flags & TRA_system)
@ -289,7 +289,7 @@ Lock* RLCK_record_locking(jrd_rel* relation)
if (relation->rel_record_locking) if (relation->rel_record_locking)
return relation->rel_record_locking; return relation->rel_record_locking;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = GET_DBB; Database* dbb = GET_DBB;
Lock* lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) Lock(); Lock* lock = FB_NEW_RPT(*dbb->dbb_permanent, sizeof(SLONG)) Lock();
@ -470,7 +470,7 @@ void RLCK_shutdown_attachment(Attachment* attachment)
* and relation locks. This runs at AST level. * and relation locks. This runs at AST level.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* Release child record locks before parent relation locks */ /* Release child record locks before parent relation locks */
for (Lock* record_lock = attachment->att_record_locks; for (Lock* record_lock = attachment->att_record_locks;
record_lock; record_lock;
@ -505,7 +505,7 @@ void RLCK_shutdown_database(Database* dbb)
* at AST level. * at AST level.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
vec* vector = dbb->dbb_relations; vec* vector = dbb->dbb_relations;
if (!vector) if (!vector)
return; return;
@ -542,7 +542,7 @@ void RLCK_signal_refresh(jrd_tra* transaction)
* lock to signal possible refresh range users. * lock to signal possible refresh range users.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* for each relation, take out a range relation lock and then release it */ /* for each relation, take out a range relation lock and then release it */
vec* vector = transaction->tra_relation_locks; vec* vector = transaction->tra_relation_locks;
@ -640,7 +640,7 @@ void RLCK_unlock_record(Lock* lock, record_param* rpb)
relation = NULL; /* theoretically impossible */ relation = NULL; /* theoretically impossible */
RLCK_unlock_record_implicit(lock, rpb); RLCK_unlock_record_implicit(lock, rpb);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
if (attachment->att_flags & ATT_shutdown) if (attachment->att_flags & ATT_shutdown)
return; return;
@ -671,7 +671,7 @@ void RLCK_unlock_record_implicit(Lock* lock, record_param* rpb)
* Unlock a record-level lock. * Unlock a record-level lock.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (!lock) if (!lock)
lock = find_record_lock(rpb); lock = find_record_lock(rpb);
const USHORT lock_level = lock->lck_logical; const USHORT lock_level = lock->lck_logical;
@ -725,7 +725,7 @@ void RLCK_unlock_relation(Lock* lock, jrd_rel* relation)
* on the specified relation. * on the specified relation.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
vec* vector = attachment->att_relation_locks; vec* vector = attachment->att_relation_locks;
if (!vector) if (!vector)
@ -774,7 +774,7 @@ static Lock* allocate_record_lock(jrd_tra* transaction, record_param* rpb)
* transaction used only for implicit record locks. * transaction used only for implicit record locks.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
if (!rpb->rpb_record) if (!rpb->rpb_record)
@ -827,7 +827,7 @@ static Lock* allocate_relation_lock(MemoryPool* pool, jrd_rel* relation)
* Allocate a lock block for a relation lock. * Allocate a lock block for a relation lock.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
Lock* lock = FB_NEW_RPT(*pool, sizeof(SLONG)) Lock(); Lock* lock = FB_NEW_RPT(*pool, sizeof(SLONG)) Lock();
lock->lck_dbb = dbb; lock->lck_dbb = dbb;
@ -859,7 +859,7 @@ static Lock* attachment_relation_lock(jrd_rel* relation)
* attachment level. * attachment level.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
@ -901,7 +901,7 @@ static void drop_record_lock(Lock* record_lock)
* the attachment block, and drop it from the list. * the attachment block, and drop it from the list.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* look through all the record locks taken out by this attachment /* look through all the record locks taken out by this attachment
looking for one with the same record number and relation id */ looking for one with the same record number and relation id */
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
@ -931,7 +931,7 @@ static Lock* find_record_lock(record_param* rpb)
* defined for a record. * defined for a record.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* look through all the record locks taken out by this attachment /* look through all the record locks taken out by this attachment
looking for one with the same record number and relation */ looking for one with the same record number and relation */
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;

View File

@ -74,7 +74,7 @@ void RNG_add_page(ULONG page_number)
* currently being defined. * currently being defined.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
RefreshRange* next_refresh_range; RefreshRange* next_refresh_range;
@ -145,7 +145,7 @@ void RNG_add_record(record_param* rpb)
* currently being defined. * currently being defined.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
RefreshRange* next_refresh_range; RefreshRange* next_refresh_range;
@ -214,7 +214,7 @@ jrd_nod* RNG_add_relation(jrd_nod* node)
* currently being defined. * currently being defined.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
if (request->req_operation == req_evaluate) { if (request->req_operation == req_evaluate) {
@ -284,7 +284,7 @@ void RNG_add_uncommitted_record(record_param* rpb)
* registering interest in the transaction that created it. * registering interest in the transaction that created it.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
RefreshRange* next_refresh_range; RefreshRange* next_refresh_range;
@ -360,7 +360,7 @@ DSC *RNG_begin(jrd_nod* node, impure_value* impure)
* Initialize a refresh range. * Initialize a refresh range.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_tra* transaction = request->req_transaction; jrd_tra* transaction = request->req_transaction;
@ -460,7 +460,7 @@ jrd_nod* RNG_delete(jrd_nod* node)
* Delete a previously created refresh range. * Delete a previously created refresh range.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
if (request->req_operation == req_evaluate) { if (request->req_operation == req_evaluate) {
@ -531,7 +531,7 @@ jrd_nod* RNG_end(jrd_nod* node)
* Stop adding records to refresh range. * Stop adding records to refresh range.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
if (request->req_operation == req_evaluate) { if (request->req_operation == req_evaluate) {
@ -575,7 +575,7 @@ void RNG_release_locks(RefreshRange* refresh_range)
* Release all locks held by a refresh range. * Release all locks held by a refresh range.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* release all the relation locks */ /* release all the relation locks */
@ -678,7 +678,7 @@ void RNG_shutdown_attachment(Attachment* attachment)
* This may be called at AST level, don't release memory. * This may be called at AST level, don't release memory.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
for (jrd_req* request = attachment->att_requests; request; for (jrd_req* request = attachment->att_requests; request;
request = request->req_request) request = request->req_request)
@ -736,7 +736,7 @@ static void delete_range(RefreshRange* refresh_range)
* a refresh range. * a refresh range.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
@ -809,7 +809,7 @@ static int post_event_ast(void* refresh_range_void)
/* Since this routine will be called asynchronously, we must establish /* Since this routine will be called asynchronously, we must establish
a thread context. */ a thread context. */
SET_THREAD_DATA; JRD_set_thread_data;
RefreshRange* refresh_range = static_cast<RefreshRange*>(refresh_range_void); RefreshRange* refresh_range = static_cast<RefreshRange*>(refresh_range_void);
tdbb->tdbb_database = refresh_range->rng_attachment->att_database; tdbb->tdbb_database = refresh_range->rng_attachment->att_database;
@ -823,7 +823,7 @@ static int post_event_ast(void* refresh_range_void)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
return 0; return 0;
} }
#endif #endif
@ -843,7 +843,7 @@ static void stop_creating(RefreshRange* refresh_range)
* those being created. * those being created.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
jrd_req* request = tdbb->tdbb_request; jrd_req* request = tdbb->tdbb_request;
/* delete from the list of ranges being created */ /* delete from the list of ranges being created */

View File

@ -142,7 +142,7 @@ void SCL_check_access(const SecurityClass* s_class,
* object in question. * object in question.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (s_class && (s_class->scl_flags & SCL_corrupt)) if (s_class && (s_class->scl_flags & SCL_corrupt))
{ {
@ -344,7 +344,7 @@ void SCL_check_procedure(const dsc* dsc_name, USHORT mask)
**************************************/ **************************************/
SqlIdentifier name; SqlIdentifier name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// Get the name in CSTRING format, ending on NULL or SPACE // Get the name in CSTRING format, ending on NULL or SPACE
@ -401,7 +401,7 @@ void SCL_check_relation(const dsc* dsc_name, USHORT mask)
**************************************/ **************************************/
SqlIdentifier name; SqlIdentifier name;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
// Get the name in CSTRING format, ending on NULL or SPACE // Get the name in CSTRING format, ending on NULL or SPACE
@ -456,7 +456,7 @@ SecurityClass* SCL_get_class(const TEXT* _string)
* class block. * class block.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
// Name may be absent or terminated with NULL or blank. Clean up name. // Name may be absent or terminated with NULL or blank. Clean up name.
@ -521,7 +521,7 @@ int SCL_get_mask(const TEXT* relation_name, const TEXT* field_name)
* access for database. * access for database.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
// Start with database security class // Start with database security class
@ -874,7 +874,7 @@ void SCL_release(SecurityClass* s_class)
* Release an unneeded and unloved security class. * Release an unneeded and unloved security class.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
for (SecurityClass** next = &attachment->att_security_classes; *next; for (SecurityClass** next = &attachment->att_security_classes; *next;
@ -980,7 +980,7 @@ static bool check_user_group(const UCHAR* acl,
* If they don't match, return true. * If they don't match, return true.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
SLONG n = 0; SLONG n = 0;

View File

@ -79,7 +79,7 @@ void SDW_add(const TEXT* file_name, USHORT shadow_number, USHORT file_flags)
* Add a brand new shadowing file to the database. * Add a brand new shadowing file to the database.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = GET_DBB; Database* dbb = GET_DBB;
// Verify database file path against DatabaseAccess entry of firebird.conf // Verify database file path against DatabaseAccess entry of firebird.conf
@ -126,7 +126,7 @@ int SDW_add_file(const TEXT* file_name, SLONG start, USHORT shadow_number)
* Return the sequence number for the new file. * Return the sequence number for the new file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* Find the file to be extended */ /* Find the file to be extended */
@ -298,7 +298,7 @@ void SDW_check(void)
* *
**************************************/ **************************************/
Database* dbb = GET_DBB; Database* dbb = GET_DBB;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* first get rid of any shadows that need to be /* first get rid of any shadows that need to be
deleted or shutdown; deleted shadows must also deleted or shutdown; deleted shadows must also
@ -363,7 +363,7 @@ bool SDW_check_conditional(void)
* if so update meta data and return true * if so update meta data and return true
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -449,7 +449,7 @@ void SDW_dump_pages(void)
* to all unwritten shadow files. * to all unwritten shadow files.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
gds__log("conditional shadow dumped for database %s", gds__log("conditional shadow dumped for database %s",
dbb->dbb_file->fil_string); dbb->dbb_file->fil_string);
@ -530,7 +530,7 @@ void SDW_get_shadows(void)
* defined. * defined.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -577,7 +577,7 @@ void SDW_init(bool activate, bool delete_)
* to use as a shadow. * to use as a shadow.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -677,7 +677,7 @@ void SDW_notify(void)
* a shadow added. * a shadow added.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -728,7 +728,7 @@ bool SDW_rollover_to_shadow(jrd_file* file, const bool inAst)
* Functional description * Functional description
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = GET_DBB; Database* dbb = GET_DBB;
if (file != dbb->dbb_file) if (file != dbb->dbb_file)
@ -895,7 +895,7 @@ void SDW_start(
SCHAR expanded_name[MAXPATHLEN]; SCHAR expanded_name[MAXPATHLEN];
USHORT header_fetched = 0; USHORT header_fetched = 0;
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
/* check that this shadow has not already been started, /* check that this shadow has not already been started,
@ -1095,7 +1095,7 @@ int SDW_start_shadowing(void* ast_object)
/* Since this routine will be called asynchronously, we must establish /* Since this routine will be called asynchronously, we must establish
a thread context. */ a thread context. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
tdbb->tdbb_database = new_dbb; tdbb->tdbb_database = new_dbb;
tdbb->tdbb_quantum = QUANTUM; tdbb->tdbb_quantum = QUANTUM;
@ -1110,7 +1110,7 @@ int SDW_start_shadowing(void* ast_object)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
ISC_ast_exit(); ISC_ast_exit();
return 0; return 0;
@ -1129,7 +1129,7 @@ static void activate_shadow(void)
* Change a shadow into a database. * Change a shadow into a database.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1210,7 +1210,7 @@ static bool check_for_file(const SCHAR* name, USHORT length)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
try { try {
@ -1242,7 +1242,7 @@ static void check_if_got_ast(jrd_file* file)
* a shadow update * a shadow update
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);
@ -1274,7 +1274,7 @@ static void copy_header(void)
* the name of the extend file. * the name of the extend file.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Database* dbb = tdbb->tdbb_database; Database* dbb = tdbb->tdbb_database;
CHECK_DBB(dbb); CHECK_DBB(dbb);

View File

@ -138,7 +138,7 @@ bool SHUT_database(Database* dbb, SSHORT flag, SSHORT delay)
* Schedule database for shutdown * Schedule database for shutdown
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
/* Only platform's user locksmith can shutdown or bring online /* Only platform's user locksmith can shutdown or bring online
@ -307,7 +307,7 @@ bool SHUT_online(Database* dbb, SSHORT flag)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
Attachment* attachment = tdbb->tdbb_attachment; Attachment* attachment = tdbb->tdbb_attachment;
/* Only platform's user locksmith can shutdown or bring online /* Only platform's user locksmith can shutdown or bring online
@ -396,7 +396,7 @@ bool SHUT_online(Database* dbb, SSHORT flag)
static bool bad_mode(bool ignore) { static bool bad_mode(bool ignore) {
if (!ignore) { if (!ignore) {
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
ISC_STATUS* status = tdbb->tdbb_status_vector; ISC_STATUS* status = tdbb->tdbb_status_vector;
*status++ = isc_arg_gds; *status++ = isc_arg_gds;
@ -426,7 +426,7 @@ static bool notify_shutdown(Database* dbb, SSHORT flag, SSHORT delay)
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
shutdown_data data; shutdown_data data;
data.data_items.flag = flag; data.data_items.flag = flag;
@ -465,7 +465,7 @@ static bool shutdown_locks(Database* dbb, SSHORT flag)
* locks if database is quiet. * locks if database is quiet.
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* Mark database and all active attachments as shutdown. */ /* Mark database and all active attachments as shutdown. */

View File

@ -370,7 +370,7 @@ Service* SVC_attach(USHORT service_length,
* *
**************************************/ **************************************/
/* If the service name begins with a slash, ignore it. */ /* If the service name begins with a slash, ignore it. */
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
if (*service_name == '/' || *service_name == '\\') { if (*service_name == '/' || *service_name == '\\') {
service_name++; service_name++;
@ -403,7 +403,7 @@ Service* SVC_attach(USHORT service_length,
0); 0);
#endif #endif
GET_THREAD_DATA; JRD_get_thread_data;
/* If anything goes wrong, we want to be able to free any memory /* If anything goes wrong, we want to be able to free any memory
that may have been allocated. */ that may have been allocated. */
@ -1780,7 +1780,7 @@ void* SVC_start(Service* service, USHORT spb_length, const SCHAR* spb)
} }
THD_MUTEX_UNLOCK(thd_mutex); THD_MUTEX_UNLOCK(thd_mutex);
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
try { try {

View File

@ -26,7 +26,7 @@
* *
*/ */
/* /*
$Id: thd.h,v 1.25 2004-05-17 22:27:56 brodsom Exp $ $Id: thd.h,v 1.26 2004-05-19 18:12:33 brodsom Exp $
*/ */
#ifndef JRD_THD_H #ifndef JRD_THD_H
@ -119,11 +119,6 @@ struct IB_RTL_CRITICAL_SECTION
#define THD_COND_STRUCT SCHAR #define THD_COND_STRUCT SCHAR
#endif #endif
#ifdef ANY_THREADING
#define GET_THREAD_DATA ((THDD) THD_get_specific())
#else
#define GET_THREAD_DATA gdbb
#endif
/* Thread priorities (may be ignored) */ /* Thread priorities (may be ignored) */

View File

@ -2231,7 +2231,7 @@ static int downgrade_lock(void* transaction_void)
a thread context. */ a thread context. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
/* Ignore the request if the transaction or lock block does not appear /* Ignore the request if the transaction or lock block does not appear
to be valid or if the lock is not a write lock. */ to be valid or if the lock is not a write lock. */
@ -2255,7 +2255,7 @@ static int downgrade_lock(void* transaction_void)
/* Restore the prior thread context */ /* Restore the prior thread context */
RESTORE_THREAD_DATA; JRD_restore_thread_data;
ISC_ast_exit(); ISC_ast_exit();
return 0; return 0;
@ -2276,7 +2276,7 @@ static void expand_view_lock(jrd_tra* transaction, jrd_rel* relation, SCHAR lock
* *
**************************************/ **************************************/
thread_db* tdbb = GET_THREAD_DATA; thread_db* tdbb = JRD_get_thread_data;
/* set up the lock on the relation/view */ /* set up the lock on the relation/view */

View File

@ -3552,7 +3552,7 @@ static void THREAD_ROUTINE garbage_collector(Database* dbb)
Once we reach the end, the thread will die, thus implicitly Once we reach the end, the thread will die, thus implicitly
killing all its contexts. */ killing all its contexts. */
thread_db thd_context, *tdbb; thread_db thd_context, *tdbb;
SET_THREAD_DATA; JRD_set_thread_data;
tdbb->tdbb_database = dbb; tdbb->tdbb_database = dbb;
tdbb->tdbb_default = dbb->dbb_permanent; tdbb->tdbb_default = dbb->dbb_permanent;
tdbb->tdbb_status_vector = status_vector; tdbb->tdbb_status_vector = status_vector;
@ -3803,7 +3803,7 @@ gc_exit:
ISC_event_post(dbb->dbb_gc_event_fini); ISC_event_post(dbb->dbb_gc_event_fini);
ISC_event_fini(gc_event); ISC_event_fini(gc_event);
RESTORE_THREAD_DATA; JRD_restore_thread_data;
THREAD_EXIT(); THREAD_EXIT();
} // try } // try

View File

@ -112,7 +112,7 @@ BLK ALLR_block(UCHAR type, ULONG count)
{ {
if (type <= (UCHAR) type_MIN || type >= (UCHAR) type_MAX) if (type <= (UCHAR) type_MIN || type >= (UCHAR) type_MAX)
{ {
TRDB trdb = GET_THREAD_DATA; TRDB trdb = REM_get_thread_data;
ISC_STATUS* status_vector = trdb->trdb_status_vector; ISC_STATUS* status_vector = trdb->trdb_status_vector;
if (status_vector) if (status_vector)

View File

@ -183,12 +183,6 @@ static ULONG remote_event_id = 0;
#define SET_OBJECT(rdb,object,id) REMOTE_set_object (rdb->rdb_port, (struct blk *) object, id) #define SET_OBJECT(rdb,object,id) REMOTE_set_object (rdb->rdb_port, (struct blk *) object, id)
#define SET_THREAD_DATA trdb = &thd_context;\
trdb->trdb_status_vector = NULL;\
THD_put_specific ((THDD) trdb);\
trdb->trdb_thd_data.thdd_type = THDD_TYPE_TRDB
#define RESTORE_THREAD_DATA THD_restore_specific()
#define GDS_ATTACH_DATABASE REM_attach_database #define GDS_ATTACH_DATABASE REM_attach_database
#define GDS_BLOB_INFO REM_blob_info #define GDS_BLOB_INFO REM_blob_info
#define GDS_CANCEL_BLOB REM_cancel_blob #define GDS_CANCEL_BLOB REM_cancel_blob
@ -283,7 +277,7 @@ ISC_STATUS GDS_ATTACH_DATABASE(ISC_STATUS* user_status,
} }
#endif #endif
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(handle, isc_bad_db_handle); NULL_CHECK(handle, isc_bad_db_handle);
@ -382,7 +376,7 @@ ISC_STATUS GDS_BLOB_INFO(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RBL blob = *blob_handle; RBL blob = *blob_handle;
CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle); CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle);
@ -398,7 +392,7 @@ ISC_STATUS GDS_BLOB_INFO(ISC_STATUS* user_status,
{ {
status = info(user_status, rdb, op_info_blob, blob->rbl_id, 0, status = info(user_status, rdb, op_info_blob, blob->rbl_id, 0,
item_length, items, 0, 0, buffer_length, buffer); item_length, items, 0, 0, buffer_length, buffer);
RESTORE_THREAD_DATA; REM_restore_thread_data;
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
@ -433,7 +427,7 @@ ISC_STATUS GDS_CANCEL_BLOB(ISC_STATUS * user_status, RBL * blob_handle)
return FB_SUCCESS; return FB_SUCCESS;
} }
SET_THREAD_DATA; REM_set_thread_data;
CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle); CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle);
RDB rdb = blob->rbl_rdb; RDB rdb = blob->rbl_rdb;
@ -474,7 +468,7 @@ ISC_STATUS GDS_CANCEL_EVENTS(ISC_STATUS * user_status, RDB * handle, SLONG * id)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *handle; RDB rdb = *handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -523,7 +517,7 @@ ISC_STATUS GDS_CLOSE_BLOB(ISC_STATUS * user_status, RBL * blob_handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RBL blob = *blob_handle; RBL blob = *blob_handle;
CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle); CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle);
@ -574,7 +568,7 @@ ISC_STATUS GDS_COMMIT(ISC_STATUS * user_status, RTR * rtr_handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RTR transaction = *rtr_handle; RTR transaction = *rtr_handle;
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle); CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
@ -617,7 +611,7 @@ ISC_STATUS GDS_COMMIT_RETAINING(ISC_STATUS * user_status, RTR * rtr_handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RTR transaction = *rtr_handle; RTR transaction = *rtr_handle;
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle); CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
@ -664,7 +658,7 @@ ISC_STATUS GDS_COMPILE(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -777,7 +771,7 @@ ISC_STATUS GDS_CREATE_BLOB2(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(blob_handle, isc_bad_segstr_handle); NULL_CHECK(blob_handle, isc_bad_segstr_handle);
RDB rdb = *db_handle; RDB rdb = *db_handle;
@ -874,7 +868,7 @@ ISC_STATUS GDS_CREATE_DATABASE(ISC_STATUS* user_status,
return isc_unavailable; return isc_unavailable;
#endif #endif
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(handle, isc_bad_db_handle); NULL_CHECK(handle, isc_bad_db_handle);
@ -974,7 +968,7 @@ ISC_STATUS GDS_DATABASE_INFO(ISC_STATUS* user_status,
UCHAR temp[1024]; UCHAR temp[1024];
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *handle; RDB rdb = *handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -1017,7 +1011,7 @@ ISC_STATUS GDS_DATABASE_INFO(ISC_STATUS* user_status,
ALLR_free(temp_buffer); ALLR_free(temp_buffer);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
} }
catch (const std::exception& ex) catch (const std::exception& ex)
{ {
@ -1046,7 +1040,7 @@ ISC_STATUS GDS_DDL(ISC_STATUS* user_status,
ISC_STATUS status; ISC_STATUS status;
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -1082,7 +1076,7 @@ ISC_STATUS GDS_DDL(ISC_STATUS* user_status,
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return status; return status;
} }
@ -1102,7 +1096,7 @@ ISC_STATUS GDS_DETACH(ISC_STATUS* user_status, RDB* handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *handle; RDB rdb = *handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -1162,7 +1156,7 @@ ISC_STATUS GDS_DETACH(ISC_STATUS* user_status, RDB* handle)
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
*user_status++ = isc_arg_gds; *user_status++ = isc_arg_gds;
*user_status++ = FB_SUCCESS; *user_status++ = FB_SUCCESS;
@ -1187,7 +1181,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, RDB* handle)
ISC_STATUS_ARRAY local_status; ISC_STATUS_ARRAY local_status;
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *handle; RDB rdb = *handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -1233,7 +1227,7 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, RDB* handle)
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
@ -1255,7 +1249,7 @@ ISC_STATUS GDS_DSQL_ALLOCATE(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(stmt_handle, isc_bad_req_handle); NULL_CHECK(stmt_handle, isc_bad_req_handle);
RDB rdb = *db_handle; RDB rdb = *db_handle;
@ -1354,7 +1348,7 @@ ISC_STATUS GDS_DSQL_EXECUTE2(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -1566,7 +1560,7 @@ ISC_STATUS GDS_DSQL_EXECUTE_IMMED2(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -1746,7 +1740,7 @@ ISC_STATUS GDS_DSQL_FETCH(ISC_STATUS* user_status,
ISC_STATUS status; ISC_STATUS status;
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -1814,7 +1808,7 @@ ISC_STATUS GDS_DSQL_FETCH(ISC_STATUS* user_status,
if (statement->rsr_flags & RSR_blob) { if (statement->rsr_flags & RSR_blob) {
status = fetch_blob(user_status, statement, blr_length, blr, status = fetch_blob(user_status, statement, blr_length, blr,
msg_type, msg_length, msg); msg_type, msg_length, msg);
RESTORE_THREAD_DATA; REM_restore_thread_data;
return status; return status;
} }
@ -1937,7 +1931,7 @@ ISC_STATUS GDS_DSQL_FETCH(ISC_STATUS* user_status,
{ {
statement->rsr_flags &= ~RSR_eof; statement->rsr_flags &= ~RSR_eof;
/* Set up status vector and RESTORE_THREAD_DATA in common return_success */ /* Set up status vector and REM_restore_thread_data in common return_success */
return_success(rdb); return_success(rdb);
return 100; return 100;
@ -2007,7 +2001,7 @@ ISC_STATUS GDS_DSQL_FREE(ISC_STATUS * user_status, RSR * stmt_handle, USHORT opt
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -2079,7 +2073,7 @@ ISC_STATUS GDS_DSQL_INSERT(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -2181,7 +2175,7 @@ ISC_STATUS GDS_DSQL_PREPARE(ISC_STATUS * user_status, RTR * rtr_handle, RSR * st
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -2285,7 +2279,7 @@ ISC_STATUS GDS_DSQL_SET_CURSOR(ISC_STATUS* user_status,
*****************************************/ *****************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -2355,7 +2349,7 @@ ISC_STATUS GDS_DSQL_SQL_INFO(ISC_STATUS* user_status,
ISC_STATUS status; ISC_STATUS status;
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -2382,7 +2376,7 @@ ISC_STATUS GDS_DSQL_SQL_INFO(ISC_STATUS* user_status,
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return status; return status;
} }
@ -2405,7 +2399,7 @@ ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Sniff out handles, etc, and find the various blocks. */ /* Sniff out handles, etc, and find the various blocks. */
@ -2449,7 +2443,7 @@ ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status,
*length = response->p_resp_data.cstr_length; *length = response->p_resp_data.cstr_length;
response->p_resp_data = temp; response->p_resp_data = temp;
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
@ -2471,7 +2465,7 @@ ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status,
if (blob->rbl_flags & RBL_eof) { if (blob->rbl_flags & RBL_eof) {
*v++ = isc_segstr_eof; *v++ = isc_segstr_eof;
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
@ -2613,7 +2607,7 @@ ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status,
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
@ -2641,7 +2635,7 @@ ISC_STATUS GDS_GET_SLICE(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *db_handle; RDB rdb = *db_handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -2745,7 +2739,7 @@ ISC_STATUS GDS_OPEN_BLOB2(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(blob_handle, isc_bad_segstr_handle); NULL_CHECK(blob_handle, isc_bad_segstr_handle);
RDB rdb = *db_handle; RDB rdb = *db_handle;
@ -2821,7 +2815,7 @@ ISC_STATUS GDS_PREPARE(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RTR transaction = *rtr_handle; RTR transaction = *rtr_handle;
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle); CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
@ -2884,7 +2878,7 @@ ISC_STATUS GDS_PUT_SEGMENT(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Sniff out handles, etc, and find the various blocks. */ /* Sniff out handles, etc, and find the various blocks. */
@ -2906,7 +2900,7 @@ ISC_STATUS GDS_PUT_SEGMENT(ISC_STATUS* user_status,
if ((port->port_flags & PORT_rpc) || !(blob->rbl_flags & RBL_create)) if ((port->port_flags & PORT_rpc) || !(blob->rbl_flags & RBL_create))
{ {
send_blob(user_status, blob, segment_length, segment); send_blob(user_status, blob, segment_length, segment);
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
@ -2920,13 +2914,13 @@ ISC_STATUS GDS_PUT_SEGMENT(ISC_STATUS* user_status,
if ((ULONG) segment_length + 2 > l) { if ((ULONG) segment_length + 2 > l) {
if (blob->rbl_ptr > blob->rbl_buffer) { if (blob->rbl_ptr > blob->rbl_buffer) {
if (send_blob(user_status, blob, 0, NULL)) { if (send_blob(user_status, blob, 0, NULL)) {
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
} }
if ((ULONG) segment_length + 2 > blob->rbl_buffer_length) { if ((ULONG) segment_length + 2 > blob->rbl_buffer_length) {
send_blob(user_status, blob, segment_length, segment); send_blob(user_status, blob, segment_length, segment);
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
p = blob->rbl_buffer; p = blob->rbl_buffer;
@ -2981,7 +2975,7 @@ ISC_STATUS GDS_PUT_SLICE(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *db_handle; RDB rdb = *db_handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -3075,7 +3069,7 @@ ISC_STATUS GDS_QUE_EVENTS(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *handle; RDB rdb = *handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -3189,7 +3183,7 @@ ISC_STATUS GDS_RECEIVE(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check handles and environment, then set up error handling */ /* Check handles and environment, then set up error handling */
@ -3380,7 +3374,7 @@ ISC_STATUS GDS_RECEIVE(ISC_STATUS * user_status,
memset(request->rrq_status_vector, 0, memset(request->rrq_status_vector, 0,
sizeof(request->rrq_status_vector)); sizeof(request->rrq_status_vector));
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
}; };
@ -3429,7 +3423,7 @@ ISC_STATUS GDS_RECONNECT(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(rtr_handle, isc_bad_trans_handle); NULL_CHECK(rtr_handle, isc_bad_trans_handle);
RDB rdb = *db_handle; RDB rdb = *db_handle;
@ -3476,7 +3470,7 @@ ISC_STATUS GDS_RELEASE_REQUEST(ISC_STATUS * user_status, rrq** req_handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
rrq* request = *req_handle; rrq* request = *req_handle;
CHECK_HANDLE(request, type_rrq, isc_bad_req_handle); CHECK_HANDLE(request, type_rrq, isc_bad_req_handle);
@ -3523,7 +3517,7 @@ ISC_STATUS GDS_REQUEST_INFO(ISC_STATUS* user_status,
ISC_STATUS status; ISC_STATUS status;
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
rrq* request = REMOTE_find_request(*req_handle, level); rrq* request = REMOTE_find_request(*req_handle, level);
CHECK_HANDLE(request, type_rrq, isc_bad_req_handle); CHECK_HANDLE(request, type_rrq, isc_bad_req_handle);
@ -3601,7 +3595,7 @@ punt:
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return status; return status;
} }
@ -3621,7 +3615,7 @@ ISC_STATUS GDS_ROLLBACK_RETAINING(ISC_STATUS * user_status, RTR * rtr_handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RTR transaction = *rtr_handle; RTR transaction = *rtr_handle;
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle); CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
@ -3666,7 +3660,7 @@ ISC_STATUS GDS_ROLLBACK(ISC_STATUS * user_status, RTR * rtr_handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RTR transaction = *rtr_handle; RTR transaction = *rtr_handle;
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle); CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
@ -3711,7 +3705,7 @@ ISC_STATUS GDS_SEEK_BLOB(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RBL blob = *blob_handle; RBL blob = *blob_handle;
CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle); CHECK_HANDLE(blob, type_rbl, isc_bad_segstr_handle);
@ -3773,7 +3767,7 @@ ISC_STATUS GDS_SEND(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
CHECK_HANDLE((*req_handle), type_rrq, isc_bad_req_handle); CHECK_HANDLE((*req_handle), type_rrq, isc_bad_req_handle);
rrq* request = REMOTE_find_request(*req_handle, level); rrq* request = REMOTE_find_request(*req_handle, level);
@ -3839,7 +3833,7 @@ ISC_STATUS GDS_SERVICE_ATTACH(ISC_STATUS* user_status,
UCHAR expanded_name[MAXPATHLEN]; UCHAR expanded_name[MAXPATHLEN];
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(handle, isc_bad_svc_handle); NULL_CHECK(handle, isc_bad_svc_handle);
@ -3950,7 +3944,7 @@ ISC_STATUS GDS_SERVICE_DETACH(ISC_STATUS * user_status, RDB * handle)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -3983,7 +3977,7 @@ ISC_STATUS GDS_SERVICE_DETACH(ISC_STATUS * user_status, RDB * handle)
/* Note: Can't return_success(rdb) here as we've torn down memory already */ /* Note: Can't return_success(rdb) here as we've torn down memory already */
RESTORE_THREAD_DATA; REM_restore_thread_data;
*user_status++ = isc_arg_gds; *user_status++ = isc_arg_gds;
*user_status++ = FB_SUCCESS; *user_status++ = FB_SUCCESS;
@ -4020,7 +4014,7 @@ ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status,
ISC_STATUS status; ISC_STATUS status;
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -4047,7 +4041,7 @@ ISC_STATUS GDS_SERVICE_QUERY(ISC_STATUS* user_status,
status = error(user_status, ex); status = error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return status; return status;
} }
@ -4075,7 +4069,7 @@ ISC_STATUS GDS_SERVICE_START(ISC_STATUS * user_status,
ISC_STATUS status; ISC_STATUS status;
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
/* Check and validate handles, etc. */ /* Check and validate handles, etc. */
@ -4102,7 +4096,7 @@ ISC_STATUS GDS_SERVICE_START(ISC_STATUS * user_status,
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return status; return status;
} }
@ -4126,7 +4120,7 @@ ISC_STATUS GDS_START_AND_SEND(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
CHECK_HANDLE((*req_handle), type_rrq, isc_bad_req_handle); CHECK_HANDLE((*req_handle), type_rrq, isc_bad_req_handle);
CHECK_HANDLE((*rtr_handle), type_rtr, isc_bad_trans_handle); CHECK_HANDLE((*rtr_handle), type_rtr, isc_bad_trans_handle);
@ -4213,7 +4207,7 @@ ISC_STATUS GDS_START(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
CHECK_HANDLE((*req_handle), type_rrq, isc_bad_req_handle); CHECK_HANDLE((*req_handle), type_rrq, isc_bad_req_handle);
CHECK_HANDLE((*rtr_handle), type_rtr, isc_bad_trans_handle); CHECK_HANDLE((*rtr_handle), type_rtr, isc_bad_trans_handle);
@ -4287,7 +4281,7 @@ ISC_STATUS GDS_START_TRANSACTION(ISC_STATUS * user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
NULL_CHECK(rtr_handle, isc_bad_trans_handle); NULL_CHECK(rtr_handle, isc_bad_trans_handle);
RDB rdb = *db_handle; RDB rdb = *db_handle;
@ -4341,7 +4335,7 @@ ISC_STATUS GDS_TRANSACT_REQUEST(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RDB rdb = *db_handle; RDB rdb = *db_handle;
CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle); CHECK_HANDLE(rdb, type_rdb, isc_bad_db_handle);
@ -4476,7 +4470,7 @@ ISC_STATUS GDS_TRANSACTION_INFO(ISC_STATUS* user_status,
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
RTR transaction = *tra_handle; RTR transaction = *tra_handle;
CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle); CHECK_HANDLE(transaction, type_rtr, isc_bad_trans_handle);
@ -4499,7 +4493,7 @@ ISC_STATUS GDS_TRANSACTION_INFO(ISC_STATUS* user_status,
return error(user_status, ex); return error(user_status, ex);
} }
RESTORE_THREAD_DATA; REM_restore_thread_data;
return status; return status;
} }
@ -4519,7 +4513,7 @@ ISC_STATUS GDS_UNWIND(ISC_STATUS* user_status, rrq** req_handle, USHORT level)
**************************************/ **************************************/
struct trdb thd_context, *trdb; struct trdb thd_context, *trdb;
SET_THREAD_DATA; REM_set_thread_data;
rrq* request = REMOTE_find_request(*req_handle, level); rrq* request = REMOTE_find_request(*req_handle, level);
CHECK_HANDLE(request, type_rrq, isc_bad_req_handle); CHECK_HANDLE(request, type_rrq, isc_bad_req_handle);
@ -5315,7 +5309,7 @@ static bool clear_queue(rem_port* port,
if (port->port_receive_rmtque) { if (port->port_receive_rmtque) {
struct trdb *trdb; struct trdb *trdb;
trdb = GET_THREAD_DATA; trdb = REM_get_thread_data;
while (port->port_receive_rmtque) while (port->port_receive_rmtque)
if (!receive_queued_packet(trdb, port, user_status, (USHORT) - 1)) if (!receive_queued_packet(trdb, port, user_status, (USHORT) - 1))
return false; return false;
@ -5427,7 +5421,7 @@ static ISC_STATUS error( ISC_STATUS * user_status)
* *
**************************************/ **************************************/
RESTORE_THREAD_DATA; REM_restore_thread_data;
return user_status[1]; return user_status[1];
} }
@ -5445,7 +5439,7 @@ static ISC_STATUS error(ISC_STATUS* user_status, const std::exception& ex)
* *
**************************************/ **************************************/
RESTORE_THREAD_DATA; REM_restore_thread_data;
return Firebird::stuff_exception(user_status, ex); return Firebird::stuff_exception(user_status, ex);
} }
@ -5874,7 +5868,7 @@ static ISC_STATUS handle_error( ISC_STATUS * user_status, ISC_STATUS code)
* *
**************************************/ **************************************/
RESTORE_THREAD_DATA; REM_restore_thread_data;
*user_status++ = isc_arg_gds; *user_status++ = isc_arg_gds;
*user_status++ = code; *user_status++ = code;
@ -6043,7 +6037,7 @@ static ISC_STATUS mov_dsql_message(const UCHAR* from_msg,
/* Set up in case we get a conversion error. /* Set up in case we get a conversion error.
NOTE: The code below is not amenable to multi-threading. */ NOTE: The code below is not amenable to multi-threading. */
TRDB trdb = GET_THREAD_DATA; TRDB trdb = REM_get_thread_data;
try { try {
@ -6139,7 +6133,7 @@ static void move_error( ISC_STATUS status, ...)
VA_START(ap, status); VA_START(ap, status);
trdb = GET_THREAD_DATA; trdb = REM_get_thread_data;
p_args = trdb->trdb_status_vector; p_args = trdb->trdb_status_vector;
end_args = p_args + ISC_STATUS_LENGTH; end_args = p_args + ISC_STATUS_LENGTH;
@ -6645,7 +6639,7 @@ static ISC_STATUS return_success( RDB rdb)
* Set up status vector to reflect successful execution. * Set up status vector to reflect successful execution.
* *
**************************************/ **************************************/
RESTORE_THREAD_DATA; REM_restore_thread_data;
ISC_STATUS* p = rdb->rdb_status_vector; ISC_STATUS* p = rdb->rdb_status_vector;
@ -7193,7 +7187,7 @@ static ISC_STATUS unsupported(ISC_STATUS* user_status)
* *
**************************************/ **************************************/
RESTORE_THREAD_DATA; REM_restore_thread_data;
*user_status++ = isc_arg_gds; *user_status++ = isc_arg_gds;
*user_status++ = isc_wish_list; *user_status++ = isc_wish_list;

View File

@ -512,11 +512,12 @@ typedef struct trdb
} *TRDB; } *TRDB;
#ifdef GET_THREAD_DATA #define REM_get_thread_data ((TRDB) THD_get_specific())
#undef GET_THREAD_DATA #define REM_set_thread_data trdb = &thd_context;\
#endif trdb->trdb_status_vector = NULL;\
THD_put_specific ((THDD) trdb);\
#define GET_THREAD_DATA ((TRDB) THD_get_specific()) trdb->trdb_thd_data.thdd_type = THDD_TYPE_TRDB
#define REM_restore_thread_data THD_restore_specific()
/* Queuing structure for Client batch fetches */ /* Queuing structure for Client batch fetches */

View File

@ -63,12 +63,6 @@
#endif #endif
#include "../remote/proto_proto.h" // xdr_protocol_overhead() #include "../remote/proto_proto.h" // xdr_protocol_overhead()
#define SET_THREAD_DATA trdb = &thd_context;\
trdb->trdb_status_vector = NULL;\
THD_put_specific ((THDD) trdb);\
trdb->trdb_thd_data.thdd_type = THDD_TYPE_TRDB
#define RESTORE_THREAD_DATA THD_restore_specific()
/** CHECK_HANDLE checks - /** CHECK_HANDLE checks -
if the id passwd is within the vector bounds, if the id passwd is within the vector bounds,
that the port_object corresponding to the id is not null, that the port_object corresponding to the id is not null,
@ -279,7 +273,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
THREAD_ENTER(); THREAD_ENTER();
SET_THREAD_DATA; REM_set_thread_data;
trdb->trdb_status_vector = status_vector; trdb->trdb_status_vector = status_vector;
try { try {
@ -354,7 +348,7 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
{ {
gds__log("SRVR_multi_thread/RECEIVE: error on main_port, shutting down"); gds__log("SRVR_multi_thread/RECEIVE: error on main_port, shutting down");
THREAD_EXIT(); THREAD_EXIT();
RESTORE_THREAD_DATA; REM_restore_thread_data;
return; return;
} }
@ -535,14 +529,14 @@ void SRVR_multi_thread( rem_port* main_port, USHORT flags)
*/ */
gds__log("SRVR_multi_thread: error during startup, shutting down"); gds__log("SRVR_multi_thread: error during startup, shutting down");
RESTORE_THREAD_DATA; REM_restore_thread_data;
THREAD_EXIT(); THREAD_EXIT();
return; return;
} }
/* Why isn't this inside the #endif above? */ /* Why isn't this inside the #endif above? */
RESTORE_THREAD_DATA; REM_restore_thread_data;
#endif #endif
} }

View File

@ -172,7 +172,7 @@ int common_main(int argc,
gsec_exit(FINI_ERROR, tdsec); gsec_exit(FINI_ERROR, tdsec);
} }
SET_THREAD_DATA; GSEC_set_thread_data;
SVC_PUTSPECIFIC_DATA; SVC_PUTSPECIFIC_DATA;
memset((void *) tdsec, 0, sizeof(*tdsec)); memset((void *) tdsec, 0, sizeof(*tdsec));
@ -380,7 +380,7 @@ static void data_print(void* arg, const internal_user_data* data, bool first)
* if first is TRUE print the header then the data * if first is TRUE print the header then the data
* *
**************************************/ **************************************/
tsec* tdsec = GET_THREAD_DATA; tsec* tdsec = GSEC_get_thread_data;
#ifdef SUPERSERVER #ifdef SUPERSERVER
#define STUFF_USER(item) SVC_putc(tdsec->tsec_service_blk, item) #define STUFF_USER(item) SVC_putc(tdsec->tsec_service_blk, item)
@ -1131,7 +1131,7 @@ void GSEC_print_status(const ISC_STATUS* status_vector)
if (status_vector) { if (status_vector) {
const ISC_STATUS* vector = status_vector; const ISC_STATUS* vector = status_vector;
#ifdef SUPERSERVER #ifdef SUPERSERVER
TSEC tdsec = GET_THREAD_DATA; TSEC tdsec = GSEC_get_thread_data;
ISC_STATUS* status = tdsec->tsec_service_blk->svc_status; ISC_STATUS* status = tdsec->tsec_service_blk->svc_status;
if (status != status_vector) { if (status != status_vector) {
int i = 0, j; int i = 0, j;
@ -1168,7 +1168,7 @@ static void util_output( const SCHAR* format, ...)
**************************************/ **************************************/
int exit_code; int exit_code;
tsec* tdsec = GET_THREAD_DATA; tsec* tdsec = GSEC_get_thread_data;
if (format[0] == '\0') { if (format[0] == '\0') {
exit_code = tdsec->tsec_output_proc(tdsec->tsec_output_data, exit_code = tdsec->tsec_output_proc(tdsec->tsec_output_data,
@ -1222,7 +1222,7 @@ void GSEC_error(
* *
**************************************/ **************************************/
#ifdef SUPERSERVER #ifdef SUPERSERVER
tsec* tdsec = GET_THREAD_DATA; tsec* tdsec = GSEC_get_thread_data;
ISC_STATUS* status = tdsec->tsec_service_blk->svc_status; ISC_STATUS* status = tdsec->tsec_service_blk->svc_status;
CMD_UTIL_put_svc_status(status, GSEC_MSG_FAC, errcode, CMD_UTIL_put_svc_status(status, GSEC_MSG_FAC, errcode,
@ -1232,7 +1232,7 @@ void GSEC_error(
isc_arg_string, arg4, isc_arg_string, arg5); isc_arg_string, arg4, isc_arg_string, arg5);
tdsec->tsec_service_blk->svc_started(); tdsec->tsec_service_blk->svc_started();
#else #else
tsec* tdsec = GET_THREAD_DATA; tsec* tdsec = GSEC_get_thread_data;
#endif #endif
GSEC_print(errcode, arg1, arg2, arg3, arg4, arg5); GSEC_print(errcode, arg1, arg2, arg3, arg4, arg5);

View File

@ -57,27 +57,6 @@ const int NAME_LEN = 33;
#include "../jrd/svc.h" #include "../jrd/svc.h"
#include "../jrd/svc_proto.h" #include "../jrd/svc_proto.h"
#ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA
#endif
#ifdef SET_THREAD_DATA
#undef SET_THREAD_DATA
#endif
#ifdef RESTORE_THREAD_DATA
#undef RESTORE_THREAD_DATA
#endif
#ifdef SUPERSERVER
#define GET_THREAD_DATA ((TSEC) THD_get_specific())
#define SET_THREAD_DATA THD_put_specific ((THDD) tdsec); \
tdsec->tsec_thd_data.thdd_type = THDD_TYPE_TSEC
#define RESTORE_THREAD_DATA THD_restore_specific();
#else
#define GET_THREAD_DATA (gdsec)
#define SET_THREAD_DATA gdsec = tdsec; \
tdsec->tsec_thd_data.thdd_type = THDD_TYPE_TSEC
#define RESTORE_THREAD_DATA
#endif
struct internal_user_data { struct internal_user_data {
int operation; /* what's to be done */ int operation; /* what's to be done */
TEXT user_name [USER_NAME_LEN]; /* the user's name */ TEXT user_name [USER_NAME_LEN]; /* the user's name */
@ -138,6 +117,21 @@ typedef struct tsec {
Jrd::Service* tsec_service_blk; Jrd::Service* tsec_service_blk;
} *TSEC; } *TSEC;
#ifdef SUPERSERVER
#define GSEC_get_thread_data ((TSEC) THD_get_specific())
#define GSEC_set_thread_data THD_put_specific ((THDD) tdsec); \
tdsec->tsec_thd_data.thdd_type = THDD_TYPE_TSEC
#define GSEC_restore_thread_data THD_restore_specific();
#else
extern struct tsec *gdsec;
#define GSEC_get_thread_data (gdsec)
#define GSEC_set_thread_data gdsec = tdsec; \
tdsec->tsec_thd_data.thdd_type = THDD_TYPE_TSEC
#define GSEC_restore_thread_data
#endif
const USHORT GsecMsg0 = 0; /* empty message */ const USHORT GsecMsg0 = 0; /* empty message */
const USHORT GsecMsg1 = 1; /* "GSEC> " (the prompt) */ const USHORT GsecMsg1 = 1; /* "GSEC> " (the prompt) */
const USHORT GsecMsg2 = 2; /* gsec (lower case version of the prompt for help display) */ const USHORT GsecMsg2 = 2; /* gsec (lower case version of the prompt for help display) */

View File

@ -214,23 +214,23 @@ struct tdba {
ISC_STATUS_ARRAY dba_status_vector; ISC_STATUS_ARRAY dba_status_vector;
}; };
#ifdef GET_THREAD_DATA #ifdef DBA_get_thread_data
#undef GET_THREAD_DATA #undef DBA_get_thread_data
#endif #endif
#ifdef SUPERSERVER #ifdef SUPERSERVER
#define GET_THREAD_DATA ((tdba*) THD_get_specific()) #define DBA_get_thread_data ((tdba*) THD_get_specific())
#define SET_THREAD_DATA { tddba = &thd_context; \ #define DBA_set_thread_data { tddba = &thd_context; \
THD_put_specific ((THDD) tddba);\ THD_put_specific ((THDD) tddba);\
tddba->tdba_thd_data.thdd_type = THDD_TYPE_TDBA; } tddba->tdba_thd_data.thdd_type = THDD_TYPE_TDBA; }
#define RESTORE_THREAD_DATA THD_restore_specific() #define DBA_restore_thread_data THD_restore_specific()
#else #else
static struct tdba* gddba; static struct tdba* gddba;
#define GET_THREAD_DATA (gddba) #define DBA_get_thread_data (gddba)
#define SET_THREAD_DATA gddba = tddba = &thd_context; \ #define DBA_set_thread_data gddba = tddba = &thd_context; \
tddba->tdba_thd_data.thdd_type = THDD_TYPE_TDBA tddba->tdba_thd_data.thdd_type = THDD_TYPE_TDBA
#define RESTORE_THREAD_DATA #define DBA_restore_thread_data
#endif #endif
void inline dba_exit(int code, tdba* tddba) void inline dba_exit(int code, tdba* tddba)
@ -290,7 +290,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
BOOL fAnsiCP; BOOL fAnsiCP;
#endif #endif
SET_THREAD_DATA; DBA_set_thread_data;
SVC_PUTSPECIFIC_DATA; SVC_PUTSPECIFIC_DATA;
memset(tddba, 0, sizeof(*tddba)); memset(tddba, 0, sizeof(*tddba));
tddba->dba_env = (UCHAR *) env; tddba->dba_env = (UCHAR *) env;
@ -923,7 +923,7 @@ int CLIB_ROUTINE main(int argc, char** argv)
#endif #endif
int exit_code = tddba->exit_code; int exit_code = tddba->exit_code;
RESTORE_THREAD_DATA; DBA_restore_thread_data;
#ifdef SUPERSERVER #ifdef SUPERSERVER
return exit_code; return exit_code;
@ -949,7 +949,7 @@ static char* alloc(size_t size)
* *
**************************************/ **************************************/
#ifdef SUPERSERVER #ifdef SUPERSERVER
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
char* const block = FB_NEW(*getDefaultMemoryPool()) SCHAR[size]; char* const block = FB_NEW(*getDefaultMemoryPool()) SCHAR[size];
#else #else
char* const block = (char*) gds__alloc(size); char* const block = (char*) gds__alloc(size);
@ -997,7 +997,7 @@ static void analyze_data( dba_rel* relation, bool sw_record)
* Analyze data pages associated with relation. * Analyze data pages associated with relation.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
pointer_page* ptr_page = (pointer_page*) tddba->buffer1; pointer_page* ptr_page = (pointer_page*) tddba->buffer1;
@ -1035,7 +1035,7 @@ static bool analyze_data_page( dba_rel* relation, const data_page* page, bool sw
* Analyze space utilization for data page. * Analyze space utilization for data page.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
if (page->pag_type != pag_data) if (page->pag_type != pag_data)
return false; return false;
@ -1102,7 +1102,7 @@ static ULONG analyze_fragments(const dba_rel* relation, const rhdf* header)
* Analyze space used by a record's fragments. * Analyze space used by a record's fragments.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
ULONG space = 0; ULONG space = 0;
while (header->rhdf_flags & rhd_incomplete) { while (header->rhdf_flags & rhd_incomplete) {
@ -1138,7 +1138,7 @@ static void analyze_index( dba_rel* relation, dba_idx* index)
* Functional description * Functional description
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
const index_root_page* index_root = const index_root_page* index_root =
(const index_root_page*) db_read(relation->rel_index_root); (const index_root_page*) db_read(relation->rel_index_root);
@ -1262,7 +1262,7 @@ static ULONG analyze_versions( dba_rel* relation, const rhdf* header)
* Analyze space used by a record's back versions. * Analyze space used by a record's back versions.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
ULONG space = 0, versions = 0; ULONG space = 0, versions = 0;
SLONG b_page = header->rhdf_b_page; SLONG b_page = header->rhdf_b_page;
USHORT b_line = header->rhdf_b_line; USHORT b_line = header->rhdf_b_line;
@ -1330,7 +1330,7 @@ static void db_error( SLONG status)
**************************************/ **************************************/
TEXT s[128]; TEXT s[128];
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
tddba->page_number = -1; tddba->page_number = -1;
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
@ -1362,7 +1362,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
* Open a database file. * Open a database file.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
dba_fil* fil; dba_fil* fil;
@ -1440,7 +1440,7 @@ static const pag* db_read( SLONG page_number)
* Read a database page. * Read a database page.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
if (tddba->page_number == page_number) if (tddba->page_number == page_number)
return tddba->global_buffer; return tddba->global_buffer;
@ -1531,7 +1531,7 @@ static void db_error( int status)
* Functional description * Functional description
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
tddba->page_number = -1; tddba->page_number = -1;
/* FIXME: The strerror() function returns the appropriate description /* FIXME: The strerror() function returns the appropriate description
@ -1571,7 +1571,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
* Put the file on an ordered list. * Put the file on an ordered list.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
dba_fil* fil; dba_fil* fil;
if (tddba->files) { if (tddba->files) {
@ -1639,7 +1639,7 @@ static const pag* db_read( SLONG page_number)
* Read a database page. * Read a database page.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
if (tddba->page_number == page_number) if (tddba->page_number == page_number)
return tddba->global_buffer; return tddba->global_buffer;
@ -1713,7 +1713,7 @@ static void dba_error(
* Format and print an error message, then punt. * Format and print an error message, then punt.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
tddba->page_number = -1; tddba->page_number = -1;
dba_print(errcode, arg1, arg2, arg3, arg4, arg5); dba_print(errcode, arg1, arg2, arg3, arg4, arg5);
@ -1738,7 +1738,7 @@ static void dba_print(
* *
**************************************/ **************************************/
TEXT buffer[256]; TEXT buffer[256];
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
gds__msg_format(NULL, GSTAT_MSG_FAC, number, sizeof(buffer), buffer, gds__msg_format(NULL, GSTAT_MSG_FAC, number, sizeof(buffer), buffer,
arg1, arg2, arg3, arg4, arg5); arg1, arg2, arg3, arg4, arg5);
@ -1776,7 +1776,7 @@ static void print_distribution(const SCHAR* prefix, const SLONG* vector)
* Print distribution as percentages. * Print distribution as percentages.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
for (SSHORT n = 0; n < BUCKETS; n++) { for (SSHORT n = 0; n < BUCKETS; n++) {
FPRINTF(tddba->sw_outfile, "%s%2d - %2d%% = %ld\n", FPRINTF(tddba->sw_outfile, "%s%2d - %2d%% = %ld\n",

View File

@ -148,16 +148,12 @@ struct tdba {
FILE* sw_outfile; FILE* sw_outfile;
}; };
#ifdef GET_THREAD_DATA
#undef GET_THREAD_DATA
#endif
static tdba* gddba; static tdba* gddba;
#define GET_THREAD_DATA (gddba) #define DBA_get_thread_data (gddba)
#define SET_THREAD_DATA gddba = tddba = &thd_context; \ #define DBA_set_thread_data gddba = tddba = &thd_context; \
tddba->tdba_thd_data.thdd_type = THDD_TYPE_TDBA tddba->tdba_thd_data.thdd_type = THDD_TYPE_TDBA
#define RESTORE_THREAD_DATA #define DBA_restore_thread_data
void inline dba_full_exit(int code, tdba* tddba) void inline dba_full_exit(int code, tdba* tddba)
{ {
@ -183,7 +179,7 @@ int CLIB_ROUTINE main( int argc, char** argv)
JMP_BUF env; JMP_BUF env;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
SET_THREAD_DATA; DBA_set_thread_data;
memset(tddba, 0, sizeof(*tddba)); memset(tddba, 0, sizeof(*tddba));
memset(&status_vector, 0, sizeof(status_vector)); memset(&status_vector, 0, sizeof(status_vector));
tddba->dba_env = (UCHAR*) env; tddba->dba_env = (UCHAR*) env;
@ -203,7 +199,7 @@ int CLIB_ROUTINE main( int argc, char** argv)
} }
const int exit_code = tddba->exit_code; const int exit_code = tddba->exit_code;
RESTORE_THREAD_DATA; DBA_restore_thread_data;
exit(exit_code); exit(exit_code);
} }
FILE* sw_outfile = tddba->sw_outfile = stderr; FILE* sw_outfile = tddba->sw_outfile = stderr;
@ -621,7 +617,7 @@ static void analyze_data( dba_rel* relation)
* Analyze data pages associated with relation. * Analyze data pages associated with relation.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
pointer_page* ptr_page = (pointer_page*) tddba->buffer1; pointer_page* ptr_page = (pointer_page*) tddba->buffer1;
@ -657,7 +653,7 @@ static bool analyze_data_page( dba_rel* relation, const data_page* page)
* Analyze space utilization for data page. * Analyze space utilization for data page.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
if (page->pag_type != pag_data) if (page->pag_type != pag_data)
return false; return false;
@ -699,7 +695,7 @@ static void analyze_index( dba_rel* relation, idx* index)
UCHAR key[256], *p, *q; UCHAR key[256], *p, *q;
SLONG number, page, prior_page, node_count; SLONG number, page, prior_page, node_count;
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
index_root_page* index_root = index_root_page* index_root =
(const index_root_page*) db_read(relation->rel_index_root); (const index_root_page*) db_read(relation->rel_index_root);
@ -972,7 +968,7 @@ static void db_error( SLONG status)
**************************************/ **************************************/
TEXT s[128]; TEXT s[128];
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, if (!FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL, NULL,
@ -1005,7 +1001,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
**************************************/ **************************************/
dba_fil* fil; dba_fil* fil;
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
if (tddba->files) { if (tddba->files) {
for (fil = tddba->files; fil->fil_next; fil = fil->fil_next); for (fil = tddba->files; fil->fil_next; fil = fil->fil_next);
@ -1053,7 +1049,7 @@ static const pag* db_read( SLONG page_number)
* Read a database page. * Read a database page.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
dba_fil* fil; dba_fil* fil;
for (fil = tddba->files; for (fil = tddba->files;
@ -1102,7 +1098,7 @@ static void db_error( int status)
* Functional description * Functional description
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
/* FIXME: The strerror() function returns the appropriate description /* FIXME: The strerror() function returns the appropriate description
string, or an unknown error message if the error code is unknown. string, or an unknown error message if the error code is unknown.
@ -1141,7 +1137,7 @@ static dba_fil* db_open(const char* file_name, USHORT file_length)
* *
**************************************/ **************************************/
dba_fil* fil; dba_fil* fil;
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
if (tddba->files) { if (tddba->files) {
for (fil = tddba->files; fil->fil_next; fil = fil->fil_next); for (fil = tddba->files; fil->fil_next; fil = fil->fil_next);
@ -1182,7 +1178,7 @@ static const pag* db_read( SLONG page_number)
* Read a database page. * Read a database page.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
dba_fil* fil; dba_fil* fil;
for (fil = tddba->files; for (fil = tddba->files;
@ -1277,7 +1273,7 @@ static void print_distribution( const SCHAR* prefix, const SLONG* vector)
* Print distribution as percentages. * Print distribution as percentages.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
for (SSHORT n = 0; n < BUCKETS; n++) { for (SSHORT n = 0; n < BUCKETS; n++) {
FPRINTF(tddba->sw_outfile, "%s%2d - %2d%% = %ld\n", FPRINTF(tddba->sw_outfile, "%s%2d - %2d%% = %ld\n",
@ -1299,7 +1295,7 @@ static void print_header( const header_page* header)
* Print database header page. * Print database header page.
* *
**************************************/ **************************************/
tdba* tddba = GET_THREAD_DATA; tdba* tddba = DBA_get_thread_data;
FILE* sw_outfile = tddba->sw_outfile; FILE* sw_outfile = tddba->sw_outfile;
FPRINTF(sw_outfile, "Database header page information:\n"); FPRINTF(sw_outfile, "Database header page information:\n");