8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 22:43:04 +01:00
This commit is contained in:
robocop 2009-06-25 10:13:54 +00:00
parent 2252786500
commit 7b1b9b6f9f
14 changed files with 549 additions and 348 deletions

View File

@ -132,12 +132,14 @@ BLK ALLQ_alloc( qli_plb* pool, UCHAR type, int count)
free = *best;
qli_frb* block;
if (best_tail > sizeof(qli_frb)) {
if (best_tail > sizeof(qli_frb))
{
USHORT l = free->frb_header.blk_length - size;
block = (qli_frb*) ((SCHAR *) free + l);
free->frb_header.blk_length -= size;
}
else {
else
{
*best = free->frb_next;
size += best_tail;
block = free;
@ -204,7 +206,8 @@ void ALLQ_fini()
if (pool)
{
qli_hnk* hunk;
for (qli_hnk* hunks = pool->plb_hunks; hunk = hunks;) {
for (qli_hnk* hunks = pool->plb_hunks; hunk = hunks;)
{
hunks = hunk->hnk_next;
ALLQ_free(hunk->hnk_address);
}
@ -271,7 +274,8 @@ SCHAR *ALLQ_malloc(SLONG size)
**************************************/
SCHAR *memory = (SCHAR*) gds__alloc(size);
if (memory) {
if (memory)
{
#ifdef DEBUG_GDS_ALLOC
gds_alloc_flag_unfreed((void *) memory); // Don't care about QLI leaks
#endif
@ -424,7 +428,8 @@ void ALLQ_release( qli_frb* block)
// Try to merge the free block with the next one down.
if (free) {
if (free)
{
if ((SCHAR *) block + block->frb_header.blk_length == (SCHAR *) free)
{
block->frb_header.blk_length += free->frb_header.blk_length;
@ -436,7 +441,8 @@ void ALLQ_release( qli_frb* block)
// Try and merge the block with the prior free block
if (prior) {
if (prior)
{
if ((SCHAR *) prior + prior->frb_header.blk_length == (SCHAR *) block)
{
prior->frb_header.blk_length += block->frb_header.blk_length;
@ -464,7 +470,8 @@ void ALLQ_rlpool( qli_plb* pool)
global_pools->vec_object[pool->plb_pool_id] = NULL;
qli_hnk* hunk;
for (qli_hnk* hunks = pool->plb_hunks; hunk = hunks;) {
for (qli_hnk* hunks = pool->plb_hunks; hunk = hunks;)
{
hunks = hunk->hnk_next;
gds__free(hunk->hnk_address);
}

View File

@ -46,8 +46,7 @@ static void dump_procedure(qli_dbb*, FILE*, const TEXT*, USHORT, FB_API_HANDLE);
static void extract_procedure(void*, const TEXT*, USHORT, qli_dbb*, ISC_QUAD&);
#ifdef NOT_USED_OR_REPLACED
static SCHAR db_items[] =
{ gds_info_page_size, gds_info_allocation, gds_info_end };
static SCHAR db_items[] = { gds_info_page_size, gds_info_allocation, gds_info_end };
#endif
bool CMD_check_ready()
@ -228,7 +227,8 @@ void CMD_finish( qli_syntax* node)
* Perform FINISH. Either finish listed databases or everything.
*
**************************************/
if (node->syn_count == 0) {
if (node->syn_count == 0)
{
while (QLI_databases)
MET_finish(QLI_databases);
return;
@ -349,7 +349,8 @@ void CMD_set( qli_syntax* node)
case set_matching_language:
if (QLI_matching_language)
ALLQ_release((qli_frb*) QLI_matching_language);
if (!(string = (qli_const*) value)) {
if (!(string = (qli_const*) value))
{
QLI_matching_language = NULL;
break;
}
@ -375,7 +376,8 @@ void CMD_set( qli_syntax* node)
case set_charset:
{
if (!value) {
if (!value)
{
QLI_charset[0] = 0;
break;
}
@ -470,7 +472,8 @@ void CMD_transaction( qli_syntax* node)
CMD_transaction(node);
node->syn_type = nod_commit;
}
else if (node->syn_count == 1) {
else if (node->syn_count == 1)
{
qli_dbb* tmp_db = (qli_dbb*) node->syn_arg[0];
tmp_db->dbb_flags |= DBB_prepared;
}

View File

@ -213,7 +213,8 @@ static qli_nod* compile_any( qli_nod* node, qli_req* old_request)
qli_msg* old_send = NULL;
qli_msg* old_receive = NULL;
if (old_request) {
if (old_request)
{
old_send = old_request->req_send;
old_receive = old_request->req_receive;
}
@ -226,12 +227,14 @@ static qli_nod* compile_any( qli_nod* node, qli_req* old_request)
else
request = old_request;
if (old_request) {
if (old_request)
{
old_request->req_send = old_send;
old_request->req_receive = old_receive;
}
if ((send != old_send) && !send->msg_parameters) {
if ((send != old_send) && !send->msg_parameters)
{
release_message(send);
send = NULL;
if (!receive)
@ -241,13 +244,15 @@ static qli_nod* compile_any( qli_nod* node, qli_req* old_request)
if (old_request && request->req_database != old_request->req_database)
IBERROR(357); // Msg357 relations from multiple databases in single rse
if (old_request && (!receive || !receive->msg_parameters)) {
if (old_request && (!receive || !receive->msg_parameters))
{
if (receive)
release_message(receive);
receive = NULL;
}
if (receive) {
if (receive)
{
qli_par* parameter = make_parameter(receive, 0);
node->nod_import = parameter;
parameter->par_desc.dsc_dtype = dtype_short;
@ -261,8 +266,7 @@ static qli_nod* compile_any( qli_nod* node, qli_req* old_request)
}
static qli_nod* compile_assignment( qli_nod* node, qli_req* request,
bool statement_internal)
static qli_nod* compile_assignment( qli_nod* node, qli_req* request, bool statement_internal)
{
/**************************************
*
@ -292,7 +296,8 @@ static qli_nod* compile_assignment( qli_nod* node, qli_req* request,
// If the assignment is to a variable, the assignment is completely local
if (to->nod_type == nod_variable) {
if (to->nod_type == nod_variable)
{
statement_internal = false;
node->nod_flags |= NOD_local;
}
@ -317,8 +322,10 @@ static qli_nod* compile_assignment( qli_nod* node, qli_req* request,
{
if (node->nod_arg[e_asn_valid])
compile_expression(node->nod_arg[e_asn_valid], request, false);
if (target->nod_type == nod_field) {
if (!request) {
if (target->nod_type == nod_field)
{
if (!request)
{
qli_ctx* context = (qli_ctx*) target->nod_arg[e_fld_context];
request = context->ctx_request;
}
@ -414,7 +421,8 @@ static qli_nod* compile_edit( qli_nod* node, qli_req* request)
// If there is an input blob, get it now.
qli_nod* value = node->nod_arg[e_edt_input];
if (value) {
if (value)
{
qli_fld* field = (qli_fld*) value->nod_arg[e_fld_field];
if (value->nod_type != nod_field || field->fld_dtype != dtype_blob)
IBERROR(356); // Msg356 EDIT argument must be a blob field
@ -508,18 +516,21 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
case nod_running_total:
case nod_running_count:
node->nod_count = 0;
if (value = node->nod_arg[e_stt_value]) {
if (value = node->nod_arg[e_stt_value])
{
value->nod_flags |= NOD_parameter2;
node->nod_arg[e_stt_value] = compile_expression(value, request, false);
}
make_descriptor(node, &node->nod_desc);
if (internal_flag) {
if (internal_flag)
{
qli_par* parm = make_parameter(request->req_send, 0);
node->nod_export = parm;
parm->par_desc = node->nod_desc;
parm->par_value = node;
}
else {
else
{
CMP_alloc_temp(node);
if (request && value && computable(value, request))
node->nod_arg[e_stt_value] = make_reference(value, request->req_receive);
@ -532,7 +543,8 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
case nod_agg_average:
case nod_agg_total:
node->nod_count = 0;
if (value = node->nod_arg[e_stt_value]) {
if (value = node->nod_arg[e_stt_value])
{
value->nod_flags |= NOD_parameter2;
node->nod_arg[e_stt_value] = compile_expression(value, request, true);
}
@ -600,7 +612,8 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
*ptr = compile_expression(*ptr, request, internal_flag);
}
make_descriptor(node, &node->nod_desc);
if (!internal_flag) {
if (!internal_flag)
{
node->nod_flags |= NOD_local;
CMP_alloc_temp(node);
}
@ -639,7 +652,8 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
parm->par_desc.dsc_length = field->fld_length;
parm->par_desc.dsc_scale = field->fld_scale;
parm->par_desc.dsc_sub_type = field->fld_sub_type;
if (parm->par_desc.dsc_dtype == dtype_text) {
if (parm->par_desc.dsc_dtype == dtype_text)
{
parm->par_desc.dsc_dtype = dtype_varying;
parm->par_desc.dsc_length += sizeof(SSHORT);
}
@ -699,13 +713,15 @@ static qli_nod* compile_field( qli_nod* node, qli_req* request, bool internal_fl
node->nod_count = 0;
qli_fld* field = (qli_fld*) node->nod_arg[e_fld_field];
qli_ctx* context = (qli_ctx*) node->nod_arg[e_fld_context];
if ((field->fld_flags & FLD_array) && !node->nod_arg[e_fld_subs]) {
if ((field->fld_flags & FLD_array) && !node->nod_arg[e_fld_subs])
{
node->nod_desc.dsc_dtype = dtype_quad;
node->nod_desc.dsc_length = 8;
node->nod_desc.dsc_scale = 0;
node->nod_desc.dsc_sub_type = 0;
}
else {
else
{
node->nod_desc.dsc_dtype = field->fld_dtype;
node->nod_desc.dsc_length = field->fld_length;
node->nod_desc.dsc_scale = field->fld_scale;
@ -761,7 +777,8 @@ static qli_nod* compile_for( qli_nod* node, qli_req* old_request, bool internal_
qli_msg* old_send = NULL;
qli_msg* old_receive = NULL;
if (old_request) {
if (old_request)
{
old_send = old_request->req_send;
old_receive = old_request->req_receive;
}
@ -784,19 +801,22 @@ static qli_nod* compile_for( qli_nod* node, qli_req* old_request, bool internal_
receive = NULL;
}
if (old_request) {
if (old_request)
{
old_request->req_send = old_send;
old_request->req_receive = old_receive;
}
if ((send != old_send) && !send->msg_parameters) {
if ((send != old_send) && !send->msg_parameters)
{
release_message(send);
send = NULL;
if (!receive)
return NULL;
}
if (receive) {
if (receive)
{
qli_par* parameter = make_parameter(receive, 0);
node->nod_arg[e_for_eof] = (qli_nod*) parameter;
parameter->par_desc.dsc_dtype = dtype_short;
@ -832,7 +852,8 @@ static qli_nod* compile_function( qli_nod* node, qli_req* old_request, bool inte
if (!internal_flag)
old_request = NULL;
if (old_request) {
if (old_request)
{
old_send = old_request->req_send;
old_receive = old_request->req_receive;
}
@ -852,7 +873,8 @@ static qli_nod* compile_function( qli_nod* node, qli_req* old_request, bool inte
// If there is a value, compile it here
qli_par* parameter = 0;
if (!internal_flag) {
if (!internal_flag)
{
node->nod_import = parameter = make_parameter(request->req_receive, 0);
make_descriptor(node, &parameter->par_desc);
}
@ -863,17 +885,20 @@ static qli_nod* compile_function( qli_nod* node, qli_req* old_request, bool inte
for (const qli_nod* const* const end = ptr + list->nod_count; ptr < end; ptr++)
compile_expression(*ptr, request, true);
if (old_request) {
if (old_request)
{
old_request->req_send = old_send;
old_request->req_receive = old_receive;
}
if (!internal_flag && request == old_request && computable(node, request)) {
if (!internal_flag && request == old_request && computable(node, request))
{
make_descriptor(node, &node->nod_desc);
return make_reference(node, request->req_receive);
}
if (send && (send != old_send) && !send->msg_parameters) {
if (send && (send != old_send) && !send->msg_parameters)
{
release_message(send);
send = NULL;
}
@ -904,7 +929,8 @@ static qli_nod* compile_if( qli_nod* node, qli_req* request, bool internal_flag)
// If the statement can't be executed in database context,
// make sure it gets executed locally
if (!internal_flag || !computable(node, request)) {
if (!internal_flag || !computable(node, request))
{
internal_flag = false;
node->nod_flags |= NOD_local;
request = NULL;
@ -1174,10 +1200,12 @@ static qli_nod* compile_report( qli_nod* node, qli_req* request)
if (list)
compile_print_list(list, request, 0);
if (control = report->rpt_bottom_breaks) {
if (control = report->rpt_bottom_breaks)
{
compile_control_break(control, request);
report->rpt_bottom_breaks = NULL;
while (control) {
while (control)
{
qli_brk* temp = control;
control = control->brk_next;
temp->brk_next = report->rpt_bottom_breaks;
@ -1218,7 +1246,8 @@ static qli_req* compile_rse(qli_nod* node, qli_req* old_request, bool internal_f
qli_req* const original_request = old_request;
if (!database) {
if (!database)
{
local_dbb = NULL;
database = &local_dbb;
}
@ -1414,7 +1443,8 @@ static qli_nod* compile_statistical( qli_nod* node, qli_req* old_request, bool i
if (!internal_flag)
old_request = NULL;
if (old_request) {
if (old_request)
{
old_send = old_request->req_send;
old_receive = old_request->req_receive;
}
@ -1431,7 +1461,8 @@ static qli_nod* compile_statistical( qli_nod* node, qli_req* old_request, bool i
// If there is a value, compile it here
if (!internal_flag) {
if (!internal_flag)
{
qli_par* parameter = make_parameter(request->req_receive, 0);
node->nod_import = parameter;
make_descriptor(node, &parameter->par_desc);
@ -1441,17 +1472,20 @@ static qli_nod* compile_statistical( qli_nod* node, qli_req* old_request, bool i
if (value)
compile_expression(value, request, true);
if (old_request) {
if (old_request)
{
old_request->req_send = old_send;
old_request->req_receive = old_receive;
}
if (!internal_flag && request == old_request && computable(node, request)) {
if (!internal_flag && request == old_request && computable(node, request))
{
make_descriptor(node, &node->nod_desc);
return make_reference(node, request->req_receive);
}
if ((send != old_send) && !send->msg_parameters) {
if ((send != old_send) && !send->msg_parameters)
{
release_message(send);
send = NULL;
}
@ -1480,7 +1514,8 @@ static qli_nod* compile_store( qli_nod* node, qli_req* request, bool internal_fl
qli_ctx* context = (qli_ctx*) node->nod_arg[e_sto_context];
qli_rel* relation = context->ctx_relation;
if (!request || request->req_database != relation->rel_database) {
if (!request || request->req_database != relation->rel_database)
{
request = make_request(relation->rel_database);
node->nod_arg[e_sto_request] = (qli_nod*) request;
}
@ -1866,11 +1901,13 @@ static void make_descriptor( qli_nod* node, dsc* desc)
case nod_rpt_total:
case nod_running_total:
make_descriptor(node->nod_arg[e_stt_value], desc);
if (desc->dsc_dtype == dtype_short) {
if (desc->dsc_dtype == dtype_short)
{
desc->dsc_dtype = dtype_long;
desc->dsc_length = sizeof(SLONG);
}
else if (desc->dsc_dtype == dtype_real) {
else if (desc->dsc_dtype == dtype_real)
{
desc->dsc_dtype = dtype_double;
desc->dsc_length = sizeof(double);
}
@ -2019,7 +2056,8 @@ static qli_nod* make_reference( qli_nod* node, qli_msg* message)
// Parameter doesn't exist -- make a new one.
if (!parm) {
if (!parm)
{
parm = make_parameter(message, node);
parm->par_value = node;
parm->par_desc = node->nod_desc;

View File

@ -114,7 +114,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
const TEXT* application_file = NULL;
ALLQ_init();
LEX_init();
bool version_flag = false, flush_flag = false;
bool version_flag = false;
bool banner_flag = true;
sw_buffers = 0;
strcpy(QLI_prompt_string, "QLI> ");
@ -155,7 +155,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
switch (UPPER(c))
{
case 'A':
if (argv >= arg_end) {
if (argv >= arg_end)
{
ERRQ_msg_put(23); // Msg23 Please retry, supplying an application script file name
exit(FINI_ERROR);
}
@ -263,7 +264,8 @@ int CLIB_ROUTINE main( int argc, char **argv)
try {
PAR_token();
}
catch (const Firebird::Exception&) {
catch (const Firebird::Exception&)
{
// try again
got_started = false;
ERRQ_pending();
@ -273,6 +275,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
// Loop until end of file or forced exit
bool flush_flag = false;
while (QLI_line)
{
qli_plb* temp = QLI_default_pool = ALLQ_pool();
@ -335,18 +338,18 @@ static bool process_statement(bool flush_flag)
* is required, return true (or status), otherwise return false.
*
**************************************/
qli_dbb* dbb;
// Clear database active flags in preparation for a new statement
QLI_abort = false;
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
for (qli_dbb* dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
dbb->dbb_flags &= ~DBB_active;
// If the last statement wrote out anything to the terminal, skip a line
if (QLI_skip_line) {
if (QLI_skip_line)
{
printf("\n");
QLI_skip_line = false;
}
@ -361,140 +364,144 @@ static bool process_statement(bool flush_flag)
try {
// Set up the appropriate prompt and get the first significant token. If
// we don't get one, we're at end of file
// Set up the appropriate prompt and get the first significant token. If
// we don't get one, we're at end of file
QLI_prompt = QLI_prompt_string;
QLI_prompt = QLI_prompt_string;
// This needs to be done after setting QLI_prompt to prevent
// and infinite loop in LEX/next_line.
// If there was a prior syntax error, flush the token stream
// This needs to be done after setting QLI_prompt to prevent
// and infinite loop in LEX/next_line.
// If there was a prior syntax error, flush the token stream
if (flush_flag)
LEX_flush();
if (flush_flag)
LEX_flush();
while (QLI_token->tok_keyword == KW_SEMI)
LEX_token();
while (QLI_token->tok_keyword == KW_SEMI)
LEX_token();
PAR_real();
PAR_real();
if (!QLI_line)
return false;
if (!QLI_line)
return false;
EXEC_poll_abort();
EXEC_poll_abort();
// Mark the current token as starting the statement. This is allows
// the EDIT command to find the last statement
// Mark the current token as starting the statement. This is allows
// the EDIT command to find the last statement
LEX_mark_statement();
LEX_mark_statement();
// Change the prompt string to the continuation prompt, and parse
// the next statement
// Change the prompt string to the continuation prompt, and parse
// the next statement
QLI_prompt = QLI_cont_string;
QLI_prompt = QLI_cont_string;
qli_syntax* syntax_tree = PARQ_parse();
if (!syntax_tree)
return false;
qli_syntax* syntax_tree = PARQ_parse();
if (!syntax_tree)
return false;
EXEC_poll_abort();
EXEC_poll_abort();
// If the statement was EXIT, force end of file on command input
// If the statement was EXIT, force end of file on command input
if (syntax_tree->syn_type == nod_exit) {
QLI_line = NULL;
return false;
}
// If the statement was quit, ask the user if he want to rollback
if (syntax_tree->syn_type == nod_quit)
{
QLI_line = NULL;
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
if (syntax_tree->syn_type == nod_exit)
{
if ((dbb->dbb_transaction) && (dbb->dbb_flags & DBB_updates))
{
if (yes_no(460, dbb->dbb_symbol->sym_string)) // Msg460 Do you want to rollback updates for <dbb>?
MET_transaction(nod_rollback, dbb);
else
MET_transaction(nod_commit, dbb);
}
QLI_line = NULL;
return false;
}
return false;
}
// Expand the statement. It will return NULL is the statement was
// a command. An error will be unwound
// If the statement was quit, ask the user if he want to rollback
qli_nod* expanded_tree = EXP_expand(syntax_tree);
if (!expanded_tree)
return false;
// Compile the statement
qli_nod* execution_tree = CMPQ_compile(expanded_tree);
if (!execution_tree)
return false;
// Generate any BLR needed to support the request
if (!GEN_generate(execution_tree))
return false;
if (QLI_statistics)
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
if (syntax_tree->syn_type == nod_quit)
{
if (dbb->dbb_flags & DBB_active)
QLI_line = NULL;
for (qli_dbb* dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
{
if (!dbb->dbb_statistics)
if ((dbb->dbb_transaction) && (dbb->dbb_flags & DBB_updates))
{
dbb->dbb_statistics = (int *) gds__alloc((SLONG) sizeof(PERF));
#ifdef DEBUG_GDS_ALLOC
// We don't care about QLI specific memory leaks for V4.0
gds_alloc_flag_unfreed((void *) dbb->dbb_statistics); // QLI: don't care
#endif
// Msg460 Do you want to rollback updates for <dbb>?
if (yes_no(460, dbb->dbb_symbol->sym_string))
MET_transaction(nod_rollback, dbb);
else
MET_transaction(nod_commit, dbb);
}
perf_get_info(&dbb->dbb_handle, (perf*) dbb->dbb_statistics);
}
return false;
}
}
// Execute the request, for better or worse
// Expand the statement. It will return NULL is the statement was
// a command. An error will be unwound
EXEC_top(execution_tree);
qli_nod* expanded_tree = EXP_expand(syntax_tree);
if (!expanded_tree)
return false;
if (QLI_statistics)
{
PERF statistics;
TEXT buffer[512], report[256];
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
// Compile the statement
qli_nod* execution_tree = CMPQ_compile(expanded_tree);
if (!execution_tree)
return false;
// Generate any BLR needed to support the request
if (!GEN_generate(execution_tree))
return false;
if (QLI_statistics)
{
report[0] = 0;
if (dbb->dbb_flags & DBB_active)
for (qli_dbb* dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
{
ERRQ_msg_get(505, report, sizeof(report));
// Msg505 " reads = !r writes = !w fetches = !f marks = !m\n"
size_t used_len = strlen(report);
ERRQ_msg_get(506, report + used_len, sizeof(report) - used_len);
// Msg506 " elapsed = !e cpu = !u system = !s mem = !x, buffers = !b"
perf_get_info(&dbb->dbb_handle, &statistics);
perf_format((perf*) dbb->dbb_statistics, &statistics, report, buffer, 0);
ERRQ_msg_put(26, SafeArg() << dbb->dbb_filename << buffer); // Msg26 Statistics for database %s %s
QLI_skip_line = true;
if (dbb->dbb_flags & DBB_active)
{
if (!dbb->dbb_statistics)
{
dbb->dbb_statistics = (int *) gds__alloc((SLONG) sizeof(PERF));
#ifdef DEBUG_GDS_ALLOC
// We don't care about QLI specific memory leaks for V4.0
gds_alloc_flag_unfreed((void *) dbb->dbb_statistics); // QLI: don't care
#endif
}
perf_get_info(&dbb->dbb_handle, (perf*) dbb->dbb_statistics);
}
}
}
}
// Release resources associated with the request
// Execute the request, for better or worse
GEN_release();
EXEC_top(execution_tree);
return false;
if (QLI_statistics)
{
PERF statistics;
TEXT buffer[512], report[256];
for (qli_dbb* dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
{
report[0] = 0;
if (dbb->dbb_flags & DBB_active)
{
ERRQ_msg_get(505, report, sizeof(report));
// Msg505 " reads = !r writes = !w fetches = !f marks = !m\n"
size_t used_len = strlen(report);
ERRQ_msg_get(506, report + used_len, sizeof(report) - used_len);
// Msg506 " elapsed = !e cpu = !u system = !s mem = !x, buffers = !b"
perf_get_info(&dbb->dbb_handle, &statistics);
perf_format((perf*) dbb->dbb_statistics, &statistics, report, buffer, 0);
ERRQ_msg_put(26, SafeArg() << dbb->dbb_filename << buffer);
// Msg26 Statistics for database %s %s
QLI_skip_line = true;
}
}
}
// Release resources associated with the request
GEN_release();
return false;
} // try
catch (const Firebird::Exception&) {
catch (const Firebird::Exception&)
{
GEN_release();
return true;
}

View File

@ -72,11 +72,13 @@ void ERRQ_database_error( qli_dbb* dbb, ISC_STATUS* status_vector)
*
**************************************/
if (dbb) {
if (dbb)
{
ERRQ_msg_put(10, dbb->dbb_filename); // Msg10 ** QLI error from database %s **
gds__print_status(status_vector);
}
else {
else
{
ERRQ_msg_put(11); // Msg11 ** QLI error from database **
gds__print_status(status_vector);
}
@ -114,7 +116,8 @@ void ERRQ_error(USHORT number, const SafeArg& arg)
Firebird::LongJump::raise();
/*
else {
else
{
ERRQ_pending();
ERRQ_exit(FINI_ERROR);
}
@ -287,7 +290,8 @@ void ERRQ_pending()
*
**************************************/
if (QLI_error) {
if (QLI_error)
{
printf("%s\n", QLI_error);
QLI_error = NULL;
}

View File

@ -230,7 +230,8 @@ void EVAL_break_increment( qli_nod* node)
// Knock off count as trivial
if (node->nod_type == nod_rpt_count) {
if (node->nod_type == nod_rpt_count)
{
*(SLONG *) node->nod_desc.dsc_address += 1;
return;
}
@ -249,7 +250,8 @@ void EVAL_break_increment( qli_nod* node)
{
if (desc2->dsc_missing)
desc1->dsc_missing = DSC_missing;
else {
else
{
desc1->dsc_missing = FALSE;
MOVQ_move(desc2, desc1);
node->nod_arg[e_stt_default] = (qli_nod*) (IPTR) count;
@ -329,7 +331,8 @@ dsc* EVAL_parameter(qli_par* parameter)
desc->dsc_missing = FALSE;
qli_msg* message = parameter->par_message;
if (missing_parameter = parameter->par_missing) {
if (missing_parameter = parameter->par_missing)
{
const USHORT* missing_flag = (USHORT*) (message->msg_buffer + missing_parameter->par_offset);
desc->dsc_missing = *missing_flag ? DSC_missing : 0;
}
@ -408,7 +411,8 @@ dsc* EVAL_value(qli_nod* node)
return desc;
}
desc->dsc_missing = FALSE;
if (node->nod_flags & nod_date) {
if (node->nod_flags & nod_date)
{
double d1 = MOVQ_date_to_double(values[0]) + MOVQ_get_double(values[1]);
MOVQ_double_to_date(d1, (SLONG*) desc->dsc_address);
}
@ -426,7 +430,8 @@ dsc* EVAL_value(qli_nod* node)
return desc;
}
desc->dsc_missing = FALSE;
if (node->nod_flags & nod_date) {
if (node->nod_flags & nod_date)
{
*((double*) desc->dsc_address) =
MOVQ_date_to_double(values[0]) - MOVQ_date_to_double(values[1]);
}
@ -463,7 +468,8 @@ dsc* EVAL_value(qli_nod* node)
return desc;
case nod_negate:
if (values[0]->dsc_missing & DSC_missing) {
if (values[0]->dsc_missing & DSC_missing)
{
desc->dsc_missing = DSC_missing;
return desc;
}
@ -497,7 +503,8 @@ dsc* EVAL_value(qli_nod* node)
return desc;
case nod_prompt:
if (!prompt[0][0]) {
if (!prompt[0][0])
{
ERRQ_msg_get(499, prompt[0], sizeof(prompt[0])); // Msg499 Re-enter
ERRQ_msg_get(500, prompt[1], sizeof(prompt[1])); // Msg500 Enter
}
@ -656,7 +663,8 @@ static DSC *execute_edit( qli_nod* node)
if (node->nod_arg[e_edt_input])
{
desc = EVAL_value(node->nod_arg[e_edt_input]);
if (desc && (desc->dsc_dtype == dtype_blob)) {
if (desc && (desc->dsc_dtype == dtype_blob))
{
desc->dsc_dtype = dtype_quad;
MOVQ_move(desc, &node->nod_desc);
desc->dsc_dtype = dtype_blob;
@ -831,7 +839,8 @@ static bool like(const UCHAR* p1, SSHORT l1, const UCHAR* p2, SSHORT l2, const U
while (--l2 >= 0)
{
const UCHAR c = *p2++;
if (escape_char && !escape && c == escape_char) {
if (escape_char && !escape && c == escape_char)
{
escape = true;
continue;
}
@ -839,7 +848,8 @@ static bool like(const UCHAR* p1, SSHORT l1, const UCHAR* p2, SSHORT l2, const U
{
if (l2 == 0)
return true;
while (l1) {
while (l1)
{
if (like(p1++, l1--, p2, l2, escape_char))
return true;
}
@ -960,7 +970,8 @@ static bool sleuth( qli_nod* node, const dsc* desc1, const dsc* desc2, const dsc
// If source is not a blob, do a simple search
if (desc1->dsc_dtype != dtype_blob) {
if (desc1->dsc_dtype != dtype_blob)
{
l1 = MOVQ_get_string(desc1, &p1, &temp1, TEMP_LENGTH);
return sleuth_check(0, (const UCHAR*) p1, (const UCHAR*) (p1 + l1), control, control + l2);
}
@ -1137,7 +1148,8 @@ static bool sleuth_class( const USHORT flags,
bool result = true;
character = cond_upper(character, flags);
if (*char_class == '~') {
if (*char_class == '~')
{
++char_class;
result = false;
}
@ -1145,11 +1157,13 @@ static bool sleuth_class( const USHORT flags,
while (char_class < end_class)
{
const UCHAR c = *char_class++;
if (c == '@') {
if (c == '@')
{
if (*char_class++ == character)
return true;
}
else if (*char_class == '-') {
else if (*char_class == '-')
{
char_class += 2;
if (character >= c && character <= char_class[-1])
return result;
@ -1318,7 +1332,8 @@ static bool string_boolean( qli_nod* node)
SSHORT l3 = 0;
while (!isc_get_segment(status_vector, &blob, (USHORT*) &l3, buffer_length, buffer))
{
if (string_function(node, l3, buffer, l2, p2)) {
if (string_function(node, l3, buffer, l2, p2))
{
result = true;
break;
}

View File

@ -190,11 +190,13 @@ void EXEC_execute( qli_nod* node)
return;
case nod_if:
if (EVAL_boolean(node->nod_arg[e_if_boolean])) {
if (EVAL_boolean(node->nod_arg[e_if_boolean]))
{
EXEC_execute(node->nod_arg[e_if_true]);
return;
}
if (node->nod_arg[e_if_false]) {
if (node->nod_arg[e_if_false])
{
EXEC_execute(node->nod_arg[e_if_false]);
return;
}
@ -509,7 +511,8 @@ static DSC *assignment( qli_nod* from_node,
USHORT trash;
USHORT* missing_flag = &trash;
qli_msg* message = NULL;
if (parameter) {
if (parameter)
{
message = parameter->par_message;
missing_flag = (USHORT *) (message->msg_buffer + parameter->par_offset);
}
@ -974,7 +977,8 @@ static void execute_print( qli_nod* node)
*
**************************************/
if (node->nod_arg[e_prt_header]) {
if (node->nod_arg[e_prt_header])
{
FMT_put((TEXT*) node->nod_arg[e_prt_header], (qli_prt*) node->nod_arg[e_prt_output]);
node->nod_arg[e_prt_header] = NULL;
}

View File

@ -511,7 +511,8 @@ static qli_nod* expand_assignment( qli_syntax* input, qli_lls* right, qli_lls* l
if (to->nod_type == nod_field || to->nod_type == nod_variable)
{
qli_fld* field = (qli_fld*) to->nod_arg[e_fld_field];
if (field->fld_flags & FLD_computed) {
if (field->fld_flags & FLD_computed)
{
ERRQ_print_error(138, field->fld_name->sym_string);
// Msg138 can't do assignment to computed field
}
@ -936,7 +937,8 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
case nod_edit_blob:
node = make_node(input->syn_type, e_edt_count);
node->nod_count = 0;
if (input->syn_arg[0]) {
if (input->syn_arg[0])
{
node->nod_count = 1;
node->nod_arg[0] = expand_expression(input->syn_arg[0], stack);
}
@ -1155,7 +1157,8 @@ static qli_nod* expand_function( qli_syntax* input, qli_lls* stack)
}
if (!symbol) {
if (!symbol)
{
symbol = (qli_symbol*) input->syn_arg[s_fun_function];
ERRQ_error(412, SafeArg() << symbol->sym_string << database->dbb_filename);
}
@ -1370,7 +1373,8 @@ static qli_nod* expand_print( qli_syntax* input, qli_lls* right, qli_lls* /*left
{
count += generate_items(syn_item, new_right, (qli_lls*) &items, rse);
}
else {
else
{
ALLQ_push((blk*) expand_print_item(*sub, new_right), &items);
count++;
}
@ -2054,7 +2058,8 @@ static qli_nod* expand_store( qli_syntax* input, qli_lls* right, qli_lls* left)
// If there is an rse, make up a FOR loop
if (input->syn_arg[s_sto_rse]) {
if (input->syn_arg[s_sto_rse])
{
loop = make_node(nod_for, e_for_count);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_sto_rse], &right);
}

View File

@ -144,7 +144,8 @@ qli_rlb* GEN_rlb_extend(qli_rlb* rlb)
const ULONG len = rlb->rlb_data - rlb->rlb_base;
rlb->rlb_length += RLB_BUFFER_SIZE;
UCHAR* new_string = (UCHAR*) ALLQ_malloc((SLONG) rlb->rlb_length);
if (old_string) {
if (old_string)
{
memcpy(new_string, old_string, len);
ALLQ_free(old_string);
}
@ -175,7 +176,8 @@ void GEN_rlb_release( qli_rlb* rlb)
if (!rlb)
return;
if (rlb->rlb_base) {
if (rlb->rlb_base)
{
ALLQ_free(rlb->rlb_base);
rlb->rlb_base = NULL;
rlb->rlb_length = 0;
@ -414,7 +416,8 @@ static void explain_index_tree(qli_dbb* db, int level, const TEXT* relation_name
break;
}
if (*explain_buffer == isc_info_rsb_end) {
if (*explain_buffer == isc_info_rsb_end)
{
explain_buffer++;
(*buffer_length)--;
}
@ -527,7 +530,8 @@ static void gen_assignment( qli_nod* node, qli_req* request)
// Handle a local expression locally
if (node->nod_flags & NOD_local) {
if (node->nod_flags & NOD_local)
{
gen_expression(from, 0);
return;
}
@ -544,7 +548,8 @@ static void gen_assignment( qli_nod* node, qli_req* request)
// the expression in the context of this request
const qli_nod* reference = target->nod_arg[e_fld_reference];
if (reference) {
if (reference)
{
gen_expression(from, 0);
gen_parameter(reference->nod_import, request);
}
@ -572,7 +577,8 @@ static void gen_control_break( qli_brk* control, qli_req* request)
*
**************************************/
for (; control; control = control->brk_next) {
for (; control; control = control->brk_next)
{
if (control->brk_field)
gen_expression((qli_nod*) control->brk_field, request);
if (control->brk_line)
@ -720,7 +726,8 @@ static void gen_erase( qli_nod* node, qli_req* request)
*
**************************************/
const qli_msg* message = (qli_msg*) node->nod_arg[e_era_message];
if (message) {
if (message)
{
request = (qli_req*) node->nod_arg[e_era_request];
gen_send_receive(message, blr_receive);
}
@ -762,7 +769,8 @@ static void gen_expression(qli_nod* node, qli_req* request)
return;
case nod_unique:
if (request) {
if (request)
{
STUFF(blr_unique);
gen_rse(node->nod_arg[e_any_rse], request);
}
@ -949,14 +957,16 @@ static void gen_expression(qli_nod* node, qli_req* request)
break;
default:
if (request && node->nod_export) {
if (request && node->nod_export)
{
gen_parameter(node->nod_export, request);
return;
}
ERRQ_bugcheck(353); // Msg353 gen_expression: not understood
}
if (request) {
if (request)
{
rlb = CHECK_RLB(request->req_blr);
STUFF(operatr);
}
@ -1038,7 +1048,8 @@ static void gen_for( qli_nod* node, qli_req* request)
// If there is a request associated with the statement, prepare to
// generate BLR. Otherwise assume that a request is alrealdy initialized.
if (node->nod_arg[e_for_request]) {
if (node->nod_arg[e_for_request])
{
request = (qli_req*) node->nod_arg[e_for_request];
gen_request(request);
}
@ -1079,7 +1090,8 @@ static void gen_for( qli_nod* node, qli_req* request)
for (const qli_par* parameter = message->msg_parameters; parameter;
parameter = parameter->par_next)
{
if (parameter->par_value) {
if (parameter->par_value)
{
STUFF(blr_assignment);
gen_expression(parameter->par_value, request);
gen_parameter(parameter, request);
@ -1202,7 +1214,8 @@ static void gen_function( qli_nod* node, qli_req* request)
for (const qli_nod* const* const end = ptr + args->nod_count; ptr < end; ptr++)
gen_expression(*ptr, request);
if (new_request) {
if (new_request)
{
gen_parameter(node->nod_import, request);
gen_compile(request);
}
@ -1244,7 +1257,8 @@ static void gen_if( qli_nod* node, qli_req* request)
STUFF(blr_begin);
gen_statement(node->nod_arg[e_if_true], request);
STUFF(blr_end);
if (node->nod_arg[e_if_false]) {
if (node->nod_arg[e_if_false])
{
STUFF(blr_begin);
gen_statement(node->nod_arg[e_if_false], request);
STUFF(blr_end);
@ -1338,7 +1352,8 @@ static void gen_map(qli_map* map, qli_req* request)
for (temp = map; temp; temp = temp->map_next)
{
if (temp->map_node->nod_type != nod_function) {
if (temp->map_node->nod_type != nod_function)
{
STUFF_WORD(temp->map_position);
gen_expression(temp->map_node, request);
}
@ -1395,12 +1410,14 @@ static void gen_parameter(const qli_par* parameter, qli_req* request)
qli_rlb* rlb = CHECK_RLB(request->req_blr);
const qli_msg* message = parameter->par_message;
if (!parameter->par_missing) {
if (!parameter->par_missing)
{
STUFF(blr_parameter);
STUFF(message->msg_number);
STUFF_WORD(parameter->par_parameter);
}
else {
else
{
STUFF(blr_parameter2);
STUFF(message->msg_number);
STUFF_WORD(parameter->par_parameter);
@ -1566,7 +1583,8 @@ static void gen_rse( qli_nod* node, qli_req* request)
else
STUFF(0);
gen_map(context->ctx_map, request);
if (list = node->nod_arg[e_rse_having]) {
if (list = node->nod_arg[e_rse_having])
{
STUFF(blr_boolean);
gen_expression(list, request);
}
@ -1584,7 +1602,8 @@ static void gen_rse( qli_nod* node, qli_req* request)
context = (qli_ctx*) *ptr;
if (context->ctx_stream)
gen_rse(context->ctx_stream, request);
else {
else
{
const qli_rel* relation = context->ctx_relation;
STUFF(blr_rid);
STUFF_WORD(relation->rel_id);
@ -1594,12 +1613,14 @@ static void gen_rse( qli_nod* node, qli_req* request)
// Handle various clauses
if (list = node->nod_arg[e_rse_first]) {
if (list = node->nod_arg[e_rse_first])
{
STUFF(blr_first);
gen_expression(list, request);
}
if (list = node->nod_arg[e_rse_boolean]) {
if (list = node->nod_arg[e_rse_boolean])
{
STUFF(blr_boolean);
gen_expression(list, request);
}
@ -1863,7 +1884,8 @@ static void gen_statistical( qli_nod* node, qli_req* request)
if (node->nod_arg[e_stt_default])
gen_expression(node->nod_arg[e_stt_default], request);
if (new_request) {
if (new_request)
{
gen_parameter(node->nod_import, request);
gen_compile(request);
}
@ -1886,7 +1908,8 @@ static void gen_store( qli_nod* node, qli_req* request)
// If there is a request associated with the statement, prepare to
// generate BLR. Otherwise assume that a request is alrealdy initialized.
if (node->nod_arg[e_sto_request]) {
if (node->nod_arg[e_sto_request])
{
request = (qli_req*) node->nod_arg[e_sto_request];
gen_request(request);
}

View File

@ -1349,7 +1349,8 @@ void MET_modify_relation( qli_rel* relation, qli_fld* fields)
rollback_update(database);
ERRQ_database_error(database, gds_status);
END_ERROR;
if (!count) {
if (!count)
{
rollback_update(database);
ERRQ_print_error(247, field_name->sym_string); // Msg247 field %s doesn't exist
}
@ -3420,7 +3421,8 @@ static void purge_relation(qli_rel* relation)
for (qli_rel** ptr = &database->dbb_relations; *ptr; ptr = &(*ptr)->rel_next)
{
if (*ptr == relation) {
if (*ptr == relation)
{
*ptr = relation->rel_next;
break;
}

View File

@ -382,7 +382,8 @@ static TEXT* cvt_to_ascii( SLONG number, TEXT* pointer, int length)
TEXT* p = pointer;
*--p = 0;
while (--length >= 0) {
while (--length >= 0)
{
*--p = (number % 10) + '0';
number /= 10;
}
@ -477,7 +478,8 @@ static const TEXT* default_edit_string(const dsc* desc, TEXT* buff)
return "X(11)";
}
if (buff == buffer) {
if (buff == buffer)
{
qli_str* string = (qli_str*) ALLOCDV(type_str, strlen(buff));
strcpy(string->str_data, buff);
buff = string->str_data;
@ -598,7 +600,8 @@ static void edit_date( const dsc* desc, pics* picture, TEXT** output)
const TEXT* meridian = "";
if (picture->pic_meridian)
{
if (times.tm_hour >= 12) {
if (times.tm_hour >= 12)
{
meridian = "PM";
if (times.tm_hour > 12)
times.tm_hour -= 12;
@ -656,7 +659,8 @@ static void edit_date( const dsc* desc, pics* picture, TEXT** output)
d = *day++;
if (!sig_day && d == '0' && blank)
*out++ = ' ';
else {
else
{
sig_day = true;
*out++ = d;
}
@ -859,7 +863,8 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
}
else if (*p == '-' || c == '+')
*out++ = *p++;
else {
else
{
*out++ = ' ';
p++;
}
@ -930,7 +935,8 @@ static void edit_numeric(const dsc* desc, pics* picture, TEXT** output)
check /= 10.0;
if (check >= 1)
overflow = true;
else {
else
{
sprintf(digits, "%0*.0f", picture->pic_digits, number);
p = digits + strlen(digits);
}
@ -947,9 +953,11 @@ static void edit_numeric(const dsc* desc, pics* picture, TEXT** output)
check /= 16.0;
if (check >= 1)
hex_overflow = true;
else {
else
{
SLONG nh = static_cast<SLONG>(number);
while (p-- > hex) {
while (p-- > hex)
{
*p = "0123456789abcdef"[nh & 15];
nh >>= 4;
}
@ -973,7 +981,8 @@ static void edit_numeric(const dsc* desc, pics* picture, TEXT** output)
break;
c = UPPER(c);
if (overflow && c != 'H') {
if (overflow && c != 'H')
{
*out++ = '*';
continue;
}
@ -986,14 +995,16 @@ static void edit_numeric(const dsc* desc, pics* picture, TEXT** output)
break;
case 'H':
if (hex_overflow) {
if (hex_overflow)
{
*out++ = '*';
continue;
}
case '*':
case 'Z':
d = (c == 'H') ? *hex++ : *digits++;
if (signif || d != '0') {
if (signif || d != '0')
{
*out++ = d;
signif = true;
}
@ -1009,13 +1020,15 @@ static void edit_numeric(const dsc* desc, pics* picture, TEXT** output)
else if (c == '-' && !negative)
c = ' ';
float_char = c;
if (!float_ptr) {
if (!float_ptr)
{
float_ptr = out;
*out++ = n ? c : ' ';
break;
}
d = *digits++;
if (signif || d != '0') {
if (signif || d != '0')
{
*out++ = d;
signif = true;
break;
@ -1033,11 +1046,13 @@ static void edit_numeric(const dsc* desc, pics* picture, TEXT** output)
case 'C':
case 'D':
d = generate(picture);
if (negative) {
if (negative)
{
*out++ = c;
*out++ = UPPER(d);
}
else if (d) {
else if (d)
{
*out++ = ' ';
*out++ = ' ';
}
@ -1061,7 +1076,8 @@ static void edit_numeric(const dsc* desc, pics* picture, TEXT** output)
case ',':
if (signif)
*out++ = c;
else if (float_ptr) {
else if (float_ptr)
{
*float_ptr = ' ';
float_ptr = out;
*out++ = float_char;
@ -1100,7 +1116,8 @@ static int generate( pics* picture)
{
// If we're in a repeat, pass it back
if (picture->pic_count > 0) {
if (picture->pic_count > 0)
{
--picture->pic_count;
return picture->pic_character;
}
@ -1117,7 +1134,8 @@ static int generate( pics* picture)
// If the next character is also a paren, it is a debit indicating
// bracket. If so, swallow the second.
if ((c == ')' || c == '(') && *picture->pic_pointer == c) {
if ((c == ')' || c == '(') && *picture->pic_pointer == c)
{
picture->pic_pointer++;
return (picture->pic_character = c);
}
@ -1133,7 +1151,8 @@ static int generate( pics* picture)
while (*p >= '0' && *p <= '9')
picture->pic_count = picture->pic_count * 10 + *p++ - '0';
if (p == picture->pic_pointer) {
if (p == picture->pic_pointer)
{
c = '(';
break;
}

View File

@ -107,7 +107,8 @@ void PRO_commit( qli_dbb* database)
if ((database->dbb_capabilities & DBB_cap_multi_trans) && !(LEX_active_procedure()))
{
if (isc_commit_transaction(status_vector, &database->dbb_proc_trans)) {
if (isc_commit_transaction(status_vector, &database->dbb_proc_trans))
{
PRO_rollback(database);
ERRQ_database_error(database, status_vector);
}
@ -134,7 +135,8 @@ void PRO_copy_procedure(qli_dbb* old_database, const TEXT* old_name,
new_database = QLI_databases;
FB_API_HANDLE old_blob;
if (!old_database) {
if (!old_database)
{
for (old_database = QLI_databases; old_database; old_database = old_database->dbb_next)
{
if (old_blob = PRO_fetch_procedure(old_database, old_name))
@ -411,7 +413,8 @@ void PRO_invoke( qli_dbb* database, const TEXT* name)
*
**************************************/
FB_API_HANDLE blob = 0;
if (database) {
if (database)
{
if (!(blob = PRO_fetch_procedure(database, name)))
{
ERRQ_print_error(71, SafeArg() << name << database->dbb_symbol->sym_string);
@ -520,7 +523,8 @@ void PRO_rollback( qli_dbb* database)
**************************************/
ISC_STATUS_ARRAY status_vector;
if (database->dbb_capabilities & DBB_cap_multi_trans) {
if (database->dbb_capabilities & DBB_cap_multi_trans)
{
isc_rollback_transaction(status_vector, &database->dbb_proc_trans);
gds_trans = 0;
@ -578,7 +582,8 @@ void PRO_setup( qli_dbb* dbb)
DB = dbb->dbb_handle;
if (dbb->dbb_flags & DBB_procedures) {
if (dbb->dbb_flags & DBB_procedures)
{
gds_trans = PRO_transaction(dbb, false);
return;
}
@ -695,7 +700,8 @@ static int clear_out_qli_procedures( qli_dbb* dbb)
END_ERROR;
isc_release_request(status_vector, &req);
if (count >= 2) {
if (count >= 2)
{
dbb->dbb_flags |= DBB_procedures;
return 0;
}
@ -781,7 +787,8 @@ static void create_qli_procedures( qli_dbb* dbb)
gds_trans = PRO_transaction(dbb, true);
if (clear_out_qli_procedures(dbb)) {
if (clear_out_qli_procedures(dbb))
{
PRO_commit(dbb);
gds_trans = PRO_transaction(dbb, true);
}
@ -843,7 +850,8 @@ static void probe( qli_dbb* database, const TEXT* name)
// Probe to see if procedure is already in use
FB_API_HANDLE blob = PRO_fetch_procedure(database, name);
if (blob) {
if (blob)
{
ISC_STATUS_ARRAY status_vector;
isc_close_blob(status_vector, &blob);
ERRQ_print_error(76, SafeArg() << name << database->dbb_symbol->sym_string);

View File

@ -97,7 +97,8 @@ void RPT_report( qli_nod* loop)
if (*(USHORT*) desc->dsc_address)
return;
if (!report->rpt_buffer) {
if (!report->rpt_buffer)
{
qli_str* string = (qli_str*) ALLOCDV(type_str, message->msg_length);
report->rpt_buffer = (UCHAR*) string->str_data;
}
@ -142,7 +143,8 @@ void RPT_report( qli_nod* loop)
for (control = report->rpt_top_breaks; control; control = control->brk_next)
{
if (test_break(control, report, message)) {
if (test_break(control, report, message))
{
top_break(control, print);
break;
}
@ -333,7 +335,8 @@ static void top_of_page(qli_prt* print, bool first_flag)
++print->prt_page_number;
qli_rpt* report = print->prt_report;
if (!first_flag) {
if (!first_flag)
{
if (control = report->rpt_bottom_page)
FMT_print((qli_nod*) control->brk_line, print);
FMT_put("\f", print);

View File

@ -171,7 +171,8 @@ void SHOW_stuff( qli_syntax* node)
show_dbb(dbb);
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & REL_system)) {
if (!(relation->rel_flags & REL_system))
{
show_rel(relation);
show_fields(relation, NULL);
}
@ -199,7 +200,8 @@ void SHOW_stuff( qli_syntax* node)
show_dbb_parameters(dbb);
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & REL_system)) {
if (!(relation->rel_flags & REL_system))
{
show_rel(relation);
show_fields(relation, NULL);
}
@ -213,7 +215,8 @@ void SHOW_stuff( qli_syntax* node)
width = get_window_size(buf_len - 1);
if (dbb = (qli_dbb*) value)
show_rels(dbb, sw, width);
else {
else
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
show_rels(dbb, sw, width);
}
@ -223,7 +226,8 @@ void SHOW_stuff( qli_syntax* node)
dbb = (qli_dbb*) value;
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & REL_system)) {
if (!(relation->rel_flags & REL_system))
{
show_rel(relation);
show_fields(relation, NULL);
}
@ -236,13 +240,13 @@ void SHOW_stuff( qli_syntax* node)
count = 0;
if (value)
count += show_security_classes_detail((qli_dbb*) value);
else {
else
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
count += show_security_classes_detail(dbb);
}
if (!count) {
ERRQ_msg_put(90);
// Msg90 No security classes defined
ERRQ_msg_put(90); // Msg90 No security classes defined
}
break;
@ -252,8 +256,7 @@ void SHOW_stuff( qli_syntax* node)
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
count += show_security_class_detail(dbb, name->nam_string);
if (!count) {
ERRQ_msg_put(91, name->nam_string);
// Msg91 Security class %s is not defined
ERRQ_msg_put(91, name->nam_string); // Msg91 Security class %s is not defined
}
break;
@ -261,13 +264,13 @@ void SHOW_stuff( qli_syntax* node)
count = 0;
if (value)
count += show_views_detail((qli_dbb*) value);
else {
else
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
count += show_views_detail(dbb);
}
if (!count) {
ERRQ_msg_put(92);
// Msg92 No views defined
ERRQ_msg_put(92); // Msg92 No views defined
}
break;
@ -283,8 +286,7 @@ void SHOW_stuff( qli_syntax* node)
{
show_rel((qli_rel*) value);
if (!show_indices_detail((qli_rel*) value)) {
ERRQ_msg_put(93);
// Msg93 No indices defined
ERRQ_msg_put(93); // Msg93 No indices defined
}
break;
}
@ -297,8 +299,7 @@ void SHOW_stuff( qli_syntax* node)
{
show_rel(relation);
if (!show_indices_detail(relation)) {
ERRQ_msg_put(94);
// Msg94 No indices defined
ERRQ_msg_put(94); // Msg94 No indices defined
}
}
}
@ -314,8 +315,7 @@ void SHOW_stuff( qli_syntax* node)
{
show_rel(relation);
if (!show_indices_detail(relation)) {
ERRQ_msg_put(94);
// Msg94 No indices defined
ERRQ_msg_put(94); // Msg94 No indices defined
}
}
}
@ -332,7 +332,8 @@ void SHOW_stuff( qli_syntax* node)
case show_filters:
if (value)
show_filts((qli_dbb*) value);
else {
else
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
show_filts(dbb);
}
@ -345,7 +346,8 @@ void SHOW_stuff( qli_syntax* node)
case show_functions:
if (value)
show_funcs((qli_dbb*) value);
else {
else
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
show_funcs(dbb);
}
@ -358,7 +360,8 @@ void SHOW_stuff( qli_syntax* node)
case show_procedures:
if (value)
show_procs((qli_dbb*) value);
else {
else
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
show_procs(dbb);
}
@ -399,7 +402,8 @@ void SHOW_stuff( qli_syntax* node)
case show_system_triggers:
if (value)
show_sys_trigs((qli_dbb*) value);
else {
else
{
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
show_sys_trigs(dbb);
}
@ -433,7 +437,8 @@ static void array_dimensions( qli_dbb* database, const TEXT* field_name)
D IN RDB$FIELD_DIMENSIONS WITH D.RDB$FIELD_NAME = field_name
SORTED BY D.RDB$DIMENSION
if (D.RDB$LOWER_BOUND != 1) {
if (D.RDB$LOWER_BOUND != 1)
{
sprintf(p, "%"SLONGFORMAT":", D.RDB$LOWER_BOUND);
while (*++p);
}
@ -510,7 +515,8 @@ static void display_blob(qli_dbb* dbb,
break;
}
}
else {
else
{
if (buffer[length] == '\n')
buffer[length] = 0;
}
@ -621,11 +627,13 @@ static void show_blob_info(ISC_QUAD& blob_blr,
*
*****************************************************/
if (UserBlob::blobIsNull(blob_src)) {
if (UserBlob::blobIsNull(blob_src))
{
ERRQ_msg_put(msg_blr);
display_blr(database, blob_blr);
}
else {
else
{
ERRQ_msg_put(msg_src, relation_name);
show_text_blob(database, "\t", 0, &blob_src, 0, NULL, true);
}
@ -777,8 +785,7 @@ static void show_datatype(qli_dbb* database,
case dtype_quad:
case dtype_int64:
if (scale) {
ERRQ_msg_partial(111, SafeArg() << scale);
// Msg111 , scale %d
ERRQ_msg_partial(111, SafeArg() << scale); // Msg111 , scale %d
}
break;
case dtype_text:
@ -786,7 +793,8 @@ static void show_datatype(qli_dbb* database,
case dtype_cstring:
if (sub_type == 1)
ERRQ_msg_partial(112); // Msg112 , subtype fixed
else if (sub_type != 0) {
else if (sub_type != 0)
{
sprintf(subtype, "%d", sub_type);
ERRQ_msg_partial(107, SafeArg() << subtype);
}
@ -811,7 +819,8 @@ static void show_dbb( qli_dbb* database)
if (database)
{
const qli_symbol* symbol = database->dbb_symbol;
if (symbol) {
if (symbol)
{
ERRQ_msg_put(113, SafeArg() << database->dbb_filename << symbol->sym_string);
// Msg113 Database %s readied as %s
}
@ -876,14 +885,16 @@ static void show_dbb_parameters( qli_dbb* database)
MET_meta_transaction(database, false);
if (database->dbb_capabilities & DBB_cap_security) {
if (database->dbb_capabilities & DBB_cap_security)
{
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_dbb])
D IN RDB$DATABASE
show_string(260, D.RDB$SECURITY_CLASS, 0, NULL);
show_text_blob(database, "\t", 261, &D.RDB$DESCRIPTION, 0, NULL, false);
END_FOR;
}
else {
else
{
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_dbb])
D IN RDB$DATABASE
show_text_blob(database, "\t", 262, &D.RDB$DESCRIPTION, 0, NULL, false);
@ -899,23 +910,27 @@ static void show_dbb_parameters( qli_dbb* database)
if (F.RDB$SHADOW_NUMBER)
{
if (!(F.RDB$FILE_FLAGS & FILE_conditional)) {
if (!(F.RDB$FILE_FLAGS & FILE_conditional))
{
ERRQ_msg_put(385, SafeArg() << F.RDB$SHADOW_NUMBER <<
F.RDB$FILE_NAME << F.RDB$FILE_START);
// Msg385 Shadow %d, File:%s starting at page %d
}
}
else {
else
{
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << F.RDB$FILE_START);
// Msg263 File:%s starting at page %d
}
END_FOR;
}
else {
else
{
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_files])
F IN DB.RDB$FILES SORTED BY F.RDB$FILE_START
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << F.RDB$FILE_START);
// Msg263 File:%s starting at page %d
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << F.RDB$FILE_START);
// Msg263 File:%s starting at page %d
END_FOR;
}
}
@ -972,12 +987,14 @@ static int show_field_detail(qli_dbb* database,
fb_utils::exact_name(RFR.RDB$FIELD_NAME);
fb_utils::exact_name(F.RDB$FIELD_NAME);
if (!R.RDB$VIEW_BLR.NULL) {
if (!R.RDB$VIEW_BLR.NULL)
{
ERRQ_msg_put(495, SafeArg() << RFR.RDB$FIELD_NAME << RFR.RDB$RELATION_NAME <<
database->dbb_symbol->sym_string);
// Msg495 Field %s in view %s of database %s
}
else {
else
{
ERRQ_msg_put(496, SafeArg() << RFR.RDB$FIELD_NAME << RFR.RDB$RELATION_NAME <<
database->dbb_symbol->sym_string);
// Msg495 Field %s in relation %s of database %s
@ -985,7 +1002,8 @@ static int show_field_detail(qli_dbb* database,
ERRQ_msg_put(265, F.RDB$FIELD_NAME);
// Msg265 Global field %s
if (!RFR.RDB$BASE_FIELD.NULL) {
if (!RFR.RDB$BASE_FIELD.NULL)
{
fb_utils::exact_name(RFR.RDB$BASE_FIELD);
view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, RFR.RDB$VIEW_CONTEXT, 0);
}
@ -1033,7 +1051,8 @@ static int show_field_instances( qli_dbb* database, const TEXT* field_name)
RFR IN RDB$RELATION_FIELDS WITH RFR.RDB$FIELD_SOURCE = field_name
SORTED BY RFR.RDB$RELATION_NAME
if (!count++) {
if (!count++)
{
ERRQ_msg_put(335, SafeArg() << field_name << database->dbb_symbol->sym_string);
// Msg335 Global field %s is used database %s as:
}
@ -1063,7 +1082,8 @@ static void show_fields( qli_rel* relation, qli_fld* fields)
// Find the long field name (including query name)
if (relation) {
if (relation)
{
if (!(relation->rel_flags & REL_fields))
MET_fields(relation);
fields = relation->rel_fields;
@ -1096,7 +1116,8 @@ static void show_fields( qli_rel* relation, qli_fld* fields)
USHORT l = symbol->sym_length;
printf(" %s", symbol->sym_string);
if (symbol = field->fld_query_name) {
if (symbol = field->fld_query_name)
{
l += symbol->sym_length + 3;
printf(" (%s)", symbol->sym_string);
}
@ -1137,13 +1158,15 @@ static void show_filt( qli_filter* filter)
qli_dbb* database = filter->qfl_database;
if (database)
{
if (!(database->dbb_capabilities & DBB_cap_filters)) {
if (!(database->dbb_capabilities & DBB_cap_filters))
{
// Msg439 Filters are not supported in database %s.
ERRQ_msg_put(439, database->dbb_symbol->sym_string);
return;
}
count = show_filter_detail(database, name->nam_string);
if (!count) {
if (!count)
{
// Msg440 Filter %s is not defined in database %s.
ERRQ_msg_put(440, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
}
@ -1153,18 +1176,21 @@ static void show_filt( qli_filter* filter)
bool any_supported = false;
for (database = QLI_databases; database; database = database->dbb_next)
{
if (database->dbb_capabilities & DBB_cap_filters) {
if (database->dbb_capabilities & DBB_cap_filters)
{
any_supported = true;
count += show_filter_detail(database, name->nam_string);
}
}
if (!count)
{
if (any_supported) {
if (any_supported)
{
// Msg441 Filter %s is not defined in any open database
ERRQ_msg_put(441, name->nam_string);
}
else {
else
{
// Msg442 Filters are not supported in any open database.
ERRQ_msg_put(442);
}
@ -1221,11 +1247,13 @@ static void show_filts( qli_dbb* database)
*
**************************************/
if (!(database->dbb_capabilities & DBB_cap_filters)) {
if (!(database->dbb_capabilities & DBB_cap_filters))
{
// Msg463 Filters are not supported for database %s.
ERRQ_msg_put(463, database->dbb_symbol->sym_string);
}
else if (!(show_filters_detail(database))) {
else if (!(show_filters_detail(database)))
{
// Msg464 no filters defined for database %s.
ERRQ_msg_put(464, database->dbb_symbol->sym_string);
}
@ -1255,7 +1283,8 @@ static int show_filters_detail( qli_dbb* database)
F IN RDB$FILTERS
SORTED BY F.RDB$FUNCTION_NAME
if (!count++) {
if (!count++)
{
ERRQ_msg_put(449, SafeArg() << database->dbb_filename <<
database->dbb_symbol->sym_string);
// Msg449 Filters in database %s (%s):
@ -1289,7 +1318,8 @@ static void show_fld( qli_syntax* field_node)
**************************************/
qli_syntax* idx_node = NULL;
if (field_node->syn_type == nod_index) {
if (field_node->syn_type == nod_index)
{
idx_node = field_node;
field_node = idx_node->syn_arg[s_idx_field];
}
@ -1307,7 +1337,8 @@ static void show_fld( qli_syntax* field_node)
else
for (qli_symbol* symbol = ((qli_name*) *ptr)->nam_symbol; symbol; symbol = symbol->sym_homonym)
{
if (symbol->sym_type == SYM_database) {
if (symbol->sym_type == SYM_database)
{
database = (qli_dbb*) symbol->sym_object;
break;
}
@ -1326,7 +1357,8 @@ static void show_fld( qli_syntax* field_node)
if (database)
{
count += show_field_detail(database, string, field_name->nam_string, NULL);
if (!count) {
if (!count)
{
ERRQ_msg_put(117, SafeArg() << s << database->dbb_symbol->sym_string);
// Msg117 Field %s does not exist in database %s
}
@ -1338,8 +1370,7 @@ static void show_fld( qli_syntax* field_node)
count += show_field_detail(database, string, field_name->nam_string, idx_node);
}
if (!count) {
ERRQ_msg_put(118, s);
// Msg118 Field %s does not exist in any open database
ERRQ_msg_put(118, s); // Msg118 Field %s does not exist in any open database
}
}
}
@ -1365,13 +1396,15 @@ static void show_func( qli_func* func)
qli_dbb* database = func->qfn_database;
if (database)
{
if (!(database->dbb_capabilities & DBB_cap_functions)) {
if (!(database->dbb_capabilities & DBB_cap_functions))
{
// Msg417 Functions are not supported in database %s.
ERRQ_msg_put(417, database->dbb_symbol->sym_string);
return;
}
count = show_func_detail(database, name->nam_string);
if (!count) {
if (!count)
{
// Msg422 Function %s is not defined in database %s.
ERRQ_msg_put(422, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
}
@ -1381,20 +1414,21 @@ static void show_func( qli_func* func)
bool any_supported = false;
for (database = QLI_databases; database; database = database->dbb_next)
{
if (database->dbb_capabilities & DBB_cap_functions) {
if (database->dbb_capabilities & DBB_cap_functions)
{
any_supported = true;
count += show_func_detail(database, name->nam_string);
}
}
if (!count)
{
if (any_supported) {
if (any_supported)
{
// Msg423 Function is %s not defined in any open database
ERRQ_msg_put(423, name->nam_string);
}
else {
// Msg420 Functions are not supported in any open database.
ERRQ_msg_put(420);
ERRQ_msg_put(420); // Msg420 Functions are not supported in any open database.
}
}
}
@ -1451,10 +1485,10 @@ static int show_func_detail( qli_dbb* database, const TEXT* func_name)
FA IN RDB$FUNCTION_ARGUMENTS WITH
FA.RDB$FUNCTION_NAME = fq_name SORTED BY FA.RDB$ARGUMENT_POSITION
if (FA.RDB$ARGUMENT_POSITION == 0) {
ERRQ_msg_partial(427);
// Msg427 Return argument is
ERRQ_msg_partial(427); // Msg427 Return argument is
}
else {
else
{
ERRQ_msg_partial(428, SafeArg() << FA.RDB$ARGUMENT_POSITION);
// Msg428 Argument %d is
}
@ -1487,12 +1521,14 @@ static void show_funcs( qli_dbb* database)
*
**************************************/
if (!(database->dbb_capabilities & DBB_cap_functions)) {
if (!(database->dbb_capabilities & DBB_cap_functions))
{
ERRQ_msg_put(461, database->dbb_symbol->sym_string);
// 461 - functions aren't supported in this database
}
if (!(show_funcs_detail(database))) {
if (!(show_funcs_detail(database)))
{
ERRQ_msg_put(462, database->dbb_symbol->sym_string);
// 462 - no functions are defined in this database
}
@ -1521,7 +1557,8 @@ static int show_funcs_detail( qli_dbb* database)
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_functions])
F IN RDB$FUNCTIONS
SORTED BY F.RDB$FUNCTION_NAME
if (!count++) {
if (!count++)
{
// Msg416 Functions in database %s (%s):
ERRQ_msg_put(416, SafeArg() << database->dbb_filename <<
database->dbb_symbol->sym_string);
@ -1573,12 +1610,14 @@ static int show_insecure_fields(qli_dbb* database,
fb_utils::exact_name(RFR.RDB$FIELD_NAME);
fb_utils::exact_name(F.RDB$FIELD_NAME);
if (R.RDB$VIEW_BLR.NULL) {
if (R.RDB$VIEW_BLR.NULL)
{
ERRQ_msg_put(496, SafeArg() << RFR.RDB$FIELD_NAME << RFR.RDB$RELATION_NAME <<
database->dbb_symbol->sym_string);
// Msg495 Field %s in relation %s of database %s
}
else {
else
{
ERRQ_msg_put(495, SafeArg() << RFR.RDB$FIELD_NAME << RFR.RDB$RELATION_NAME <<
database->dbb_symbol->sym_string);
// Msg495 Field %s in view %s of database %s
@ -1586,7 +1625,8 @@ static int show_insecure_fields(qli_dbb* database,
ERRQ_msg_put(338, F.RDB$FIELD_NAME);
// Msg338 Global field %s
if (!RFR.RDB$BASE_FIELD.NULL) {
if (!RFR.RDB$BASE_FIELD.NULL)
{
fb_utils::exact_name(RFR.RDB$BASE_FIELD);
view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, RFR.RDB$VIEW_CONTEXT, 0);
}
@ -1640,7 +1680,8 @@ static void show_gbl_field( qli_syntax* field_node)
qli_name* name = (qli_name*) *ptr;
for (qli_symbol* symbol = name->nam_symbol; symbol; symbol = symbol->sym_homonym)
{
if (symbol->sym_type == SYM_database) {
if (symbol->sym_type == SYM_database)
{
database = (qli_dbb*) symbol->sym_object;
break;
}
@ -1652,7 +1693,8 @@ static void show_gbl_field( qli_syntax* field_node)
if (database)
{
count += show_gbl_field_detail(database, field_name->nam_string);
if (!count) {
if (!count)
{
ERRQ_msg_put(122, // Msg122 Global field %s does not exist in database %s
SafeArg() << field_name->nam_string <<
database->dbb_symbol->sym_string);
@ -1662,7 +1704,8 @@ static void show_gbl_field( qli_syntax* field_node)
{
for (database = QLI_databases; database; database = database->dbb_next)
count += show_gbl_field_detail(database, field_name->nam_string);
if (!count) {
if (!count)
{
ERRQ_msg_put(123, field_name->nam_string);
// Msg123 Global field %s does not exist in any open database
}
@ -1713,7 +1756,8 @@ static int show_gbl_field_detail( qli_dbb* database, const TEXT* field_name)
show_text_blob(database, "\t", 283, &F.RDB$QUERY_HEADER, 0, NULL, false);
END_FOR;
if (count && !(show_field_instances(database, field_name))) {
if (count && !(show_field_instances(database, field_name)))
{
ERRQ_msg_put(284, SafeArg() << field_name << database->dbb_symbol->sym_string);
// Msg284 %s is not used in any relations in database %s
}
@ -1742,7 +1786,8 @@ static void show_gbl_fields( qli_dbb* database)
if (database)
{
count += show_gbl_fields_detail(database);
if (!count) {
if (!count)
{
ERRQ_msg_put(124, database->dbb_symbol->sym_string);
// Msg124 There are no fields defined for database %s
}
@ -1754,8 +1799,7 @@ static void show_gbl_fields( qli_dbb* database)
count += show_gbl_fields_detail(database);
}
if (!count) {
ERRQ_msg_put(125);
// Msg125 There are no fields defined in any open database
ERRQ_msg_put(125); // Msg125 There are no fields defined in any open database
}
}
}
@ -1783,7 +1827,8 @@ static int show_gbl_fields_detail( qli_dbb* database)
F IN RDB$FIELDS WITH F.RDB$SYSTEM_FLAG MISSING OR
F.RDB$SYSTEM_FLAG = 0 SORTED BY F.RDB$FIELD_NAME
if (!count++) {
if (!count++)
{
ERRQ_msg_put(286, SafeArg() << database->dbb_symbol->sym_string);
// Msg286 Global fields for database %s:
}
@ -1945,7 +1990,8 @@ static void show_names( const TEXT* name, USHORT width, TEXT* buffer)
*s++ = ' ';
*s++ = ' ';
strcpy(s, name);
while (*s) {
while (*s)
{
s++;
len--;
}
@ -1978,9 +2024,10 @@ static void show_proc( qli_proc* proc)
FB_API_HANDLE blob = PRO_fetch_procedure(database, (TEXT*) name->nam_string);
if (blob)
display_procedure(database, (const UCHAR*) name->nam_string, blob);
else {
ERRQ_msg_put(126, // Msg126 Procedure %s not found in database %s
SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
else
{
// Msg126 Procedure %s not found in database %s
ERRQ_msg_put(126, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
}
return;
}
@ -1989,15 +2036,16 @@ static void show_proc( qli_proc* proc)
for (database = QLI_databases; database; database = database->dbb_next)
{
FB_API_HANDLE blob = PRO_fetch_procedure(database, (TEXT*) name->nam_string);
if (blob) {
if (blob)
{
display_procedure(database, (const UCHAR*) name->nam_string, blob);
count++;
}
}
if (!count) {
ERRQ_msg_put(127, name->nam_string);
// Msg127 Procedure %s not found
if (!count)
{
ERRQ_msg_put(127, name->nam_string); // Msg127 Procedure %s not found
return;
}
}
@ -2104,9 +2152,9 @@ static void show_rel_detail( qli_rel* relation)
WITH X.RDB$RELATION_NAME EQ relation->rel_symbol->sym_string
if (!X.RDB$TRIGGER_BLR.NULL)
{
if (msg) {
ERRQ_msg_put(msg);
// Msg380 Trigger defined for this relation
if (msg)
{
ERRQ_msg_put(msg); // Msg380 Trigger defined for this relation
msg = 0;
}
printf("\t");
@ -2189,7 +2237,8 @@ static USHORT show_security_class_detail( qli_dbb* database, const TEXT* name)
USHORT count = 0;
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_secur_class])
S IN RDB$SECURITY_CLASSES WITH S.RDB$SECURITY_CLASS = name
if (fb_utils::exact_name(S.RDB$SECURITY_CLASS)[0]) {
if (fb_utils::exact_name(S.RDB$SECURITY_CLASS)[0])
{
printf("\t%s:\n", S.RDB$SECURITY_CLASS);
display_acl(database, S.RDB$ACL);
}
@ -2220,12 +2269,14 @@ static USHORT show_security_classes_detail( qli_dbb* database)
USHORT count = 0;
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_secur])
S IN RDB$SECURITY_CLASSES
if (!count) {
if (!count)
{
ERRQ_msg_put(297, database->dbb_symbol->sym_string);
// Msg297 Security classes for database %s
}
if (fb_utils::exact_name(S.RDB$SECURITY_CLASS)[0]) {
if (fb_utils::exact_name(S.RDB$SECURITY_CLASS)[0])
{
printf("\t%s:\n", S.RDB$SECURITY_CLASS);
display_acl(database, S.RDB$ACL);
}
@ -2249,7 +2300,8 @@ static void show_string(USHORT msg1, TEXT* string1, USHORT msg2, TEXT* string2)
*
**************************************/
if (string2 && (!*string1 || *string1 == ' ')) {
if (string2 && (!*string1 || *string1 == ' '))
{
msg1 = msg2;
string1 = string2;
}
@ -2329,7 +2381,8 @@ static void show_text_blob(qli_dbb* database,
*
**************************************/
if (blob2 && UserBlob::blobIsNull(*blob1)) {
if (blob2 && UserBlob::blobIsNull(*blob1))
{
blob1 = blob2;
msg1 = msg2;
}
@ -2475,9 +2528,9 @@ static void show_trigger_messages( qli_dbb* database, const TEXT* name)
M IN RDB$TRIGGER_MESSAGES WITH M.RDB$TRIGGER_NAME = name
SORTED BY M.RDB$MESSAGE_NUMBER
if (first) {
ERRQ_msg_put(456, name);
// msg 456: Messages associated with %s:\n
if (first)
{
ERRQ_msg_put(456, name); // msg 456: Messages associated with %s:\n
first = false;
}
ERRQ_msg_put(457, SafeArg() << M.RDB$MESSAGE_NUMBER << M.RDB$MESSAGE);
@ -2554,7 +2607,8 @@ static void show_trigs( qli_dbb* database)
if (database)
{
if (!show_triggers_detail(database)) {
if (!show_triggers_detail(database))
{
ERRQ_msg_put(130, database->dbb_symbol->sym_string);
// Msg130 No triggers are defined in database %s
}
@ -2651,12 +2705,14 @@ static void show_var( const qli_name* var_name)
**************************************/
const qli_fld* variable;
for (variable = QLI_variables; variable; variable = variable->fld_next) {
for (variable = QLI_variables; variable; variable = variable->fld_next)
{
if (!strcmp(var_name->nam_string, variable->fld_name->sym_string))
break;
}
if (!variable) {
if (!variable)
{
ERRQ_msg_put(474, var_name->nam_string); // Msg474 Variable %s has not been declared
return;
}
@ -2711,7 +2767,8 @@ static void show_versions()
**************************************/
ERRQ_msg_put(133, GDS_VERSION); // Msg133 QLI, version %s
for (qli_dbb* dbb = QLI_databases; dbb; dbb = dbb->dbb_next) {
for (qli_dbb* dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
{
ERRQ_msg_put(134, dbb->dbb_filename);
// Msg134 Version(s) for database %s
isc_version(&dbb->dbb_handle, NULL, NULL);
@ -2740,12 +2797,14 @@ static void show_view( qli_rel* relation)
WITH X.RDB$RELATION_NAME EQ relation->rel_symbol->sym_string
AND X.RDB$VIEW_BLR NOT MISSING
if (X.RDB$VIEW_SOURCE.NULL) {
if (X.RDB$VIEW_SOURCE.NULL)
{
ERRQ_msg_put(312, relation->rel_symbol->sym_string);
// Msg312 View source for relation %s is not available. View BLR:
display_blr(database, X.RDB$VIEW_BLR);
}
else {
else
{
ERRQ_msg_put(313, relation->rel_symbol->sym_string);
// Msg313 Relation %s is a view defined as:
show_text_blob(database, "\t", 0, &X.RDB$VIEW_SOURCE, 0, NULL, false);
@ -2773,7 +2832,8 @@ static int show_views_detail( qli_dbb* database)
X IN RDB$RELATIONS WITH X.RDB$VIEW_BLR NOT MISSING
SORTED BY X.RDB$RELATION_NAME
if (!count++) {
if (!count++)
{
ERRQ_msg_put(316, database->dbb_symbol->sym_string);
// Msg316 Views in database %s:
}
@ -2831,17 +2891,20 @@ static void view_info(qli_dbb* dbb,
}
*p = '\0';
if (RFR.RDB$BASE_FIELD.NULL) {
if (RFR.RDB$BASE_FIELD.NULL)
{
ERRQ_msg_put(507, SafeArg() << spaces << base_field << RFR.RDB$RELATION_NAME);
// Msg507 %s Based on field %s of relation %s
}
else {
else
{
ERRQ_msg_put(508, SafeArg() << spaces << base_field << RFR.RDB$RELATION_NAME);
// Msg508 %s Based on field %s of view %s
}
show_text_blob(dbb, "\t", 349, &RFR.RDB$DESCRIPTION, 0, NULL, false);
if (!RFR.RDB$DESCRIPTION.NULL) {
if (!RFR.RDB$DESCRIPTION.NULL)
{
ERRQ_msg_put(349, SafeArg() << spaces << base_field);
// Msg349 %sBase field description for %s:
show_text_blob(dbb, "\t\t", 0, &RFR.RDB$DESCRIPTION, 0, NULL, false);