8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 15:23:03 +01:00

Pass some tdbb's as arguments.

This commit is contained in:
robocop 2008-03-18 13:04:05 +00:00
parent e632ad961d
commit f5db14b277
6 changed files with 33 additions and 31 deletions

View File

@ -265,7 +265,8 @@ static const deferred_task task_table[] =
}; };
USHORT DFW_assign_index_type(DeferredWork* work, SSHORT field_type, SSHORT ttype) USHORT DFW_assign_index_type(thread_db* tdbb,
DeferredWork* work, SSHORT field_type, SSHORT ttype)
{ {
/************************************** /**************************************
* *
@ -278,7 +279,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 = JRD_get_thread_data(); SET_TDBB(tdbb);
if (field_type == dtype_varying || if (field_type == dtype_varying ||
field_type == dtype_cstring || field_type == dtype_cstring ||
@ -443,7 +444,7 @@ void DFW_merge_work(jrd_tra* transaction,
} }
void DFW_perform_system_work(void) void DFW_perform_system_work(thread_db* tdbb)
{ {
/************************************** /**************************************
* *
@ -456,13 +457,14 @@ void DFW_perform_system_work(void)
* system transaction. * system transaction.
* *
**************************************/ **************************************/
Database* dbb = GET_DBB(); SET_TDBB(tdbb);
Database* dbb = tdbb->getDatabase();
DFW_perform_work(dbb->dbb_sys_trans); DFW_perform_work(tdbb, dbb->dbb_sys_trans);
} }
void DFW_perform_work(jrd_tra* transaction) void DFW_perform_work(thread_db* tdbb, jrd_tra* transaction)
{ {
/************************************** /**************************************
* *
@ -475,7 +477,6 @@ void DFW_perform_work(jrd_tra* transaction)
* come. * come.
* *
**************************************/ **************************************/
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 */
@ -486,6 +487,7 @@ void DFW_perform_work(jrd_tra* transaction)
return; return;
} }
SET_TDBB(tdbb);
Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool); Jrd::ContextPoolHolder context(tdbb, transaction->tra_pool);
/* Loop for as long as any of the deferred work routines says that it has /* Loop for as long as any of the deferred work routines says that it has
@ -1868,7 +1870,7 @@ static bool create_index( thread_db* tdbb,
const SSHORT text_type = const SSHORT text_type =
INTL_CS_COLL_TO_TTYPE(FLD.RDB$CHARACTER_SET_ID, collate); INTL_CS_COLL_TO_TTYPE(FLD.RDB$CHARACTER_SET_ID, collate);
idx.idx_rpt[SEG.RDB$FIELD_POSITION].idx_itype = idx.idx_rpt[SEG.RDB$FIELD_POSITION].idx_itype =
DFW_assign_index_type(work, DFW_assign_index_type(tdbb, work,
gds_cvt_blr_dtype[FLD.RDB$FIELD_TYPE], gds_cvt_blr_dtype[FLD.RDB$FIELD_TYPE],
text_type); text_type);

View File

@ -24,11 +24,11 @@
#ifndef JRD_DFW_PROTO_H #ifndef JRD_DFW_PROTO_H
#define JRD_DFW_PROTO_H #define JRD_DFW_PROTO_H
USHORT DFW_assign_index_type(Jrd::DeferredWork*, SSHORT, SSHORT); USHORT DFW_assign_index_type(Jrd::thread_db*, Jrd::DeferredWork*, SSHORT, SSHORT);
void DFW_delete_deferred(Jrd::jrd_tra*, SLONG); void DFW_delete_deferred(Jrd::jrd_tra*, SLONG);
void DFW_merge_work(Jrd::jrd_tra*, SLONG, SLONG); void DFW_merge_work(Jrd::jrd_tra*, SLONG, SLONG);
void DFW_perform_system_work(void); void DFW_perform_system_work(Jrd::thread_db*);
void DFW_perform_work(Jrd::jrd_tra*); void DFW_perform_work(Jrd::thread_db*, Jrd::jrd_tra*);
void DFW_perform_post_commit_work(Jrd::jrd_tra*); void DFW_perform_post_commit_work(Jrd::jrd_tra*);
Jrd::DeferredWork* DFW_post_work(Jrd::jrd_tra*, enum Jrd::dfw_t, const dsc*, USHORT); Jrd::DeferredWork* DFW_post_work(Jrd::jrd_tra*, enum Jrd::dfw_t, const dsc*, USHORT);
Jrd::DeferredWork* DFW_post_work_arg(Jrd::jrd_tra*, Jrd::DeferredWork*, const dsc*, USHORT); Jrd::DeferredWork* DFW_post_work_arg(Jrd::jrd_tra*, Jrd::DeferredWork*, const dsc*, USHORT);

View File

@ -143,7 +143,6 @@ bool GRANT_privileges( thread_db* tdbb, SSHORT phase, DeferredWork* work,
* the order of operations lightly. * the order of operations lightly.
* *
**************************************/ **************************************/
switch (phase) { switch (phase) {
case 1: case 1:
case 2: case 2:
@ -263,10 +262,11 @@ bool GRANT_privileges( thread_db* tdbb, SSHORT phase, DeferredWork* work,
} }
default: default:
SET_TDBB(tdbb);
break; break;
} }
DFW_perform_system_work(); DFW_perform_system_work(tdbb);
return false; return false;
} }

