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);
|
||||
CMP_stuff_symbol(request, field->fld_symbol);
|
||||
|
||||
bool loop_flags[16];
|
||||
bool loop_flags[MAX_ARRAY_DIMENSIONS];
|
||||
{ // scope block
|
||||
USHORT n = 0;
|
||||
for (bool* p = loop_flags; n < slice->slc_dimensions; n++, p++)
|
||||
*p = cmp_sdl_loop(request, n, slice, array);
|
||||
fb_assert(slice->slc_dimensions <= MAX_ARRAY_DIMENSIONS);
|
||||
USHORT n = 0;
|
||||
for (bool* p = loop_flags; n < slice->slc_dimensions; n++, p++)
|
||||
*p = cmp_sdl_loop(request, n, slice, array);
|
||||
} // end scope block
|
||||
|
||||
request->add_byte(isc_sdl_element);
|
||||
|
@ -47,6 +47,7 @@
|
||||
|
||||
#include "../jrd/event.h"
|
||||
#include "../jrd/alt_proto.h"
|
||||
#include "../jrd/constants.h"
|
||||
|
||||
#if !defined(SUPERSERVER) || defined(EMBEDDED) || defined(SUPERCLIENT)
|
||||
#if !defined(BOOT_BUILD)
|
||||
@ -246,7 +247,7 @@ struct teb_t {
|
||||
UCHAR* teb_tpb;
|
||||
};
|
||||
|
||||
teb_t tebs[16];
|
||||
teb_t tebs[MAX_DB_PER_TRANS];
|
||||
teb_t* teb;
|
||||
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_DB_PER_TRANS = 16; // A multi-db txn can span up to 16 dbs
|
||||
|
||||
// relation types
|
||||
|
||||
enum rel_t {
|
||||
|
@ -3816,24 +3816,22 @@ ISC_STATUS GDS_START_MULTIPLE(ISC_STATUS * user_status,
|
||||
|
||||
try {
|
||||
|
||||
for (v = vector; v < end; v++)
|
||||
{
|
||||
Attachment* attachment = *v->teb_database;
|
||||
if (check_database(tdbb, attachment, user_status)) {
|
||||
return user_status[1];
|
||||
}
|
||||
for (v = vector; v < end; v++)
|
||||
{
|
||||
Attachment* attachment = *v->teb_database;
|
||||
if (check_database(tdbb, attachment, user_status)) {
|
||||
return user_status[1];
|
||||
}
|
||||
#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
|
||||
tdbb->tdbb_status_vector = user_status;
|
||||
transaction =
|
||||
TRA_start(tdbb, v->teb_tpb_length,
|
||||
reinterpret_cast<const char*>(v->teb_tpb));
|
||||
transaction->tra_sibling = prior;
|
||||
prior = transaction;
|
||||
Database* dbb = tdbb->tdbb_database;
|
||||
--dbb->dbb_use_count;
|
||||
}
|
||||
tdbb->tdbb_status_vector = user_status;
|
||||
transaction = TRA_start(tdbb, v->teb_tpb_length, v->teb_tpb);
|
||||
transaction->tra_sibling = prior;
|
||||
prior = transaction;
|
||||
Database* dbb = tdbb->tdbb_database;
|
||||
--dbb->dbb_use_count;
|
||||
}
|
||||
|
||||
} // try
|
||||
catch (const Firebird::Exception& ex) {
|
||||
|
@ -557,6 +557,9 @@ static void log_teb(SSHORT count, const TEB* vector)
|
||||
* Log a transaction element block.
|
||||
*
|
||||
**************************************/
|
||||
if (count < 0)
|
||||
return;
|
||||
|
||||
for (TEB* const end = vector + count; vector < end; vector++) {
|
||||
log_pointer(*vector->teb_database);
|
||||
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
|
||||
*
|
||||
**************************************/
|
||||
TEB tebs[16];
|
||||
TEB tebs[MAX_DB_PER_TRANS];
|
||||
struct dsc$descriptor_s *dbname;
|
||||
|
||||
int stat = 1;
|
||||
|
@ -50,7 +50,7 @@ struct sdl_arg {
|
||||
ISC_STATUS* sdl_arg_status_vector;
|
||||
IPTR sdl_arg_compiled[COMPILE_SIZE];
|
||||
IPTR* sdl_arg_next;
|
||||
IPTR* sdl_arg_end;
|
||||
const IPTR* sdl_arg_end;
|
||||
};
|
||||
|
||||
/* 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;
|
||||
IPTR* label;
|
||||
const UCHAR* expressions[16];
|
||||
const UCHAR* expressions[MAX_ARRAY_DIMENSIONS];
|
||||
const UCHAR** expr;
|
||||
|
||||
#define STUFF(word, arg) if (!stuff ((IPTR) word, arg)) return NULL
|
||||
|
@ -33,8 +33,8 @@ struct sdl_info {
|
||||
Firebird::MetaName sdl_info_relation;
|
||||
dsc sdl_info_element;
|
||||
USHORT sdl_info_dimensions;
|
||||
SLONG sdl_info_lower[16];
|
||||
SLONG sdl_info_upper[16];
|
||||
SLONG sdl_info_lower[MAX_ARRAY_DIMENSIONS];
|
||||
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_tra* temp = FB_NEW_RPT(*tdbb->getDefaultPool(), 0) jrd_tra(*tdbb->getDefaultPool());
|
||||
temp->tra_pool = tdbb->getDefaultPool();
|
||||
transaction_options(tdbb, temp, reinterpret_cast<const UCHAR*>(tpb),
|
||||
tpb_length);
|
||||
transaction_options(tdbb, temp, tpb, tpb_length);
|
||||
|
||||
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. */
|
||||
|
||||
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);
|
||||
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. */
|
||||
|
||||
if (!(transaction = trans))
|
||||
transaction = TRA_start(tdbb,
|
||||
sizeof(sweep_tpb),
|
||||
reinterpret_cast<const char*>(sweep_tpb));
|
||||
transaction = TRA_start(tdbb, sizeof(sweep_tpb), sweep_tpb);
|
||||
|
||||
SLONG transaction_oldest_active = transaction->tra_oldest_active;
|
||||
tdbb->tdbb_transaction = transaction;
|
||||
@ -2998,7 +2996,7 @@ static void transaction_options(
|
||||
{
|
||||
continue;
|
||||
}
|
||||
for (USHORT l = 0; l < id; l++) {
|
||||
for (ULONG l = 0; l < id; l++) {
|
||||
if ( (lock = (*vector)[l]) ) {
|
||||
level = lock->lck_logical;
|
||||
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_shutdown_attachment(Jrd::thread_db*, Jrd::Attachment*);
|
||||
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);
|
||||
bool TRA_sweep(Jrd::thread_db*, Jrd::jrd_tra*);
|
||||
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"
|
||||
|
||||
#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_ignore_limbo
|
||||
};
|
||||
|
@ -91,6 +91,7 @@
|
||||
#include "../jrd/why_proto.h"
|
||||
#include "../common/classes/rwlock.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.
|
||||
@ -5092,7 +5093,7 @@ ISC_STATUS API_ROUTINE_VARARG GDS_START_TRANSACTION(ISC_STATUS * user_status,
|
||||
* Start a transaction.
|
||||
*
|
||||
**************************************/
|
||||
TEB tebs[16], *teb, *end;
|
||||
TEB tebs[MAX_DB_PER_TRANS], *teb, *end;
|
||||
ISC_STATUS status;
|
||||
va_list ptr;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user