8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 20:03:03 +01:00
This commit is contained in:
asfernandes 2008-08-31 01:10:41 +00:00
parent a2026308da
commit 96194d08ba
11 changed files with 73 additions and 70 deletions

View File

@ -469,7 +469,7 @@ static void ExtractDriveLetter(const TEXT*, ULONG*);
static Database* init(thread_db*, const PathName&, bool); static Database* init(thread_db*, const PathName&, bool);
static void prepare(thread_db*, jrd_tra*, USHORT, const UCHAR*); static void prepare(thread_db*, jrd_tra*, USHORT, const UCHAR*);
static void release_attachment(thread_db*, Attachment*, ISC_STATUS* = 0); static void release_attachment(thread_db*, Attachment*, ISC_STATUS* = NULL);
static void detachLocksFromAttachment(Attachment*); static void detachLocksFromAttachment(Attachment*);
static void rollback(thread_db*, jrd_tra*, const bool); static void rollback(thread_db*, jrd_tra*, const bool);
static void shutdown_database(Database*, const bool); static void shutdown_database(Database*, const bool);
@ -2220,11 +2220,11 @@ ISC_STATUS GDS_DROP_DATABASE(ISC_STATUS* user_status, Attachment** handle)
} }
ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS * user_status, ISC_STATUS GDS_GET_SEGMENT(ISC_STATUS* user_status,
blb** blob_handle, blb** blob_handle,
USHORT * length, USHORT* length,
USHORT buffer_length, USHORT buffer_length,
UCHAR * buffer) UCHAR* buffer)
{ {
/************************************** /**************************************
* *
@ -3797,11 +3797,13 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
attachment->att_flags & ATT_shutdown) attachment->att_flags & ATT_shutdown)
{ {
const PathName& file_name = attachment->att_filename; const PathName& file_name = attachment->att_filename;
if (punt) { if (punt)
{
CCH_unwind(tdbb, false); CCH_unwind(tdbb, false);
ERR_post(Arg::Gds(isc_shutdown) << Arg::Str(file_name)); ERR_post(Arg::Gds(isc_shutdown) << Arg::Str(file_name));
} }
else { else
{
ERR_build_status(tdbb->tdbb_status_vector, ERR_build_status(tdbb->tdbb_status_vector,
Arg::Gds(isc_shutdown) << Arg::Str(file_name)); Arg::Gds(isc_shutdown) << Arg::Str(file_name));
return true; return true;
@ -3810,11 +3812,13 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
else if (attachment->att_flags & ATT_shutdown && else if (attachment->att_flags & ATT_shutdown &&
!(tdbb->tdbb_flags & TDBB_shutdown_manager)) !(tdbb->tdbb_flags & TDBB_shutdown_manager))
{ {
if (punt) { if (punt)
{
CCH_unwind(tdbb, false); CCH_unwind(tdbb, false);
ERR_post(Arg::Gds(isc_att_shutdown)); ERR_post(Arg::Gds(isc_att_shutdown));
} }
else { else
{
ERR_build_status(tdbb->tdbb_status_vector, ERR_build_status(tdbb->tdbb_status_vector,
Arg::Gds(isc_att_shutdown)); Arg::Gds(isc_att_shutdown));
return true; return true;
@ -3833,11 +3837,13 @@ bool JRD_reschedule(thread_db* tdbb, SLONG quantum, bool punt)
(!transaction || !(transaction->tra_flags & TRA_system))) (!transaction || !(transaction->tra_flags & TRA_system)))
{ {
attachment->att_flags &= ~ATT_cancel_raise; attachment->att_flags &= ~ATT_cancel_raise;
if (punt) { if (punt)
{
CCH_unwind(tdbb, false); CCH_unwind(tdbb, false);
ERR_post(Arg::Gds(isc_cancelled)); ERR_post(Arg::Gds(isc_cancelled));
} }
else { else
{
ERR_build_status(tdbb->tdbb_status_vector, Arg::Gds(isc_cancelled)); ERR_build_status(tdbb->tdbb_status_vector, Arg::Gds(isc_cancelled));
return true; return true;
} }
@ -4954,7 +4960,7 @@ Attachment::Attachment(MemoryPool* pool, Database* dbb)
att_remote_process(*pool), att_remote_process(*pool),
att_dsql_cache(*pool), att_dsql_cache(*pool),
att_udf_pointers(*pool), att_udf_pointers(*pool),
att_strings_buffer(0) att_strings_buffer(NULL)
{ {
att_mutex.enter(); att_mutex.enter();
} }

View File

@ -96,7 +96,7 @@
#include "../include/gen/iberror.h" #include "../include/gen/iberror.h"
namespace Firebird { namespace Firebird {
class StringsBuffer; class StringsBuffer;
} }
class str; class str;

View File

@ -571,11 +571,9 @@ bool BackupManager::actualize_alloc(thread_db* tdbb)
} }
last_allocated_page = temp_bdb.bdb_page.getPageNum() + alloc_buffer[0]; last_allocated_page = temp_bdb.bdb_page.getPageNum() + alloc_buffer[0];
if (alloc_buffer[0] == database->dbb_page_size / sizeof(ULONG) - 1) if (alloc_buffer[0] == database->dbb_page_size / sizeof(ULONG) - 1)
// if page is full adjust position for next pointer page last_allocated_page++; // if page is full adjust position for next pointer page
last_allocated_page++;
else else
// We finished reading allocation table break; // We finished reading allocation table
break;
} }
} }
catch (const Firebird::Exception& ex) { catch (const Firebird::Exception& ex) {
@ -769,8 +767,7 @@ bool BackupManager::actualize_state(thread_db* tdbb)
temp_bdb.bdb_page = HEADER_PAGE_NUMBER; temp_bdb.bdb_page = HEADER_PAGE_NUMBER;
temp_bdb.bdb_dbb = database; temp_bdb.bdb_dbb = database;
temp_bdb.bdb_buffer = reinterpret_cast<Ods::pag*>(header); temp_bdb.bdb_buffer = reinterpret_cast<Ods::pag*>(header);
PageSpace* pageSpace = PageSpace* pageSpace = database->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
database->dbb_page_manager.findPageSpace(DB_PAGE_SPACE);
fb_assert(pageSpace); fb_assert(pageSpace);
jrd_file* file = pageSpace->file; jrd_file* file = pageSpace->file;
while (!PIO_read(file, &temp_bdb, temp_bdb.bdb_buffer, status)) { while (!PIO_read(file, &temp_bdb, temp_bdb.bdb_buffer, status)) {

View File

@ -497,7 +497,7 @@ USHORT PAG_add_file(const TEXT* file_name, SLONG start)
// Verify database file path against DatabaseAccess entry of firebird.conf // Verify database file path against DatabaseAccess entry of firebird.conf
if (!JRD_verify_database_access(file_name)) { if (!JRD_verify_database_access(file_name)) {
ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("additional database file") << ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("additional database file") <<
Arg::Str(file_name)); Arg::Str(file_name));
} }
@ -1285,8 +1285,8 @@ void PAG_header(thread_db* tdbb, bool info)
* file system permission gives only ReadOnly access. Punt out with * file system permission gives only ReadOnly access. Punt out with
* isc_no_priv error (no privileges) * isc_no_priv error (no privileges)
*/ */
ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("read-write") << ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("read-write") <<
Arg::Str("database") << Arg::Str("database") <<
Arg::Str(attachment->att_filename)); Arg::Str(attachment->att_filename));
} }
@ -1372,10 +1372,10 @@ void PAG_header_init(thread_db* tdbb)
if (!Ods::isSupported(header->hdr_ods_version, header->hdr_ods_minor)) if (!Ods::isSupported(header->hdr_ods_version, header->hdr_ods_minor))
{ {
ERR_post(Arg::Gds(isc_wrong_ods) << Arg::Str(attachment->att_filename) << ERR_post(Arg::Gds(isc_wrong_ods) << Arg::Str(attachment->att_filename) <<
Arg::Num(ods_version) << Arg::Num(ods_version) <<
Arg::Num(header->hdr_ods_minor) << Arg::Num(header->hdr_ods_minor) <<
Arg::Num(ODS_VERSION) << Arg::Num(ODS_VERSION) <<
Arg::Num(ODS_CURRENT)); Arg::Num(ODS_CURRENT));
} }
@ -1448,8 +1448,7 @@ void PAG_init(thread_db* tdbb)
(dbb->dbb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4; (dbb->dbb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4;
pageSpace->ppFirst = 1; pageSpace->ppFirst = 1;
/* dbb_ods_version can be 0 when a new database is being created */ /* dbb_ods_version can be 0 when a new database is being created */
if ((dbb->dbb_ods_version == 0) if ((dbb->dbb_ods_version == 0) || (dbb->dbb_ods_version >= ODS_VERSION10))
|| (dbb->dbb_ods_version >= ODS_VERSION10))
{ {
pageMgr.gensPerPage = pageMgr.gensPerPage =
(dbb->dbb_page_size - (dbb->dbb_page_size -
@ -1631,7 +1630,7 @@ void PAG_init2(thread_db* tdbb, USHORT shadow_number)
// Verify database file path against DatabaseAccess entry of firebird.conf // Verify database file path against DatabaseAccess entry of firebird.conf
file_name[file_length] = 0; file_name[file_length] = 0;
if (!JRD_verify_database_access(file_name)) { if (!JRD_verify_database_access(file_name)) {
ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("additional database file") << ERR_post(Arg::Gds(isc_conf_access_denied) << Arg::Str("additional database file") <<
Arg::Str(file_name)); Arg::Str(file_name));
} }

View File

@ -696,7 +696,7 @@ CompilerScratch* PAR_parse(thread_db* tdbb, const UCHAR* blr, USHORT internal_fl
if (version != blr_version4 && version != blr_version5) if (version != blr_version4 && version != blr_version5)
{ {
error(csb, Arg::Gds(isc_wroblrver) << Arg::Num(blr_version4) << error(csb, Arg::Gds(isc_wroblrver) << Arg::Num(blr_version4) <<
Arg::Num(version)); Arg::Num(version));
} }
@ -1660,8 +1660,7 @@ static jrd_nod* par_message(thread_db* tdbb, CompilerScratch* csb)
} }
if (offset > MAX_FORMAT_SIZE) if (offset > MAX_FORMAT_SIZE)
error(csb, Arg::Gds(isc_imp_exc) << error(csb, Arg::Gds(isc_imp_exc) << Arg::Gds(isc_blktoobig));
Arg::Gds(isc_blktoobig));
format->fmt_length = (USHORT) offset; format->fmt_length = (USHORT) offset;
@ -1953,12 +1952,12 @@ static jrd_nod* par_plan(thread_db* tdbb, CompilerScratch* csb)
{ {
if (tdbb->getAttachment()->att_flags & ATT_gbak_attachment) if (tdbb->getAttachment()->att_flags & ATT_gbak_attachment)
{ {
warning(csb, Arg::Warning(isc_indexname) << Arg::Str(name) << warning(csb, Arg::Warning(isc_indexname) << Arg::Str(name) <<
Arg::Str(relation->rel_name)); Arg::Str(relation->rel_name));
} }
else else
{ {
error(csb, Arg::Gds(isc_indexname) << Arg::Str(name) << error(csb, Arg::Gds(isc_indexname) << Arg::Str(name) <<
Arg::Str(relation->rel_name)); Arg::Str(relation->rel_name));
} }
} }
@ -2081,8 +2080,10 @@ static void par_procedure_parms(
(count != procedure->prc_outputs)) (count != procedure->prc_outputs))
{ {
/** They don't match...Hmmm...Its OK if we were dropping the procedure **/ /** They don't match...Hmmm...Its OK if we were dropping the procedure **/
if (!(tdbb->tdbb_flags & TDBB_prc_being_dropped)) { if (!(tdbb->tdbb_flags & TDBB_prc_being_dropped))
error(csb, Arg::Gds(input_flag ? isc_prcmismat : isc_prc_out_param_mismatch) << Arg::Str(procedure->prc_name)); {
error(csb, Arg::Gds(input_flag ? isc_prcmismat : isc_prc_out_param_mismatch) <<
Arg::Str(procedure->prc_name));
} }
else else
mismatch = true; mismatch = true;
@ -2176,7 +2177,8 @@ static void par_procedure_parms(
else if ((input_flag ? procedure->prc_inputs : procedure->prc_outputs) && else if ((input_flag ? procedure->prc_inputs : procedure->prc_outputs) &&
!mismatch) !mismatch)
{ {
error(csb, Arg::Gds(input_flag ? isc_prcmismat : isc_prc_out_param_mismatch) << Arg::Str(procedure->prc_name)); error(csb, Arg::Gds(input_flag ? isc_prcmismat : isc_prc_out_param_mismatch) <<
Arg::Str(procedure->prc_name));
} }
} }
@ -2984,8 +2986,7 @@ jrd_nod* PAR_parse_node(thread_db* tdbb, CompilerScratch* csb, USHORT expected,
n = BLR_BYTE; n = BLR_BYTE;
if (n >= csb->csb_rpt.getCount() || !(csb->csb_rpt[n].csb_flags & csb_used)) if (n >= csb->csb_rpt.getCount() || !(csb->csb_rpt[n].csb_flags & csb_used))
error(csb, Arg::Gds(isc_ctxnotdef)); error(csb, Arg::Gds(isc_ctxnotdef));
node->nod_arg[e_erase_stream] = node->nod_arg[e_erase_stream] = (jrd_nod*) (IPTR) csb->csb_rpt[n].csb_stream;
(jrd_nod*) (IPTR) csb->csb_rpt[n].csb_stream;
break; break;
case blr_modify: case blr_modify:
@ -3016,9 +3017,8 @@ jrd_nod* PAR_parse_node(thread_db* tdbb, CompilerScratch* csb, USHORT expected,
if (BLR_PEEK == (UCHAR) blr_stall) if (BLR_PEEK == (UCHAR) blr_stall)
node->nod_arg[e_for_stall] = PAR_parse_node(tdbb, csb, STATEMENT); node->nod_arg[e_for_stall] = PAR_parse_node(tdbb, csb, STATEMENT);
if (BLR_PEEK == (UCHAR) blr_rse || if (BLR_PEEK == (UCHAR) blr_rse || BLR_PEEK == (UCHAR) blr_singular)
BLR_PEEK == (UCHAR) blr_singular) node->nod_arg[e_for_re] = PAR_parse_node(tdbb, csb, TYPE_RSE);
node->nod_arg[e_for_re] = PAR_parse_node(tdbb, csb, TYPE_RSE);
else else
node->nod_arg[e_for_re] = par_rse(tdbb, csb, blr_operator); node->nod_arg[e_for_re] = par_rse(tdbb, csb, blr_operator);
node->nod_arg[e_for_statement] = PAR_parse_node(tdbb, csb, sub_type); node->nod_arg[e_for_statement] = PAR_parse_node(tdbb, csb, sub_type);

View File

@ -144,9 +144,11 @@ bool PCMET_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork* work,
} }
if (IDX.RDB$SEGMENT_COUNT) if (IDX.RDB$SEGMENT_COUNT)
{
/* Msg359: segments not allowed in expression index %s */
ERR_post(Arg::Gds(isc_no_meta_update) << ERR_post(Arg::Gds(isc_no_meta_update) <<
Arg::Gds(isc_no_segments_err) << Arg::Str(work->dfw_name)); Arg::Gds(isc_no_segments_err) << Arg::Str(work->dfw_name));
/* Msg359: segments not allowed in expression index %s */ }
if (IDX.RDB$UNIQUE_FLAG) if (IDX.RDB$UNIQUE_FLAG)
idx.idx_flags |= idx_unique; idx.idx_flags |= idx_unique;
if (IDX.RDB$INDEX_TYPE == 1) if (IDX.RDB$INDEX_TYPE == 1)

View File

@ -133,8 +133,8 @@ void SCL_check_access(const SecurityClass* s_class,
if (s_class && (s_class->scl_flags & SCL_corrupt)) if (s_class && (s_class->scl_flags & SCL_corrupt))
{ {
ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("(ACL unrecognized)") << ERR_post(Arg::Gds(isc_no_priv) << Arg::Str("(ACL unrecognized)") <<
Arg::Str("security_class") << Arg::Str("security_class") <<
Arg::Str(s_class->scl_name)); Arg::Str(s_class->scl_name));
} }
@ -188,13 +188,13 @@ void SCL_check_access(const SecurityClass* s_class,
} }
if (denied_db) { if (denied_db) {
ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) << ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) <<
Arg::Str("DATABASE") << Arg::Str("DATABASE") <<
Arg::Str("")); Arg::Str(""));
} }
else { else {
ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) << ERR_post(Arg::Gds(isc_no_priv) << Arg::Str(names->p_names_string) <<
Arg::Str(type) << Arg::Str(type) <<
Arg::Str(name)); Arg::Str(name));
} }
} }