View File

@ -67,10 +67,10 @@ const char* DEFAULT_CLASS = "SQL$DEFAULT";
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
static void add_generator(TEXT*, jrd_req**); static void add_generator(TEXT*, jrd_req**);
#endif #endif
static void add_global_fields(USHORT); static void add_global_fields(thread_db*, USHORT);
static void add_index_set(Database*, bool, USHORT, USHORT); static void add_index_set(Database*, bool, USHORT, USHORT);
static void add_new_triggers(USHORT, USHORT); static void add_new_triggers(USHORT, USHORT);
static void add_relation_fields(USHORT); static void add_relation_fields(thread_db*, USHORT);
static void add_security_to_sys_rel(thread_db*, const Firebird::MetaName&, static void add_security_to_sys_rel(thread_db*, const Firebird::MetaName&,
const TEXT*, const UCHAR*, const SSHORT); const TEXT*, const UCHAR*, const SSHORT);
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
@ -468,9 +468,9 @@ void INI_format(const TEXT* owner, const TEXT* charset)
store_functions(tdbb, dbb); store_functions(tdbb, dbb);
DFW_perform_system_work(); DFW_perform_system_work(tdbb);
add_relation_fields(0); add_relation_fields(tdbb, 0);
/* /*
==================================================================== ====================================================================
@ -843,13 +843,13 @@ void INI_update_database()
which holds their information needs to have an additional field which holds their information needs to have an additional field
to define which major ODS version they belong to. to define which major ODS version they belong to.
PENDING WORK. PENDING WORK.
add_global_fields (major_version, minor_version); add_global_fields (tdbb, major_version, minor_version);
add_relation_fields (major_version, minor_version); add_relation_fields (tdbb, major_version, minor_version);
Look at add_new_triggers() for reference. Look at add_new_triggers() for reference.
***/ ***/
add_global_fields(minor_version); add_global_fields(tdbb, minor_version);
add_relation_fields(minor_version); add_relation_fields(tdbb, minor_version);
} }
add_index_set(dbb, true, major_version, minor_version); add_index_set(dbb, true, major_version, minor_version);
@ -888,7 +888,7 @@ void INI_update_database()
dbb->dbb_minor_version = header->hdr_ods_minor; dbb->dbb_minor_version = header->hdr_ods_minor;
CCH_RELEASE(tdbb, &window); CCH_RELEASE(tdbb, &window);
DFW_perform_system_work(); DFW_perform_system_work(tdbb);
} }
#ifdef NOT_USED_OR_REPLACED #ifdef NOT_USED_OR_REPLACED
@ -923,7 +923,7 @@ static void add_generator(TEXT* generator_name, jrd_req** handle)
} }
#endif #endif
static void add_global_fields( USHORT minor_version) static void add_global_fields(thread_db* tdbb, USHORT minor_version)
{ {
/************************************** /**************************************
* *
@ -938,7 +938,7 @@ static void add_global_fields( USHORT minor_version)
* ODS change. * ODS change.
* *
**************************************/ **************************************/
thread_db* tdbb = JRD_get_thread_data(); SET_TDBB(tdbb);
/* add desired global fields to system relations */ /* add desired global fields to system relations */
@ -955,7 +955,7 @@ static void add_global_fields( USHORT minor_version)
CMP_release(tdbb, handle); CMP_release(tdbb, handle);
} }
DFW_perform_system_work(); DFW_perform_system_work(tdbb);
} }
@ -1102,7 +1102,7 @@ static void add_new_triggers(USHORT major_version, USHORT minor_version)
} }
static void add_relation_fields( USHORT minor_version) static void add_relation_fields(thread_db* tdbb, USHORT minor_version)
{ {
/************************************** /**************************************
* *
@ -1117,7 +1117,7 @@ static void add_relation_fields( USHORT minor_version)
* ODS change. * ODS change.
* *
**************************************/ **************************************/
thread_db* tdbb = JRD_get_thread_data(); SET_TDBB(tdbb);
Database* dbb = tdbb->getDatabase(); Database* dbb = tdbb->getDatabase();
/* add desired fields to system relations, forcing a new format version */ /* add desired fields to system relations, forcing a new format version */
@ -1160,7 +1160,7 @@ static void add_relation_fields( USHORT minor_version)
CMP_release(tdbb, m_handle); CMP_release(tdbb, m_handle);
} }
DFW_perform_system_work(); DFW_perform_system_work(tdbb);
} }

