mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:03:03 +01:00
Partial commit with some cleanup and more constants.
This commit is contained in:
parent
ef6f5217fc
commit
8e7e781e5f
@ -1503,11 +1503,12 @@ static void cmp_slice( gpre_req* request)
|
|||||||
request->add_byte(isc_sdl_field);
|
request->add_byte(isc_sdl_field);
|
||||||
CMP_stuff_symbol(request, field->fld_symbol);
|
CMP_stuff_symbol(request, field->fld_symbol);
|
||||||
|
|
||||||
bool loop_flags[16];
|
bool loop_flags[MAX_ARRAY_DIMENSIONS];
|
||||||
{ // scope block
|
{ // scope block
|
||||||
USHORT n = 0;
|
fb_assert(slice->slc_dimensions <= MAX_ARRAY_DIMENSIONS);
|
||||||
for (bool* p = loop_flags; n < slice->slc_dimensions; n++, p++)
|
USHORT n = 0;
|
||||||
*p = cmp_sdl_loop(request, n, slice, array);
|
for (bool* p = loop_flags; n < slice->slc_dimensions; n++, p++)
|
||||||
|
*p = cmp_sdl_loop(request, n, slice, array);
|
||||||
} // end scope block
|
} // end scope block
|
||||||
|
|
||||||
request->add_byte(isc_sdl_element);
|
request->add_byte(isc_sdl_element);
|
||||||
|
@ -47,6 +47,7 @@
|
|||||||
|
|
||||||
#include "../jrd/event.h"
|
#include "../jrd/event.h"
|
||||||
#include "../jrd/alt_proto.h"
|
#include "../jrd/alt_proto.h"
|
||||||
|
#include "../jrd/constants.h"
|
||||||
|
|
||||||
#if !defined(SUPERSERVER) || defined(EMBEDDED) || defined(SUPERCLIENT)
|
#if !defined(SUPERSERVER) || defined(EMBEDDED) || defined(SUPERCLIENT)
|
||||||
#if !defined(BOOT_BUILD)
|
#if !defined(BOOT_BUILD)
|
||||||
@ -246,7 +247,7 @@ struct teb_t {
|
|||||||
UCHAR* teb_tpb;
|
UCHAR* teb_tpb;
|
||||||
};
|
};
|
||||||
|
|
||||||
teb_t tebs[16];
|
teb_t tebs[MAX_DB_PER_TRANS];
|
||||||
teb_t* teb;
|
teb_t* teb;
|
||||||
va_list ptr;
|
va_list ptr;
|
||||||
|
|
||||||
|
@ -159,6 +159,8 @@ const size_t MAX_SORT_ITEMS = 255; // ORDER BY f1,...,f255
|
|||||||
|
|
||||||
const size_t MAX_TABLE_VERSIONS = 255; // maybe this should be in ods.h.
|
const size_t MAX_TABLE_VERSIONS = 255; // maybe this should be in ods.h.
|
||||||
|
|
||||||
|
const size_t MAX_DB_PER_TRANS = 16; // A multi-db txn can span up to 16 dbs
|
||||||
|
|
||||||
// relation types
|
// relation types
|
||||||
|
|
||||||
enum rel_t {
|
enum rel_t {
|
||||||
|
@ -3816,24 +3816,22 @@ ISC_STATUS GDS_START_MULTIPLE(ISC_STATUS * user_status,
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
for (v = vector; v < end; v++)
|
for (v = vector; v < end; v++)
|
||||||
{
|
{
|
||||||
Attachment* attachment = *v->teb_database;
|
Attachment* attachment = *v->teb_database;
|
||||||
if (check_database(tdbb, attachment, user_status)) {
|
if (check_database(tdbb, attachment, user_status)) {
|
||||||
return user_status[1];
|
return user_status[1];
|
||||||
}
|
}
|
||||||
#ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
|
#ifdef REPLAY_OSRI_API_CALLS_SUBSYSTEM
|
||||||
LOG_call(log_start_multiple, *tra_handle, count, vector);
|
LOG_call(log_start_multiple, *tra_handle, count, vector);
|
||||||
#endif
|
#endif
|
||||||
tdbb->tdbb_status_vector = user_status;
|
tdbb->tdbb_status_vector = user_status;
|
||||||
transaction =
|
transaction = TRA_start(tdbb, v->teb_tpb_length, v->teb_tpb);
|
||||||
TRA_start(tdbb, v->teb_tpb_length,
|
transaction->tra_sibling = prior;
|
||||||
reinterpret_cast<const char*>(v->teb_tpb));
|
prior = transaction;
|
||||||
transaction->tra_sibling = prior;
|
Database* dbb = tdbb->tdbb_database;
|
||||||
prior = transaction;
|
--dbb->dbb_use_count;
|
||||||
Database* dbb = tdbb->tdbb_database;
|
}
|
||||||
--dbb->dbb_use_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // try
|
} // try
|
||||||
catch (const Firebird::Exception& ex) {
|
catch (const Firebird::Exception& ex) {
|
||||||
|
@ -557,6 +557,9 @@ static void log_teb(SSHORT count, const TEB* vector)
|
|||||||
* Log a transaction element block.
|
* Log a transaction element block.
|
||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
|
if (count < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
for (TEB* const end = vector + count; vector < end; vector++) {
|
for (TEB* const end = vector + count; vector < end; vector++) {
|
||||||
log_pointer(*vector->teb_database);
|
log_pointer(*vector->teb_database);
|
||||||
log_long((SLONG) vector->teb_tpb_length);
|
log_long((SLONG) vector->teb_tpb_length);
|
||||||
|
@ -61,7 +61,7 @@ int rdb$vmspas_init(int dbcount, int *d)
|
|||||||
* Mimic RdB's rdb$vmspas_init
|
* Mimic RdB's rdb$vmspas_init
|
||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
TEB tebs[16];
|
TEB tebs[MAX_DB_PER_TRANS];
|
||||||
struct dsc$descriptor_s *dbname;
|
struct dsc$descriptor_s *dbname;
|
||||||
|
|
||||||
int stat = 1;
|
int stat = 1;
|
||||||
|
@ -50,7 +50,7 @@ struct sdl_arg {
|
|||||||
ISC_STATUS* sdl_arg_status_vector;
|
ISC_STATUS* sdl_arg_status_vector;
|
||||||
IPTR sdl_arg_compiled[COMPILE_SIZE];
|
IPTR sdl_arg_compiled[COMPILE_SIZE];
|
||||||
IPTR* sdl_arg_next;
|
IPTR* sdl_arg_next;
|
||||||
IPTR* sdl_arg_end;
|
const IPTR* sdl_arg_end;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Structure to computes ranges */
|
/* Structure to computes ranges */
|
||||||
@ -424,7 +424,7 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
|
|||||||
**************************************/
|
**************************************/
|
||||||
SLONG n, count, variable, value, sdl_operator;
|
SLONG n, count, variable, value, sdl_operator;
|
||||||
IPTR* label;
|
IPTR* label;
|
||||||
const UCHAR* expressions[16];
|
const UCHAR* expressions[MAX_ARRAY_DIMENSIONS];
|
||||||
const UCHAR** expr;
|
const UCHAR** expr;
|
||||||
|
|
||||||
#define STUFF(word, arg) if (!stuff ((IPTR) word, arg)) return NULL
|
#define STUFF(word, arg) if (!stuff ((IPTR) word, arg)) return NULL
|
||||||
|
@ -33,8 +33,8 @@ struct sdl_info {
|
|||||||
Firebird::MetaName sdl_info_relation;
|
Firebird::MetaName sdl_info_relation;
|
||||||
dsc sdl_info_element;
|
dsc sdl_info_element;
|
||||||
USHORT sdl_info_dimensions;
|
USHORT sdl_info_dimensions;
|
||||||
SLONG sdl_info_lower[16];
|
SLONG sdl_info_lower[MAX_ARRAY_DIMENSIONS];
|
||||||
SLONG sdl_info_upper[16];
|
SLONG sdl_info_upper[MAX_ARRAY_DIMENSIONS];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1493,7 +1493,7 @@ int TRA_snapshot_state(thread_db* tdbb, const jrd_tra* trans, SLONG number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const SCHAR* tpb)
|
jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const UCHAR* tpb)
|
||||||
{
|
{
|
||||||
/**************************************
|
/**************************************
|
||||||
*
|
*
|
||||||
@ -1524,8 +1524,7 @@ jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const SCHAR* tpb)
|
|||||||
Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool());
|
Jrd::ContextPoolHolder context(tdbb, JrdMemoryPool::createPool());
|
||||||
jrd_tra* temp = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
|
jrd_tra* temp = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
|
||||||
temp->tra_pool = tdbb->getDefaultPool();
|
temp->tra_pool = tdbb->getDefaultPool();
|
||||||
transaction_options(tdbb, temp, reinterpret_cast<const UCHAR*>(tpb),
|
transaction_options(tdbb, temp, tpb, tpb_length);
|
||||||
tpb_length);
|
|
||||||
|
|
||||||
Lock* lock = TRA_transaction_lock(tdbb, temp);
|
Lock* lock = TRA_transaction_lock(tdbb, temp);
|
||||||
|
|
||||||
@ -1797,7 +1796,8 @@ jrd_tra* TRA_start(thread_db* tdbb, int tpb_length, const SCHAR* tpb)
|
|||||||
undo the transaction if it rolls back. */
|
undo the transaction if it rolls back. */
|
||||||
|
|
||||||
if ((trans != dbb->dbb_sys_trans) &&
|
if ((trans != dbb->dbb_sys_trans) &&
|
||||||
!(trans->tra_flags & TRA_no_auto_undo)) {
|
!(trans->tra_flags & TRA_no_auto_undo))
|
||||||
|
{
|
||||||
VIO_start_save_point(tdbb, trans);
|
VIO_start_save_point(tdbb, trans);
|
||||||
trans->tra_save_point->sav_flags |= SAV_trans_level;
|
trans->tra_save_point->sav_flags |= SAV_trans_level;
|
||||||
}
|
}
|
||||||
@ -1926,9 +1926,7 @@ bool TRA_sweep(thread_db* tdbb, jrd_tra* trans)
|
|||||||
below to advance the OIT we must save it before it changes. */
|
below to advance the OIT we must save it before it changes. */
|
||||||
|
|
||||||
if (!(transaction = trans))
|
if (!(transaction = trans))
|
||||||
transaction = TRA_start(tdbb,
|
transaction = TRA_start(tdbb, sizeof(sweep_tpb), sweep_tpb);
|
||||||
sizeof(sweep_tpb),
|
|
||||||
reinterpret_cast<const char*>(sweep_tpb));
|
|
||||||
|
|
||||||
SLONG transaction_oldest_active = transaction->tra_oldest_active;
|
SLONG transaction_oldest_active = transaction->tra_oldest_active;
|
||||||
tdbb->tdbb_transaction = transaction;
|
tdbb->tdbb_transaction = transaction;
|
||||||
@ -2998,7 +2996,7 @@ static void transaction_options(
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (USHORT l = 0; l < id; l++) {
|
for (ULONG l = 0; l < id; l++) {
|
||||||
if ( (lock = (*vector)[l]) ) {
|
if ( (lock = (*vector)[l]) ) {
|
||||||
level = lock->lck_logical;
|
level = lock->lck_logical;
|
||||||
LCK_release(tdbb, lock);
|
LCK_release(tdbb, lock);
|
||||||
|
@ -56,7 +56,7 @@ void TRA_rollback(Jrd::thread_db*, Jrd::jrd_tra*, const bool, const bool);
|
|||||||
void TRA_set_state(Jrd::thread_db*, Jrd::jrd_tra*, SLONG, SSHORT);
|
void TRA_set_state(Jrd::thread_db*, Jrd::jrd_tra*, SLONG, SSHORT);
|
||||||
void TRA_shutdown_attachment(Jrd::thread_db*, Jrd::Attachment*);
|
void TRA_shutdown_attachment(Jrd::thread_db*, Jrd::Attachment*);
|
||||||
int TRA_snapshot_state(Jrd::thread_db*, const Jrd::jrd_tra*, SLONG);
|
int TRA_snapshot_state(Jrd::thread_db*, const Jrd::jrd_tra*, SLONG);
|
||||||
Jrd::jrd_tra* TRA_start(Jrd::thread_db*, int, const SCHAR*);
|
Jrd::jrd_tra* TRA_start(Jrd::thread_db*, int, const UCHAR*);
|
||||||
int TRA_state(const UCHAR*, ULONG, ULONG);
|
int TRA_state(const UCHAR*, ULONG, ULONG);
|
||||||
bool TRA_sweep(Jrd::thread_db*, Jrd::jrd_tra*);
|
bool TRA_sweep(Jrd::thread_db*, Jrd::jrd_tra*);
|
||||||
Jrd::Lock* TRA_transaction_lock(Jrd::thread_db*, blk*);
|
Jrd::Lock* TRA_transaction_lock(Jrd::thread_db*, blk*);
|
||||||
|
@ -130,7 +130,7 @@ static void verb_post(thread_db*, jrd_tra*, record_param*, Record*, record_param
|
|||||||
#include "../jrd/ini.h"
|
#include "../jrd/ini.h"
|
||||||
|
|
||||||
#ifdef GARBAGE_THREAD
|
#ifdef GARBAGE_THREAD
|
||||||
static const SCHAR gc_tpb[] = { isc_tpb_version1, isc_tpb_read,
|
static const UCHAR gc_tpb[] = { isc_tpb_version1, isc_tpb_read,
|
||||||
isc_tpb_read_committed, isc_tpb_rec_version,
|
isc_tpb_read_committed, isc_tpb_rec_version,
|
||||||
isc_tpb_ignore_limbo
|
isc_tpb_ignore_limbo
|
||||||
};
|
};
|
||||||
|
@ -91,6 +91,7 @@
|
|||||||
#include "../jrd/why_proto.h"
|
#include "../jrd/why_proto.h"
|
||||||
#include "../common/classes/rwlock.h"
|
#include "../common/classes/rwlock.h"
|
||||||
#include "../common/classes/auto.h"
|
#include "../common/classes/auto.h"
|
||||||
|
#include "../jrd/constants.h"
|
||||||
|
|
||||||
|
|
||||||
// In 2.0 it's hard to include ibase.h in why.cpp due to API declaration conflicts.
|
// In 2.0 it's hard to include ibase.h in why.cpp due to API declaration conflicts.
|
||||||
@ -5092,7 +5093,7 @@ ISC_STATUS API_ROUTINE_VARARG GDS_START_TRANSACTION(ISC_STATUS * user_status,
|
|||||||
* Start a transaction.
|
* Start a transaction.
|
||||||
*
|
*
|
||||||
**************************************/
|
**************************************/
|
||||||
TEB tebs[16], *teb, *end;
|
TEB tebs[MAX_DB_PER_TRANS], *teb, *end;
|
||||||
ISC_STATUS status;
|
ISC_STATUS status;
|
||||||
va_list ptr;
|
va_list ptr;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user