View File

@ -509,7 +509,7 @@ static const UCHAR* compile(const UCHAR* sdl, sdl_arg* arg)
count = *p++; count = *p++;
if (arg && count != arg->sdl_arg_desc->iad_dimensions) { if (arg && count != arg->sdl_arg_desc->iad_dimensions) {
error(arg->sdl_arg_status_vector, error(arg->sdl_arg_status_vector,
Arg::Gds(isc_invalid_dimension) << Arg::Num(arg->sdl_arg_desc->iad_dimensions) << Arg::Gds(isc_invalid_dimension) << Arg::Num(arg->sdl_arg_desc->iad_dimensions) <<
Arg::Num(count)); Arg::Num(count));
return NULL; return NULL;
} }

View File

@ -655,7 +655,7 @@ rem_port* INET_connect(const TEXT* name,
{ {
gds__log("INET/INET_connect: gethostbyname (%s) failed, error code = %d", gds__log("INET/INET_connect: gethostbyname (%s) failed, error code = %d",
host.c_str(), H_ERRNO); host.c_str(), H_ERRNO);
inet_gen_error(port, inet_gen_error(port,
Arg::Gds(isc_network_error) << Arg::Str(port->port_connection->str_data) << Arg::Gds(isc_network_error) << Arg::Str(port->port_connection->str_data) <<
Arg::Gds(isc_net_lookup_err) << Arg::Gds(isc_net_lookup_err) <<
Arg::Gds(isc_host_unknown)); Arg::Gds(isc_host_unknown));
@ -718,7 +718,7 @@ rem_port* INET_connect(const TEXT* name,
inet_gen_error(port, inet_gen_error(port,
Arg::Gds(isc_network_error) << Arg::Str(port->port_connection->str_data) << Arg::Gds(isc_network_error) << Arg::Str(port->port_connection->str_data) <<
Arg::Gds(isc_net_lookup_err) << Arg::Gds(isc_net_lookup_err) <<
Arg::Gds(isc_service_unknown) << Arg::Str(protocol) << Arg::Gds(isc_service_unknown) << Arg::Str(protocol) <<
Arg::Str("tcp")); Arg::Str("tcp"));
return NULL; return NULL;
} /* else / not hardwired gds_db translation */ } /* else / not hardwired gds_db translation */
@ -2749,7 +2749,6 @@ static void inet_error(
} }
else { else {
/* No status value, just format the basic arguments. */ /* No status value, just format the basic arguments. */
inet_gen_error(port, inet_gen_error(port,
Arg::Gds(isc_network_error) << Arg::Str(port->port_connection->str_data) << Arg::Gds(isc_network_error) << Arg::Str(port->port_connection->str_data) <<
Arg::Gds(operation)); Arg::Gds(operation));

View File

@ -617,7 +617,7 @@ void REMOTE_save_status_strings( ISC_STATUS* vector)
// ensure string is correctly terminated // ensure string is correctly terminated
if (status != isc_arg_cstring) if (status != isc_arg_cstring)
attach_failures_ptr[l-1] = 0; attach_failures_ptr[l - 1] = 0;
else else
vector[-1] = l; vector[-1] = l;

View File

@ -39,25 +39,25 @@
using MsgFormat::SafeArg; using MsgFormat::SafeArg;
namespace { namespace {
void put_status_arg(ISC_STATUS*& status, const MsgFormat::safe_cell& value) void put_status_arg(ISC_STATUS*& status, const MsgFormat::safe_cell& value)
{
using MsgFormat::safe_cell;
switch (value.type)
{ {
case safe_cell::at_int64: using MsgFormat::safe_cell;
case safe_cell::at_uint64:
*status++ = isc_arg_number; switch (value.type)
*status++ = static_cast<SLONG>(value.i_value); // May truncate number! {
break; case safe_cell::at_int64:
case safe_cell::at_str: case safe_cell::at_uint64:
*status++ = isc_arg_string; *status++ = isc_arg_number;
*status++ = (ISC_STATUS) (IPTR) (value.st_value.s_string); *status++ = static_cast<SLONG>(value.i_value); // May truncate number!
break; break;
default: case safe_cell::at_str:
break; *status++ = isc_arg_string;
*status++ = (ISC_STATUS) (IPTR) (value.st_value.s_string);
break;
default:
break;
}
} }
}
} // anonymous namespace } // anonymous namespace
void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status, void CMD_UTIL_put_svc_status(ISC_STATUS* svc_status,