8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 02:03:04 +01:00

Style and minor cleanup.

This commit is contained in:
robocop 2008-12-09 07:24:32 +00:00
parent c174f5b430
commit ed0546aae5
33 changed files with 807 additions and 1157 deletions

View File

@ -402,8 +402,7 @@ void ALLQ_release( FRB block)
UCHAR pool_id = block->frb_header.blk_pool_id;
PLB pool;
if (pool_id >= global_pools->vec_count ||
!(pool = (PLB) global_pools->vec_object[pool_id]))
if (pool_id >= global_pools->vec_count || !(pool = (PLB) global_pools->vec_object[pool_id]))
{
ERRQ_bugcheck(4);
// Msg4 bad pool id
@ -412,8 +411,7 @@ void ALLQ_release( FRB block)
FRB prior = NULL;
FRB free;
FRB* ptr;
for (ptr = &pool->plb_free; free = *ptr;
prior = free, ptr = &free->frb_next)
for (ptr = &pool->plb_free; free = *ptr; prior = free, ptr = &free->frb_next)
{
if ((SCHAR *) block <= (SCHAR *) free)
break;
@ -489,8 +487,7 @@ static void extend_pool( PLB pool, USHORT count)
* of given size.
*
**************************************/
const SLONG size =
(count + sizeof(hnk) + MIN_ALLOCATION - 1) & ~(MIN_ALLOCATION - 1);
const SLONG size = (count + sizeof(hnk) + MIN_ALLOCATION - 1) & ~(MIN_ALLOCATION - 1);
if ((USHORT) size < count)
IBERROR(481); // msg 481 unsuccessful attempt to extend pool beyond 64KB

View File

@ -24,7 +24,7 @@
#ifndef QLI_COMMA_PROTO_H
#define QLI_COMMA_PROTO_H
bool CMD_check_ready(void);
bool CMD_check_ready();
void CMD_copy_procedure(qli_syntax*);
void CMD_define_procedure(qli_syntax*);
void CMD_delete_proc(qli_syntax*);

View File

@ -88,10 +88,8 @@ void CMD_copy_procedure( qli_syntax* node)
QPR old_proc = (QPR) node->syn_arg[0];
QPR new_proc = (QPR) node->syn_arg[1];
PRO_copy_procedure(old_proc->qpr_database,
old_proc->qpr_name->nam_string,
new_proc->qpr_database,
new_proc->qpr_name->nam_string);
PRO_copy_procedure(old_proc->qpr_database, old_proc->qpr_name->nam_string,
new_proc->qpr_database, new_proc->qpr_name->nam_string);
}
@ -180,8 +178,7 @@ void CMD_extract( qli_syntax* node)
qli_syntax* list = node->syn_arg[0];
if (list) {
qli_syntax** ptr = list->syn_arg;
for (const qli_syntax* const* const end = ptr + list->syn_count;
ptr < end; ptr++)
for (const qli_syntax* const* const end = ptr + list->syn_count; ptr < end; ptr++)
{
QPR proc = (QPR) *ptr;
DBB database = proc->qpr_database;
@ -196,8 +193,7 @@ void CMD_extract( qli_syntax* node)
database->dbb_symbol->sym_string);
continue;
}
dump_procedure(database, file, name->nam_string, name->nam_length,
blob);
dump_procedure(database, file, name->nam_string, name->nam_length, blob);
}
}
else {
@ -265,8 +261,7 @@ void CMD_rename_proc( qli_syntax* node)
NAM old_name = old_proc->qpr_name;
NAM new_name = new_proc->qpr_name;
if (PRO_rename_procedure
(database, old_name->nam_string, new_name->nam_string))
if (PRO_rename_procedure(database, old_name->nam_string, new_name->nam_string))
{
return;
}
@ -322,15 +317,13 @@ void CMD_set( qli_syntax* node)
QLI_echo = (bool)(IPTR) value;
break;
case set_form:
IBERROR(484); // FORMs not supported
break;
//case set_form:
// IBERROR(484); // FORMs not supported
// break;
case set_password:
string = (qli_const*) value;
length =
MIN(string->con_desc.dsc_length,
sizeof(QLI_default_password));
length = MIN(string->con_desc.dsc_length, sizeof(QLI_default_password));
strncpy(QLI_default_password, (char*) string->con_data, length);
QLI_default_password[length] = 0;
break;
@ -339,8 +332,7 @@ void CMD_set( qli_syntax* node)
string = (qli_const*) value;
if (string->con_desc.dsc_length > sizeof(QLI_prompt_string))
ERRQ_error(86); // Msg86 substitute prompt string too long
strncpy(QLI_prompt_string, (char*) string->con_data,
string->con_desc.dsc_length);
strncpy(QLI_prompt_string, (char*) string->con_data, string->con_desc.dsc_length);
QLI_prompt_string[string->con_desc.dsc_length] = 0;
break;
@ -348,8 +340,7 @@ void CMD_set( qli_syntax* node)
string = (qli_const*) value;
if (string->con_desc.dsc_length > sizeof(QLI_cont_string))
ERRQ_error(87); // Msg87 substitute prompt string too long
strncpy(QLI_cont_string, (char*) string->con_data,
string->con_desc.dsc_length);
strncpy(QLI_cont_string, (char*) string->con_data, string->con_desc.dsc_length);
QLI_cont_string[string->con_desc.dsc_length] = 0;
break;
@ -360,21 +351,17 @@ void CMD_set( qli_syntax* node)
QLI_matching_language = NULL;
break;
}
QLI_matching_language =
(qli_const*) ALLOCPV(type_con, string->con_desc.dsc_length);
QLI_matching_language = (qli_const*) ALLOCPV(type_con, string->con_desc.dsc_length);
strncpy((char*)QLI_matching_language->con_data, (char*)string->con_data,
string->con_desc.dsc_length);
QLI_matching_language->con_desc.dsc_dtype = dtype_text;
QLI_matching_language->con_desc.dsc_address =
QLI_matching_language->con_data;
QLI_matching_language->con_desc.dsc_length =
string->con_desc.dsc_length;
QLI_matching_language->con_desc.dsc_address = QLI_matching_language->con_data;
QLI_matching_language->con_desc.dsc_length = string->con_desc.dsc_length;
break;
case set_user:
string = (qli_const*) value;
length =
MIN(string->con_desc.dsc_length, sizeof(QLI_default_user));
length = MIN(string->con_desc.dsc_length, sizeof(QLI_default_user));
strncpy(QLI_default_user, (char*)string->con_data, length);
QLI_default_user[length] = 0;
break;
@ -477,8 +464,7 @@ void CMD_transaction( qli_syntax* node)
if (node->syn_type == nod_commit)
{
if ((node->syn_count > 1) ||
(node->syn_count == 0 && QLI_databases->dbb_next))
if ((node->syn_count > 1) || (node->syn_count == 0 && QLI_databases->dbb_next))
{
node->syn_type = nod_prepare;
CMD_transaction(node);
@ -497,8 +483,7 @@ void CMD_transaction( qli_syntax* node)
{
for (DBB db_iter = QLI_databases; db_iter; db_iter = db_iter->dbb_next)
{
if ((node->syn_type == nod_commit)
&& !(db_iter->dbb_flags & DBB_prepared))
if ((node->syn_type == nod_commit) && !(db_iter->dbb_flags & DBB_prepared))
{
ERRQ_msg_put(465, db_iter->dbb_symbol->sym_string);
}
@ -515,12 +500,10 @@ void CMD_transaction( qli_syntax* node)
}
qli_syntax** ptr = node->syn_arg;
for (const qli_syntax* const* const end = ptr + node->syn_count;
ptr < end; ptr++)
for (const qli_syntax* const* const end = ptr + node->syn_count; ptr < end; ptr++)
{
DBB database = (DBB) *ptr;
if ((node->syn_type == nod_commit) &&
!(database->dbb_flags & DBB_prepared))
if ((node->syn_type == nod_commit) && !(database->dbb_flags & DBB_prepared))
{
ERRQ_msg_put(465, database->dbb_symbol->sym_string);
}

View File

@ -138,8 +138,8 @@ bool CMP_node_match( const qli_nod* node1, const qli_nod* node2)
switch (node1->nod_type) {
case nod_field:
if (node1->nod_arg[e_fld_field] != node2->nod_arg[e_fld_field] ||
node1->nod_arg[e_fld_context] != node2->nod_arg[e_fld_context]
|| node1->nod_arg[e_fld_subs] != node2->nod_arg[e_fld_subs])
node1->nod_arg[e_fld_context] != node2->nod_arg[e_fld_context] ||
node1->nod_arg[e_fld_subs] != node2->nod_arg[e_fld_subs])
{
return false;
}
@ -172,21 +172,18 @@ bool CMP_node_match( const qli_nod* node1, const qli_nod* node2)
case nod_agg_min:
case nod_agg_total:
case nod_agg_count:
return CMP_node_match(node1->nod_arg[e_stt_value],
node2->nod_arg[e_stt_value]);
return CMP_node_match(node1->nod_arg[e_stt_value], node2->nod_arg[e_stt_value]);
case nod_function:
if (node1->nod_arg[e_fun_function] != node1->nod_arg[e_fun_function])
return false;
return CMP_node_match(node1->nod_arg[e_fun_args],
node2->nod_arg[e_fun_args]);
return CMP_node_match(node1->nod_arg[e_fun_args], node2->nod_arg[e_fun_args]);
}
const qli_nod* const* ptr1 = node1->nod_arg;
const qli_nod* const* ptr2 = node2->nod_arg;
for (const qli_nod* const* const end = ptr1 + node1->nod_count; ptr1 < end;
++ptr1, ++ptr2)
for (const qli_nod* const* const end = ptr1 + node1->nod_count; ptr1 < end; ++ptr1, ++ptr2)
{
if (!CMP_node_match(*ptr1, *ptr2))
return false;
@ -303,12 +300,10 @@ static qli_nod* compile_assignment( qli_nod* node, qli_req* request,
qli_nod* target = compile_expression(to, request, target_internal);
node->nod_arg[e_asn_to] = target;
node->nod_arg[e_asn_from] =
compile_expression(from, request, statement_internal);
node->nod_arg[e_asn_from] = compile_expression(from, request, statement_internal);
qli_nod* initial = node->nod_arg[e_asn_initial];
if (initial)
node->nod_arg[e_asn_initial] =
compile_expression(initial, request, false);
node->nod_arg[e_asn_initial] = compile_expression(initial, request, false);
if (statement_internal) {
node->nod_arg[e_asn_valid] = NULL; // Memory reclaimed in the main loop
@ -323,8 +318,7 @@ static qli_nod* compile_assignment( qli_nod* node, qli_req* request,
qli_ctx* context = (qli_ctx*) target->nod_arg[e_fld_context];
request = context->ctx_request;
}
target->nod_arg[e_fld_reference] =
make_reference(target, request->req_send);
target->nod_arg[e_fld_reference] = make_reference(target, request->req_send);
}
}
@ -376,10 +370,8 @@ static void compile_control_break( qli_brk* control, qli_req* request)
for (; control; control = control->brk_next) {
report_control_break = control;
if (control->brk_field)
/*
control->brk_field = (qli_syntax*) compile_expression (control->brk_field, request, false);
*/
{
// control->brk_field = (qli_syntax*) compile_expression (control->brk_field, request, false);
qli_nod* temp = (qli_nod*) control->brk_field;;
temp->nod_flags |= NOD_parameter2;
temp = compile_expression((qli_nod*) control->brk_field, request, false);
@ -510,8 +502,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
node->nod_count = 0;
if (value = node->nod_arg[e_stt_value]) {
value->nod_flags |= NOD_parameter2;
node->nod_arg[e_stt_value] =
compile_expression(value, request, false);
node->nod_arg[e_stt_value] = compile_expression(value, request, false);
}
make_descriptor(node, &node->nod_desc);
if (internal_flag) {
@ -523,8 +514,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
else {
CMP_alloc_temp(node);
if (request && value && computable(value, request))
node->nod_arg[e_stt_value] =
make_reference(value, request->req_receive);
node->nod_arg[e_stt_value] = make_reference(value, request->req_receive);
}
return node;
@ -536,8 +526,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
node->nod_count = 0;
if (value = node->nod_arg[e_stt_value]) {
value->nod_flags |= NOD_parameter2;
node->nod_arg[e_stt_value] =
compile_expression(value, request, true);
node->nod_arg[e_stt_value] = compile_expression(value, request, true);
}
make_descriptor(node, &node->nod_desc);
if (!internal_flag && request)
@ -546,8 +535,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
case nod_map:
map = (qli_map*) node->nod_arg[e_map_map];
map->map_node = value =
compile_expression(map->map_node, request, true);
map->map_node = value = compile_expression(map->map_node, request, true);
make_descriptor(value, &node->nod_desc);
if (!internal_flag && request)
return make_reference(node, request->req_receive);
@ -575,8 +563,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
case nod_and:
case nod_or:
case nod_not:
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end;
ptr++)
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
{
(*ptr)->nod_flags |= NOD_parameter2;
*ptr = compile_expression(*ptr, request, internal_flag);
@ -594,14 +581,12 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
case nod_concatenate:
case nod_substr:
case nod_user_name:
if (!internal_flag && request && request->req_receive &&
computable(node, request))
if (!internal_flag && request && request->req_receive && computable(node, request))
{
compile_expression(node, request, true);
return make_reference(node, request->req_receive);
}
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end;
ptr++)
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
{
(*ptr)->nod_flags |= NOD_parameter2;
*ptr = compile_expression(*ptr, request, internal_flag);
@ -615,8 +600,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
case nod_format:
value = node->nod_arg[e_fmt_value];
node->nod_arg[e_fmt_value] =
compile_expression(value, request, false);
node->nod_arg[e_fmt_value] = compile_expression(value, request, false);
node->nod_desc.dsc_length = FMT_expression(node);
node->nod_desc.dsc_dtype = dtype_text;
CMP_alloc_temp(node);
@ -782,9 +766,8 @@ static qli_nod* compile_for( qli_nod* node, qli_req* old_request, bool internal_
/* If nothing is required for sub-statement, and no data is required in
either direction, we don't need to execute the statement. */
if (!compile_statement
(node->nod_arg[e_for_statement], request, internal_flag)
&& !receive->msg_parameters)
if (!compile_statement(node->nod_arg[e_for_statement], request, internal_flag) &&
!receive->msg_parameters)
{
release_message(receive);
receive = NULL;
@ -859,8 +842,7 @@ static qli_nod* compile_function( qli_nod* node, qli_req* old_request,
qli_par* parameter = 0;
if (!internal_flag) {
node->nod_import = parameter =
make_parameter(request->req_receive, 0);
node->nod_import = parameter = make_parameter(request->req_receive, 0);
make_descriptor(node, &parameter->par_desc);
}
@ -952,8 +934,7 @@ static qli_nod* compile_list_fields( qli_nod* node, qli_req* request)
}
static qli_nod* compile_modify( qli_nod* node, qli_req* org_request,
bool internal_flag)
static qli_nod* compile_modify( qli_nod* node, qli_req* org_request, bool internal_flag)
{
/**************************************
*
@ -994,9 +975,9 @@ static qli_nod* compile_modify( qli_nod* node, qli_req* org_request,
if (internal_flag)
internal_flag = computable(node->nod_arg[e_mod_statement], request);
if (!compile_statement
(node->nod_arg[e_mod_statement], request, internal_flag)
&& (send != old_send) && !send->msg_parameters) {
if (!compile_statement(node->nod_arg[e_mod_statement], request, internal_flag) &&
(send != old_send) && !send->msg_parameters)
{
node->nod_flags |= NOD_remote;
release_message(send);
send = NULL;
@ -1237,10 +1218,11 @@ static qli_req* compile_rse(
for (; ctx_ptr < ctx_end; ctx_ptr++) {
qli_ctx* context = *ctx_ptr;
if (context->ctx_stream) {
if (request =
compile_rse(context->ctx_stream, old_request, internal_flag,
send, receive, database))
if (request = compile_rse(context->ctx_stream, old_request, internal_flag,
send, receive, database))
{
old_request = request;
}
}
else {
qli_rel* relation = context->ctx_relation;
@ -1257,8 +1239,7 @@ static qli_req* compile_rse(
request = old_request;
if (send) {
if (old_request && request == old_request &&
!(old_request->req_flags & REQ_rse_compiled))
if (old_request && request == old_request && !(old_request->req_flags & REQ_rse_compiled))
*send = request->req_send;
else
request->req_send = *send = make_message(request);
@ -1279,22 +1260,19 @@ static qli_req* compile_rse(
const qli_nod* const* end;
qli_nod* list;
if (list = node->nod_arg[e_rse_sort])
for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end;
ptr += 2)
for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end; ptr += 2)
{
compile_expression(*ptr, request, true);
}
if (list = node->nod_arg[e_rse_reduced])
for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end;
ptr += 2)
for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end; ptr += 2)
{
compile_expression(*ptr, request, true);
}
if (list = node->nod_arg[e_rse_group_by])
for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end;
ptr++)
for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; ptr++)
{
compile_expression(*ptr, request, true);
}
@ -1344,8 +1322,7 @@ static qli_nod* compile_statement( qli_nod* node, qli_req* request, bool interna
{
qli_nod* result = NULL;
qli_nod** ptr = node->nod_arg;
for (const qli_nod* const* const end = ptr + node->nod_count;
ptr < end; ptr++)
for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++)
{
if (compile_statement(*ptr, request, internal_flag))
result = node;
@ -1505,9 +1482,8 @@ static qli_nod* compile_store( qli_nod* node, qli_req* request, bool internal_fl
if (internal_flag)
internal_flag = computable(node->nod_arg[e_sto_statement], request);
if (!compile_statement
(node->nod_arg[e_sto_statement], request, internal_flag)
&& !send->msg_parameters)
if (!compile_statement(node->nod_arg[e_sto_statement], request, internal_flag) &&
!send->msg_parameters)
{
node->nod_flags |= NOD_remote;
release_message(send);
@ -1559,8 +1535,7 @@ static bool computable( qli_nod* node, qli_req* request)
return false;
if ((sub = node->nod_arg[e_rse_first]) && !computable(sub, request))
return false;
for (ptr = node->nod_arg + e_rse_count, end = ptr + node->nod_count;
ptr < end; ptr++)
for (ptr = node->nod_arg + e_rse_count, end = ptr + node->nod_count; ptr < end; ptr++)
{
context = (qli_ctx*) * ptr;
if (context->ctx_stream) {
@ -1578,8 +1553,7 @@ static bool computable( qli_nod* node, qli_req* request)
case nod_field:
if (sub = node->nod_arg[e_fld_subs])
for (ptr = sub->nod_arg, end = ptr + sub->nod_count; ptr < end;
ptr++)
for (ptr = sub->nod_arg, end = ptr + sub->nod_count; ptr < end; ptr++)
{
if (*ptr && !computable(*ptr, request))
return false;
@ -2079,8 +2053,10 @@ static void release_message( qli_msg* message)
qli_msg** ptr;
for (ptr = &request->req_messages; *ptr; ptr = &(*ptr)->msg_next)
{
if (*ptr == message)
break;
}
if (!*ptr)
ERRQ_bugcheck(364); // Msg 364 lost message

View File

@ -72,7 +72,7 @@ enum show_t {
show_variable,
show_variables,
show_indices,
show_qualified_procedure,
//show_qualified_procedure,
show_field,
show_filter,
show_filters,
@ -82,7 +82,7 @@ enum show_t {
show_triggers,
show_security_class,
show_security_classes,
show_forms,
//show_forms,
show_function,
show_functions,
show_views,
@ -95,18 +95,18 @@ enum show_t {
enum set_t {
set_blr,
set_statistics,
set_epilog,
//set_epilog, Unused
set_columns,
set_lines,
set_semi,
set_echo,
set_form,
//set_form,
set_matching_language,
set_prompt,
set_continuation,
set_user,
set_password,
set_euc_justify, // JPN specific option
//set_euc_justify, // JPN specific option
set_count,
set_charset
#ifdef DEV_BUILD
@ -141,12 +141,7 @@ const int s_rse_op = 8; // Comparison operator
const int s_rse_join_type = 9; // Join type
const int s_rse_all_flag = 10; // Explicit "ALL" flag
const int s_rse_list = 11;
#ifdef PC_ENGINE
const int s_rse_index = 12;
const int s_rse_count = 13;
#else
const int s_rse_count = 12;
#endif
const int s_for_rse = 0;
const int s_for_statement = 1;

View File

@ -63,7 +63,7 @@ const char* STARTUP_FILE = "HOME"; // Assume its Unix
extern TEXT *QLI_prompt;
static void enable_signals(void);
static void enable_signals();
static bool process_statement(bool);
static void CLIB_ROUTINE signal_arith_excp(USHORT, USHORT, USHORT);
static int async_quit(const int, const int, void*);
@ -288,7 +288,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
}
static void enable_signals(void)
static void enable_signals()
{
/**************************************
*
@ -435,10 +435,11 @@ static bool process_statement(bool flush_flag)
if (QLI_statistics)
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
if (dbb->dbb_flags & DBB_active) {
if (!dbb->dbb_statistics) {
dbb->dbb_statistics =
(int *) gds__alloc((SLONG) sizeof(PERF));
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
@ -466,8 +467,7 @@ static bool process_statement(bool flush_flag)
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);
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;
}
@ -618,8 +618,7 @@ static bool yes_no(USHORT number, const TEXT* arg1)
buffer[0] = 0;
if (!LEX_get_line(prompt, buffer, sizeof(buffer)))
return true;
for (const answer_t* response = answer_table; *response->answer != '\0';
response++)
for (const answer_t* response = answer_table; *response->answer != '\0'; response++)
{
const TEXT* p = buffer;
while (*p == ' ')

View File

@ -300,7 +300,7 @@ typedef struct dbb {
FB_API_HANDLE dbb_edit_blob;
FB_API_HANDLE dbb_edit_store;
FB_API_HANDLE dbb_scan_blobs;
FB_API_HANDLE dbb_delete_blob;
//FB_API_HANDLE dbb_delete_blob; // Unused
USHORT dbb_flags;
USHORT dbb_type; /* Friend or foe? */
USHORT dbb_pagesize; // For SQL metadata
@ -326,13 +326,13 @@ const ULONG DBB_cap_security = 4; // Firebird style security classes
const ULONG DBB_cap_idx_inactive = 16; // Firebird index inactive flag
const ULONG DBB_cap_multi_trans = 32; // Database supports multiple transactions
const ULONG DBB_cap_single_trans = 64; // Database supports only a single transaction
const ULONG DBB_cap_dudley = 128; // We're authorized for meta-data updates
//const ULONG DBB_cap_dudley = 128; // We're authorized for meta-data updates. Unused
const ULONG DBB_cap_functions = 256; // The DBMS knows about function
const ULONG DBB_cap_new_triggers = 512; // triggers (new V3 style)
const ULONG DBB_cap_shadowing = 1024; // Database supports shadowing
const ULONG DBB_cap_types = 2048; // Database has RDB$TYPES relation
const ULONG DBB_cap_dimensions = 4096; // Database supports arrays -- What a database!
const ULONG DBB_cap_external_type = 8192; // Database supports external datatypes
//const ULONG DBB_cap_external_type = 8192; // Database supports external datatypes. Unused
const ULONG DBB_cap_rfr_sys_flag = 16384; // Database hasn't forgotten about the system flag
const ULONG DBB_cap_filters = 32768; // Database supports filters
const ULONG DBB_cap_index_type = 65536; // Database has too damn much stuff
@ -373,7 +373,7 @@ struct qli_fld {
USHORT fld_segment_length; // Segment length for blobs
SSHORT fld_scale; // Scale factor of field
qli_syntax* fld_validation; // Validation expression
qli_syntax* fld_computed; // Computed by expression
//qli_syntax* fld_computed; // Computed by expression. Unused
qli_const* fld_missing; // Missing value defined in system relation
SSHORT fld_sub_type; // Subtype for blobs, text and EXACT_NUMERICs.
SSHORT fld_sub_type_missing; // Subtype missing flag
@ -390,7 +390,7 @@ const USHORT FLD_modify = 4;
const USHORT FLD_missing = 8;
const USHORT FLD_not_null = 16;
const USHORT FLD_add = 32;
const USHORT FLD_unique = 64;
//const USHORT FLD_unique = 64; Unused
const USHORT FLD_array = 128;
// Privileges for SQL metadata
@ -413,7 +413,7 @@ struct qli_lls {
struct qli_str {
blk str_header;
USHORT str_length;
USHORT str_fluff;
USHORT str_fluff; // ??? Not used, maybe alignment?
TEXT str_data[2];
};
@ -450,7 +450,7 @@ typedef struct plb {
// State flags for dsc_missing
const USHORT DSC_missing = 1;
const USHORT DSC_initial = 2;
const USHORT DSC_initial = 2; // Nobody sets this value, at least directly
// Function description
@ -461,7 +461,7 @@ struct qli_fun {
qli_symbol* fun_symbol; // Associated symbol block
qli_symbol* fun_query_name;
dsc fun_return; // Return descriptor
USHORT fun_args; // Number of arguments
//USHORT fun_args; // Number of arguments. Unused
dsc fun_arg[1]; /* Data type of arguments
If you change this change blk.h too */
};

View File

@ -94,8 +94,7 @@ void ERRQ_database_error( DBB dbb, ISC_STATUS* status_vector)
}
void ERRQ_error(USHORT number,
const SafeArg& arg)
void ERRQ_error(USHORT number, const SafeArg& arg)
{
/**************************************
*
@ -122,8 +121,7 @@ void ERRQ_error(USHORT number,
*/
}
void ERRQ_error(USHORT number,
const char* str)
void ERRQ_error(USHORT number, const char* str)
{
/**************************************
*
@ -142,8 +140,7 @@ void ERRQ_error(USHORT number,
}
void ERRQ_error_format(USHORT number,
const SafeArg& arg)
void ERRQ_error_format(USHORT number, const SafeArg& arg)
{
/**************************************
*
@ -185,10 +182,7 @@ void ERRQ_exit( int status)
}
void ERRQ_msg_format(USHORT number,
USHORT length,
TEXT* output_string,
const SafeArg& arg)
void ERRQ_msg_format(USHORT number, USHORT length, TEXT* output_string, const SafeArg& arg)
{
/**************************************
*
@ -205,9 +199,7 @@ void ERRQ_msg_format(USHORT number,
}
void ERRQ_msg_partial(
USHORT number,
const SafeArg& arg)
void ERRQ_msg_partial(USHORT number, const SafeArg& arg)
{
/**************************************
*
@ -220,14 +212,12 @@ void ERRQ_msg_partial(
*
**************************************/
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message),
ERRQ_message, arg);
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, arg);
printf("%s", ERRQ_message);
}
void ERRQ_msg_put(USHORT number,
const SafeArg& arg)
void ERRQ_msg_put(USHORT number, const SafeArg& arg)
{
/**************************************
*
@ -241,14 +231,12 @@ void ERRQ_msg_put(USHORT number,
*
**************************************/
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message),
ERRQ_message, arg);
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, arg);
printf("%s\n", ERRQ_message);
}
void ERRQ_msg_put(USHORT number,
const char* str)
void ERRQ_msg_put(USHORT number, const char* str)
{
/**************************************
*
@ -262,8 +250,7 @@ void ERRQ_msg_put(USHORT number,
*
**************************************/
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message),
ERRQ_message, SafeArg() << str);
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, SafeArg() << str);
printf("%s\n", ERRQ_message);
}
@ -287,7 +274,7 @@ int ERRQ_msg_get( USHORT number, TEXT* output_msg, size_t s_size)
}
void ERRQ_pending(void)
void ERRQ_pending()
{
/**************************************
*
@ -307,8 +294,7 @@ void ERRQ_pending(void)
}
void ERRQ_print_error(USHORT number,
const SafeArg& arg)
void ERRQ_print_error(USHORT number, const SafeArg& arg)
{
/**************************************
*
@ -326,8 +312,7 @@ void ERRQ_print_error(USHORT number,
}
void ERRQ_print_error(USHORT number,
const char* str)
void ERRQ_print_error(USHORT number, const char* str)
{
/**************************************
*

View File

@ -32,13 +32,12 @@ void ERRQ_error(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_error(USHORT, const char* str);
void ERRQ_error_format(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_exit (int);
void ERRQ_msg_format(USHORT, USHORT, TEXT*,
const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_msg_format(USHORT, USHORT, TEXT*, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
int ERRQ_msg_get(USHORT, TEXT*, size_t s_size);
void ERRQ_msg_partial (USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_msg_put (USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_msg_put(USHORT number, const char* str);
void ERRQ_pending (void);
void ERRQ_pending ();
void ERRQ_print_error(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_print_error(USHORT number, const char* str);
void ERRQ_syntax (USHORT);

View File

@ -51,11 +51,11 @@ static bool like(const UCHAR*, SSHORT, const UCHAR*, SSHORT, const UCHAR);
static TEXT* make_blob_buffer(FB_API_HANDLE, USHORT *);
static bool matches(const TEXT*, SSHORT, const TEXT*, SSHORT);
static bool sleuth(qli_nod*, const dsc*, const dsc*, const dsc*);
static bool sleuth_check(USHORT, const UCHAR*, const UCHAR* const,
const UCHAR*, const UCHAR* const);
static bool sleuth_check(USHORT, const UCHAR*, const UCHAR* const, const UCHAR*,
const UCHAR* const);
static bool sleuth_class(const USHORT, const UCHAR*, const UCHAR* const, UCHAR);
static int sleuth_merge(const UCHAR*, const UCHAR* const , const UCHAR*,
const UCHAR* const, UCHAR* const);
static int sleuth_merge(const UCHAR*, const UCHAR* const , const UCHAR*, const UCHAR* const,
UCHAR* const);
static bool string_boolean(qli_nod*);
static bool string_function(qli_nod*, SSHORT, const TEXT*, SSHORT, const TEXT*);
@ -105,10 +105,8 @@ int EVAL_boolean( qli_nod* node)
case nod_leq:
case nod_lss:
case nod_between:
if (!(value1 = EVAL_value(node->nod_arg[0])) ||
(value1->dsc_missing & DSC_missing) ||
!(value2 = EVAL_value(node->nod_arg[1])) ||
(value2->dsc_missing & DSC_missing))
if (!(value1 = EVAL_value(node->nod_arg[0])) || (value1->dsc_missing & DSC_missing) ||
!(value2 = EVAL_value(node->nod_arg[1])) || (value2->dsc_missing & DSC_missing))
{
return false;
}
@ -147,8 +145,7 @@ int EVAL_boolean( qli_nod* node)
case nod_between:
if (result < 0)
return false;
if (!(value2 = EVAL_value(node->nod_arg[2])) ||
(value2->dsc_missing & DSC_missing))
if (!(value2 = EVAL_value(node->nod_arg[2])) || (value2->dsc_missing & DSC_missing))
{
return false;
}
@ -281,8 +278,7 @@ void EVAL_break_increment( qli_nod* node)
case nod_rpt_total:
case nod_rpt_average:
if (desc1->dsc_dtype == dtype_long)
*(SLONG *) desc1->dsc_address +=
MOVQ_get_long(desc2, desc1->dsc_scale);
*(SLONG *) desc1->dsc_address += MOVQ_get_long(desc2, desc1->dsc_scale);
else
*(double *) desc1->dsc_address += MOVQ_get_double(desc2);
break;
@ -330,8 +326,7 @@ dsc* EVAL_parameter(qli_par* parameter)
qli_msg* message = parameter->par_message;
if (missing_parameter = parameter->par_missing) {
const USHORT* missing_flag =
(USHORT*) (message->msg_buffer + missing_parameter->par_offset);
const USHORT* missing_flag = (USHORT*) (message->msg_buffer + missing_parameter->par_offset);
desc->dsc_missing = (*missing_flag) ? DSC_missing : 0;
}
@ -386,8 +381,7 @@ dsc* EVAL_value(qli_nod* node)
case nod_variable:
{
qli_fld* field = (qli_fld*) node->nod_arg[e_fld_field];
desc->dsc_missing =
(field->fld_flags & FLD_missing) ? DSC_missing : 0;
desc->dsc_missing = (field->fld_flags & FLD_missing) ? DSC_missing : 0;
}
return desc;
@ -401,8 +395,7 @@ dsc* EVAL_value(qli_nod* node)
return desc;
case nod_add:
if ((values[0]->dsc_missing & DSC_missing) ||
(values[1]->dsc_missing & DSC_missing))
if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
{
desc->dsc_missing = DSC_missing;
return desc;
@ -422,8 +415,7 @@ dsc* EVAL_value(qli_nod* node)
return desc;
case nod_subtract:
if ((values[0]->dsc_missing & DSC_missing) ||
(values[1]->dsc_missing & DSC_missing))
if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
{
desc->dsc_missing = DSC_missing;
return desc;
@ -444,8 +436,7 @@ dsc* EVAL_value(qli_nod* node)
return desc;
case nod_divide:
if ((values[0]->dsc_missing & DSC_missing) ||
(values[1]->dsc_missing & DSC_missing))
if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
{
desc->dsc_missing = DSC_missing;
return desc;
@ -456,8 +447,7 @@ dsc* EVAL_value(qli_nod* node)
return desc;
case nod_multiply:
if ((values[0]->dsc_missing & DSC_missing) ||
(values[1]->dsc_missing & DSC_missing))
if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
{
desc->dsc_missing = DSC_missing;
return desc;
@ -480,19 +470,16 @@ dsc* EVAL_value(qli_nod* node)
desc->dsc_missing = FALSE;
switch (desc->dsc_dtype) {
case dtype_short:
*((SSHORT *) desc->dsc_address) =
-MOVQ_get_long(values[0], desc->dsc_scale);
*((SSHORT *) desc->dsc_address) = -MOVQ_get_long(values[0], desc->dsc_scale);
break;
case dtype_long:
*((SLONG *) desc->dsc_address) =
-MOVQ_get_long(values[0], desc->dsc_scale);
*((SLONG *) desc->dsc_address) = -MOVQ_get_long(values[0], desc->dsc_scale);
break;
/* lets throw arithmetic not supported until fixed
case dtype_int64:
*((SINT64 *) desc->dsc_address) =
-MOVQ_get_long(values[0], desc->dsc_scale);
*((SINT64 *) desc->dsc_address) = -MOVQ_get_long(values[0], desc->dsc_scale);
break;
*/ case dtype_real:
@ -540,8 +527,7 @@ dsc* EVAL_value(qli_nod* node)
if (desc2->dsc_missing & DSC_missing)
return desc;
if (desc->dsc_dtype == dtype_long)
*(SLONG *) desc->dsc_address +=
MOVQ_get_long(desc2, desc->dsc_scale);
*(SLONG *) desc->dsc_address += MOVQ_get_long(desc2, desc->dsc_scale);
else
*(double *) desc->dsc_address += MOVQ_get_double(desc2);
}
@ -551,8 +537,7 @@ dsc* EVAL_value(qli_nod* node)
case nod_format:
{
UCHAR* p = desc->dsc_address;
PIC_edit(values[0], (pics*) node->nod_arg[e_fmt_picture], (TEXT**) &p,
desc->dsc_length);
PIC_edit(values[0], (pics*) node->nod_arg[e_fmt_picture], (TEXT**) &p, desc->dsc_length);
desc->dsc_length = p - desc->dsc_address;
}
return desc;
@ -734,22 +719,18 @@ static DSC *execute_prompt( qli_nod* node)
dsc* desc = &node->nod_desc;
vary* data = (vary*) desc->dsc_address;
TEXT* value =
(desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
TEXT* value = (desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
buffer : data->vary_string;
const int length =
(desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
const int length = (desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
sizeof(buffer) : desc->dsc_length - 2;
for (;;) {
++QLI_prompt_count;
if (node->nod_arg[e_prm_prompt]) {
if (reprompt)
sprintf(string, "\07%s %s: ", prompt[0],
(TEXT *) node->nod_arg[e_prm_prompt]);
sprintf(string, "\07%s %s: ", prompt[0], (TEXT*) node->nod_arg[e_prm_prompt]);
else
sprintf(string, "%s %s: ", prompt[1],
(TEXT *) node->nod_arg[e_prm_prompt]);
sprintf(string, "%s %s: ", prompt[1], (TEXT*) node->nod_arg[e_prm_prompt]);
}
else {
if (reprompt)
@ -1270,12 +1251,10 @@ static bool string_boolean( qli_nod* node)
* or STARTS WITH.
*
**************************************/
DSC *desc1, *desc2, *desc3;
const DSC *desc1, *desc2, *desc3;
if (!(desc1 = EVAL_value(node->nod_arg[0])) ||
(desc1->dsc_missing & DSC_missing) ||
!(desc2 = EVAL_value(node->nod_arg[1])) ||
(desc2->dsc_missing & DSC_missing) ||
if (!(desc1 = EVAL_value(node->nod_arg[0])) || (desc1->dsc_missing & DSC_missing) ||
!(desc2 = EVAL_value(node->nod_arg[1])) || (desc2->dsc_missing & DSC_missing) ||
(node->nod_arg[2] && (!(desc3 = EVAL_value(node->nod_arg[2])) ||
(desc3->dsc_missing & DSC_missing))))
{
@ -1314,8 +1293,7 @@ static bool string_boolean( qli_nod* node)
ISC_STATUS_ARRAY status_vector;
SSHORT l3 = 0;
while (!isc_get_segment(status_vector, &blob, (USHORT*) &l3,
buffer_length, buffer))
while (!isc_get_segment(status_vector, &blob, (USHORT*) &l3, buffer_length, buffer))
{
if (string_function(node, l3, buffer, l2, p2)) {
result = true;
@ -1391,8 +1369,7 @@ static bool string_function(
TEXT temp[16];
const TEXT* q1 = NULL;
if (node->nod_count > 2 &&
MOVQ_get_string(EVAL_value(node->nod_arg[2]), &q1, (vary*) temp,
sizeof(temp)))
MOVQ_get_string(EVAL_value(node->nod_arg[2]), &q1, (vary*) temp, sizeof(temp)))
{
c1 = *q1;
}

View File

@ -89,7 +89,7 @@ static const SCHAR count_info[] =
};
void EXEC_abort(void)
void EXEC_abort()
{
/**************************************
*
@ -254,8 +254,7 @@ FB_API_HANDLE EXEC_open_blob( qli_nod* node)
ISC_STATUS_ARRAY status_vector;
if (isc_open_blob2(status_vector, &dbb->dbb_handle, &dbb->dbb_transaction,
&blob, (ISC_QUAD*) desc->dsc_address, bpb_length,
bpb))
&blob, (ISC_QUAD*) desc->dsc_address, bpb_length, bpb))
{
ERRQ_database_error(dbb, status_vector);
}
@ -351,7 +350,7 @@ FILE* EXEC_open_output(qli_nod* node)
}
void EXEC_poll_abort(void)
void EXEC_poll_abort()
{
/**************************************
*
@ -508,8 +507,7 @@ static DSC *assignment( qli_nod* from_node,
qli_msg* message = NULL;
if (parameter) {
message = parameter->par_message;
missing_flag =
(USHORT *) (message->msg_buffer + parameter->par_offset);
missing_flag = (USHORT *) (message->msg_buffer + parameter->par_offset);
}
try {
@ -573,8 +571,7 @@ static void commit_retaining( qli_nod* node)
return;
if (node->nod_type == nod_commit_retaining &&
((node->nod_count > 1) ||
(node->nod_count == 0 && QLI_databases->dbb_next)))
((node->nod_count > 1) || (node->nod_count == 0 && QLI_databases->dbb_next)))
{
node->nod_type = nod_prepare;
commit_retaining(node);
@ -589,11 +586,9 @@ static void commit_retaining( qli_nod* node)
if (node->nod_count == 0) {
for (DBB database = QLI_databases; database;
database = database->dbb_next)
for (DBB database = QLI_databases; database; database = database->dbb_next)
{
if ((node->nod_type == nod_commit_retaining)
&& !(database->dbb_flags & DBB_prepared))
if ((node->nod_type == nod_commit_retaining) && !(database->dbb_flags & DBB_prepared))
{
ERRQ_msg_put(465, database->dbb_symbol->sym_string);
}
@ -609,8 +604,7 @@ static void commit_retaining( qli_nod* node)
for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++)
{
DBB database = (DBB) *ptr;
if ((node->nod_type == nod_commit_retaining) &&
!(database->dbb_flags & DBB_prepared))
if ((node->nod_type == nod_commit_retaining) && !(database->dbb_flags & DBB_prepared))
{
ERRQ_msg_put(465, database->dbb_symbol->sym_string);
}
@ -658,8 +652,7 @@ static bool copy_blob( qli_nod* value, qli_par* parameter)
dsc* to_desc = EVAL_parameter(parameter);
if (to_dbb == from_dbb &&
(!to_desc->dsc_sub_type ||
from_desc->dsc_sub_type == to_desc->dsc_sub_type))
(!to_desc->dsc_sub_type || from_desc->dsc_sub_type == to_desc->dsc_sub_type))
{
return false;
}
@ -698,8 +691,7 @@ static bool copy_blob( qli_nod* value, qli_par* parameter)
}
if (!from_blob.open(from_dbb->dbb_handle, from_dbb->dbb_transaction,
*(ISC_QUAD*) from_desc->dsc_address, bpb_length,
bpb))
*(ISC_QUAD*) from_desc->dsc_address, bpb_length, bpb))
{
ERRQ_database_error(from_dbb, status_vector);
}
@ -782,8 +774,7 @@ static void execute_abort( qli_nod* node)
const TEXT* ptr = NULL;
UCHAR temp[80];
const USHORT l =
MOVQ_get_string(EVAL_value(node->nod_arg[0]), &ptr,
(vary*) temp, sizeof(temp));
MOVQ_get_string(EVAL_value(node->nod_arg[0]), &ptr, (vary*) temp, sizeof(temp));
UCHAR msg[128];
MOVQ_terminate(ptr, (SCHAR*) msg, l, sizeof(msg));
@ -817,8 +808,7 @@ static void execute_assignment( qli_nod* node)
if (to->nod_type == nod_field) {
qli_nod* reference = to->nod_arg[e_fld_reference];
parameter = reference->nod_import;
if (to->nod_desc.dsc_dtype == dtype_blob &&
from->nod_desc.dsc_dtype == dtype_blob &&
if (to->nod_desc.dsc_dtype == dtype_blob && from->nod_desc.dsc_dtype == dtype_blob &&
copy_blob(from, parameter))
{
return;
@ -830,8 +820,7 @@ static void execute_assignment( qli_nod* node)
if (parameter)
parameter = parameter->par_missing;
assignment(from, EVAL_value(to),
node->nod_arg[e_asn_valid], initial, parameter);
assignment(from, EVAL_value(to), node->nod_arg[e_asn_valid], initial, parameter);
// propagate the missing flag in variable assignments
@ -943,9 +932,7 @@ static void execute_output( qli_nod* node)
// Set up error handling
try {
// Finally, execute the query
EXEC_execute(node->nod_arg[e_out_statement]);
fclose(print->prt_file);
@ -1057,8 +1044,7 @@ static void map_data( qli_msg* message)
desc->dsc_address = message->msg_buffer + parameter->par_offset;
qli_par* missing_parameter = parameter->par_missing;
if (missing_parameter) {
USHORT* missing_flag = (USHORT*) (message->msg_buffer +
missing_parameter->par_offset);
USHORT* missing_flag = (USHORT*) (message->msg_buffer + missing_parameter->par_offset);
*missing_flag = (desc->dsc_missing & DSC_missing) ? DSC_missing : 0;
}
@ -1142,8 +1128,7 @@ static void set_null( qli_msg* message)
* statements.
*
**************************************/
for (qli_par* parameter = message->msg_parameters; parameter;
parameter = parameter->par_next)
for (qli_par* parameter = message->msg_parameters; parameter; parameter = parameter->par_next)
{
qli_nod* from = parameter->par_value;
if (from->nod_type == nod_field) {
@ -1177,11 +1162,11 @@ static void transaction_state( qli_nod* node, DBB database)
if (database->dbb_transaction) {
if (node->nod_type == nod_commit_retaining) {
if (isc_commit_retaining(status, &database->dbb_transaction))
ERRQ_database_error(database, status);
ERRQ_database_error(database, status);
}
else if (node->nod_type == nod_prepare) {
if (isc_prepare_transaction(status, &database->dbb_transaction))
ERRQ_database_error(database, status);
ERRQ_database_error(database, status);
}
}
}

View File

@ -96,7 +96,7 @@ typedef enum {
CTX_RELATION,
CTX_VARIABLE,
CTX_AGGREGATE,
CTX_UNION,
//CTX_UNION,
CTX_STREAM
} CTX_T;
@ -132,7 +132,7 @@ struct qli_map {
struct qli_msg {
blk msg_header;
qli_req* msg_request; // Parent request
qli_ctx* msg_context; // Contexts in message
//qli_ctx* msg_context; // Contexts in message
qli_msg* msg_next; // Next message in request
struct qli_par* msg_parameters; // Field instances
USHORT msg_number; // Message number
@ -157,7 +157,7 @@ struct qli_par {
// Print item block
typedef enum itm_t
{
{
item_value,
item_skip,
item_column,
@ -182,12 +182,12 @@ struct qli_print_item {
USHORT itm_print_length;
USHORT itm_header_offset;
USHORT itm_header_length;
USHORT itm_header_segments;
//USHORT itm_header_segments;
USHORT itm_count; // Number of lines to skip
USHORT itm_column; // Logical column number
//USHORT itm_column; // Logical column number
FB_API_HANDLE itm_stream;
USHORT itm_kanji_fragment; // JPN: last kanji on line border
ISC_STATUS itm_blob_status; // JPN: status of the last blob fetch
//USHORT itm_kanji_fragment; // JPN: last kanji on line border
//ISC_STATUS itm_blob_status; // JPN: status of the last blob fetch
};
// itm_flags
@ -255,10 +255,7 @@ const int e_rse_context = 4; // Context block
const int e_rse_group_by = 5;
const int e_rse_having = 6;
const int e_rse_join_type = 7;
#ifdef PC_ENGINE
const int e_rse_index = 8;
#endif
const int e_rse_count = 9;
const int e_rse_count = 8;
const int e_prt_list = 0; // List of print items
const int e_prt_file_name = 1; // Output file name

View File

@ -72,7 +72,7 @@ static qli_nod* expand_store(qli_syntax*, qli_lls*, qli_lls*);
static void expand_values(qli_syntax*, qli_lls*);
static qli_ctx* find_context(const nam*, qli_lls*);
static int generate_fields(qli_ctx*, qli_lls*, qli_syntax*);
static int generate_items(qli_syntax*, qli_lls*, qli_lls*, qli_nod*);
static int generate_items(const qli_syntax*, qli_lls*, qli_lls*, qli_nod*);
static bool global_agg(const qli_syntax*, const qli_syntax*);
static bool invalid_nod_field(const qli_nod*, const qli_nod*);
static bool invalid_syn_field(const qli_syntax*, const qli_syntax*);
@ -361,8 +361,7 @@ static void declare_global( qli_fld* variable, qli_syntax* field_node)
qli_fld* field;
for (qli_fld** ptr = &QLI_variables; field = *ptr; ptr = &field->fld_next)
if (!strcmp
(field->fld_name->sym_string, variable->fld_name->sym_string))
if (!strcmp(field->fld_name->sym_string, variable->fld_name->sym_string))
{
*ptr = field->fld_next;
ALLQ_release((FRB) field->fld_name);
@ -513,8 +512,7 @@ static qli_nod* expand_assignment( qli_syntax* input, qli_lls* right, qli_lls* l
if (from->nod_type == nod_prompt)
from->nod_arg[e_prm_field] = to->nod_arg[e_fld_field];
if (field->fld_validation)
node->nod_arg[e_asn_valid] =
expand_expression(field->fld_validation, left);
node->nod_arg[e_asn_valid] = expand_expression(field->fld_validation, left);
}
if (!node->nod_arg[e_asn_valid])
@ -548,8 +546,7 @@ static qli_nod* expand_any( qli_syntax* input, qli_lls* stack)
boolean->nod_arg[0] = expand_expression(input->syn_arg[1], stack);
qli_nod* negation = make_node(nod_not, 1);
negation->nod_arg[0] = boolean;
rse->nod_arg[e_rse_boolean] =
make_and(rse->nod_arg[e_rse_boolean], negation);
rse->nod_arg[e_rse_boolean] = make_and(rse->nod_arg[e_rse_boolean], negation);
}
return node;
@ -621,11 +618,9 @@ static void expand_control_break( qli_brk** ptr, qli_lls* right)
control->brk_next = list;
list = control;
if (control->brk_field)
control->brk_field =
(qli_syntax*) expand_expression(control->brk_field, right);
control->brk_field = (qli_syntax*) expand_expression(control->brk_field, right);
if (control->brk_line)
control->brk_line =
(qli_syntax*) expand_print_list(control->brk_line, right);
control->brk_line = (qli_syntax*) expand_print_list(control->brk_line, right);
}
*ptr = list;
@ -761,8 +756,7 @@ static qli_nod* expand_erase( qli_syntax* input, qli_lls* right, qli_lls* left)
if (input->syn_arg[s_era_rse]) {
loop = make_node(nod_for, e_for_count);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_era_rse],
&right);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_era_rse], &right);
}
// Loop thru contexts counting them.
@ -848,8 +842,9 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
node->nod_arg[e_stt_default] = expand_expression(value, stack);
if (input->syn_arg[s_prt_distinct] && node->nod_arg[e_stt_rse]
&& node->nod_arg[e_stt_value])
expand_distinct(node->nod_arg[e_stt_rse],
node->nod_arg[e_stt_value]);
{
expand_distinct(node->nod_arg[e_stt_rse], node->nod_arg[e_stt_value]);
}
// count2 next 2 lines go
if (input->syn_type == nod_count)
node->nod_arg[e_stt_value] = 0;
@ -878,16 +873,13 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
}
*/
if ((value = input->syn_arg[s_stt_value]) &&
(input->syn_arg[s_prt_distinct]
|| (input->syn_type != nod_agg_count)))
(input->syn_arg[s_prt_distinct] || (input->syn_type != nod_agg_count)))
{
node->nod_arg[e_stt_value] =
expand_expression(value, stack->lls_next);
if (input->syn_arg[s_prt_distinct]
|| (input->syn_type == nod_agg_count && context->ctx_sub_rse))
node->nod_arg[e_stt_value] = expand_expression(value, stack->lls_next);
if (input->syn_arg[s_prt_distinct] ||
(input->syn_type == nod_agg_count && context->ctx_sub_rse))
{
expand_distinct(context->ctx_sub_rse,
node->nod_arg[e_stt_value]);
expand_distinct(context->ctx_sub_rse, node->nod_arg[e_stt_value]);
}
}
return post_map(node, context);
@ -941,8 +933,7 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
case nod_format:
node = make_node(input->syn_type, e_fmt_count);
node->nod_count = 1;
node->nod_arg[e_fmt_value] =
expand_expression(input->syn_arg[s_fmt_value], stack);
node->nod_arg[e_fmt_value] = expand_expression(input->syn_arg[s_fmt_value], stack);
node->nod_arg[e_fmt_edit] = (qli_nod*) input->syn_arg[s_fmt_edit];
return node;
@ -1053,10 +1044,8 @@ static qli_nod* expand_field( qli_syntax* input, qli_lls* stack, qli_syntax* sub
continue;
}
qli_ctx** ptr =
(qli_ctx**) stream_context->ctx_stream->nod_arg + e_rse_count;
const qli_ctx* const* const end =
ptr + stream_context->ctx_stream->nod_count;
qli_ctx** ptr = (qli_ctx**) stream_context->ctx_stream->nod_arg + e_rse_count;
const qli_ctx* const* const end = ptr + stream_context->ctx_stream->nod_count;
for (; ptr < end; ptr++)
if (*ptr == context)
break;
@ -1086,8 +1075,7 @@ static qli_nod* expand_for( qli_syntax* input, qli_lls* right, qli_lls* left)
**************************************/
qli_nod* node = make_node(input->syn_type, e_for_count);
node->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_for_rse], &right);
node->nod_arg[e_for_statement] =
expand_statement(input->syn_arg[s_for_statement], right, left);
node->nod_arg[e_for_statement] = expand_statement(input->syn_arg[s_for_statement], right, left);
return node;
}
@ -1116,8 +1104,7 @@ static qli_nod* expand_function( qli_syntax* input, qli_lls* stack)
qli_nod* node = make_node(input->syn_type, e_fun_count);
node->nod_count = 1;
qli_ctx* context;
if (stack && (context = (qli_ctx*) stack->lls_object)
&& (context->ctx_type == CTX_RELATION))
if (stack && (context = (qli_ctx*) stack->lls_object) && (context->ctx_type == CTX_RELATION))
{
if (context->ctx_primary)
context = context->ctx_primary;
@ -1157,8 +1144,7 @@ static qli_nod* expand_function( qli_syntax* input, qli_lls* stack)
node->nod_arg[e_fun_function] = (qli_nod*) function;
node->nod_arg[e_fun_args] =
expand_expression(input->syn_arg[s_fun_args], stack);
node->nod_arg[e_fun_args] = expand_expression(input->syn_arg[s_fun_args], stack);
return node;
}
@ -1180,8 +1166,7 @@ static qli_nod* expand_group_by( qli_syntax* input, qli_lls* stack, qli_ctx* con
qli_nod** ptr2 = node->nod_arg;
qli_syntax** ptr = input->syn_arg;
for (const qli_syntax* const* const end = ptr + input->syn_count; ptr < end;
ptr++, ptr2++)
for (const qli_syntax* const* const end = ptr + input->syn_count; ptr < end; ptr++, ptr2++)
{
*ptr2 = expand_expression(*ptr, stack);
post_map(*ptr2, context);
@ -1209,8 +1194,7 @@ static qli_nod* expand_modify( qli_syntax* input, qli_lls* right, qli_lls* left)
if (input->syn_arg[s_mod_rse]) {
loop = make_node(nod_for, e_for_count);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_mod_rse],
&right);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_mod_rse], &right);
}
qli_lls* contexts;
@ -1355,13 +1339,11 @@ static qli_nod* expand_print( qli_syntax* input, qli_lls* right, qli_lls* left)
qli_syntax* syn_list = input->syn_arg[s_prt_list];
if (syn_list) {
qli_syntax** sub = syn_list->syn_arg;
for (const qli_syntax* const* const end = sub + syn_list->syn_count;
sub < end; sub++)
for (const qli_syntax* const* const end = sub + syn_list->syn_count; sub < end; sub++)
{
qli_syntax* syn_item;
if (((*sub)->syn_type == nod_print_item)
&& (syn_item = (*sub)->syn_arg[s_itm_value])
&& (syn_item->syn_type == nod_star))
const qli_syntax* syn_item;
if (((*sub)->syn_type == nod_print_item) &&
(syn_item = (*sub)->syn_arg[s_itm_value]) && (syn_item->syn_type == nod_star))
{
count += generate_items(syn_item, new_right, (qli_lls*) &items, rse);
}
@ -1373,8 +1355,7 @@ static qli_nod* expand_print( qli_syntax* input, qli_lls* right, qli_lls* left)
}
else if (syn_rse && (syn_list = syn_rse->syn_arg[s_rse_reduced])) {
qli_syntax** sub = syn_list->syn_arg;
for (const qli_syntax* const* const end = sub + syn_list->syn_count;
sub < end; sub += 2)
for (const qli_syntax* const* const end = sub + syn_list->syn_count; sub < end; sub += 2)
{
qli_print_item* item = (qli_print_item*) ALLOCD(type_itm);
item->itm_type = item_value;
@ -1390,13 +1371,11 @@ static qli_nod* expand_print( qli_syntax* input, qli_lls* right, qli_lls* left)
qli_rel* relation = context->ctx_relation;
if (!relation || context->ctx_sub_rse)
continue;
for (qli_fld* field = relation->rel_fields; field;
field = field->fld_next)
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
{
if (
(field->fld_system_flag
&& field->fld_system_flag != relation->rel_system_flag)
|| field->fld_flags & FLD_array)
if ((field->fld_system_flag &&
field->fld_system_flag != relation->rel_system_flag) ||
field->fld_flags & FLD_array)
{
continue;
}
@ -1454,8 +1433,7 @@ static qli_nod* expand_print( qli_syntax* input, qli_lls* right, qli_lls* left)
loop->nod_arg[e_for_statement] = node;
node = loop;
if (input->syn_arg[s_prt_order])
rse->nod_arg[e_rse_sort] =
expand_sort(input->syn_arg[s_prt_order], new_right, list);
rse->nod_arg[e_rse_sort] = expand_sort(input->syn_arg[s_prt_order], new_right, list);
}
return node;
@ -1540,8 +1518,7 @@ static qli_nod* expand_print_list( qli_syntax* input, qli_lls* stack)
qli_lls* items = NULL;
qli_syntax** ptr = input->syn_arg;
for (const qli_syntax* const* const end = ptr + input->syn_count;
ptr < end; ptr++)
for (const qli_syntax* const* const end = ptr + input->syn_count; ptr < end; ptr++)
{
ALLQ_push((blk*) expand_print_item(*ptr, stack), &items);
}
@ -1628,8 +1605,7 @@ static qli_nod* expand_restructure( qli_syntax* input, qli_lls* right, qli_lls*
node->nod_arg[e_sto_context] = (qli_nod*) context;
context->ctx_type = CTX_RELATION;
context->ctx_rse = (qli_nod*) -1;
qli_rel* relation = context->ctx_relation =
(qli_rel*) rel_node->syn_arg[s_rel_relation];
qli_rel* relation = context->ctx_relation = (qli_rel*) rel_node->syn_arg[s_rel_relation];
// If we don't already know about the relation, find out now.
@ -1650,8 +1626,7 @@ static qli_nod* expand_restructure( qli_syntax* input, qli_lls* right, qli_lls*
// First look for an exact field name match
qli_fld* fld;
for (fld = ctx->ctx_relation->rel_fields; fld;
fld = fld->fld_next)
for (fld = ctx->ctx_relation->rel_fields; fld; fld = fld->fld_next)
{
if (compare_symbols(field->fld_name, fld->fld_name))
break;
@ -1659,8 +1634,7 @@ static qli_nod* expand_restructure( qli_syntax* input, qli_lls* right, qli_lls*
// Next try, target field name matching source query name
if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld;
fld = fld->fld_next)
for (fld = ctx->ctx_relation->rel_fields; fld; fld = fld->fld_next)
{
if (compare_symbols(field->fld_name, fld->fld_query_name))
break;
@ -1668,13 +1642,10 @@ static qli_nod* expand_restructure( qli_syntax* input, qli_lls* right, qli_lls*
// If nothing yet, look for any old match
if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld;
fld = fld->fld_next)
for (fld = ctx->ctx_relation->rel_fields; fld; fld = fld->fld_next)
{
if (compare_symbols(field-> fld_query_name,
fld->fld_name)
|| compare_symbols(field->fld_query_name,
fld->fld_query_name))
if (compare_symbols(field-> fld_query_name, fld->fld_name) ||
compare_symbols(field->fld_query_name, fld->fld_query_name))
{
break;
}
@ -1683,8 +1654,7 @@ static qli_nod* expand_restructure( qli_syntax* input, qli_lls* right, qli_lls*
if (fld) {
qli_nod* assignment = make_node(nod_assign, e_asn_count);
assignment->nod_count = e_asn_count - 1;
assignment->nod_arg[e_asn_to] =
make_field(field, context);
assignment->nod_arg[e_asn_to] = make_field(field, context);
assignment->nod_arg[e_asn_from] = make_field(fld, ctx);
ALLQ_push((blk*) assignment, &stack);
goto found_field;
@ -1758,8 +1728,7 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
// Process the FIRST clause before the context gets augmented
if (input->syn_arg[s_rse_first])
node->nod_arg[e_rse_first] =
expand_expression(input->syn_arg[e_rse_first], old_stack);
node->nod_arg[e_rse_first] = expand_expression(input->syn_arg[e_rse_first], old_stack);
// Process relations
@ -1778,12 +1747,10 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
}
else {
context->ctx_type = CTX_RELATION;
qli_rel* relation = context->ctx_relation =
(qli_rel*) rel_node->syn_arg[s_rel_relation];
qli_rel* relation = context->ctx_relation = (qli_rel*) rel_node->syn_arg[s_rel_relation];
if (!(relation->rel_flags & REL_fields))
MET_fields(relation);
qli_symbol* symbol = context->ctx_symbol =
(qli_symbol*) rel_node->syn_arg[s_rel_context];
qli_symbol* symbol = context->ctx_symbol = (qli_symbol*) rel_node->syn_arg[s_rel_context];
if (symbol)
symbol->sym_object = (BLK) context;
if (over) {
@ -1792,10 +1759,8 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
for (USHORT j = 0; j < over->syn_count; j++) {
qli_syntax* field = over->syn_arg[j];
qli_nod* eql_node = make_node(nod_eql, 2);
eql_node->nod_arg[0] =
expand_expression(field, short_stack);
eql_node->nod_arg[1] =
expand_expression(field, new_stack);
eql_node->nod_arg[0] = expand_expression(field, short_stack);
eql_node->nod_arg[1] = expand_expression(field, new_stack);
boolean = make_and(eql_node, boolean);
}
ALLQ_pop(&short_stack);
@ -1807,18 +1772,14 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
// Handle explicit boolean
if (input->syn_arg[e_rse_boolean])
boolean = make_and(boolean,
expand_expression(input->syn_arg[e_rse_boolean],
new_stack));
boolean = make_and(boolean, expand_expression(input->syn_arg[e_rse_boolean], new_stack));
// Handle implicit boolean from SQL xxx IN (yyy FROM relation)
if (input->syn_arg[s_rse_outer]) {
qli_nod* eql_node = make_node((enum nod_t)(IPTR)input->syn_arg[s_rse_op], 2);
eql_node->nod_arg[0] =
expand_expression(input->syn_arg[s_rse_outer], old_stack);
eql_node->nod_arg[1] =
expand_expression(input->syn_arg[s_rse_inner], new_stack);
eql_node->nod_arg[0] = expand_expression(input->syn_arg[s_rse_outer], old_stack);
eql_node->nod_arg[1] = expand_expression(input->syn_arg[s_rse_inner], new_stack);
if (input->syn_arg[s_rse_all_flag])
eql_node = negate(eql_node);
boolean = make_and(eql_node, boolean);
@ -1833,19 +1794,13 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
else
node->nod_arg[e_rse_sort] = temp;
}
#ifdef PC_ENGINE
else if (input->syn_arg[s_rse_index])
node->nod_arg[e_rse_index] = (qli_nod*) input->syn_arg[s_rse_index];
#endif
if (input->syn_arg[s_rse_reduced])
node->nod_arg[e_rse_reduced] =
expand_sort(input->syn_arg[e_rse_reduced], new_stack, 0);
node->nod_arg[e_rse_reduced] = expand_sort(input->syn_arg[e_rse_reduced], new_stack, 0);
if (input->syn_arg[s_rse_group_by])
parent_rse->nod_arg[e_rse_group_by] =
expand_group_by(input->syn_arg[s_rse_group_by], new_stack,
parent_context);
expand_group_by(input->syn_arg[s_rse_group_by], new_stack, parent_context);
node->nod_arg[e_rse_join_type] = (qli_nod*) input->syn_arg[s_rse_join_type];
@ -1858,8 +1813,7 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
qli_ctx* context = NULL;
ptr2 = node->nod_arg + e_rse_count;
for (const qli_nod* const* const end = ptr2 + node->nod_count;
ptr2 < end; ptr2++)
for (const qli_nod* const* const end = ptr2 + node->nod_count; ptr2 < end; ptr2++)
{
context = (qli_ctx*) *ptr2;
context->ctx_parent = parent_context;
@ -1870,8 +1824,7 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
ALLQ_push((blk*) parent_context, stack);
if (input->syn_arg[s_rse_having])
parent_rse->nod_arg[e_rse_having] =
expand_expression(input->syn_arg[s_rse_having], *stack);
parent_rse->nod_arg[e_rse_having] = expand_expression(input->syn_arg[s_rse_having], *stack);
return parent_rse;
}
@ -1960,13 +1913,11 @@ static qli_nod* expand_statement( qli_syntax* input, qli_lls* right, qli_lls* le
case nod_if:
node = make_node(input->syn_type, input->syn_count);
node->nod_arg[e_if_boolean] =
expand_expression(input->syn_arg[s_if_boolean], right);
node->nod_arg[e_if_boolean] = expand_expression(input->syn_arg[s_if_boolean], right);
node->nod_arg[e_if_true] =
expand_statement(input->syn_arg[s_if_true], right, left);
if (input->syn_arg[s_if_false])
node->nod_arg[e_if_false] =
expand_statement(input->syn_arg[s_if_false], right, left);
node->nod_arg[e_if_false] = expand_statement(input->syn_arg[s_if_false], right, left);
else
node->nod_count = 2;
return node;
@ -1994,8 +1945,7 @@ static qli_nod* expand_statement( qli_syntax* input, qli_lls* right, qli_lls* le
case nod_repeat:
node = make_node(input->syn_type, input->syn_count);
node->nod_arg[e_rpt_value] =
expand_expression(input->syn_arg[s_rpt_value], left);
node->nod_arg[e_rpt_value] = expand_expression(input->syn_arg[s_rpt_value], left);
node->nod_arg[e_rpt_statement] =
expand_statement(input->syn_arg[s_rpt_statement], right, left);
return node;
@ -2055,8 +2005,7 @@ static qli_nod* expand_store( qli_syntax* input, qli_lls* right, qli_lls* left)
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);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_sto_rse], &right);
}
qli_nod* node = make_node(input->syn_type, e_sto_count);
@ -2066,8 +2015,7 @@ static qli_nod* expand_store( qli_syntax* input, qli_lls* right, qli_lls* left)
node->nod_arg[e_sto_context] = (qli_nod*) context;
context->ctx_type = CTX_RELATION;
context->ctx_rse = (qli_nod*) -1;
qli_rel* relation = context->ctx_relation =
(qli_rel*) rel_node->syn_arg[s_rel_relation];
qli_rel* relation = context->ctx_relation = (qli_rel*) rel_node->syn_arg[s_rel_relation];
if (!(relation->rel_flags & REL_fields))
MET_fields(relation);
@ -2083,8 +2031,7 @@ static qli_nod* expand_store( qli_syntax* input, qli_lls* right, qli_lls* left)
if (input->syn_arg[s_sto_values]) {
if (!input->syn_arg[s_sto_fields]) {
qli_lls* stack = NULL;
for (qli_fld* field = relation->rel_fields; field;
field = field->fld_next)
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
{
ALLQ_push((blk*) decompile_field(field, 0), &stack);
}
@ -2106,15 +2053,12 @@ static qli_nod* expand_store( qli_syntax* input, qli_lls* right, qli_lls* left)
}
else {
qli_lls* stack = NULL;
for (qli_fld* field = relation->rel_fields; field;
field = field->fld_next)
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
{
if (field->fld_flags & FLD_computed)
continue;
if (
(field->fld_system_flag
&& field->fld_system_flag != relation->rel_system_flag)
|| field->fld_flags & FLD_array)
if ((field->fld_system_flag && field->fld_system_flag != relation->rel_system_flag) ||
field->fld_flags & FLD_array)
{
continue;
}
@ -2182,8 +2126,7 @@ static void expand_values( qli_syntax* input, qli_lls* right)
while (temp) {
qli_ctx* context = (qli_ctx*) ALLQ_pop(&temp);
value_count +=
generate_fields(context, (qli_lls*) &values,
input->syn_arg[s_sto_rse]);
generate_fields(context, (qli_lls*) &values, input->syn_arg[s_sto_rse]);
}
}
else
@ -2193,8 +2136,7 @@ static void expand_values( qli_syntax* input, qli_lls* right)
qli_ctx* context = find_context((const nam*) value->syn_arg[0], right);
if (!context)
IBERROR(154); // Msg154 unrecognized context
value_count +=
generate_fields(context, (qli_lls*) &values, input->syn_arg[s_sto_rse]);
value_count += generate_fields(context, (qli_lls*) &values, input->syn_arg[s_sto_rse]);
}
else {
ALLQ_push((blk*) value, &values);
@ -2278,10 +2220,8 @@ static int generate_fields( qli_ctx* context, qli_lls* values, qli_syntax* rse)
int count = 0;
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next) {
if (
(field->fld_system_flag
&& field->fld_system_flag != relation->rel_system_flag)
|| field->fld_flags & FLD_array)
if ((field->fld_system_flag && field->fld_system_flag != relation->rel_system_flag) ||
field->fld_flags & FLD_array)
{
continue;
}
@ -2296,7 +2236,7 @@ static int generate_fields( qli_ctx* context, qli_lls* values, qli_syntax* rse)
}
static int generate_items( qli_syntax* symbol, qli_lls* right, qli_lls* items, qli_nod* rse)
static int generate_items(const qli_syntax* symbol, qli_lls* right, qli_lls* items, qli_nod* rse)
{
/**************************************
*
@ -2331,10 +2271,8 @@ static int generate_items( qli_syntax* symbol, qli_lls* right, qli_lls* items, q
qli_rel* relation = context->ctx_relation;
int count = 0;
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next) {
if (
(field->fld_system_flag
&& field->fld_system_flag != relation->rel_system_flag)
|| field->fld_flags & FLD_array)
if ((field->fld_system_flag && field->fld_system_flag != relation->rel_system_flag) ||
field->fld_flags & FLD_array)
{
continue;
}
@ -2396,8 +2334,7 @@ static bool global_agg( const qli_syntax* item, const qli_syntax* group_list)
case nod_substr:
{
const qli_syntax* const* ptr = item->syn_arg;
for (const qli_syntax* const* const end = ptr + item->syn_count; ptr < end;
ptr++)
for (const qli_syntax* const* const end = ptr + item->syn_count; ptr < end; ptr++)
{
if ((*ptr)->syn_type == nod_constant)
continue;
@ -2445,11 +2382,10 @@ static bool invalid_nod_field( const qli_nod* node, const qli_nod* list)
const qli_fld* field = (qli_fld*) node->nod_arg[e_fld_field];
const qli_ctx* context = (qli_ctx*) node->nod_arg[e_fld_context];
const qli_nod* const* ptr = list->nod_arg;
for (const qli_nod* const* const end = ptr + list->nod_count;
ptr < end; ptr++)
for (const qli_nod* const* const end = ptr + list->nod_count; ptr < end; ptr++)
{
if (field == (qli_fld*) (*ptr)->nod_arg[e_fld_field]
&& context == (qli_ctx*) (*ptr)->nod_arg[e_fld_context])
if (field == (qli_fld*) (*ptr)->nod_arg[e_fld_field] &&
context == (qli_ctx*) (*ptr)->nod_arg[e_fld_context])
{
return false;
}
@ -2458,8 +2394,7 @@ static bool invalid_nod_field( const qli_nod* node, const qli_nod* list)
}
else {
const qli_nod* const* ptr = node->nod_arg;
for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end;
ptr++)
for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++)
{
switch ((*ptr)->nod_type) {
case nod_field:
@ -2541,8 +2476,7 @@ static bool invalid_syn_field( const qli_syntax* syn_node, const qli_syntax* lis
}
else {
const qli_syntax* const* ptr = syn_node->syn_arg;
for (const qli_syntax* const* const end = ptr + syn_node->syn_count;
ptr < end; ptr++)
for (const qli_syntax* const* const end = ptr + syn_node->syn_count; ptr < end; ptr++)
{
switch ((*ptr)->syn_type) {
case nod_field:
@ -2632,8 +2566,7 @@ static qli_nod* make_assignment( qli_nod* target, qli_nod* initial, qli_lls* rig
assignment->nod_arg[e_asn_from] = prompt;
if (field->fld_validation)
assignment->nod_arg[e_asn_valid] =
expand_expression(field->fld_validation, stack);
assignment->nod_arg[e_asn_valid] = expand_expression(field->fld_validation, stack);
else
--assignment->nod_count;
@ -2758,8 +2691,7 @@ static qli_nod* possible_literal(qli_syntax* input,
/* If the value isn't a field, is qualified, or can be resolved,
it doesn't qualify for conversion. Return NULL. */
if (input->syn_type != nod_field ||
input->syn_count != 1 || resolve(input, stack, &context))
if (input->syn_type != nod_field || input->syn_count != 1 || resolve(input, stack, &context))
{
return NULL;
}
@ -2867,11 +2799,10 @@ static qli_fld* resolve( qli_syntax* node, qli_lls* stack, qli_ctx** out_context
switch (context->ctx_type) {
case CTX_VARIABLE:
if (ptr == base)
for (field = context->ctx_variable; field;
field = field->fld_next)
for (field = context->ctx_variable; field; field = field->fld_next)
{
if (compare_names(name, field->fld_name)
|| compare_names(name, field->fld_query_name))
if (compare_names(name, field->fld_name) ||
compare_names(name, field->fld_query_name))
{
return field;
}
@ -2957,8 +2888,7 @@ static void resolve_really( qli_fld* variable, const qli_syntax* field_node)
resolved = MET_declare(0, variable, fld_name);
else if (field_node->syn_count == 2) {
qli_symbol *symbol;
for (symbol = rel_name->nam_symbol; symbol;
symbol = symbol->sym_homonym)
for (symbol = rel_name->nam_symbol; symbol; symbol = symbol->sym_homonym)
{
if (symbol->sym_type == SYM_database) {
DBB dbb = (DBB) symbol->sym_object;
@ -2969,21 +2899,17 @@ static void resolve_really( qli_fld* variable, const qli_syntax* field_node)
if (!resolved) {
for (DBB dbb = QLI_databases; dbb && !resolved; dbb = dbb->dbb_next)
for (symbol = rel_name->nam_symbol; symbol;
symbol = symbol->sym_homonym)
for (symbol = rel_name->nam_symbol; symbol; symbol = symbol->sym_homonym)
{
qli_rel* relation;
if (symbol->sym_type == SYM_relation
&& (relation = (qli_rel*) symbol->sym_object)
&& relation->rel_database == dbb)
if (symbol->sym_type == SYM_relation &&
(relation = (qli_rel*) symbol->sym_object) && relation->rel_database == dbb)
{
if (!relation->rel_fields)
MET_fields(relation);
for (field = relation->rel_fields; field;
field = field->fld_next)
for (field = relation->rel_fields; field; field = field->fld_next)
{
resolved = local = compare_names(fld_name,
field->fld_name);
resolved = local = compare_names(fld_name, field->fld_name);
if (resolved)
break;
}

View File

@ -46,11 +46,7 @@ using MsgFormat::SafeArg;
inline bool is_printable(UCHAR x)
{
return ((x >= ' ') && (x <= 127)) ||
(x == '\n') ||
(x == '\t') ||
(x == '\r') ||
(x == '\f');
return ((x >= ' ') && (x <= 127)) || (x == '\n') || (x == '\t') || (x == '\r') || (x == '\f');
}
#endif
@ -181,14 +177,11 @@ TEXT* FMT_format(qli_lls* stack)
if (*item->itm_query_header == '-')
item->itm_query_header = NULL;
else {
const USHORT n =
decompose_header(item->itm_query_header, segments,
lengths);
const USHORT n = decompose_header(item->itm_query_header, segments, lengths);
number_segments = MAX(n, number_segments);
USHORT* ptr = lengths;
for (USHORT j = 0; j < n; j++, ptr++)
item->itm_header_length =
MAX(item->itm_header_length, *ptr);
item->itm_header_length = MAX(item->itm_header_length, *ptr);
}
}
@ -196,8 +189,8 @@ TEXT* FMT_format(qli_lls* stack)
// If the item would overflow the line, reset to beginning of line
if (offset + MAX(item->itm_print_length, item->itm_header_length) >
QLI_columns) offset = 0;
if (offset + MAX(item->itm_print_length, item->itm_header_length) > QLI_columns)
offset = 0;
/* Before we blindly format the header, make sure there already isn't
header information in the same location */
@ -254,8 +247,7 @@ TEXT* FMT_format(qli_lls* stack)
qli_print_item* item2 = (qli_print_item*) temp2->lls_object;
if (item2->itm_type != item_value)
continue;
if (item2->itm_print_offset <
item->itm_print_offset + item->itm_print_length)
if (item2->itm_print_offset < item->itm_print_offset + item->itm_print_length)
{
item->itm_flags |= ITM_overlapped;
break;
@ -285,8 +277,7 @@ TEXT* FMT_format(qli_lls* stack)
qli_print_item* item = (qli_print_item*) temp->lls_object;
if (item->itm_type != item_value)
continue;
const USHORT n =
decompose_header(item->itm_query_header, segments, lengths);
const USHORT n = decompose_header(item->itm_query_header, segments, lengths);
const SSHORT segment = j - (number_segments - n);
if (segment < 0)
continue;
@ -345,8 +336,7 @@ qli_nod* FMT_list(qli_nod* list)
qli_print_item** new_ptr = (qli_print_item**) new_nod->nod_arg;
USHORT column = 0;
for (item = (qli_print_item**) list->nod_arg, end = item + list->nod_count;
item < end; item++)
for (item = (qli_print_item**) list->nod_arg, end = item + list->nod_count; item < end; item++)
{
if ((*item)->itm_type != item_value || !(value = (*item)->itm_value))
continue;
@ -355,8 +345,7 @@ qli_nod* FMT_list(qli_nod* list)
if (value->nod_type == nod_reference)
value = value->nod_arg[0];
bool expression = true;
if (value->nod_type == nod_field ||
value->nod_type == nod_variable ||
if (value->nod_type == nod_field || value->nod_type == nod_variable ||
value->nod_type == nod_function)
{
expression = false;
@ -393,8 +382,7 @@ qli_nod* FMT_list(qli_nod* list)
}
p[-1] = 0;
}
value->nod_desc.dsc_length =
strlen((char*) value->nod_desc.dsc_address);
value->nod_desc.dsc_length = strlen((char*) value->nod_desc.dsc_address);
}
else {
value->nod_desc.dsc_length = name->sym_length;
@ -423,8 +411,7 @@ qli_nod* FMT_list(qli_nod* list)
new_item->itm_count = 1;
column += 2;
for (item = (qli_print_item**) list->nod_arg, end = item + list->nod_count;
item < end; item++)
for (item = (qli_print_item**) list->nod_arg, end = item + list->nod_count; item < end; item++)
{
if ((*item)->itm_type != item_value || !(value = (*item)->itm_value))
continue;
@ -488,8 +475,7 @@ void FMT_print( qli_nod* list, qli_prt* print)
case item_skip:
{
put_line(print, &p, buffer, '\n');
print_blobs(print, (qli_print_item**) list->nod_arg,
(qli_print_item**) ptr);
print_blobs(print, (qli_print_item**) list->nod_arg, (qli_print_item**) ptr);
for (USHORT l = item->itm_count - 1; l > 0; --l)
put_line(print, &p, buffer, '\n');
QLI_skip_line = false;
@ -539,8 +525,7 @@ void FMT_print( qli_nod* list, qli_prt* print)
if (!(desc->dsc_missing & DSC_missing))
PIC_edit(desc, item->itm_picture, &p, BUFFER_REMAINING(p));
else if (item->itm_picture->pic_missing)
PIC_edit(desc, item->itm_picture->pic_missing, &p,
BUFFER_REMAINING(p));
PIC_edit(desc, item->itm_picture->pic_missing, &p, BUFFER_REMAINING(p));
continue;
}
@ -661,8 +646,7 @@ void FMT_report( qli_rpt* report)
if (report->rpt_name) {
USHORT lengths[16];
const TEXT* segments[16];
const USHORT n =
decompose_header(report->rpt_name, segments, lengths);
const USHORT n = decompose_header(report->rpt_name, segments, lengths);
USHORT i;
for (i = 0; i < n; i++)
width = MAX(width, lengths[i] + 15);
@ -755,8 +739,7 @@ static void format_index( qli_print_item* item, qli_nod* field, const bool print
{ // scope
const TEXT* qh;
if (field->nod_type != nod_field ||
!(args = field->nod_arg[e_fld_subs]) ||
if (field->nod_type != nod_field || !(args = field->nod_arg[e_fld_subs]) ||
((qh = item->itm_query_header) && (*qh == '"' || *qh == '\'')))
{
return;
@ -794,8 +777,7 @@ static void format_index( qli_print_item* item, qli_nod* field, const bool print
TEXT s[32];
qli_nod** ptr = args->nod_arg;
for (const qli_nod* const* const end = ptr + args->nod_count;
ptr < end; ptr++)
for (const qli_nod* const* const end = ptr + args->nod_count; ptr < end; ptr++)
{
qli_nod* subscript = *ptr;
switch (subscript->nod_type) {
@ -888,8 +870,7 @@ static TEXT* format_report( qli_vec* columns_vec, USHORT width, USHORT* max_widt
continue;
case item_value:
max_print_width =
MAX(max_print_width, item->itm_print_length);
max_print_width = MAX(max_print_width, item->itm_print_length);
node = item->itm_value;
if (node->nod_desc.dsc_dtype >= dtype_short &&
node->nod_desc.dsc_dtype <= dtype_double)
@ -897,14 +878,11 @@ static TEXT* format_report( qli_vec* columns_vec, USHORT width, USHORT* max_widt
}
if (item->itm_query_header) {
const USHORT n =
decompose_header(item->itm_query_header, segments,
lengths);
const USHORT n = decompose_header(item->itm_query_header, segments, lengths);
number_segments = MAX(n, number_segments);
USHORT* ptr = lengths;
for (USHORT j = 0; j < n; j++, ptr++)
item->itm_header_length =
MAX(item->itm_header_length, *ptr);
item->itm_header_length = MAX(item->itm_header_length, *ptr);
}
format_value(item, 0);
@ -923,11 +901,9 @@ static TEXT* format_report( qli_vec* columns_vec, USHORT width, USHORT* max_widt
continue;
if (right_adjust)
item->itm_print_offset =
offset + right_offset - item->itm_print_length;
item->itm_print_offset = offset + right_offset - item->itm_print_length;
else
item->itm_print_offset =
offset + (column_width - item->itm_print_length) / 2;
item->itm_print_offset = offset + (column_width - item->itm_print_length) / 2;
item->itm_header_offset = offset + column_width / 2;
@ -975,7 +951,7 @@ static TEXT* format_report( qli_vec* columns_vec, USHORT width, USHORT* max_widt
USHORT len = bottom - BOTTOM_LINE;
qli_str* header = (qli_str*) ALLOCDV(type_str,
(max_offset + 1) * (number_segments + 1) + 2 + len);
(max_offset + 1) * (number_segments + 1) + 2 + len);
TEXT* p = header->str_data;
// Generate the various lines of the header line at a time.
@ -991,9 +967,7 @@ static TEXT* format_report( qli_vec* columns_vec, USHORT width, USHORT* max_widt
qli_print_item* item = (qli_print_item*) temp->lls_object;
if (item->itm_type != item_value)
continue;
const USHORT n =
decompose_header(item->itm_query_header, segments,
lengths);
const USHORT n = decompose_header(item->itm_query_header, segments, lengths);
SSHORT segment = j - (number_segments - n);
if (segment < 0)
continue;
@ -1069,8 +1043,7 @@ static void format_value( qli_print_item* item, int flags)
// msg 480 can not format unsubscripted array %s
}
if (!(item->itm_picture->pic_missing) &&
(node->nod_type == nod_field) &&
if (!(item->itm_picture->pic_missing) && (node->nod_type == nod_field) &&
(field = (qli_fld*) node->nod_arg[e_fld_field]) && field->fld_missing)
{
PIC_missing(field->fld_missing, picture);
@ -1194,8 +1167,7 @@ static bool match_expr(const qli_nod* node1, const qli_nod* node2)
if (node1->nod_type == node2->nod_type) {
if (node1->nod_type == nod_field) {
if (node1->nod_arg[e_fld_field] != node2->nod_arg[e_fld_field] ||
node1->nod_arg[e_fld_context] !=
node2->nod_arg[e_fld_context])
node1->nod_arg[e_fld_context] != node2->nod_arg[e_fld_context])
{
return false;
}
@ -1203,8 +1175,7 @@ static bool match_expr(const qli_nod* node1, const qli_nod* node2)
}
const qli_nod* const* ptr1 = node1->nod_arg;
const qli_nod* const* ptr2 = node2->nod_arg;
for (const qli_nod* const* end = ptr1 + node1->nod_count; ptr1 < end;
++ptr1, ++ptr2)
for (const qli_nod* const* end = ptr1 + node1->nod_count; ptr1 < end; ++ptr1, ++ptr2)
{
if (!match_expr(*ptr1, *ptr2))
return false;
@ -1237,9 +1208,7 @@ static void print_blobs( qli_prt* print, qli_print_item** first, qli_print_item*
for (ptr = first; ptr < last; ptr++) {
const qli_print_item* item = *ptr;
if (item->itm_dtype == dtype_blob && item->itm_stream)
length =
MAX(length,
item->itm_print_offset + item->itm_print_length + 2);
length = MAX(length, item->itm_print_offset + item->itm_print_length + 2);
}
@ -1296,8 +1265,7 @@ static int print_line( qli_print_item* item, TEXT** ptr)
USHORT length;
ISC_STATUS_ARRAY status_vector;
const ISC_STATUS status = isc_get_segment(status_vector, &item->itm_stream,
&length, l, p);
const ISC_STATUS status = isc_get_segment(status_vector, &item->itm_stream, &length, l, p);
if (status && status != isc_segment) {
ISC_STATUS* null_status = 0;
isc_close_blob(null_status, &item->itm_stream);
@ -1410,8 +1378,7 @@ static void report_item( qli_print_item* item, qli_vec** columns_vec, USHORT* co
otherwise, someplace else. */
qli_lls** col = (qli_lls**) (columns->vec_object + *col_ndx);
const qli_lls* const* const col_end =
(qli_lls**) (columns->vec_object + columns->vec_count);
const qli_lls* const* const col_end = (qli_lls**) (columns->vec_object + columns->vec_count);
for (; col < col_end && *col; col++)
for (qli_lls* temp = *col; temp; temp = temp->lls_next) {
qli_print_item* item2 = (qli_print_item*) temp->lls_object;
@ -1449,8 +1416,7 @@ static void report_line( qli_nod* list, qli_vec** columns_vec)
**************************************/
USHORT col_ndx = 0;
qli_print_item** ptr = (qli_print_item**) list->nod_arg;
for (const qli_print_item* const* const end = ptr + list->nod_count;
ptr < end; ptr++)
for (const qli_print_item* const* const end = ptr + list->nod_count; ptr < end; ptr++)
{
qli_print_item* item = *ptr;
report_item(item, columns_vec, &col_ndx);

View File

@ -26,6 +26,7 @@
// Logical column block
/*
typedef struct col {
blk col_header;
col* col_next; // Next logical column
@ -34,6 +35,7 @@ typedef struct col {
USHORT col_column; // Starting column number
USHORT col_print_length; // Max print length
} *COL;
*/
/* Picture string elements:
@ -74,7 +76,7 @@ typedef enum pic_t {
pic_numeric,
pic_date,
pic_float,
pic_text
// pic_text // unused
} PIC_T;
// Picture string handling block
@ -88,7 +90,7 @@ struct pics {
USHORT pic_count; // Count of repeat characters
TEXT pic_character; // Last significant character
PIC_T pic_type; // Type of edit
USHORT pic_length; /* Printing columns (MAX of edit_string & missing) */
USHORT pic_length; // Printing columns (MAX of edit_string & missing)
USHORT pic_floats; // Character of floating things
USHORT pic_digits; // Digits of number
USHORT pic_hex_digits; // Hexidecimal digits
@ -101,7 +103,7 @@ struct pics {
USHORT pic_nmonths; // Digits of numeric month
USHORT pic_years; // Digits of year
USHORT pic_julians; // Digits of julian days
USHORT pic_decimals; /* Number of decimal points (?!) */
USHORT pic_decimals; // Number of decimal points (?!)
USHORT pic_brackets; // Pairs of deficit brackets
USHORT pic_exponents; // Exponential indicators
USHORT pic_float_digits; // Floating digits

View File

@ -94,7 +94,7 @@ qli_nod* GEN_generate( qli_nod* node)
}
void GEN_release(void)
void GEN_release()
{
/**************************************
*
@ -599,8 +599,7 @@ static void gen_compile( qli_req* request)
DBB dbb = request->req_database;
ISC_STATUS_ARRAY status_vector;
if (isc_compile_request(status_vector, &dbb->dbb_handle,
&request->req_handle, length,
if (isc_compile_request(status_vector, &dbb->dbb_handle, &request->req_handle, length,
(const char*) rlb->rlb_base))
{
GEN_rlb_release (rlb);
@ -776,8 +775,7 @@ static void gen_expression(qli_nod* node, qli_req* request)
{
qli_map* map = (qli_map*) node->nod_arg[e_map_map];
const qli_ctx* context = (qli_ctx*) node->nod_arg[e_map_context];
if (context->ctx_request != request &&
map->map_node->nod_type == nod_field)
if (context->ctx_request != request && map->map_node->nod_type == nod_field)
{
gen_field(map->map_node, request);
return;
@ -999,8 +997,7 @@ static void gen_field( qli_nod* node, qli_req* request)
if (args) {
STUFF(args->nod_count);
qli_nod** ptr = args->nod_arg;
for (const qli_nod* const* const end = ptr + args->nod_count;
ptr < end; ++ptr)
for (const qli_nod* const* const end = ptr + args->nod_count; ptr < end; ++ptr)
{
gen_expression(*ptr, request);
}
@ -1069,7 +1066,7 @@ static void gen_for( qli_nod* node, qli_req* request)
// Build assigments for all values referenced.
for (const qli_par* parameter = message->msg_parameters; parameter;
parameter = parameter->par_next)
parameter = parameter->par_next)
{
if (parameter->par_value) {
STUFF(blr_assignment);
@ -1465,8 +1462,7 @@ static void gen_request( qli_req* request)
// Build declarations for all messages.
for (qli_msg* message = request->req_messages; message;
message = message->msg_next)
for (qli_msg* message = request->req_messages; message; message = message->msg_next)
{
message->msg_length = 0;
for (param = message->msg_parameters; param; param = param->par_next) {
@ -1474,15 +1470,13 @@ static void gen_request( qli_req* request)
param->par_parameter = message->msg_parameter++;
const USHORT alignment = type_alignments[desc->dsc_dtype];
if (alignment)
message->msg_length =
FB_ALIGN(message->msg_length, alignment);
message->msg_length = FB_ALIGN(message->msg_length, alignment);
param->par_offset = message->msg_length;
message->msg_length += desc->dsc_length;
qli_par* missing_param = param->par_missing;
if (missing_param) {
missing_param->par_parameter = message->msg_parameter++;
message->msg_length =
FB_ALIGN(message->msg_length, sizeof(USHORT));
message->msg_length = FB_ALIGN(message->msg_length, sizeof(USHORT));
desc = &missing_param->par_desc;
missing_param->par_offset = message->msg_length;
message->msg_length += desc->dsc_length;
@ -1540,8 +1534,7 @@ static void gen_rse( qli_nod* node, qli_req* request)
request->req_flags |= REQ_group_by;
STUFF(list->nod_count);
qli_nod** ptr = list->nod_arg;
for (const qli_nod* const* const end = ptr + list->nod_count;
ptr < end; ++ptr)
for (const qli_nod* const* const end = ptr + list->nod_count; ptr < end; ++ptr)
{
gen_expression(*ptr, request);
}
@ -1647,8 +1640,7 @@ static void gen_sort( qli_nod* node, qli_req* request, const UCHAR operatr)
request->req_flags |= REQ_project;
qli_nod** ptr = node->nod_arg;
for (qli_nod** const end = ptr + node->nod_count * 2; ptr < end;
ptr += 2)
for (qli_nod** const end = ptr + node->nod_count * 2; ptr < end; ptr += 2)
{
if (operatr == blr_sort)
STUFF((ptr[1]) ? blr_descending : blr_ascending);
@ -1698,8 +1690,7 @@ static void gen_statement( qli_nod* node, qli_req* request)
case nod_list:
{
qli_nod** ptr = node->nod_arg;
for (const qli_nod* const* const end = ptr + node->nod_count;
ptr < end; ++ptr)
for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ++ptr)
{
gen_statement(*ptr, request);
}

View File

@ -59,7 +59,7 @@ static void print_topic(USHORT, USHORT, const TEXT**, USHORT*, const TEXT*, bool
static const TEXT* strip(const TEXT*);
void HELP_fini(void)
void HELP_fini()
{
/**************************************
*
@ -107,8 +107,7 @@ void HELP_help( qli_syntax* node)
*topic++ = "QLI";
NAM *ptr, *end;
for (ptr = (NAM *) node->syn_arg, end = ptr + node->syn_count; ptr < end;
ptr++)
for (ptr = (NAM *) node->syn_arg, end = ptr + node->syn_count; ptr < end; ptr++)
{
*topic++ = (*ptr)->nam_string;
}
@ -141,7 +140,8 @@ static int additional_topics( const TEXT* parent, const TEXT* banner, const TEXT
USHORT topics = 0;
USHORT l = strlen(parent);
FOR X IN TOPICS WITH X.PARENT EQ parent SORTED BY X.TOPIC
FOR X IN TOPICS
WITH X.PARENT EQ parent SORTED BY X.TOPIC
if (QLI_abort)
return 0;
const TEXT* p = X.TOPIC;
@ -257,7 +257,8 @@ static void print_topic(
TEXT* const next = p;
USHORT count = 0;
FOR X IN TOPICS WITH X.FACILITY EQ "QLI" AND
FOR X IN TOPICS
WITH X.FACILITY EQ "QLI" AND
(X.TOPIC STARTING WITH * topics AND X.PARENT EQ parent) OR
(X.TOPIC = X.FACILITY AND X.TOPIC = *topics AND X.TOPIC = X.PARENT)
count++;
@ -268,7 +269,8 @@ static void print_topic(
count = 0;
FOR(LEVEL level) X IN TOPICS WITH X.FACILITY EQ "QLI" AND
FOR(LEVEL level) X IN TOPICS
WITH X.FACILITY EQ "QLI" AND
(X.TOPIC STARTING WITH * topics AND X.PARENT EQ parent) OR
(X.TOPIC = X.FACILITY AND X.TOPIC = *topics AND X.TOPIC = X.PARENT)
SORTED BY X.TOPIC
@ -291,8 +293,7 @@ static void print_topic(
*p++ = *q++;
*p = 0;
if (level < depth)
print_topic(level + 1, depth, topics + 1, max_level, string,
error_flag);
print_topic(level + 1, depth, topics + 1, max_level, string, error_flag);
else {
printf("\n%s\n\n", strip(string));
QLI_skip_line = true;
@ -305,8 +306,7 @@ static void print_topic(
ERRQ_msg_format(81, sizeof(banner), banner, SafeArg() << INDENT);
// Msg81 %sSub-topics available:
if (additional_topics(string, banner, INDENT))
print_more(level, depth, topics, max_level, string,
error_flag);
print_more(level, depth, topics, max_level, string, error_flag);
}
END_FOR;

View File

@ -50,7 +50,7 @@ const qli_kword keywords[] =
};
void HSH_fini(void)
void HSH_fini()
{
/**************************************
*
@ -71,7 +71,7 @@ void HSH_fini(void)
}
void HSH_init(void)
void HSH_init()
{
/**************************************
*
@ -116,8 +116,7 @@ void HSH_insert( qli_symbol* symbol, bool ignore_case)
for (qli_symbol* old = hash_table[h]; old; old = old->sym_collision)
{
if (scompare(symbol->sym_string, symbol->sym_length,
old->sym_string, old->sym_length))
if (scompare(symbol->sym_string, symbol->sym_length, old->sym_string, old->sym_length))
{
symbol->sym_homonym = old->sym_homonym;
old->sym_homonym = symbol;
@ -152,7 +151,7 @@ qli_symbol* HSH_lookup(const SCHAR* string, int length)
scompare = scompare_sens;
}
for (qli_symbol* symbol = hash_table[hash(string, length)]; symbol;
symbol = symbol->sym_collision)
symbol = symbol->sym_collision)
{
if (scompare(string, length, symbol->sym_string, symbol->sym_length))
return symbol;

View File

@ -66,7 +66,7 @@ static int nextchar(const bool);
static void next_line(const bool);
static void retchar();
static bool scan_number(SSHORT, TEXT **);
static int skip_white(void);
static int skip_white();
static qli_lls* QLI_statements;
static int QLI_position;
@ -134,7 +134,7 @@ inline char classes(UCHAR idx)
bool LEX_active_procedure(void)
bool LEX_active_procedure()
{
/**************************************
*
@ -198,7 +198,7 @@ void LEX_edit(SLONG start, SLONG stop)
}
qli_tok* LEX_edit_string(void)
qli_tok* LEX_edit_string()
{
/**************************************
*
@ -264,7 +264,7 @@ qli_tok* LEX_edit_string(void)
}
qli_tok* LEX_filename(void)
qli_tok* LEX_filename()
{
/**************************************
*
@ -351,7 +351,7 @@ qli_tok* LEX_filename(void)
}
void LEX_fini(void)
void LEX_fini()
{
/**************************************
*
@ -371,7 +371,7 @@ void LEX_fini(void)
}
void LEX_flush(void)
void LEX_flush()
{
/**************************************
*
@ -482,7 +482,7 @@ bool LEX_get_line(const TEXT* prompt,
}
void LEX_init(void)
void LEX_init()
{
/**************************************
*
@ -515,7 +515,7 @@ void LEX_init(void)
}
void LEX_mark_statement(void)
void LEX_mark_statement()
{
/**************************************
*
@ -530,9 +530,7 @@ void LEX_mark_statement(void)
**************************************/
qli_line* temp;
for (temp = QLI_line;
temp->line_next && QLI_statements;
temp = temp->line_next)
for (temp = QLI_line; temp->line_next && QLI_statements; temp = temp->line_next)
{
if (temp->line_next->line_position == (IPTR) QLI_statements->lls_object)
return;
@ -545,7 +543,7 @@ void LEX_mark_statement(void)
}
void LEX_pop_line(void)
void LEX_pop_line()
{
/**************************************
*
@ -585,8 +583,7 @@ void LEX_procedure( DBB database, FB_API_HANDLE blob)
**************************************/
qli_line* temp = (qli_line*) ALLOCPV(type_line, QLI_token->tok_length);
temp->line_source_blob = blob;
strncpy(temp->line_source_name, QLI_token->tok_string,
QLI_token->tok_length);
strncpy(temp->line_source_name, QLI_token->tok_string, QLI_token->tok_length);
temp->line_type = line_blob;
temp->line_database = database;
temp->line_size = sizeof(temp->line_data);
@ -711,7 +708,7 @@ void LEX_put_procedure(FB_API_HANDLE blob, SLONG start, SLONG stop)
}
void LEX_real(void)
void LEX_real()
{
/**************************************
*
@ -729,7 +726,7 @@ void LEX_real(void)
}
qli_lls* LEX_statement_list(void)
qli_lls* LEX_statement_list()
{
/**************************************
*
@ -748,7 +745,7 @@ qli_lls* LEX_statement_list(void)
}
qli_tok* LEX_token(void)
qli_tok* LEX_token()
{
/**************************************
*
@ -788,8 +785,7 @@ qli_tok* LEX_token(void)
}
*p++ = c;
QLI_token->tok_position = QLI_line->line_position +
QLI_line->line_ptr - QLI_line->line_data - 1;
QLI_token->tok_position = QLI_line->line_position + QLI_line->line_ptr - QLI_line->line_data - 1;
// On end of file, generate furious but phone end of line tokens
@ -984,8 +980,7 @@ static void next_line(const bool eof_ok)
if (QLI_line->line_type == line_blob) {
// If the current blob segment contains another line, use it
if ((p = QLI_line->line_ptr) != QLI_line->line_data
&& p[-1] == '\n' && *p)
if ((p = QLI_line->line_ptr) != QLI_line->line_data && p[-1] == '\n' && *p)
{
flag = true;
}
@ -995,8 +990,7 @@ static void next_line(const bool eof_ok)
p = QLI_line->line_data;
QLI_line->line_ptr = QLI_line->line_data;
flag = PRO_get_line(QLI_line->line_source_blob, p,
QLI_line->line_size);
flag = PRO_get_line(QLI_line->line_source_blob, p, QLI_line->line_size);
if (flag && QLI_echo)
printf("%s", QLI_line->line_data);
}
@ -1176,7 +1170,7 @@ static bool scan_number(SSHORT c,
}
static int skip_white(void)
static int skip_white()
{
/**************************************
*

View File

@ -24,23 +24,23 @@
#ifndef QLI_LEX_PROTO_H
#define QLI_LEX_PROTO_H
bool LEX_active_procedure (void);
bool LEX_active_procedure ();
void LEX_edit (SLONG, SLONG);
qli_tok* LEX_edit_string(void);
qli_tok* LEX_filename(void);
void LEX_fini (void);
void LEX_flush (void);
qli_tok* LEX_edit_string();
qli_tok* LEX_filename();
void LEX_fini ();
void LEX_flush ();
bool LEX_get_line (const TEXT*, TEXT *, int);
void LEX_init (void);
void LEX_mark_statement (void);
void LEX_pop_line (void);
void LEX_init ();
void LEX_mark_statement ();
void LEX_pop_line ();
void LEX_procedure(dbb*, FB_API_HANDLE);
bool LEX_push_file (const TEXT*, const bool);
bool LEX_push_string (const TEXT* const);
void LEX_put_procedure (FB_API_HANDLE, SLONG, SLONG);
void LEX_real (void);
qli_lls* LEX_statement_list(void);
qli_tok* LEX_token(void);
void LEX_real ();
qli_lls* LEX_statement_list();
qli_tok* LEX_token();
#endif // QLI_LEX_PROTO_H

View File

@ -149,7 +149,7 @@ static const rfr_tab_t rfr_table[] =
{ "RDB$FILES", "RDB$SHADOW_NUMBER", DBB_cap_shadowing },
{ "RDB$TYPES", "RDB$TYPE_NAME", DBB_cap_types },
{ "RDB$FIELDS", "RDB$DIMENSIONS", DBB_cap_dimensions },
{ "RDB$FIELDS", "RDB$EXTERNAL_TYPE", DBB_cap_external_type },
// { "RDB$FIELDS", "RDB$EXTERNAL_TYPE", DBB_cap_external_type }, Unused
{ "RDB$RELATION_FIELDS", "RDB$SYSTEM_FLAG", DBB_cap_rfr_sys_flag },
{ "RDB$FILTERS", "RDB$FUNCTION_NAME", DBB_cap_filters },
{ "RDB$INDICES", "RDB$INDEX_TYPE", DBB_cap_index_type },
@ -245,10 +245,9 @@ void MET_define_index( qli_syntax* node)
strcpy(X.RDB$RELATION_NAME, relation->rel_symbol->sym_string);
strcpy(X.RDB$INDEX_NAME, symbol->sym_string);
X.RDB$UNIQUE_FLAG = (node->syn_flags & s_dfi_flag_unique);
X.RDB$INDEX_INACTIVE = (node->syn_flags & s_dfi_flag_inactive);
X.RDB$INDEX_INACTIVE = (node->syn_flags & s_dfi_flag_inactive) ? TRUE : FALSE;
X.RDB$SEGMENT_COUNT = fields->syn_count;
X.RDB$INDEX_TYPE =
(node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
X.RDB$INDEX_TYPE = (node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
END_STORE
ON_ERROR
rollback_update(database);
@ -281,8 +280,7 @@ void MET_define_index( qli_syntax* node)
MET_fields(relation);
bool present = false;
for (qli_fld* field = relation->rel_fields; field;
field = field->fld_next)
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
{
if (!(strcmp((*ptr)->nam_string, field->fld_name->sym_string))) {
present = true;
@ -293,7 +291,7 @@ void MET_define_index( qli_syntax* node)
if (!present) {
rollback_update(database);
ERRQ_print_error(236, SafeArg() << (*ptr)->nam_string <<
relation->rel_symbol->sym_string);
relation->rel_symbol->sym_string);
// Msg236 Field %s does not occur in relation %s
}
@ -359,8 +357,7 @@ void MET_define_relation( qli_rel* relation, qli_rel* source)
clone_fields(relation, source);
else {
USHORT position = 1;
for (qli_fld* field = relation->rel_fields; field;
field = field->fld_next, position++)
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next, position++)
{
add_field(relation, field, position);
}
@ -432,8 +429,7 @@ void MET_define_sql_relation( qli_rel* relation)
STUFF_WORD(1);
USHORT position = 1;
for (qli_fld* field = relation->rel_fields; field;
field = field->fld_next, position++)
for (qli_fld* field = relation->rel_fields; field; field = field->fld_next, position++)
{
add_sql_field(relation, field, position, rlb);
}
@ -457,8 +453,7 @@ void MET_define_sql_relation( qli_rel* relation)
FOR(REQUEST_HANDLE database->dbb_requests[REQ_relation_id])
X IN DB.RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ symbol->sym_string
relation->rel_id = X.RDB$RELATION_ID;
symbol =
make_symbol(X.RDB$RELATION_NAME, sizeof(X.RDB$RELATION_NAME));
symbol = make_symbol(X.RDB$RELATION_NAME, sizeof(X.RDB$RELATION_NAME));
symbol->sym_type = SYM_relation;
symbol->sym_object = (BLK) relation;
relation->rel_symbol = symbol;
@ -522,9 +517,11 @@ void MET_delete_database( DBB dbb)
ISC_STATUS_ARRAY status_vector;
if (isc_attach_database(status_vector, 0, dbb->dbb_filename,
&dbb->dbb_handle, dpb.getBufferLength(),
&dbb->dbb_handle, dpb.getBufferLength(),
reinterpret_cast<const char*>(dpb.getBuffer())))
ERRQ_database_error(dbb, status_vector);
{
ERRQ_database_error(dbb, status_vector);
}
qli_lls* stack = NULL;
@ -797,9 +794,8 @@ void MET_fields( qli_rel* relation)
field->fld_segment_length = 80;
else {
field->fld_segment_length =
((RFL.RDB$SEGMENT_LENGTH) < 256
&& (RFL.RDB$SEGMENT_LENGTH >
0)) ? RFL.RDB$SEGMENT_LENGTH : 255;
((RFL.RDB$SEGMENT_LENGTH) < 256 && (RFL.RDB$SEGMENT_LENGTH > 0)) ?
RFL.RDB$SEGMENT_LENGTH : 255;
}
ISC_QUAD* blob = & RFR.RDB$QUERY_HEADER;
@ -813,23 +809,21 @@ void MET_fields( qli_rel* relation)
field->fld_flags |= FLD_computed;
field->fld_dtype = MET_get_datatype(RFL.RDB$FIELD_TYPE);
field->fld_length =
field_length(field->fld_dtype, RFL.RDB$FIELD_LENGTH);
field->fld_length = field_length(field->fld_dtype, RFL.RDB$FIELD_LENGTH);
if (field->fld_dtype == dtype_varying)
field->fld_length += sizeof(SSHORT);
field->fld_sub_type = RFL.RDB$FIELD_SUB_TYPE;
field->fld_sub_type_missing = RFL.RDB$FIELD_SUB_TYPE.NULL;
if (!RFL.RDB$MISSING_VALUE.NULL)
field->fld_missing =
missing_value(RFL.RDB$MISSING_VALUE, field->fld_name);
field->fld_missing = missing_value(RFL.RDB$MISSING_VALUE, field->fld_name);
if (!(field->fld_edit_string =
make_string(RFR.RDB$EDIT_STRING, sizeof(RFR.RDB$EDIT_STRING))))
field->fld_edit_string =
make_string(RFL.RDB$EDIT_STRING, sizeof(RFL.RDB$EDIT_STRING));
field->fld_validation =
parse_blr_blob(RFL.RDB$VALIDATION_BLR, field->fld_name);
make_string(RFR.RDB$EDIT_STRING, sizeof(RFR.RDB$EDIT_STRING))))
{
field->fld_edit_string = make_string(RFL.RDB$EDIT_STRING, sizeof(RFL.RDB$EDIT_STRING));
}
field->fld_validation = parse_blr_blob(RFL.RDB$VALIDATION_BLR, field->fld_name);
if (MET_dimensions(database, RFL.RDB$FIELD_NAME) > 0)
field->fld_flags |= FLD_array;
END_FOR
@ -1005,7 +999,7 @@ void MET_index_info(DBB db,
p = fb_utils::exact_name(SEG.RDB$FIELD_NAME);
if (p + strlen(p) + 2 > buffer + bufsize)
break;
while (*p) {
*b++ = *p++;
}
@ -1109,7 +1103,7 @@ FB_API_HANDLE MET_meta_transaction(DBB database, bool update_flag)
if (!transaction &&
((database->dbb_capabilities & DBB_cap_multi_trans) ||
!(database->dbb_capabilities & DBB_cap_single_trans)))
!(database->dbb_capabilities & DBB_cap_single_trans)))
{
if (isc_start_transaction(status_vector, &transaction, 1,
&database->dbb_handle, sizeof(tpb), tpb))
@ -1135,11 +1129,9 @@ FB_API_HANDLE MET_meta_transaction(DBB database, bool update_flag)
if (!(gds_trans = database->dbb_transaction))
gds_trans = MET_transaction(nod_start_trans, database);
}
// otherwise make one more effort to start the transaction
else if (!gds_trans)
{
// otherwise make one more effort to start the transaction
START_TRANSACTION
ON_ERROR
ERRQ_database_error(database, status_vector);
@ -1183,8 +1175,7 @@ void MET_modify_field( DBB database, qli_fld* field)
X.RDB$FIELD_TYPE = blr_dtypes[field->fld_dtype];
X.RDB$FIELD_SCALE = field->fld_scale;
X.RDB$FIELD_LENGTH = (field->fld_dtype == dtype_varying) ?
field->fld_length -
sizeof(SSHORT) : field->fld_length;
field->fld_length - sizeof(SSHORT) : field->fld_length;
}
if (!field->fld_sub_type_missing) {
X.RDB$FIELD_SUB_TYPE.NULL = FALSE;
@ -1240,8 +1231,7 @@ void MET_modify_field( DBB database, qli_fld* field)
{
qli_rel* relation;
if (symbol->sym_type == SYM_relation &&
(relation = (qli_rel*) symbol->sym_object) &&
relation->rel_database == database)
(relation = (qli_rel*) symbol->sym_object) && relation->rel_database == database)
{
delete_fields(relation);
MET_fields(relation);
@ -1279,11 +1269,9 @@ void MET_modify_index( qli_syntax* node)
if (node->syn_flags & s_dfi_flag_selectivity)
X.RDB$UNIQUE_FLAG = (node->syn_flags & s_dfi_flag_unique);
if (node->syn_flags & s_dfi_flag_activity)
X.RDB$INDEX_INACTIVE =
(node->syn_flags & s_dfi_flag_inactive);
X.RDB$INDEX_INACTIVE = (node->syn_flags & s_dfi_flag_inactive) ? TRUE : FALSE;
if (node->syn_flags & s_dfi_flag_order)
X.RDB$INDEX_TYPE =
(node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
X.RDB$INDEX_TYPE = (node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
if (node->syn_flags & s_dfi_flag_statistics)
X.RDB$STATISTICS = -1.0;
END_MODIFY
@ -1444,11 +1432,11 @@ void MET_ready( qli_syntax* node, USHORT create_flag)
dbb = (DBB) *ptr;
if (create_flag)
isc_create_database(status_vector, 0, dbb->dbb_filename,
&dbb->dbb_handle, dpb.getBufferLength(),
&dbb->dbb_handle, dpb.getBufferLength(),
reinterpret_cast<const char*>(dpb.getBuffer()), 0);
else
isc_attach_database(status_vector, 0, dbb->dbb_filename,
&dbb->dbb_handle, dpb.getBufferLength(),
&dbb->dbb_handle, dpb.getBufferLength(),
reinterpret_cast<const char*>(dpb.getBuffer()));
if (status_vector[1])
break;
@ -1470,7 +1458,7 @@ void MET_ready( qli_syntax* node, USHORT create_flag)
}
void MET_shutdown(void)
void MET_shutdown()
{
/**************************************
*
@ -1689,8 +1677,7 @@ static void add_field( qli_rel* relation, qli_fld* field, USHORT position)
X.RDB$RELATION_NAME EQ relation_name->sym_string AND
X.RDB$FIELD_NAME EQ field_name->sym_string
rollback_update(relation->rel_database);
ERRQ_print_error(251, SafeArg() << field_name->sym_string <<
relation_name->sym_string);
ERRQ_print_error(251, SafeArg() << field_name->sym_string << relation_name->sym_string);
// Msg251 Field %s already exists in relation %s
END_FOR
ON_ERROR
@ -1768,8 +1755,7 @@ static void add_sql_field( qli_rel* relation, qli_fld* field, USHORT position,
X.RDB$RELATION_NAME EQ relation_name->sym_string AND
X.RDB$FIELD_NAME EQ field_name->sym_string
rollback_update(relation->rel_database);
ERRQ_print_error(251, SafeArg() << field_name->sym_string <<
relation_name->sym_string);
ERRQ_print_error(251, SafeArg() << field_name->sym_string << relation_name->sym_string);
// Msg251 Field %s already exists in relation %s
END_FOR
ON_ERROR
@ -1786,8 +1772,8 @@ static void add_sql_field( qli_rel* relation, qli_fld* field, USHORT position,
STUFF(isc_dyn_fld_length);
STUFF_WORD(2);
const USHORT l = (field->fld_dtype == dtype_varying)
? field->fld_length - sizeof(SSHORT) : field->fld_length;
const USHORT l = (field->fld_dtype == dtype_varying) ?
field->fld_length - sizeof(SSHORT) : field->fld_length;
STUFF_WORD(l);
STUFF(isc_dyn_fld_scale);
@ -1844,8 +1830,7 @@ static void blob_copy( qli_rlb* rlb, qli_rel* source, ISC_QUAD& source_blob_id)
**************************************/
ISC_STATUS_ARRAY status_vector;
DBB source_dbb =
(source->rel_database) ? source->rel_database : QLI_databases;
DBB source_dbb = (source->rel_database) ? source->rel_database : QLI_databases;
DB = source_dbb->dbb_handle;
UserBlob source_blob(status_vector);
@ -1928,16 +1913,14 @@ static void change_field( qli_rel* relation, qli_fld* field)
// Msg252 datatype can not be changed locally
}
if (global_field
&&
!(check_global_field(database, NULL, global_field->sym_string)))
if (global_field && !(check_global_field(database, NULL, global_field->sym_string)))
{
rollback_update(database);
ERRQ_print_error(253, global_field->sym_string);
// Msg253 global field %s does not exist
}
// Modify RFR
// Modify RFR
USHORT count = 0;
FOR(REQUEST_HANDLE database->dbb_requests[REQ_mdf_rfr])
@ -1999,8 +1982,8 @@ static bool check_global_field(DBB database,
if (field->fld_dtype &&
(X.RDB$FIELD_TYPE != blr_dtypes[field->fld_dtype] ||
X.RDB$FIELD_LENGTH != static_cast<SLONG>(
((field->fld_dtype == dtype_varying) ? field->fld_length -
sizeof(SSHORT) : field->fld_length)) ||
((field->fld_dtype == dtype_varying) ?
field->fld_length - sizeof(SSHORT) : field->fld_length)) ||
X.RDB$FIELD_SCALE != field->fld_scale))
{
rollback_update(database);
@ -2008,8 +1991,7 @@ static bool check_global_field(DBB database,
// Msg255 Datatype conflict with existing global field %s
}
field->fld_dtype = MET_get_datatype(X.RDB$FIELD_TYPE);
field->fld_length =
field_length(field->fld_dtype, X.RDB$FIELD_LENGTH);
field->fld_length = field_length(field->fld_dtype, X.RDB$FIELD_LENGTH);
if (field->fld_dtype == dtype_varying) {
field->fld_length += sizeof(SSHORT);
}
@ -2018,21 +2000,18 @@ static bool check_global_field(DBB database,
field->fld_sub_type_missing = X.RDB$FIELD_SUB_TYPE.NULL;
if (!field->fld_edit_string)
{
field->fld_edit_string =
make_string(X.RDB$EDIT_STRING, sizeof(X.RDB$EDIT_STRING));
field->fld_edit_string = make_string(X.RDB$EDIT_STRING, sizeof(X.RDB$EDIT_STRING));
}
if (!field->fld_query_name)
{
field->fld_query_name =
make_symbol(X.RDB$QUERY_NAME, sizeof(X.RDB$QUERY_NAME));
field->fld_query_name = make_symbol(X.RDB$QUERY_NAME, sizeof(X.RDB$QUERY_NAME));
}
if (!field->fld_query_header)
{
ISC_QUAD& blob = X.RDB$QUERY_HEADER;
if (!UserBlob::blobIsNull(blob))
{
field->fld_query_header =
get_query_header(database, blob);
field->fld_query_header = get_query_header(database, blob);
}
}
}
@ -2198,21 +2177,22 @@ static void clone_fields( qli_rel* target, qli_rel* source)
if ((source->rel_database->dbb_capabilities & DBB_cap_rfr_sys_flag) &&
(target->rel_database->dbb_capabilities & DBB_cap_rfr_sys_flag))
FOR(REQUEST_HANDLE req2
TRANSACTION_HANDLE s_trans)
{
FOR(REQUEST_HANDLE req2 TRANSACTION_HANDLE s_trans)
S_RFR IN DB.RDB$RELATION_FIELDS WITH
S_RFR.RDB$FIELD_NAME = Y.RDB$FIELD_NAME AND
S_RFR.RDB$RELATION_NAME = Y.RDB$RELATION_NAME
if (!S_RFR.RDB$SYSTEM_FLAG.NULL) {
STUFF(isc_dyn_system_flag);
STUFF_WORD(2);
STUFF_WORD(S_RFR.RDB$SYSTEM_FLAG);
}
END_FOR
ON_ERROR
rollback_update(target->rel_database);
ERRQ_database_error(source->rel_database, gds_status);
END_ERROR;
S_RFR.RDB$FIELD_NAME = Y.RDB$FIELD_NAME AND
S_RFR.RDB$RELATION_NAME = Y.RDB$RELATION_NAME
if (!S_RFR.RDB$SYSTEM_FLAG.NULL) {
STUFF(isc_dyn_system_flag);
STUFF_WORD(2);
STUFF_WORD(S_RFR.RDB$SYSTEM_FLAG);
}
END_FOR
ON_ERROR
rollback_update(target->rel_database);
ERRQ_database_error(source->rel_database, gds_status);
END_ERROR;
}
if (!F.RDB$COMPUTED_BLR.NULL)
{
@ -2303,7 +2283,7 @@ static void clone_global_fields( qli_rel* target, qli_rel* source)
Y.RDB$FIELD_NAME = RFR.RDB$FIELD_SOURCE REDUCED TO Y.RDB$FIELD_NAME
if (!Y.RDB$COMPUTED_BLR.NULL ||
(!fb_utils::implicit_domain(RFR.RDB$FIELD_NAME) &&
fb_utils::implicit_domain(Y.RDB$FIELD_NAME)))
fb_utils::implicit_domain(Y.RDB$FIELD_NAME)))
{
continue;
}
@ -2315,11 +2295,9 @@ static void clone_global_fields( qli_rel* target, qli_rel* source)
if ((A.RDB$FIELD_TYPE != Y.RDB$FIELD_TYPE) ||
(A.RDB$FIELD_LENGTH != Y.RDB$FIELD_LENGTH) ||
(A.RDB$FIELD_SCALE.NULL != Y.RDB$FIELD_SCALE.NULL) ||
((!Y.RDB$FIELD_SCALE.NULL) &&
(A.RDB$FIELD_SCALE != Y.RDB$FIELD_SCALE)) ||
(A.RDB$FIELD_SUB_TYPE.NULL != Y.RDB$FIELD_SUB_TYPE.NULL)
|| ((!Y.RDB$FIELD_SUB_TYPE.NULL)
&& (A.RDB$FIELD_SUB_TYPE != Y.RDB$FIELD_SUB_TYPE)))
((!Y.RDB$FIELD_SCALE.NULL) && (A.RDB$FIELD_SCALE != Y.RDB$FIELD_SCALE)) ||
(A.RDB$FIELD_SUB_TYPE.NULL != Y.RDB$FIELD_SUB_TYPE.NULL) ||
((!Y.RDB$FIELD_SUB_TYPE.NULL) && (A.RDB$FIELD_SUB_TYPE != Y.RDB$FIELD_SUB_TYPE)))
{
TEXT* name = ALLQ_malloc((SLONG) sizeof(Y.RDB$FIELD_NAME));
@ -2581,15 +2559,15 @@ static ISC_STATUS detach(ISC_STATUS * status_vector,
if (dbb->dbb_transaction)
if (isc_commit_transaction(status, &dbb->dbb_transaction))
status = alt_vector;
status = alt_vector;
if (dbb->dbb_proc_trans && (dbb->dbb_capabilities & DBB_cap_multi_trans))
if (isc_commit_transaction(status, &dbb->dbb_proc_trans))
status = alt_vector;
status = alt_vector;
if (dbb->dbb_meta_trans && (dbb->dbb_capabilities & DBB_cap_multi_trans))
if (isc_commit_transaction(status, &dbb->dbb_meta_trans))
status = alt_vector;
status = alt_vector;
isc_detach_database(status, &dbb->dbb_handle);
@ -2648,8 +2626,8 @@ static int field_length( USHORT dtype, USHORT length)
return sizeof(float);
case dtype_double:
return sizeof(double);
case dtype_int64:
return sizeof(SINT64);
case dtype_int64:
return sizeof(SINT64);
case dtype_sql_time:
case dtype_sql_date:
@ -2687,7 +2665,7 @@ static void get_database_type( DBB new_dbb)
if (status_vector[1])
ERRQ_database_error(new_dbb, gds_status);
UCHAR* p = buffer;
const UCHAR* p = buffer;
while (*p != isc_info_end && p < buffer + sizeof(buffer)) {
UCHAR item = *p++;
@ -2737,10 +2715,13 @@ static TEXT *get_query_header( DBB database, ISC_QUAD& blob_id)
}
TEXT* p = header;
const char* const end = header + sizeof(header) - 3;
// CVC: No bounds check here: it's assumed that 1024 is enough, but "p"
// might overflow "header" eventually.
for (;;) {
if (p >= end)
break;
size_t length;
if (!blob.getSegment(sizeof(buffer), buffer, length))
break;
@ -2751,10 +2732,10 @@ static TEXT *get_query_header( DBB database, ISC_QUAD& blob_id)
if (*q == '"')
do {
*p++ = *q++;
} while (*q);
} while (*q && p < end);
else {
*p++ = '"';
while (*q)
while (*q && p < end)
*p++ = *q++;
*p++ = '"';
}
@ -2876,8 +2857,7 @@ static void install( dbb* old_dbb)
Y.RDB$ARGUMENT_POSITION EQ X.RDB$RETURN_ARGUMENT
function->fun_return.dsc_dtype = MET_get_datatype(Y.RDB$FIELD_TYPE);
function->fun_return.dsc_length =
field_length(function->fun_return.dsc_dtype,
Y.RDB$FIELD_LENGTH);
field_length(function->fun_return.dsc_dtype, Y.RDB$FIELD_LENGTH);
function->fun_return.dsc_scale = Y.RDB$FIELD_SCALE;
END_FOR
ON_ERROR
@ -2943,6 +2923,8 @@ static TEXT *make_string( TEXT* string, SSHORT length)
* trailing blanks. If there's nothing left, return NULL.
*
**************************************/
fb_assert(length > 0);
string[length] = 0;
if (!(length = truncate_string(string)))
@ -2980,10 +2962,7 @@ static qli_symbol* make_symbol( TEXT* string, SSHORT length)
symbol->sym_length = length;
TEXT* p = symbol->sym_name;
symbol->sym_string = p;
do {
*p++ = *string++;
} while (--length);
memcpy(p, string, length);
return symbol;
}
@ -3004,8 +2983,8 @@ static qli_const* missing_value( ISC_QUAD& blob_id, qli_symbol* symbol)
qli_syntax* element = parse_blr_blob(blob_id, symbol);
if (element)
return ((qli_const*) element->syn_arg[0]);
else
return NULL;
return NULL;
}
@ -3455,8 +3434,7 @@ static void set_capabilities( DBB database)
// Look for desireable fields in system relations
for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation;
rel_field_table++)
for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation; rel_field_table++)
{
FOR(REQUEST_HANDLE req) x IN DB.RDB$RELATION_FIELDS
WITH x.RDB$RELATION_NAME = rel_field_table->relation
@ -3527,8 +3505,7 @@ static void sql_grant_revoke( qli_syntax* node, USHORT type)
qli_syntax* fields = node->syn_arg[s_grant_fields];
NAM* name = (NAM*) names->syn_arg;
for (NAM* const end = name + names->syn_count;
name < end; name++)
for (NAM* const end = name + names->syn_count; name < end; name++)
{
if (fields->syn_count) {
NAM* field = (NAM *) fields->syn_arg;
@ -3540,8 +3517,7 @@ static void sql_grant_revoke( qli_syntax* node, USHORT type)
}
}
else
stuff_priv(rlb, type, relation_name, privileges,
(*name)->nam_string, NULL);
stuff_priv(rlb, type, relation_name, privileges, (*name)->nam_string, NULL);
}
STUFF(isc_dyn_end);

View File

@ -45,7 +45,7 @@ void MET_modify_field(dbb*, qli_fld*);
void MET_modify_index(qli_syntax*);
void MET_modify_relation(qli_rel*, qli_fld*);
void MET_ready(qli_syntax*, USHORT);
void MET_shutdown (void);
void MET_shutdown();
void MET_sql_alter_table(qli_rel*, qli_fld*);
void MET_sql_cr_view(qli_syntax*);
void MET_sql_grant(qli_syntax*);

View File

@ -38,9 +38,9 @@ using MsgFormat::SafeArg;
static void date_error(const TEXT*, const USHORT);
static double double_from_text(const dsc* desc);
static void timestamp_to_text(SLONG[2], DSC *);
static void sql_time_to_text(ULONG[1], DSC *);
static void sql_date_to_text(SLONG[1], DSC *);
static void sql_date_to_text(const SLONG[1], DSC*);
static void sql_time_to_text(const ULONG[1], DSC*);
static void timestamp_to_text(const SLONG[2], DSC*);
static void mover_error(int, USHORT, USHORT);
static void now_to_date(const tm*, SLONG[2]);
static void numeric_to_text(const dsc*, dsc*);
@ -102,8 +102,7 @@ int MOVQ_compare(const dsc* arg1, const dsc* arg2)
// Handle the simple (matched) ones first
if (arg1->dsc_dtype == arg2->dsc_dtype &&
arg1->dsc_scale == arg2->dsc_scale)
if (arg1->dsc_dtype == arg2->dsc_dtype && arg1->dsc_scale == arg2->dsc_scale)
{
const UCHAR* p1 = arg1->dsc_address;
const UCHAR* p2 = arg2->dsc_address;
@ -999,7 +998,7 @@ static double double_from_text(const dsc* desc)
}
static void sql_date_to_text( SLONG date[1], DSC * to)
static void sql_date_to_text( const SLONG date[1], DSC* to)
{
/**************************************
*
@ -1016,7 +1015,7 @@ static void sql_date_to_text( SLONG date[1], DSC * to)
date2[0] = date[0];
date2[1] = 0;
isc_decode_date((ISC_QUAD*) date2, &times);
isc_decode_date((const ISC_QUAD*) date2, &times);
TEXT temp[35];
sprintf(temp, "%2d-%.3s-%04d", times.tm_mday,
@ -1037,7 +1036,7 @@ static void sql_date_to_text( SLONG date[1], DSC * to)
}
static void sql_time_to_text( ULONG date[1], DSC * to)
static void sql_time_to_text( const ULONG date[1], DSC* to)
{
/**************************************
*
@ -1055,7 +1054,7 @@ static void sql_time_to_text( ULONG date[1], DSC * to)
date2[0] = 0;
date2[1] = date[0];
isc_decode_date((ISC_QUAD*) date2, &times);
isc_decode_date((const ISC_QUAD*) date2, &times);
TEXT temp[35];
sprintf(temp, " %2d:%.2d:%.2d.%.4"SLONGFORMAT, times.tm_hour, times.tm_min,
@ -1076,7 +1075,7 @@ static void sql_time_to_text( ULONG date[1], DSC * to)
}
static void timestamp_to_text( SLONG date[2], DSC * to)
static void timestamp_to_text( const SLONG date[2], DSC* to)
{
/**************************************
*
@ -1089,7 +1088,7 @@ static void timestamp_to_text( SLONG date[2], DSC * to)
*
**************************************/
tm times;
isc_decode_date((ISC_QUAD*)date, &times);
isc_decode_date((const ISC_QUAD*) date, &times);
TEXT temp[35];
sprintf(temp, "%2d-%.3s-%04d", times.tm_mday,
@ -1231,8 +1230,7 @@ static void numeric_to_text(const dsc* from, dsc* to)
if ((to->dsc_dtype == dtype_text && length > to->dsc_length) ||
(to->dsc_dtype == dtype_cstring && length >= to->dsc_length) ||
(to->dsc_dtype == dtype_varying
&& length > to->dsc_length - sizeof(SSHORT)))
(to->dsc_dtype == dtype_varying && length > to->dsc_length - sizeof(SSHORT)))
{
IBERROR(57); // Msg 57 overflow during conversion
}
@ -1287,8 +1285,7 @@ static void numeric_to_text(const dsc* from, dsc* to)
return;
}
*(SSHORT *) (to->dsc_address) =
(UCHAR *) q - to->dsc_address - sizeof(SSHORT);
*(SSHORT *) (to->dsc_address) = (UCHAR *) q - to->dsc_address - sizeof(SSHORT);
}
@ -1450,7 +1447,9 @@ static void string_to_date(const TEXT* string, USHORT length, SLONG date[2])
if (times.tm_year != times2.tm_year ||
times.tm_mon != times2.tm_mon || times.tm_mday != times2.tm_mday)
{
date_error(string, length);
}
while (precision++ < 4)
components[6] *= 10;

View File

@ -23,12 +23,12 @@
#include "firebird.h"
int pipe(void)
int pipe()
{
return -1;
}
int vfork(void)
int vfork()
{
return -1;
}

File diff suppressed because it is too large Load Diff

View File

@ -54,8 +54,8 @@ struct qli_tok {
KWWORDS tok_keyword; // keyword number, if recognized
SLONG tok_position; // byte number in input stream
USHORT tok_length;
qli_tok* tok_next;
qli_tok* tok_prior;
//qli_tok* tok_next;
//qli_tok* tok_prior;
TEXT tok_string [2];
};
@ -65,8 +65,8 @@ enum line_t {
line_stdin,
line_blob,
line_file,
line_string,
line_edit
line_string
//, line_edit
};
struct qli_line {
@ -79,7 +79,7 @@ struct qli_line {
SLONG line_position;
FB_API_HANDLE line_source_blob; // Blob handle
FILE* line_source_file; // File handle
enum line_t line_type;
line_t line_type;
TEXT line_data[256];
TEXT line_source_name[2];
};

View File

@ -24,11 +24,11 @@
#ifndef QLI_PARSE_PROTO_H
#define QLI_PARSE_PROTO_H
qli_syntax* PARQ_parse(void);
qli_syntax* PARQ_parse();
bool PAR_match (KWWORDS);
void PAR_real (void);
void PAR_real_token (void);
void PAR_token (void);
void PAR_real ();
void PAR_real_token ();
void PAR_token ();
#endif // QLI_PARSE_PROTO_H

View File

@ -86,10 +86,12 @@ pics* PIC_analyze(const TEXT* string, const dsc* desc)
*
**************************************/
if (!string)
{
if (!desc)
return NULL;
else
string = default_edit_string(desc, NULL);
string = default_edit_string(desc, NULL);
}
pics* picture = (pics*) ALLOCD(type_pic);
picture->pic_string = picture->pic_pointer = string;
@ -255,35 +257,24 @@ pics* PIC_analyze(const TEXT* string, const dsc* desc)
picture->pic_floats +
picture->pic_literals +
picture->pic_decimals +
picture->pic_months +
picture->pic_days +
picture->pic_weekdays +
picture->pic_years +
picture->pic_nmonths +
picture->pic_julians +
picture->pic_months + picture->pic_days + picture->pic_weekdays + picture->pic_years +
picture->pic_nmonths + picture->pic_julians +
picture->pic_brackets +
picture->pic_exponents +
picture->pic_float_digits +
picture->pic_hours +
picture->pic_minutes + picture->pic_seconds + picture->pic_meridian;
picture->pic_hours + picture->pic_minutes + picture->pic_seconds +
picture->pic_meridian;
if (picture->pic_missing) {
picture->pic_length =
MAX(picture->pic_print_length,
picture->pic_missing->pic_print_length);
picture->pic_length = MAX(picture->pic_print_length, picture->pic_missing->pic_print_length);
picture->pic_missing->pic_length = picture->pic_length;
}
else
picture->pic_length = picture->pic_print_length;
if (picture->pic_days ||
picture->pic_weekdays ||
picture->pic_months ||
picture->pic_nmonths ||
picture->pic_years ||
picture->pic_hours ||
picture->pic_julians)
if (picture->pic_days || picture->pic_weekdays || picture->pic_months || picture->pic_nmonths ||
picture->pic_years || picture->pic_hours || picture->pic_julians)
{
picture->pic_type = pic_date;
}
@ -361,8 +352,7 @@ void PIC_missing( qli_const* constant, pics* picture)
pics* missing_picture = PIC_analyze(scratch->str_data, desc);
picture->pic_missing = missing_picture;
picture->pic_length =
MAX(picture->pic_print_length, missing_picture->pic_print_length);
picture->pic_length = MAX(picture->pic_print_length, missing_picture->pic_print_length);
missing_picture->pic_length = picture->pic_length;
}
@ -732,9 +722,7 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
(G-format is untrustworthy.) */
if (picture->pic_exponents) {
width =
picture->pic_print_length - picture->pic_floats -
picture->pic_literals;
width = picture->pic_print_length - picture->pic_floats - picture->pic_literals;
decimal_digits = picture->pic_fractions;
sprintf(temp, "%*.*e", width, decimal_digits, number);
#ifdef WIN_NT
@ -757,8 +745,8 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
++p;
*p = 0; // move the end
}
if ((w_digits > width)
|| (!f_digits && w_digits == 1 && temp[0] == '0')) {
if ((w_digits > width) || (!f_digits && w_digits == 1 && temp[0] == '0'))
{
/* if the number doesn't fit in the default window, revert
to exponential notation; displaying the maximum number of
mantissa digits. */

View File

@ -100,8 +100,7 @@ void PRO_commit( DBB database)
**************************************/
ISC_STATUS_ARRAY status_vector;
if ((database->dbb_capabilities & DBB_cap_multi_trans) &&
!(LEX_active_procedure()))
if ((database->dbb_capabilities & DBB_cap_multi_trans) && !(LEX_active_procedure()))
{
if (isc_commit_transaction(status_vector, &database->dbb_proc_trans)) {
PRO_rollback(database);
@ -133,8 +132,7 @@ void PRO_copy_procedure(
FB_API_HANDLE old_blob;
if (!old_database) {
for (old_database = QLI_databases; old_database;
old_database = old_database->dbb_next)
for (old_database = QLI_databases; old_database; old_database = old_database->dbb_next)
{
if (old_blob = PRO_fetch_procedure(old_database, old_name))
break;
@ -145,7 +143,7 @@ void PRO_copy_procedure(
if (!old_blob)
ERRQ_print_error(70, old_name);
// Msg 70 procedure \"%s\" is undefined
// Msg 70 procedure \"%s\" is undefined
if (new_database != old_database)
PRO_setup(new_database);
@ -177,12 +175,11 @@ void PRO_copy_procedure(
ERRQ_database_error(new_database, status_vector);
}
USHORT length;
while (!(isc_get_segment(status_vector, &old_blob, &length,
sizeof(buffer), buffer)))
while (!(isc_get_segment(status_vector, &old_blob, &length, sizeof(buffer), buffer)))
{
buffer[length] = 0;
if (isc_put_segment(status_vector, &new_blob, length, buffer))
ERRQ_database_error(new_database, status_vector);
ERRQ_database_error(new_database, status_vector);
}
PRO_close(old_database, old_blob);
PRO_close(new_database, new_blob);
@ -306,8 +303,7 @@ void PRO_edit_procedure( DBB database, const TEXT* name)
FOR(REQUEST_HANDLE database->dbb_edit_blob) X IN DB.QLI$PROCEDURES WITH
X.QLI$PROCEDURE_NAME EQ name
MODIFY X USING
if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle,
gds_trans, name))
if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle, gds_trans, name))
{
return;
}
@ -318,8 +314,7 @@ void PRO_edit_procedure( DBB database, const TEXT* name)
STORE(REQUEST_HANDLE database->dbb_edit_store) X IN DB.QLI$PROCEDURES
X.QLI$PROCEDURE = gds_blob_null;
if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle,
gds_trans, name))
if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle, gds_trans, name))
{
return;
}
@ -414,11 +409,10 @@ void PRO_invoke( DBB database, const TEXT* name)
{
ERRQ_print_error(71, SafeArg() << name << database->dbb_symbol->sym_string);
}
// Msg 71 procedure \"%s\" is undefined in database %s
// Msg 71 procedure \"%s\" is undefined in database %s
}
else
for (database = QLI_databases; database;
database = database->dbb_next)
for (database = QLI_databases; database; database = database->dbb_next)
{
if (blob = PRO_fetch_procedure(database, name))
break;
@ -426,7 +420,7 @@ void PRO_invoke( DBB database, const TEXT* name)
if (!blob)
ERRQ_print_error(72, name);
// Msg 72 procedure \"%s\" is undefined
// Msg 72 procedure \"%s\" is undefined
LEX_procedure((dbb*)database, blob);
LEX_token();
@ -453,9 +447,8 @@ FB_API_HANDLE PRO_open_blob( DBB database, ISC_QUAD& blob_id)
USHORT bpb_length = p - bpb;
if (isc_open_blob2(status_vector, &database->dbb_handle,
&database->dbb_proc_trans, &blob, &blob_id,
bpb_length, bpb))
if (isc_open_blob2(status_vector, &database->dbb_handle, &database->dbb_proc_trans,
&blob, &blob_id, bpb_length, bpb))
{
ERRQ_database_error(database, status_vector);
}
@ -551,8 +544,7 @@ void PRO_scan( DBB database, extract_fn_t routine, void* arg)
while (*p && *p != ' ') {
p++;
}
(*routine) (arg, X.QLI$PROCEDURE_NAME, p - X.QLI$PROCEDURE_NAME,
database, X.QLI$PROCEDURE);
(*routine) (arg, X.QLI$PROCEDURE_NAME, p - X.QLI$PROCEDURE_NAME, database, X.QLI$PROCEDURE);
END_FOR
}
@ -637,7 +629,7 @@ FB_API_HANDLE PRO_transaction( DBB database, bool update_flag)
!(database->dbb_capabilities & DBB_cap_single_trans)))
{
if (isc_start_transaction(status_vector, &transaction, 1,
&database->dbb_handle, sizeof(tpb), tpb))
&database->dbb_handle, sizeof(tpb), tpb))
{
database->dbb_capabilities |= DBB_cap_single_trans;
}
@ -805,7 +797,7 @@ static void create_qli_procedures( DBB dbb)
{
PRO_rollback(dbb);
IBERROR(73);
// Msg 73 Could not create QLI$PROCEDURE_NAME field
// Msg 73 Could not create QLI$PROCEDURE_NAME field
}
if (isc_ddl(gds_status, &DB, &gds_trans, sizeof(dyn_gdl2),
@ -813,7 +805,7 @@ static void create_qli_procedures( DBB dbb)
{
PRO_rollback(dbb);
IBERROR(74);
// Msg 74 Could not create QLI$PROCEDURE field
// Msg 74 Could not create QLI$PROCEDURE field
}
if (isc_ddl(gds_status, &DB, &gds_trans, sizeof(dyn_gdl3),
@ -821,7 +813,7 @@ static void create_qli_procedures( DBB dbb)
{
PRO_rollback(dbb);
IBERROR(75);
// Msg 75 Could not create QLI$PROCEDURES relation
// Msg 75 Could not create QLI$PROCEDURES relation
}
if (isc_ddl(gds_status, &DB, &gds_trans, sizeof(dyn_gdl4),
@ -829,7 +821,7 @@ static void create_qli_procedures( DBB dbb)
{
PRO_rollback(dbb);
IBERROR(409);
// msg 409 Could not create QLI$PROCEDURES index
// msg 409 Could not create QLI$PROCEDURES index
}
dbb->dbb_flags |= DBB_procedures;

View File

@ -44,9 +44,9 @@ static void top_of_page(qli_prt*, bool);
//#define SWAP(a, b) {temp = a; a = b; b = temp;}
inline void swap_uchar(UCHAR*& a, UCHAR*& b)
{
UCHAR* temp = a;
a = b;
b = temp;
UCHAR* temp = a;
a = b;
b = temp;
}
@ -117,14 +117,13 @@ void RPT_report( qli_nod* loop)
// Force TOP breaks for all fields
for (control = report->rpt_top_breaks; control;
control = control->brk_next) FMT_print((qli_nod*) control->brk_line, print);
for (control = report->rpt_top_breaks; control; control = control->brk_next)
FMT_print((qli_nod*) control->brk_line, print);
for (;;) {
// Check for bottom breaks. If we find one, force all lower breaks.
for (control = report->rpt_bottom_breaks; control;
control = control->brk_next)
for (control = report->rpt_bottom_breaks; control; control = control->brk_next)
{
if (test_break(control, report, message)) {
swap_uchar(message->msg_buffer, report->rpt_buffer);
@ -140,8 +139,7 @@ void RPT_report( qli_nod* loop)
// Now check for top breaks.
for (control = report->rpt_top_breaks; control;
control = control->brk_next)
for (control = report->rpt_top_breaks; control; control = control->brk_next)
{
if (test_break(control, report, message)) {
top_break(control, print);

View File

@ -53,8 +53,7 @@ static void display_procedure(DBB, const UCHAR*, FB_API_HANDLE);
static USHORT get_window_size(int);
static void show_blob_info(ISC_QUAD&, ISC_QUAD&, USHORT, USHORT, DBB, const TEXT*);
static void show_blr(DBB, USHORT, ISC_QUAD&, USHORT, ISC_QUAD&);
static void show_datatype(DBB, USHORT, USHORT, SSHORT, SSHORT, USHORT,
USHORT);
static void show_datatype(DBB, USHORT, USHORT, SSHORT, SSHORT, USHORT, USHORT);
static void show_dbb(DBB);
static void show_dbb_parameters(DBB);
static int show_field_detail(DBB, const TEXT*, const TEXT*, qli_syntax*);
@ -70,7 +69,7 @@ static int show_func_detail(DBB, TEXT*);
static void show_funcs(DBB);
static int show_funcs_detail(DBB);
static int show_insecure_fields(DBB, const TEXT*, const TEXT*);
static void show_forms_db(DBB);
//static void show_forms_db(DBB);
static void show_gbl_field(qli_syntax*);
static int show_gbl_field_detail(DBB, const TEXT*);
static void show_gbl_fields(DBB);
@ -87,19 +86,17 @@ static USHORT show_security_class_detail(DBB, const TEXT*);
static USHORT show_security_classes_detail(DBB);
static void show_string(USHORT, TEXT*, USHORT, TEXT*);
static void show_sys_trigs(DBB);
static void show_text_blob(DBB, const TEXT*, USHORT, ISC_QUAD*, USHORT,
ISC_QUAD*, bool);
static void show_text_blob(DBB, const TEXT*, USHORT, ISC_QUAD*, USHORT, ISC_QUAD*, bool);
static void show_trig(qli_rel*);
static int show_trigger_detail(DBB, const TEXT*);
static void show_trigger_header(TEXT*, USHORT, USHORT, USHORT, ISC_QUAD&,
DBB, const TEXT*);
static void show_trigger_header(TEXT*, USHORT, USHORT, USHORT, ISC_QUAD&, DBB, const TEXT*);
static void show_trigger_messages(DBB, const TEXT*);
static void show_trigger_status(TEXT*, USHORT, USHORT, USHORT);
static void show_trigs(DBB);
static int show_triggers_detail(DBB);
static void show_var(const nam*);
static void show_vars(void);
static void show_versions(void);
static void show_vars();
static void show_versions();
static void show_view(qli_rel*);
static int show_views_detail(DBB);
static void view_info(DBB, const TEXT*, const TEXT*, SSHORT, SSHORT);
@ -162,8 +159,7 @@ void SHOW_stuff( qli_syntax* node)
for (USHORT i = 0; i < node->syn_count; i++) {
const show_t sw = (enum show_t)(IPTR)*ptr++;
qli_syntax* value = *ptr++;
if (sw != show_matching_language &&
sw != show_version &&
if (sw != show_matching_language && sw != show_version &&
sw != show_variable && sw != show_variables && CMD_check_ready())
{
return;
@ -172,8 +168,7 @@ void SHOW_stuff( qli_syntax* node)
case show_all:
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) {
show_dbb(dbb);
for (relation = dbb->dbb_relations; relation;
relation = relation->rel_next)
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & REL_system)) {
show_rel(relation);
@ -200,8 +195,7 @@ void SHOW_stuff( qli_syntax* node)
dbb = QLI_databases;
show_dbb(dbb);
show_dbb_parameters(dbb);
for (relation = dbb->dbb_relations; relation;
relation = relation->rel_next)
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & REL_system)) {
show_rel(relation);
@ -225,8 +219,7 @@ void SHOW_stuff( qli_syntax* node)
case show_db_fields:
dbb = (DBB) value;
for (relation = dbb->dbb_relations; relation;
relation = relation->rel_next)
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & REL_system)) {
show_rel(relation);
@ -294,8 +287,7 @@ void SHOW_stuff( qli_syntax* node)
}
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) {
show_dbb(dbb);
for (relation = dbb->dbb_relations; relation;
relation = relation->rel_next)
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & (REL_system | REL_view))) {
show_rel(relation);
@ -311,8 +303,7 @@ void SHOW_stuff( qli_syntax* node)
case show_db_indices:
dbb = (DBB) value;
show_dbb(dbb);
for (relation = dbb->dbb_relations; relation;
relation = relation->rel_next)
for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
{
if (!(relation->rel_flags & (REL_system | REL_view))) {
show_rel(relation);
@ -341,6 +332,7 @@ void SHOW_stuff( qli_syntax* node)
}
break;
/*
case show_forms:
if (value)
show_forms_db((DBB) value);
@ -349,6 +341,7 @@ void SHOW_stuff( qli_syntax* node)
show_forms_db(dbb);
}
break;
*/
case show_function:
show_func((QFN) value);
@ -780,15 +773,15 @@ static void show_datatype(
ERRQ_msg_partial(433); // Msg433 array
}
if (dtype == dtype_short || dtype == dtype_long || dtype == dtype_quad || dtype == dtype_int64) {
if (dtype == dtype_short || dtype == dtype_long || dtype == dtype_quad || dtype == dtype_int64)
{
if (scale) {
ERRQ_msg_partial(111, SafeArg() << scale);
// Msg111 , scale %d
}
}
if (dtype == dtype_text ||
dtype == dtype_varying || dtype == dtype_cstring)
if (dtype == dtype_text || dtype == dtype_varying || dtype == dtype_cstring)
{
if (sub_type == 1)
ERRQ_msg_partial(112); // Msg112 , subtype fixed
@ -846,9 +839,10 @@ static void show_dbb_parameters( DBB database)
return;
if (isc_database_info(status_vector, &database->dbb_handle,
sizeof(db_items), db_items,
sizeof(buffer), (char*) buffer))
ERRQ_database_error(database, status_vector);
sizeof(db_items), db_items, sizeof(buffer), (char*) buffer))
{
ERRQ_database_error(database, status_vector);
}
SLONG page_size = 0, allocation = 0;
@ -880,15 +874,13 @@ static void show_dbb_parameters( DBB database)
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);
show_text_blob(database, "\t", 261, &D.RDB$DESCRIPTION, 0, NULL, false);
END_FOR;
}
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);
show_text_blob(database, "\t", 262, &D.RDB$DESCRIPTION, 0, NULL, false);
END_FOR;
}
@ -899,16 +891,13 @@ static void show_dbb_parameters( DBB database)
if (F.RDB$SHADOW_NUMBER) {
if (!(F.RDB$FILE_FLAGS & FILE_conditional)) {
ERRQ_msg_put(385, SafeArg() <<
F.RDB$SHADOW_NUMBER <<
F.RDB$FILE_NAME <<
F.RDB$FILE_START);
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 {
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME <<
F.RDB$FILE_START);
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << F.RDB$FILE_START);
// Msg263 File:%s starting at page %d
}
END_FOR;
@ -916,8 +905,7 @@ static void show_dbb_parameters( DBB database)
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);
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << F.RDB$FILE_START);
// Msg263 File:%s starting at page %d
END_FOR;
}
@ -965,8 +953,7 @@ static int show_field_detail(
continue;
const USHORT dimensions = MET_dimensions(database, F.RDB$FIELD_NAME);
if (dimensions && idx_node &&
dimensions != idx_node->syn_arg[s_idx_count]->syn_count)
if (dimensions && idx_node && dimensions != idx_node->syn_arg[s_idx_count]->syn_count)
{
continue;
}
@ -992,31 +979,25 @@ static int show_field_detail(
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);
view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, RFR.RDB$VIEW_CONTEXT, 0);
}
show_text_blob(database, "\t", 266, &RFR.RDB$DESCRIPTION, 339,
&F.RDB$DESCRIPTION, false);
show_text_blob(database, "\t", 266, &RFR.RDB$DESCRIPTION, 339, &F.RDB$DESCRIPTION, false);
ERRQ_msg_put(267);
// Msg267 Datatype information:
printf("\t");
show_datatype(database, MET_get_datatype(F.RDB$FIELD_TYPE),
F.RDB$FIELD_LENGTH, F.RDB$FIELD_SCALE,
F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH, dimensions);
show_datatype(database, MET_get_datatype(F.RDB$FIELD_TYPE), F.RDB$FIELD_LENGTH,
F.RDB$FIELD_SCALE, F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH, dimensions);
if (dimensions && !idx_node)
array_dimensions(database, F.RDB$FIELD_NAME);
printf("\n");
show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341,
F.RDB$COMPUTED_BLR);
show_blr(database, 342, F.RDB$VALIDATION_SOURCE, 342,
F.RDB$VALIDATION_BLR);
show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341, F.RDB$COMPUTED_BLR);
show_blr(database, 342, F.RDB$VALIDATION_SOURCE, 342, F.RDB$VALIDATION_BLR);
show_string(270, RFR.RDB$SECURITY_CLASS, 0, NULL);
show_string(271, RFR.RDB$QUERY_NAME, 271, F.RDB$QUERY_NAME);
show_string(273, RFR.RDB$EDIT_STRING, 273, F.RDB$EDIT_STRING);
show_text_blob(database, "\t", 275, &RFR.RDB$QUERY_HEADER, 275,
&F.RDB$QUERY_HEADER, false);
show_text_blob(database, "\t", 275, &RFR.RDB$QUERY_HEADER, 275, &F.RDB$QUERY_HEADER, false);
END_FOR;
return count;
@ -1072,7 +1053,7 @@ static void show_fields( qli_rel* relation, qli_fld* fields)
**************************************/
DBB database;
// Find the long field name (including query name)
// Find the long field name (including query name)
if (relation) {
if (!(relation->rel_flags & REL_fields))
@ -1114,14 +1095,13 @@ static void show_fields( qli_rel* relation, qli_fld* fields)
putchar(' ');
show_datatype(database, field->fld_dtype,
(field->fld_dtype == dtype_varying) ?
field->fld_length - 2 : field->fld_length,
field->fld_scale,
field->fld_sub_type, field->fld_segment_length,
field->fld_length - 2 : field->fld_length,
field->fld_scale, field->fld_sub_type, field->fld_segment_length,
(field->fld_flags & FLD_array) ? 1 : 0);
if (database && field->fld_flags & FLD_array)
array_dimensions(database, field->fld_name->sym_string);
if (field->fld_flags & FLD_computed)
ERRQ_msg_put(119); // Msg119 (computed expression)
ERRQ_msg_put(119); // Msg119 (computed expression)
else
printf("\n");
}
@ -1155,8 +1135,7 @@ static void show_filt( QFL filter)
count = show_filter_detail(database, name->nam_string);
if (!count) {
// Msg440 Filter %s is not defined in database %s.
ERRQ_msg_put(440, SafeArg() << name->nam_string <<
database->dbb_symbol->sym_string);
ERRQ_msg_put(440, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
}
}
else {
@ -1206,7 +1185,7 @@ static int show_filter_detail( DBB database, TEXT* filter_name)
count++;
fb_utils::exact_name(filter_name);
ERRQ_msg_put(444, // Msg444 Filter %s in database \"%s\" (%s):
ERRQ_msg_put(444, // Msg444 Filter %s in database \"%s\" (%s):
SafeArg() << filter_name << database->dbb_filename <<
database->dbb_symbol->sym_string);
ERRQ_msg_put(445, F.RDB$MODULE_NAME);
@ -1267,7 +1246,7 @@ static int show_filters_detail( DBB database)
if (!count++) {
ERRQ_msg_put(449, SafeArg() << database->dbb_filename <<
database->dbb_symbol->sym_string);
// Msg449 Filters in database %s (%s):
// Msg449 Filters in database %s (%s):
}
show_names(F.RDB$FUNCTION_NAME, width, buffer);
END_FOR;
@ -1315,7 +1294,7 @@ static void show_fld( qli_syntax* field_node)
relation_name = (NAM) * ptr;
else
for (qli_symbol* symbol = ((NAM) * ptr)->nam_symbol; symbol;
symbol = symbol->sym_homonym)
symbol = symbol->sym_homonym)
{
if (symbol->sym_type == SYM_database) {
database = (DBB) symbol->sym_object;
@ -1334,20 +1313,16 @@ static void show_fld( qli_syntax* field_node)
int count = 0;
if (database) {
count += show_field_detail(database, string,
field_name->nam_string, NULL);
count += show_field_detail(database, string, field_name->nam_string, NULL);
if (!count) {
ERRQ_msg_put(117, SafeArg() << s << database->dbb_symbol->sym_string);
// Msg117 Field %s does not exist in database %s
}
}
else {
for (database = QLI_databases; database;
database = database->dbb_next)
for (database = QLI_databases; database; database = database->dbb_next)
{
count +=
show_field_detail(database, string, field_name->nam_string,
idx_node);
count += show_field_detail(database, string, field_name->nam_string, idx_node);
}
if (!count) {
ERRQ_msg_put(118, s);
@ -1384,8 +1359,7 @@ static void show_func( QFN func)
count = show_func_detail(database, name->nam_string);
if (!count) {
// Msg422 Function %s is not defined in database %s.
ERRQ_msg_put(422, SafeArg() << name->nam_string <<
database->dbb_symbol->sym_string);
ERRQ_msg_put(422, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
}
}
else {
@ -1438,12 +1412,12 @@ static int show_func_detail( DBB database, TEXT* func_name)
strcpy(func_name, F.RDB$FUNCTION_NAME);
if (F.RDB$QUERY_NAME[0]) {
ERRQ_msg_put(424, // Msg424 Function %s (%s) in database \"%s\" (%s):
ERRQ_msg_put(424, // Msg424 Function %s (%s) in database \"%s\" (%s):
SafeArg() << F.RDB$FUNCTION_NAME << F.RDB$QUERY_NAME <<
database->dbb_filename << database->dbb_symbol->sym_string);
}
else {
ERRQ_msg_put(425, // Msg425 Function %s in database \"%s\" (%s):
ERRQ_msg_put(425, // Msg425 Function %s in database \"%s\" (%s):
SafeArg() << F.RDB$FUNCTION_NAME << database->dbb_filename <<
database->dbb_symbol->sym_string);
}
@ -1526,7 +1500,7 @@ static int show_funcs_detail( DBB database)
F IN RDB$FUNCTIONS
SORTED BY F.RDB$FUNCTION_NAME
if (!count++) {
// Msg416 Functions in database %s (%s):
// Msg416 Functions in database %s (%s):
ERRQ_msg_put(416, SafeArg() << database->dbb_filename <<
database->dbb_symbol->sym_string);
}
@ -1593,12 +1567,10 @@ static int show_insecure_fields(
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);
view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, RFR.RDB$VIEW_CONTEXT, 0);
}
show_text_blob(database, "\t", 339, &RFR.RDB$DESCRIPTION, 339,
&F.RDB$DESCRIPTION, false);
show_text_blob(database, "\t", 339, &RFR.RDB$DESCRIPTION, 339, &F.RDB$DESCRIPTION, false);
ERRQ_msg_partial(340); // Msg340 Datatype information:
printf("\t");
show_datatype(database, MET_get_datatype(F.RDB$FIELD_TYPE),
@ -1606,20 +1578,17 @@ static int show_insecure_fields(
F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH,
MET_dimensions(database, F.RDB$FIELD_NAME));
printf("\n");
show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341,
F.RDB$COMPUTED_BLR);
show_blr(database, 342, F.RDB$VALIDATION_SOURCE, 342,
F.RDB$VALIDATION_BLR);
show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341, F.RDB$COMPUTED_BLR);
show_blr(database, 342, F.RDB$VALIDATION_SOURCE, 342, F.RDB$VALIDATION_BLR);
show_string(343, RFR.RDB$QUERY_NAME, 343, F.RDB$QUERY_NAME);
show_string(346, RFR.RDB$EDIT_STRING, 346, F.RDB$EDIT_STRING);
show_text_blob(database, "\t", 345, &RFR.RDB$QUERY_HEADER, 345,
&F.RDB$QUERY_HEADER, false);
show_text_blob(database, "\t", 345, &RFR.RDB$QUERY_HEADER, 345, &F.RDB$QUERY_HEADER, false);
END_FOR;
return count;
}
/*
static void show_forms_db( DBB database)
{
/**************************************
@ -1632,11 +1601,12 @@ static void show_forms_db( DBB database)
* Show what we know about forms
* for one database.
*
**************************************/
**************************************./
ERRQ_msg_put(120, database->dbb_symbol->sym_string);
// Msg120 There are no forms defined for database %s
}
*/
static void show_gbl_field( qli_syntax* field_node)
{
@ -1665,8 +1635,7 @@ static void show_gbl_field( qli_syntax* field_node)
}
else {
NAM name = (NAM) *ptr;
for (qli_symbol* symbol = name->nam_symbol;
symbol; symbol = symbol->sym_homonym)
for (qli_symbol* symbol = name->nam_symbol; symbol; symbol = symbol->sym_homonym)
{
if (symbol->sym_type == SYM_database) {
database = (DBB) symbol->sym_object;
@ -1732,10 +1701,8 @@ static int show_gbl_field_detail( DBB database, const TEXT* field_name)
F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH,
MET_dimensions(database, F.RDB$FIELD_NAME));
printf("\n");
show_blr(database, 279, F.RDB$COMPUTED_SOURCE, 341,
F.RDB$COMPUTED_BLR);
show_blr(database, 280, F.RDB$VALIDATION_SOURCE, 342,
F.RDB$VALIDATION_BLR);
show_blr(database, 279, F.RDB$COMPUTED_SOURCE, 341, F.RDB$COMPUTED_BLR);
show_blr(database, 280, F.RDB$VALIDATION_SOURCE, 342, F.RDB$VALIDATION_BLR);
show_string(281, F.RDB$QUERY_NAME, 0, NULL);
show_string(282, F.RDB$EDIT_STRING, 0, NULL);
show_text_blob(database, "\t", 283, &F.RDB$QUERY_HEADER, 0, NULL, false);
@ -1775,8 +1742,7 @@ static void show_gbl_fields( DBB database)
}
}
else {
for (database = QLI_databases; database;
database = database->dbb_next)
for (database = QLI_databases; database; database = database->dbb_next)
{
count += show_gbl_fields_detail(database);
}
@ -2091,10 +2057,8 @@ static void show_rel_detail( qli_rel* relation)
MET_meta_transaction(database, false);
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_rel_detail])
R IN RDB$RELATIONS WITH
R.RDB$RELATION_NAME = relation_name
show_text_blob(database, "\t", 291, &R.RDB$DESCRIPTION, 0,
NULL, false);
R IN RDB$RELATIONS WITH R.RDB$RELATION_NAME = relation_name
show_text_blob(database, "\t", 291, &R.RDB$DESCRIPTION, 0, NULL, false);
if (database->dbb_capabilities & DBB_cap_security)
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_rel_secur])
@ -2110,7 +2074,7 @@ static void show_rel_detail( qli_rel* relation)
ERRQ_msg_put(293, E.RDB$EXTERNAL_FILE); // Msg293 Stored in external file %s
END_FOR;
// OBSOLETE - Handling of DBB_cap_triggers (old V2 style triggers)
// OBSOLETE - Handling of DBB_cap_triggers (old V2 style triggers)
// OBSOLETE - Msg294 An erase trigger is defined for %s
// OBSOLETE - Msg295 A modify trigger is defined for %s
// OBSOLETE - Msg296 A store trigger is defined for %s
@ -2127,10 +2091,8 @@ static void show_rel_detail( qli_rel* relation)
msg = 0;
}
printf("\t");
show_trigger_status(X.RDB$TRIGGER_NAME,
X.RDB$TRIGGER_TYPE,
X.RDB$TRIGGER_INACTIVE,
X.RDB$TRIGGER_SEQUENCE);
show_trigger_status(X.RDB$TRIGGER_NAME, X.RDB$TRIGGER_TYPE,
X.RDB$TRIGGER_INACTIVE, X.RDB$TRIGGER_SEQUENCE);
}
END_FOR;
}
@ -2381,8 +2343,7 @@ static void show_trig( qli_rel* relation)
*
**************************************/
if (!(show_trigger_detail(relation->rel_database,
relation->rel_symbol->sym_string)))
if (!(show_trigger_detail(relation->rel_database, relation->rel_symbol->sym_string)))
{
ERRQ_msg_put(129, relation->rel_symbol->sym_string);
// Msg129 No triggers are defined for relation %s
@ -2554,8 +2515,8 @@ static void show_trigger_status(
ERRQ_msg_format(msg_num, sizeof(trigger_active), trigger_active);
fb_utils::exact_name(name);
ERRQ_msg_put(366, SafeArg() << name << trigger_type << sequence <<
trigger_active); // Msg366 Name: %s, Type: %s, Sequence: %d, Active: %s
ERRQ_msg_put(366, SafeArg() << name << trigger_type << sequence << trigger_active);
// Msg366 Name: %s, Type: %s, Sequence: %d, Active: %s
}
@ -2582,10 +2543,10 @@ static void show_trigs( DBB database)
else {
for (database = QLI_databases; database; database = database->dbb_next)
if (!show_triggers_detail(database))
{
ERRQ_msg_put(131, database->dbb_symbol->sym_string);
// Msg131 No triggers are defined in database %s
}
{
ERRQ_msg_put(131, database->dbb_symbol->sym_string);
// Msg131 No triggers are defined in database %s
}
}
}
@ -2697,7 +2658,7 @@ static void show_var( const nam* var_name)
}
static void show_vars(void)
static void show_vars()
{
/**************************************
*
@ -2715,7 +2676,7 @@ static void show_vars(void)
}
static void show_versions(void)
static void show_versions()
{
/**************************************
*
@ -2731,7 +2692,7 @@ static void show_versions(void)
for (DBB dbb = QLI_databases; dbb; dbb = dbb->dbb_next) {
ERRQ_msg_put(134, dbb->dbb_filename);
// Msg134 Version(s) for database %s
// Msg134 Version(s) for database %s
isc_version(&dbb->dbb_handle, NULL, NULL);
}
}
@ -2866,8 +2827,7 @@ static void view_info(
show_text_blob(dbb, "\t\t", 0, &RFR.RDB$DESCRIPTION, 0, NULL, false);
}
if (!RFR.RDB$BASE_FIELD.NULL
&& (dbb->dbb_capabilities & DBB_cap_multi_trans))
if (!RFR.RDB$BASE_FIELD.NULL && (dbb->dbb_capabilities & DBB_cap_multi_trans))
{
fb_utils::exact_name(RFR.RDB$BASE_FIELD);
view_info(dbb, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD,

View File

@ -40,24 +40,24 @@ KW_BLR,
KW_BOTTOM,
KW_BY,
KW_CHAR,
KW_CHOICE,
KW_CLOSE,
KW_COLLECTION,
KW_COLLECTIONS,
//KW_CHOICE,
//KW_CLOSE,
//KW_COLLECTION,
//KW_COLLECTIONS,
KW_COLON,
KW_COLUMN,
KW_COLUMNS,
KW_COLUMN_HEADER,
KW_COMMA,
KW_COMMIT,
KW_COMPUTED,
//KW_COMPUTED,
KW_CONTAINING,
KW_CONT_PROMPT,
KW_COPY,
KW_COUNT,
KW_CREATE,
KW_CROSS,
KW_CURSOR,
//KW_CURSOR,
KW_DATABASE,
KW_DATABASES,
KW_DATE,
@ -76,21 +76,21 @@ KW_EDIT,
KW_EDIT_STRING,
KW_ELSE,
KW_END,
KW_END_CHOICE,
KW_END_FOR,
KW_END_MODIFY,
//KW_END_CHOICE,
//KW_END_FOR,
//KW_END_MODIFY,
KW_END_PROCEDURE,
KW_END_REPORT,
KW_END_STORE,
KW_END_STREAM,
KW_ENTREE,
//KW_END_STORE,
//KW_END_STREAM,
//KW_ENTREE,
KW_EQ,
KW_EQUALS,
KW_ERASE,
KW_ESCAPE,
KW_EUC_JUSTIFY,
//KW_EUC_JUSTIFY,
KW_EXACTCASE,
KW_EXEC,
//KW_EXEC,
KW_EXISTS,
KW_EXIT,
#ifdef DEV_BUILD
@ -115,7 +115,7 @@ KW_GE,
KW_GLOBAL,
KW_GRANT,
KW_GROUP,
KW_GROUPED,
//KW_GROUPED,
KW_GT,
KW_HAVING,
KW_HELP,
@ -133,7 +133,7 @@ KW_INTEGER,
KW_INTO,
KW_IS,
KW_JOIN,
KW_LABEL,
//KW_LABEL,
KW_LE,
KW_LEAVE,
KW_LEFT,
@ -143,13 +143,13 @@ KW_LINES,
KW_LIST,
KW_LONG,
KW_LT,
KW_L_BRACE,
//KW_L_BRACE,
KW_L_BRCKET,
KW_MATCHES,
KW_MATCHING_LANGUAGE,
KW_MAX,
KW_MEN,
KW_MENU,
//KW_MEN,
//KW_MENU,
KW_MIN,
KW_MINUS,
KW_MISSING,
@ -163,7 +163,7 @@ KW_NULL,
KW_NUMERIC,
KW_OF,
KW_ON,
KW_OPEN,
//KW_OPEN,
KW_OPTION,
KW_OR,
KW_ORDER,
@ -198,7 +198,7 @@ KW_RIGHT,
KW_RIGHT_PAREN,
KW_ROLLBACK,
KW_RUNNING,
KW_R_BRACE,
//KW_R_BRACE,
KW_R_BRCKET,
KW_SCALE,
KW_SECURITY_CLASS,
@ -228,16 +228,16 @@ KW_THEN,
KW_TO,
KW_TOP,
KW_TOTAL,
KW_TRIGGER,
//KW_TRIGGER,
KW_TRIGGERS,
KW_UNION,
//KW_UNION,
KW_UNIQUE,
KW_UPDATE,
KW_UPPERCASE,
//KW_UPPERCASE,
KW_USER,
KW_USER_NAME,
KW_USING,
KW_VALID,
//KW_VALID,
KW_VALUES,
KW_VARCHAR,
KW_VARIABLE,

View File

@ -47,17 +47,17 @@
{KW_BY, "BY"},
{KW_CHAR, "CHAR"},
{KW_CHAR, "CHARACTER"},
{KW_CHOICE, "CHOICE"},
{KW_CLOSE, "CLOSE"},
{KW_COLLECTION, "COLLECTION"},
{KW_COLLECTIONS, "COLLECTIONS"},
//{KW_CHOICE, "CHOICE"},
//{KW_CLOSE, "CLOSE"},
//{KW_COLLECTION, "COLLECTION"},
//{KW_COLLECTIONS, "COLLECTIONS"},
{KW_COLON, ":"},
{KW_COLUMN, "COL"},
{KW_COLUMNS, "COLUMNS"},
{KW_COLUMN_HEADER, "COLUMN_HEADER"},
{KW_COMMA, ","},
{KW_COMMIT, "COMMIT"},
{KW_COMPUTED, "COMPUTED"},
//{KW_COMPUTED, "COMPUTED"},
{KW_CONTAINING, "CONT"},
{KW_CONTAINING, "CONTAINING"},
{KW_CONTAINING, "CT"},
@ -66,7 +66,7 @@
{KW_COUNT, "COUNT"},
{KW_CREATE, "CREATE"},
{KW_CROSS, "CROSS"},
{KW_CURSOR, "CURSOR"},
//{KW_CURSOR, "CURSOR"},
{KW_DATABASE, "DATABASE"},
{KW_DATABASES, "DATABASES"},
{KW_DATE, "DATE"},
@ -88,22 +88,22 @@
{KW_EDIT_STRING, "EDIT_STRING"},
{KW_ELSE, "ELSE"},
{KW_END, "END"},
{KW_END_CHOICE, "END_CHOICE"},
{KW_END_FOR, "END_FOR"},
{KW_END_MODIFY, "END_MODIFY"},
//{KW_END_CHOICE, "END_CHOICE"},
//{KW_END_FOR, "END_FOR"},
//{KW_END_MODIFY, "END_MODIFY"},
{KW_END_PROCEDURE, "END_PROCEDURE"},
{KW_END_REPORT, "END_REPORT"},
{KW_END_STORE, "END_STORE"},
{KW_END_STREAM, "END_STREAM"},
{KW_ENTREE, "ENTREE"},
//{KW_END_STORE, "END_STORE"},
//{KW_END_STREAM, "END_STREAM"},
//{KW_ENTREE, "ENTREE"},
{KW_EQ, "=="},
{KW_EQ, "EQ"},
{KW_EQUALS, "="},
{KW_ERASE, "ERASE"},
{KW_ESCAPE, "ESCAPE"},
{KW_EUC_JUSTIFY, "EUC_JUSTIFY"},
//{KW_EUC_JUSTIFY, "EUC_JUSTIFY"},
{KW_EXACTCASE, "EXACTCASE"},
{KW_EXEC, "EXEC"},
//{KW_EXEC, "EXEC"},
{KW_EXISTS, "EXISTS"},
{KW_EXIT, "EXIT"},
#ifdef DEV_BUILD
@ -130,7 +130,7 @@
{KW_GLOBAL, "GLOBAL"},
{KW_GRANT, "GRANT"},
{KW_GROUP, "GROUP"},
{KW_GROUPED, "GROUPED"},
//{KW_GROUPED, "GROUPED"},
{KW_GT, ">"},
{KW_GT, "GT"},
{KW_HAVING, "HAVING"},
@ -151,7 +151,7 @@
{KW_INTO, "INTO"},
{KW_IS, "IS"},
{KW_JOIN, "JOIN"},
{KW_LABEL, "LABEL"},
//{KW_LABEL, "LABEL"},
{KW_LE, "<="},
{KW_LE, "LE"},
{KW_LE, "^>"},
@ -164,14 +164,14 @@
{KW_LONG, "LONG"},
{KW_LT, "<"},
{KW_LT, "LT"},
{KW_L_BRACE, "{"},
//{KW_L_BRACE, "{"},
{KW_L_BRCKET, "["},
{KW_MATCHES, "MATCHES"},
{KW_MATCHES, "MATCHING"},
{KW_MATCHING_LANGUAGE, "MATCHING_LANGUAGE"},
{KW_MAX, "MAX"},
{KW_MEN, "MANU"},
{KW_MENU, "MENU"},
//{KW_MEN, "MANU"},
//{KW_MENU, "MENU"},
{KW_MIN, "MIN"},
{KW_MINUS, "-"},
{KW_MISSING, "MISSING"},
@ -189,7 +189,7 @@
{KW_NUMERIC, "NUMERIC"},
{KW_OF, "OF"},
{KW_ON, "ON"},
{KW_OPEN, "OPEN"},
//{KW_OPEN, "OPEN"},
{KW_OPTION, "OPTION"},
{KW_OR, "OR"},
{KW_OR, "||"},
@ -226,7 +226,7 @@
{KW_RIGHT_PAREN, ")"},
{KW_ROLLBACK, "ROLLBACK"},
{KW_RUNNING, "RUNNING"},
{KW_R_BRACE, "}"},
//{KW_R_BRACE, "}"},
{KW_R_BRCKET, "]"},
{KW_SCALE, "SCALE"},
{KW_SECURITY_CLASS, "SECURITY_CLASS"},
@ -263,16 +263,16 @@
{KW_TOP, "TOP"},
{KW_TOTAL, "SUM"},
{KW_TOTAL, "TOTAL"},
{KW_TRIGGER, "TRIGGER"},
//{KW_TRIGGER, "TRIGGER"},
{KW_TRIGGERS, "TRIGGERS"},
{KW_UNION, "UNION"},
//{KW_UNION, "UNION"},
{KW_UNIQUE, "UNIQUE"},
{KW_UPDATE, "UPDATE"},
{KW_UPPERCASE, "UPPERCASE"},
//{KW_UPPERCASE, "UPPERCASE"},
{KW_USER, "USER"},
{KW_USER_NAME, "RDB$USER_NAME"},
{KW_USING, "USING"},
{KW_VALID, "VALID"},
//{KW_VALID, "VALID"},
{KW_VALUES, "VALUES"},
{KW_VARCHAR, "VARCHAR"},
{KW_VARIABLE, "VARIABLE"},