View File

@ -177,7 +177,7 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
CMP_get_desc(tdbb, csb, idx.idx_expression, CMP_get_desc(tdbb, csb, idx.idx_expression,
&idx.idx_expression_desc); &idx.idx_expression_desc);
idx.idx_rpt[0].idx_itype = idx.idx_rpt[0].idx_itype =
DFW_assign_index_type(work, DFW_assign_index_type(tdbb, work,
idx.idx_expression_desc.dsc_dtype, idx.idx_expression_desc.dsc_dtype,
idx.idx_expression_desc.dsc_sub_type); idx.idx_expression_desc.dsc_sub_type);
idx.idx_rpt[0].idx_selectivity = 0; idx.idx_rpt[0].idx_selectivity = 0;

View File

@ -424,7 +424,7 @@ void TRA_commit(thread_db* tdbb, jrd_tra* transaction, const bool retaining_flag
/* Perform any meta data work deferred */ /* Perform any meta data work deferred */
if (!(transaction->tra_flags & TRA_prepared)) if (!(transaction->tra_flags & TRA_prepared))
DFW_perform_work(transaction); DFW_perform_work(tdbb, transaction);
if (transaction->tra_flags & (TRA_prepare2 | TRA_reconnected)) if (transaction->tra_flags & (TRA_prepare2 | TRA_reconnected))
MET_update_transaction(tdbb, transaction, true); MET_update_transaction(tdbb, transaction, true);
@ -964,7 +964,7 @@ void TRA_prepare(thread_db* tdbb, jrd_tra* transaction, USHORT length,
/* Perform any meta data work deferred */ /* Perform any meta data work deferred */
DFW_perform_work(transaction); DFW_perform_work(tdbb, transaction);
#ifdef GARBAGE_THREAD #ifdef GARBAGE_THREAD
/* Flush pages if transaction logically modified data */ /* Flush pages if transaction logically modified data */