8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 06:03:02 +01:00
This commit is contained in:
robocop 2008-02-24 03:23:40 +00:00
parent 3a9567e868
commit f8007f4071
9 changed files with 99 additions and 86 deletions

View File

@ -95,8 +95,8 @@ private:
{
if ((offset < this->size) && (offset + _size <= this->size))
return ptr + offset;
else
return NULL;
return NULL;
}
bool sameFile(const TempFile* file) const

View File

@ -341,8 +341,8 @@ ULONG TextType::str_to_upper(ULONG srcLen,
{
if (tt->texttype_fn_str_to_upper)
return (*tt->texttype_fn_str_to_upper)(tt, srcLen, src, dstLen, dst);
else
return Firebird::IntlUtil::toUpper(getCharSet(), srcLen, src, dstLen, dst, NULL);
return Firebird::IntlUtil::toUpper(getCharSet(), srcLen, src, dstLen, dst, NULL);
}
@ -353,8 +353,8 @@ ULONG TextType::str_to_lower(ULONG srcLen,
{
if (tt->texttype_fn_str_to_lower)
return (*tt->texttype_fn_str_to_lower)(tt, srcLen, src, dstLen, dst);
else
return Firebird::IntlUtil::toLower(getCharSet(), srcLen, src, dstLen, dst, NULL);
return Firebird::IntlUtil::toLower(getCharSet(), srcLen, src, dstLen, dst, NULL);
}

View File

@ -540,14 +540,14 @@ namespace {
class HugeStaticBuffer
{
public:
HugeStaticBuffer(MemoryPool& p)
explicit HugeStaticBuffer(MemoryPool& p)
: zeroArray(p),
zeroBuff(zeroArray.getBuffer(ZERO_BUF_SIZE))
{
memset(zeroBuff, 0, ZERO_BUF_SIZE);
}
const char* get() { return zeroBuff; }
const char* get() const { return zeroBuff; }
private:
Firebird::Array<char> zeroArray;

View File

@ -1106,9 +1106,8 @@ static SSHORT par_context(CompilerScratch* csb, SSHORT* context_ptr)
if (csb->csb_g_flags & csb_reuse_context) {
return tail->csb_stream;
}
else {
error(csb, isc_ctxinuse, 0);
}
error(csb, isc_ctxinuse, 0);
}
const SSHORT stream = csb->nextStream(false);
@ -1476,10 +1475,9 @@ static jrd_nod* par_function(thread_db* tdbb, CompilerScratch* csb)
anode->nod_arg[e_fun_args] = par_args(tdbb, csb, VALUE);
return anode;
}
else {
csb->csb_running -= count;
error(csb, isc_funnotdef, isc_arg_string, ERR_cstring(name), 0);
}
csb->csb_running -= count;
error(csb, isc_funnotdef, isc_arg_string, ERR_cstring(name), 0);
}
UserFunction* homonyms;
@ -2441,17 +2439,17 @@ static jrd_nod* par_rse(thread_db* tdbb, CompilerScratch* csb, SSHORT rse_op)
if (!rse->rse_jointype ||
(rse->rse_count == 2 && rse->rse_boolean))
{
// Convert right outer joins to left joins to avoid
// RIGHT JOIN handling at lower engine levels
if (rse->rse_jointype == blr_right) {
// Swap sub-streams
jrd_nod* temp = rse->rse_relation[0];
rse->rse_relation[0] = rse->rse_relation[1];
rse->rse_relation[1] = temp;
// Convert right outer joins to left joins to avoid
// RIGHT JOIN handling at lower engine levels
if (rse->rse_jointype == blr_right) {
// Swap sub-streams
jrd_nod* temp = rse->rse_relation[0];
rse->rse_relation[0] = rse->rse_relation[1];
rse->rse_relation[1] = temp;
rse->rse_jointype = blr_left;
}
return (jrd_nod*) rse;
rse->rse_jointype = blr_left;
}
return (jrd_nod*) rse;
}
}
syntax_error(csb, (TEXT*)((rse_op == blr_rs_stream) ?

View File

@ -246,7 +246,8 @@ void API_ROUTINE perf_get_info(FB_API_HANDLE* handle, PERF* perf)
const char* p = buffer;
while (true)
switch (*p++) {
switch (*p++)
{
case isc_info_reads:
perf->perf_reads = get_parameter(&p);
break;
@ -283,12 +284,18 @@ void API_ROUTINE perf_get_info(FB_API_HANDLE* handle, PERF* perf)
return;
case isc_info_error:
if (p[2] == isc_info_marks)
switch (p[2])
{
case isc_info_marks:
perf->perf_marks = 0;
else if (p[2] == isc_info_current_memory)
break;
case isc_info_current_memory:
perf->perf_current_memory = 0;
else if (p[2] == isc_info_max_memory)
break;
case isc_info_max_memory:
perf->perf_max_memory = 0;
break;
}
{
const SLONG temp = isc_vax_integer(p, 2);
fb_assert(temp <= MAX_SSHORT);

View File

@ -2241,47 +2241,51 @@ static bool get_record(thread_db* tdbb,
break;
case rsb_skip:
switch (mode) {
#ifdef SCROLLABLE_CURSORS
case RSE_get_backward:
if (((irsb_skip_n*) impure)->irsb_count > 0)
{
irsb_skip_n* skip = (irsb_skip_n*) impure;
switch (mode)
{
invalidate_child_rpbs(tdbb, rsb);
return false;
}
if (((irsb_skip_n*) impure)->irsb_count == 0)
{
((irsb_skip_n*) impure)->irsb_count++;
if (get_record(tdbb, rsb->rsb_next, NULL, mode))
#ifdef SCROLLABLE_CURSORS
case RSE_get_backward:
if (skip->irsb_count > 0)
{
invalidate_child_rpbs(tdbb, rsb);
return false;
}
((irsb_skip_n*) impure)->irsb_count++;
if (!get_record(tdbb, rsb->rsb_next, NULL, mode))
return false;
break;
case RSE_get_current:
if (((irsb_skip_n*) impure)->irsb_count >= 1)
{
invalidate_child_rpbs(tdbb, rsb);
return false;
}
else if (!get_record(tdbb, rsb->rsb_next, NULL, mode))
return false;
break;
#endif
case RSE_get_forward:
while (((irsb_skip_n*) impure)->irsb_count > 1) {
((irsb_skip_n*) impure)->irsb_count--;
return false;
}
if (skip->irsb_count == 0)
{
skip->irsb_count++;
if (get_record(tdbb, rsb->rsb_next, NULL, mode))
invalidate_child_rpbs(tdbb, rsb);
return false;
}
skip->irsb_count++;
if (!get_record(tdbb, rsb->rsb_next, NULL, mode))
return false;
break;
case RSE_get_current:
if (skip->irsb_count >= 1)
{
invalidate_child_rpbs(tdbb, rsb);
return false;
}
if (!get_record(tdbb, rsb->rsb_next, NULL, mode))
return false;
break;
#endif
case RSE_get_forward:
while (skip->irsb_count > 1) {
skip->irsb_count--;
if (!get_record(tdbb, rsb->rsb_next, NULL, mode))
return false;
}
skip->irsb_count--;
if (!get_record(tdbb, rsb->rsb_next, NULL, mode))
return false;
break;
}
((irsb_skip_n*) impure)->irsb_count--;
if (!get_record(tdbb, rsb->rsb_next, NULL, mode))
return false;
break;
}
break;

View File

@ -144,26 +144,26 @@ void SCL_check_access(const SecurityClass* s_class,
0);
}
const Attachment* const attachment = tdbb->getAttachment();
const Attachment& attachment = *tdbb->getAttachment();
// Allow the database owner to back up a database even if he does not have
// read access to all the tables in the database
if ((attachment->att_flags & ATT_gbak_attachment) && (mask & SCL_read))
if ((attachment.att_flags & ATT_gbak_attachment) && (mask & SCL_read))
{
return;
}
// Allow the locksmith any access to database
if (attachment->locksmith())
if (attachment.locksmith())
{
return;
}
bool denied_db = false;
const SecurityClass* const att_class = attachment->att_security_class;
const SecurityClass* const att_class = attachment.att_security_class;
if (att_class && !(att_class->scl_flags & mask))
{
denied_db = true;
@ -974,6 +974,7 @@ static bool check_user_group(const UCHAR* acl,
else // processing group name
{
Firebird::UCharBuffer buffer;
fb_assert(l < length); // Not sure how we can guarantee this.
UCHAR* user_group_name = buffer.getBuffer(length);
do {
const TEXT one_char = *acl++;

View File

@ -646,8 +646,10 @@ int TRA_get_state(thread_db* tdbb, SLONG number)
return TPC_snapshot_state(tdbb, number);
if (number && dbb->dbb_pc_transactions)
{
if (TRA_precommited(tdbb, number, number))
return tra_precommitted;
}
return TRA_fetch_state(tdbb, number);
}
@ -1069,7 +1071,7 @@ void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction)
}
}
{
{ // scope
vec<jrd_rel*>& rels = *dbb->dbb_relations;
for (size_t i = 0; i < rels.count(); i++)
{
@ -1080,7 +1082,7 @@ void TRA_release_transaction(thread_db* tdbb, jrd_tra* transaction)
}
}
}
} // end scope
// Release the locks associated with the transaction
@ -1275,10 +1277,8 @@ void TRA_rollback(thread_db* tdbb, jrd_tra* transaction, const bool retaining_fl
retain_context(tdbb, transaction, false, state);
return;
}
else {
TRA_set_state(tdbb, transaction, transaction->tra_number, state);
}
TRA_set_state(tdbb, transaction, transaction->tra_number, state);
TRA_release_transaction(tdbb, transaction);
}
@ -1352,16 +1352,15 @@ void TRA_set_state(thread_db* tdbb, jrd_tra* transaction, SLONG number, SSHORT s
if (transaction && !(transaction->tra_flags & TRA_write))
return;
else {
{ //scope
Database::Checkout dcoHolder(dbb);
THREAD_YIELD();
}
tip = reinterpret_cast<tx_inv_page*>(CCH_FETCH(tdbb, &window, LCK_write, pag_transactions));
if (generation == tip->pag_generation)
CCH_MARK_MUST_WRITE(tdbb, &window);
CCH_RELEASE(tdbb, &window);
{ //scope
Database::Checkout dcoHolder(dbb);
THREAD_YIELD();
}
tip = reinterpret_cast<tx_inv_page*>(CCH_FETCH(tdbb, &window, LCK_write, pag_transactions));
if (generation == tip->pag_generation)
CCH_MARK_MUST_WRITE(tdbb, &window);
CCH_RELEASE(tdbb, &window);
#endif
}
@ -1450,8 +1449,8 @@ int TRA_snapshot_state(thread_db* tdbb, const jrd_tra* trans, SLONG number)
int state = TPC_snapshot_state(tdbb, number);
if (state == tra_active)
return tra_committed;
else
return state;
return state;
}
// If the transaction is a commited sub-transction - do the easy lookup.

View File

@ -4191,7 +4191,7 @@ ISC_STATUS API_ROUTINE GDS_RECONNECT(ISC_STATUS* user_status,
&handle,
length, id))
{
return status[1];
return status[1];
}
new Transaction(handle, tra_handle, dbb);
@ -5352,8 +5352,10 @@ static Transaction* find_transaction(Attachment* dbb,
**************************************/
for (; transaction; transaction = transaction->next)
{
if (transaction->parent == dbb)
return transaction;
}
return NULL;
}
@ -5741,6 +5743,7 @@ static ISC_STATUS prepare(ISC_STATUS* user_status,
length = p - description;
for (sub = transaction->next; sub; sub = sub->next)
{
if (CALL(PROC_PREPARE, sub->implementation) (status,
&sub->handle,
length, description))
@ -5750,6 +5753,7 @@ static ISC_STATUS prepare(ISC_STATUS* user_status,
}
return status[1];
}
}
if (description != tdr_buffer)
free_block(description);