8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 04:43:03 +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; UCHAR pool_id = block->frb_header.blk_pool_id;
PLB pool; PLB pool;
if (pool_id >= global_pools->vec_count || if (pool_id >= global_pools->vec_count || !(pool = (PLB) global_pools->vec_object[pool_id]))
!(pool = (PLB) global_pools->vec_object[pool_id]))
{ {
ERRQ_bugcheck(4); ERRQ_bugcheck(4);
// Msg4 bad pool id // Msg4 bad pool id
@ -412,8 +411,7 @@ void ALLQ_release( FRB block)
FRB prior = NULL; FRB prior = NULL;
FRB free; FRB free;
FRB* ptr; FRB* ptr;
for (ptr = &pool->plb_free; free = *ptr; for (ptr = &pool->plb_free; free = *ptr; prior = free, ptr = &free->frb_next)
prior = free, ptr = &free->frb_next)
{ {
if ((SCHAR *) block <= (SCHAR *) free) if ((SCHAR *) block <= (SCHAR *) free)
break; break;
@ -489,8 +487,7 @@ static void extend_pool( PLB pool, USHORT count)
* of given size. * of given size.
* *
**************************************/ **************************************/
const SLONG size = const SLONG size = (count + sizeof(hnk) + MIN_ALLOCATION - 1) & ~(MIN_ALLOCATION - 1);
(count + sizeof(hnk) + MIN_ALLOCATION - 1) & ~(MIN_ALLOCATION - 1);
if ((USHORT) size < count) if ((USHORT) size < count)
IBERROR(481); // msg 481 unsuccessful attempt to extend pool beyond 64KB IBERROR(481); // msg 481 unsuccessful attempt to extend pool beyond 64KB

View File

@ -24,7 +24,7 @@
#ifndef QLI_COMMA_PROTO_H #ifndef QLI_COMMA_PROTO_H
#define 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_copy_procedure(qli_syntax*);
void CMD_define_procedure(qli_syntax*); void CMD_define_procedure(qli_syntax*);
void CMD_delete_proc(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 old_proc = (QPR) node->syn_arg[0];
QPR new_proc = (QPR) node->syn_arg[1]; QPR new_proc = (QPR) node->syn_arg[1];
PRO_copy_procedure(old_proc->qpr_database, PRO_copy_procedure(old_proc->qpr_database, old_proc->qpr_name->nam_string,
old_proc->qpr_name->nam_string, new_proc->qpr_database, new_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]; qli_syntax* list = node->syn_arg[0];
if (list) { if (list) {
qli_syntax** ptr = list->syn_arg; qli_syntax** ptr = list->syn_arg;
for (const qli_syntax* const* const end = ptr + list->syn_count; for (const qli_syntax* const* const end = ptr + list->syn_count; ptr < end; ptr++)
ptr < end; ptr++)
{ {
QPR proc = (QPR) *ptr; QPR proc = (QPR) *ptr;
DBB database = proc->qpr_database; DBB database = proc->qpr_database;
@ -196,8 +193,7 @@ void CMD_extract( qli_syntax* node)
database->dbb_symbol->sym_string); database->dbb_symbol->sym_string);
continue; continue;
} }
dump_procedure(database, file, name->nam_string, name->nam_length, dump_procedure(database, file, name->nam_string, name->nam_length, blob);
blob);
} }
} }
else { else {
@ -265,8 +261,7 @@ void CMD_rename_proc( qli_syntax* node)
NAM old_name = old_proc->qpr_name; NAM old_name = old_proc->qpr_name;
NAM new_name = new_proc->qpr_name; NAM new_name = new_proc->qpr_name;
if (PRO_rename_procedure if (PRO_rename_procedure(database, old_name->nam_string, new_name->nam_string))
(database, old_name->nam_string, new_name->nam_string))
{ {
return; return;
} }
@ -322,15 +317,13 @@ void CMD_set( qli_syntax* node)
QLI_echo = (bool)(IPTR) value; QLI_echo = (bool)(IPTR) value;
break; break;
case set_form: //case set_form:
IBERROR(484); // FORMs not supported // IBERROR(484); // FORMs not supported
break; // break;
case set_password: case set_password:
string = (qli_const*) value; string = (qli_const*) value;
length = length = MIN(string->con_desc.dsc_length, sizeof(QLI_default_password));
MIN(string->con_desc.dsc_length,
sizeof(QLI_default_password));
strncpy(QLI_default_password, (char*) string->con_data, length); strncpy(QLI_default_password, (char*) string->con_data, length);
QLI_default_password[length] = 0; QLI_default_password[length] = 0;
break; break;
@ -339,8 +332,7 @@ void CMD_set( qli_syntax* node)
string = (qli_const*) value; string = (qli_const*) value;
if (string->con_desc.dsc_length > sizeof(QLI_prompt_string)) if (string->con_desc.dsc_length > sizeof(QLI_prompt_string))
ERRQ_error(86); // Msg86 substitute prompt string too long ERRQ_error(86); // Msg86 substitute prompt string too long
strncpy(QLI_prompt_string, (char*) string->con_data, strncpy(QLI_prompt_string, (char*) string->con_data, string->con_desc.dsc_length);
string->con_desc.dsc_length);
QLI_prompt_string[string->con_desc.dsc_length] = 0; QLI_prompt_string[string->con_desc.dsc_length] = 0;
break; break;
@ -348,8 +340,7 @@ void CMD_set( qli_syntax* node)
string = (qli_const*) value; string = (qli_const*) value;
if (string->con_desc.dsc_length > sizeof(QLI_cont_string)) if (string->con_desc.dsc_length > sizeof(QLI_cont_string))
ERRQ_error(87); // Msg87 substitute prompt string too long ERRQ_error(87); // Msg87 substitute prompt string too long
strncpy(QLI_cont_string, (char*) string->con_data, strncpy(QLI_cont_string, (char*) string->con_data, string->con_desc.dsc_length);
string->con_desc.dsc_length);
QLI_cont_string[string->con_desc.dsc_length] = 0; QLI_cont_string[string->con_desc.dsc_length] = 0;
break; break;
@ -360,21 +351,17 @@ void CMD_set( qli_syntax* node)
QLI_matching_language = NULL; QLI_matching_language = NULL;
break; break;
} }
QLI_matching_language = QLI_matching_language = (qli_const*) ALLOCPV(type_con, string->con_desc.dsc_length);
(qli_const*) ALLOCPV(type_con, string->con_desc.dsc_length);
strncpy((char*)QLI_matching_language->con_data, (char*)string->con_data, strncpy((char*)QLI_matching_language->con_data, (char*)string->con_data,
string->con_desc.dsc_length); string->con_desc.dsc_length);
QLI_matching_language->con_desc.dsc_dtype = dtype_text; QLI_matching_language->con_desc.dsc_dtype = dtype_text;
QLI_matching_language->con_desc.dsc_address = QLI_matching_language->con_desc.dsc_address = QLI_matching_language->con_data;
QLI_matching_language->con_data; QLI_matching_language->con_desc.dsc_length = string->con_desc.dsc_length;
QLI_matching_language->con_desc.dsc_length =
string->con_desc.dsc_length;
break; break;
case set_user: case set_user:
string = (qli_const*) value; string = (qli_const*) value;
length = length = MIN(string->con_desc.dsc_length, sizeof(QLI_default_user));
MIN(string->con_desc.dsc_length, sizeof(QLI_default_user));
strncpy(QLI_default_user, (char*)string->con_data, length); strncpy(QLI_default_user, (char*)string->con_data, length);
QLI_default_user[length] = 0; QLI_default_user[length] = 0;
break; break;
@ -477,8 +464,7 @@ void CMD_transaction( qli_syntax* node)
if (node->syn_type == nod_commit) if (node->syn_type == nod_commit)
{ {
if ((node->syn_count > 1) || if ((node->syn_count > 1) || (node->syn_count == 0 && QLI_databases->dbb_next))
(node->syn_count == 0 && QLI_databases->dbb_next))
{ {
node->syn_type = nod_prepare; node->syn_type = nod_prepare;
CMD_transaction(node); 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) for (DBB db_iter = QLI_databases; db_iter; db_iter = db_iter->dbb_next)
{ {
if ((node->syn_type == nod_commit) if ((node->syn_type == nod_commit) && !(db_iter->dbb_flags & DBB_prepared))
&& !(db_iter->dbb_flags & DBB_prepared))
{ {
ERRQ_msg_put(465, db_iter->dbb_symbol->sym_string); 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; qli_syntax** ptr = node->syn_arg;
for (const qli_syntax* const* const end = ptr + node->syn_count; for (const qli_syntax* const* const end = ptr + node->syn_count; ptr < end; ptr++)
ptr < end; ptr++)
{ {
DBB database = (DBB) *ptr; DBB database = (DBB) *ptr;
if ((node->syn_type == nod_commit) && if ((node->syn_type == nod_commit) && !(database->dbb_flags & DBB_prepared))
!(database->dbb_flags & DBB_prepared))
{ {
ERRQ_msg_put(465, database->dbb_symbol->sym_string); 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) { switch (node1->nod_type) {
case nod_field: case nod_field:
if (node1->nod_arg[e_fld_field] != node2->nod_arg[e_fld_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] ||
|| node1->nod_arg[e_fld_subs] != node2->nod_arg[e_fld_subs]) node1->nod_arg[e_fld_subs] != node2->nod_arg[e_fld_subs])
{ {
return false; 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_min:
case nod_agg_total: case nod_agg_total:
case nod_agg_count: case nod_agg_count:
return CMP_node_match(node1->nod_arg[e_stt_value], return CMP_node_match(node1->nod_arg[e_stt_value], node2->nod_arg[e_stt_value]);
node2->nod_arg[e_stt_value]);
case nod_function: case nod_function:
if (node1->nod_arg[e_fun_function] != node1->nod_arg[e_fun_function]) if (node1->nod_arg[e_fun_function] != node1->nod_arg[e_fun_function])
return false; return false;
return CMP_node_match(node1->nod_arg[e_fun_args], return CMP_node_match(node1->nod_arg[e_fun_args], node2->nod_arg[e_fun_args]);
node2->nod_arg[e_fun_args]);
} }
const qli_nod* const* ptr1 = node1->nod_arg; const qli_nod* const* ptr1 = node1->nod_arg;
const qli_nod* const* ptr2 = node2->nod_arg; const qli_nod* const* ptr2 = node2->nod_arg;
for (const qli_nod* const* const end = ptr1 + node1->nod_count; ptr1 < end; for (const qli_nod* const* const end = ptr1 + node1->nod_count; ptr1 < end; ++ptr1, ++ptr2)
++ptr1, ++ptr2)
{ {
if (!CMP_node_match(*ptr1, *ptr2)) if (!CMP_node_match(*ptr1, *ptr2))
return false; 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); qli_nod* target = compile_expression(to, request, target_internal);
node->nod_arg[e_asn_to] = target; node->nod_arg[e_asn_to] = target;
node->nod_arg[e_asn_from] = node->nod_arg[e_asn_from] = compile_expression(from, request, statement_internal);
compile_expression(from, request, statement_internal);
qli_nod* initial = node->nod_arg[e_asn_initial]; qli_nod* initial = node->nod_arg[e_asn_initial];
if (initial) if (initial)
node->nod_arg[e_asn_initial] = node->nod_arg[e_asn_initial] = compile_expression(initial, request, false);
compile_expression(initial, request, false);
if (statement_internal) { if (statement_internal) {
node->nod_arg[e_asn_valid] = NULL; // Memory reclaimed in the main loop 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]; qli_ctx* context = (qli_ctx*) target->nod_arg[e_fld_context];
request = context->ctx_request; request = context->ctx_request;
} }
target->nod_arg[e_fld_reference] = target->nod_arg[e_fld_reference] = make_reference(target, request->req_send);
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) { for (; control; control = control->brk_next) {
report_control_break = control; report_control_break = control;
if (control->brk_field) 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;; qli_nod* temp = (qli_nod*) control->brk_field;;
temp->nod_flags |= NOD_parameter2; temp->nod_flags |= NOD_parameter2;
temp = compile_expression((qli_nod*) control->brk_field, request, false); 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; node->nod_count = 0;
if (value = node->nod_arg[e_stt_value]) { if (value = node->nod_arg[e_stt_value]) {
value->nod_flags |= NOD_parameter2; value->nod_flags |= NOD_parameter2;
node->nod_arg[e_stt_value] = node->nod_arg[e_stt_value] = compile_expression(value, request, false);
compile_expression(value, request, false);
} }
make_descriptor(node, &node->nod_desc); make_descriptor(node, &node->nod_desc);
if (internal_flag) { if (internal_flag) {
@ -523,8 +514,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
else { else {
CMP_alloc_temp(node); CMP_alloc_temp(node);
if (request && value && computable(value, request)) if (request && value && computable(value, request))
node->nod_arg[e_stt_value] = node->nod_arg[e_stt_value] = make_reference(value, request->req_receive);
make_reference(value, request->req_receive);
} }
return node; return node;
@ -536,8 +526,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
node->nod_count = 0; node->nod_count = 0;
if (value = node->nod_arg[e_stt_value]) { if (value = node->nod_arg[e_stt_value]) {
value->nod_flags |= NOD_parameter2; value->nod_flags |= NOD_parameter2;
node->nod_arg[e_stt_value] = node->nod_arg[e_stt_value] = compile_expression(value, request, true);
compile_expression(value, request, true);
} }
make_descriptor(node, &node->nod_desc); make_descriptor(node, &node->nod_desc);
if (!internal_flag && request) if (!internal_flag && request)
@ -546,8 +535,7 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
case nod_map: case nod_map:
map = (qli_map*) node->nod_arg[e_map_map]; map = (qli_map*) node->nod_arg[e_map_map];
map->map_node = value = map->map_node = value = compile_expression(map->map_node, request, true);
compile_expression(map->map_node, request, true);
make_descriptor(value, &node->nod_desc); make_descriptor(value, &node->nod_desc);
if (!internal_flag && request) if (!internal_flag && request)
return make_reference(node, request->req_receive); 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_and:
case nod_or: case nod_or:
case nod_not: case nod_not:
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
ptr++)
{ {
(*ptr)->nod_flags |= NOD_parameter2; (*ptr)->nod_flags |= NOD_parameter2;
*ptr = compile_expression(*ptr, request, internal_flag); *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_concatenate:
case nod_substr: case nod_substr:
case nod_user_name: case nod_user_name:
if (!internal_flag && request && request->req_receive && if (!internal_flag && request && request->req_receive && computable(node, request))
computable(node, request))
{ {
compile_expression(node, request, true); compile_expression(node, request, true);
return make_reference(node, request->req_receive); return make_reference(node, request->req_receive);
} }
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
ptr++)
{ {
(*ptr)->nod_flags |= NOD_parameter2; (*ptr)->nod_flags |= NOD_parameter2;
*ptr = compile_expression(*ptr, request, internal_flag); *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: case nod_format:
value = node->nod_arg[e_fmt_value]; value = node->nod_arg[e_fmt_value];
node->nod_arg[e_fmt_value] = node->nod_arg[e_fmt_value] = compile_expression(value, request, false);
compile_expression(value, request, false);
node->nod_desc.dsc_length = FMT_expression(node); node->nod_desc.dsc_length = FMT_expression(node);
node->nod_desc.dsc_dtype = dtype_text; node->nod_desc.dsc_dtype = dtype_text;
CMP_alloc_temp(node); 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 /* If nothing is required for sub-statement, and no data is required in
either direction, we don't need to execute the statement. */ either direction, we don't need to execute the statement. */
if (!compile_statement if (!compile_statement(node->nod_arg[e_for_statement], request, internal_flag) &&
(node->nod_arg[e_for_statement], request, internal_flag) !receive->msg_parameters)
&& !receive->msg_parameters)
{ {
release_message(receive); release_message(receive);
receive = NULL; receive = NULL;
@ -859,8 +842,7 @@ static qli_nod* compile_function( qli_nod* node, qli_req* old_request,
qli_par* parameter = 0; qli_par* parameter = 0;
if (!internal_flag) { if (!internal_flag) {
node->nod_import = parameter = node->nod_import = parameter = make_parameter(request->req_receive, 0);
make_parameter(request->req_receive, 0);
make_descriptor(node, &parameter->par_desc); 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, static qli_nod* compile_modify( qli_nod* node, qli_req* org_request, bool internal_flag)
bool internal_flag)
{ {
/************************************** /**************************************
* *
@ -994,9 +975,9 @@ static qli_nod* compile_modify( qli_nod* node, qli_req* org_request,
if (internal_flag) if (internal_flag)
internal_flag = computable(node->nod_arg[e_mod_statement], request); internal_flag = computable(node->nod_arg[e_mod_statement], request);
if (!compile_statement if (!compile_statement(node->nod_arg[e_mod_statement], request, internal_flag) &&
(node->nod_arg[e_mod_statement], request, internal_flag) (send != old_send) && !send->msg_parameters)
&& (send != old_send) && !send->msg_parameters) { {
node->nod_flags |= NOD_remote; node->nod_flags |= NOD_remote;
release_message(send); release_message(send);
send = NULL; send = NULL;
@ -1237,10 +1218,11 @@ static qli_req* compile_rse(
for (; ctx_ptr < ctx_end; ctx_ptr++) { for (; ctx_ptr < ctx_end; ctx_ptr++) {
qli_ctx* context = *ctx_ptr; qli_ctx* context = *ctx_ptr;
if (context->ctx_stream) { if (context->ctx_stream) {
if (request = if (request = compile_rse(context->ctx_stream, old_request, internal_flag,
compile_rse(context->ctx_stream, old_request, internal_flag, send, receive, database))
send, receive, database)) {
old_request = request; old_request = request;
}
} }
else { else {
qli_rel* relation = context->ctx_relation; qli_rel* relation = context->ctx_relation;
@ -1257,8 +1239,7 @@ static qli_req* compile_rse(
request = old_request; request = old_request;
if (send) { if (send) {
if (old_request && request == old_request && if (old_request && request == old_request && !(old_request->req_flags & REQ_rse_compiled))
!(old_request->req_flags & REQ_rse_compiled))
*send = request->req_send; *send = request->req_send;
else else
request->req_send = *send = make_message(request); request->req_send = *send = make_message(request);
@ -1279,22 +1260,19 @@ static qli_req* compile_rse(
const qli_nod* const* end; const qli_nod* const* end;
qli_nod* list; qli_nod* list;
if (list = node->nod_arg[e_rse_sort]) if (list = node->nod_arg[e_rse_sort])
for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end; for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end; ptr += 2)
ptr += 2)
{ {
compile_expression(*ptr, request, true); compile_expression(*ptr, request, true);
} }
if (list = node->nod_arg[e_rse_reduced]) if (list = node->nod_arg[e_rse_reduced])
for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end; for (ptr = list->nod_arg, end = ptr + list->nod_count * 2; ptr < end; ptr += 2)
ptr += 2)
{ {
compile_expression(*ptr, request, true); compile_expression(*ptr, request, true);
} }
if (list = node->nod_arg[e_rse_group_by]) if (list = node->nod_arg[e_rse_group_by])
for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; for (ptr = list->nod_arg, end = ptr + list->nod_count; ptr < end; ptr++)
ptr++)
{ {
compile_expression(*ptr, request, true); 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* result = NULL;
qli_nod** ptr = node->nod_arg; qli_nod** ptr = node->nod_arg;
for (const qli_nod* const* const end = ptr + node->nod_count; for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++)
ptr < end; ptr++)
{ {
if (compile_statement(*ptr, request, internal_flag)) if (compile_statement(*ptr, request, internal_flag))
result = node; result = node;
@ -1505,9 +1482,8 @@ static qli_nod* compile_store( qli_nod* node, qli_req* request, bool internal_fl
if (internal_flag) if (internal_flag)
internal_flag = computable(node->nod_arg[e_sto_statement], request); internal_flag = computable(node->nod_arg[e_sto_statement], request);
if (!compile_statement if (!compile_statement(node->nod_arg[e_sto_statement], request, internal_flag) &&
(node->nod_arg[e_sto_statement], request, internal_flag) !send->msg_parameters)
&& !send->msg_parameters)
{ {
node->nod_flags |= NOD_remote; node->nod_flags |= NOD_remote;
release_message(send); release_message(send);
@ -1559,8 +1535,7 @@ static bool computable( qli_nod* node, qli_req* request)
return false; return false;
if ((sub = node->nod_arg[e_rse_first]) && !computable(sub, request)) if ((sub = node->nod_arg[e_rse_first]) && !computable(sub, request))
return false; return false;
for (ptr = node->nod_arg + e_rse_count, end = ptr + node->nod_count; for (ptr = node->nod_arg + e_rse_count, end = ptr + node->nod_count; ptr < end; ptr++)
ptr < end; ptr++)
{ {
context = (qli_ctx*) * ptr; context = (qli_ctx*) * ptr;
if (context->ctx_stream) { if (context->ctx_stream) {
@ -1578,8 +1553,7 @@ static bool computable( qli_nod* node, qli_req* request)
case nod_field: case nod_field:
if (sub = node->nod_arg[e_fld_subs]) if (sub = node->nod_arg[e_fld_subs])
for (ptr = sub->nod_arg, end = ptr + sub->nod_count; ptr < end; for (ptr = sub->nod_arg, end = ptr + sub->nod_count; ptr < end; ptr++)
ptr++)
{ {
if (*ptr && !computable(*ptr, request)) if (*ptr && !computable(*ptr, request))
return false; return false;
@ -2079,8 +2053,10 @@ static void release_message( qli_msg* message)
qli_msg** ptr; qli_msg** ptr;
for (ptr = &request->req_messages; *ptr; ptr = &(*ptr)->msg_next) for (ptr = &request->req_messages; *ptr; ptr = &(*ptr)->msg_next)
{
if (*ptr == message) if (*ptr == message)
break; break;
}
if (!*ptr) if (!*ptr)
ERRQ_bugcheck(364); // Msg 364 lost message ERRQ_bugcheck(364); // Msg 364 lost message

View File

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

View File

@ -63,7 +63,7 @@ const char* STARTUP_FILE = "HOME"; // Assume its Unix
extern TEXT *QLI_prompt; extern TEXT *QLI_prompt;
static void enable_signals(void); static void enable_signals();
static bool process_statement(bool); static bool process_statement(bool);
static void CLIB_ROUTINE signal_arith_excp(USHORT, USHORT, USHORT); static void CLIB_ROUTINE signal_arith_excp(USHORT, USHORT, USHORT);
static int async_quit(const int, const int, void*); 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) if (QLI_statistics)
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
if (dbb->dbb_flags & DBB_active) { if (dbb->dbb_flags & DBB_active)
if (!dbb->dbb_statistics) { {
dbb->dbb_statistics = if (!dbb->dbb_statistics)
(int *) gds__alloc((SLONG) sizeof(PERF)); {
dbb->dbb_statistics = (int *) gds__alloc((SLONG) sizeof(PERF));
#ifdef DEBUG_GDS_ALLOC #ifdef DEBUG_GDS_ALLOC
// We don't care about QLI specific memory leaks for V4.0 // We don't care about QLI specific memory leaks for V4.0
gds_alloc_flag_unfreed((void *) dbb->dbb_statistics); // QLI: don't care 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); ERRQ_msg_get(506, report + used_len, sizeof(report) - used_len);
// Msg506 " elapsed = !e cpu = !u system = !s mem = !x, buffers = !b" // Msg506 " elapsed = !e cpu = !u system = !s mem = !x, buffers = !b"
perf_get_info(&dbb->dbb_handle, &statistics); perf_get_info(&dbb->dbb_handle, &statistics);
perf_format((perf*) dbb->dbb_statistics, &statistics, perf_format((perf*) dbb->dbb_statistics, &statistics, report, buffer, 0);
report, buffer, 0);
ERRQ_msg_put(26, SafeArg() << dbb->dbb_filename << buffer); // Msg26 Statistics for database %s %s ERRQ_msg_put(26, SafeArg() << dbb->dbb_filename << buffer); // Msg26 Statistics for database %s %s
QLI_skip_line = true; QLI_skip_line = true;
} }
@ -618,8 +618,7 @@ static bool yes_no(USHORT number, const TEXT* arg1)
buffer[0] = 0; buffer[0] = 0;
if (!LEX_get_line(prompt, buffer, sizeof(buffer))) if (!LEX_get_line(prompt, buffer, sizeof(buffer)))
return true; return true;
for (const answer_t* response = answer_table; *response->answer != '\0'; for (const answer_t* response = answer_table; *response->answer != '\0'; response++)
response++)
{ {
const TEXT* p = buffer; const TEXT* p = buffer;
while (*p == ' ') while (*p == ' ')

View File

@ -300,7 +300,7 @@ typedef struct dbb {
FB_API_HANDLE dbb_edit_blob; FB_API_HANDLE dbb_edit_blob;
FB_API_HANDLE dbb_edit_store; FB_API_HANDLE dbb_edit_store;
FB_API_HANDLE dbb_scan_blobs; FB_API_HANDLE dbb_scan_blobs;
FB_API_HANDLE dbb_delete_blob; //FB_API_HANDLE dbb_delete_blob; // Unused
USHORT dbb_flags; USHORT dbb_flags;
USHORT dbb_type; /* Friend or foe? */ USHORT dbb_type; /* Friend or foe? */
USHORT dbb_pagesize; // For SQL metadata 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_idx_inactive = 16; // Firebird index inactive flag
const ULONG DBB_cap_multi_trans = 32; // Database supports multiple transactions 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_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_functions = 256; // The DBMS knows about function
const ULONG DBB_cap_new_triggers = 512; // triggers (new V3 style) const ULONG DBB_cap_new_triggers = 512; // triggers (new V3 style)
const ULONG DBB_cap_shadowing = 1024; // Database supports shadowing const ULONG DBB_cap_shadowing = 1024; // Database supports shadowing
const ULONG DBB_cap_types = 2048; // Database has RDB$TYPES relation 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_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_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_filters = 32768; // Database supports filters
const ULONG DBB_cap_index_type = 65536; // Database has too damn much stuff 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 USHORT fld_segment_length; // Segment length for blobs
SSHORT fld_scale; // Scale factor of field SSHORT fld_scale; // Scale factor of field
qli_syntax* fld_validation; // Validation expression 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 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; // Subtype for blobs, text and EXACT_NUMERICs.
SSHORT fld_sub_type_missing; // Subtype missing flag 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_missing = 8;
const USHORT FLD_not_null = 16; const USHORT FLD_not_null = 16;
const USHORT FLD_add = 32; const USHORT FLD_add = 32;
const USHORT FLD_unique = 64; //const USHORT FLD_unique = 64; Unused
const USHORT FLD_array = 128; const USHORT FLD_array = 128;
// Privileges for SQL metadata // Privileges for SQL metadata
@ -413,7 +413,7 @@ struct qli_lls {
struct qli_str { struct qli_str {
blk str_header; blk str_header;
USHORT str_length; USHORT str_length;
USHORT str_fluff; USHORT str_fluff; // ??? Not used, maybe alignment?
TEXT str_data[2]; TEXT str_data[2];
}; };
@ -450,7 +450,7 @@ typedef struct plb {
// State flags for dsc_missing // State flags for dsc_missing
const USHORT DSC_missing = 1; const USHORT DSC_missing = 1;
const USHORT DSC_initial = 2; const USHORT DSC_initial = 2; // Nobody sets this value, at least directly
// Function description // Function description
@ -461,7 +461,7 @@ struct qli_fun {
qli_symbol* fun_symbol; // Associated symbol block qli_symbol* fun_symbol; // Associated symbol block
qli_symbol* fun_query_name; qli_symbol* fun_query_name;
dsc fun_return; // Return descriptor 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 dsc fun_arg[1]; /* Data type of arguments
If you change this change blk.h too */ 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, void ERRQ_error(USHORT number, const SafeArg& arg)
const SafeArg& arg)
{ {
/************************************** /**************************************
* *
@ -122,8 +121,7 @@ void ERRQ_error(USHORT number,
*/ */
} }
void ERRQ_error(USHORT number, void ERRQ_error(USHORT number, const char* str)
const char* str)
{ {
/************************************** /**************************************
* *
@ -142,8 +140,7 @@ void ERRQ_error(USHORT number,
} }
void ERRQ_error_format(USHORT number, void ERRQ_error_format(USHORT number, const SafeArg& arg)
const SafeArg& arg)
{ {
/************************************** /**************************************
* *
@ -185,10 +182,7 @@ void ERRQ_exit( int status)
} }
void ERRQ_msg_format(USHORT number, void ERRQ_msg_format(USHORT number, USHORT length, TEXT* output_string, const SafeArg& arg)
USHORT length,
TEXT* output_string,
const SafeArg& arg)
{ {
/************************************** /**************************************
* *
@ -205,9 +199,7 @@ void ERRQ_msg_format(USHORT number,
} }
void ERRQ_msg_partial( void ERRQ_msg_partial(USHORT number, const SafeArg& arg)
USHORT number,
const SafeArg& arg)
{ {
/************************************** /**************************************
* *
@ -220,14 +212,12 @@ void ERRQ_msg_partial(
* *
**************************************/ **************************************/
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, arg);
ERRQ_message, arg);
printf("%s", ERRQ_message); printf("%s", ERRQ_message);
} }
void ERRQ_msg_put(USHORT number, void ERRQ_msg_put(USHORT number, const SafeArg& arg)
const SafeArg& arg)
{ {
/************************************** /**************************************
* *
@ -241,14 +231,12 @@ void ERRQ_msg_put(USHORT number,
* *
**************************************/ **************************************/
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, arg);
ERRQ_message, arg);
printf("%s\n", ERRQ_message); printf("%s\n", ERRQ_message);
} }
void ERRQ_msg_put(USHORT number, void ERRQ_msg_put(USHORT number, const char* str)
const char* str)
{ {
/************************************** /**************************************
* *
@ -262,8 +250,7 @@ void ERRQ_msg_put(USHORT number,
* *
**************************************/ **************************************/
fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), fb_msg_format(0, QLI_MSG_FAC, number, sizeof(ERRQ_message), ERRQ_message, SafeArg() << str);
ERRQ_message, SafeArg() << str);
printf("%s\n", ERRQ_message); 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, void ERRQ_print_error(USHORT number, const SafeArg& arg)
const SafeArg& arg)
{ {
/************************************** /**************************************
* *
@ -326,8 +312,7 @@ void ERRQ_print_error(USHORT number,
} }
void ERRQ_print_error(USHORT number, void ERRQ_print_error(USHORT number, const char* str)
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(USHORT, const char* str);
void ERRQ_error_format(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg()); void ERRQ_error_format(USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_exit (int); void ERRQ_exit (int);
void ERRQ_msg_format(USHORT, USHORT, TEXT*, void ERRQ_msg_format(USHORT, USHORT, TEXT*, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
int ERRQ_msg_get(USHORT, TEXT*, size_t s_size); int ERRQ_msg_get(USHORT, TEXT*, size_t s_size);
void ERRQ_msg_partial (USHORT, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg()); 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, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_msg_put(USHORT number, const char* str); 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, const MsgFormat::SafeArg& arg = MsgFormat::SafeArg());
void ERRQ_print_error(USHORT number, const char* str); void ERRQ_print_error(USHORT number, const char* str);
void ERRQ_syntax (USHORT); 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 TEXT* make_blob_buffer(FB_API_HANDLE, USHORT *);
static bool matches(const TEXT*, SSHORT, const TEXT*, SSHORT); static bool matches(const TEXT*, SSHORT, const TEXT*, SSHORT);
static bool sleuth(qli_nod*, const dsc*, const dsc*, const dsc*); static bool sleuth(qli_nod*, const dsc*, const dsc*, const dsc*);
static bool sleuth_check(USHORT, const UCHAR*, const UCHAR* const, static bool sleuth_check(USHORT, const UCHAR*, const UCHAR* const, const UCHAR*,
const UCHAR*, const UCHAR* const); const UCHAR* const);
static bool sleuth_class(const USHORT, const UCHAR*, const UCHAR* const, UCHAR); static bool sleuth_class(const USHORT, const UCHAR*, const UCHAR* const, UCHAR);
static int sleuth_merge(const UCHAR*, const UCHAR* const , const UCHAR*, static int sleuth_merge(const UCHAR*, const UCHAR* const , const UCHAR*, const UCHAR* const,
const UCHAR* const, UCHAR* const); UCHAR* const);
static bool string_boolean(qli_nod*); static bool string_boolean(qli_nod*);
static bool string_function(qli_nod*, SSHORT, const TEXT*, SSHORT, const TEXT*); 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_leq:
case nod_lss: case nod_lss:
case nod_between: case nod_between:
if (!(value1 = EVAL_value(node->nod_arg[0])) || if (!(value1 = EVAL_value(node->nod_arg[0])) || (value1->dsc_missing & DSC_missing) ||
(value1->dsc_missing & DSC_missing) || !(value2 = EVAL_value(node->nod_arg[1])) || (value2->dsc_missing & DSC_missing))
!(value2 = EVAL_value(node->nod_arg[1])) ||
(value2->dsc_missing & DSC_missing))
{ {
return false; return false;
} }
@ -147,8 +145,7 @@ int EVAL_boolean( qli_nod* node)
case nod_between: case nod_between:
if (result < 0) if (result < 0)
return false; return false;
if (!(value2 = EVAL_value(node->nod_arg[2])) || if (!(value2 = EVAL_value(node->nod_arg[2])) || (value2->dsc_missing & DSC_missing))
(value2->dsc_missing & DSC_missing))
{ {
return false; return false;
} }
@ -281,8 +278,7 @@ void EVAL_break_increment( qli_nod* node)
case nod_rpt_total: case nod_rpt_total:
case nod_rpt_average: case nod_rpt_average:
if (desc1->dsc_dtype == dtype_long) if (desc1->dsc_dtype == dtype_long)
*(SLONG *) desc1->dsc_address += *(SLONG *) desc1->dsc_address += MOVQ_get_long(desc2, desc1->dsc_scale);
MOVQ_get_long(desc2, desc1->dsc_scale);
else else
*(double *) desc1->dsc_address += MOVQ_get_double(desc2); *(double *) desc1->dsc_address += MOVQ_get_double(desc2);
break; break;
@ -330,8 +326,7 @@ dsc* EVAL_parameter(qli_par* parameter)
qli_msg* message = parameter->par_message; qli_msg* message = parameter->par_message;
if (missing_parameter = parameter->par_missing) { if (missing_parameter = parameter->par_missing) {
const USHORT* missing_flag = const USHORT* missing_flag = (USHORT*) (message->msg_buffer + missing_parameter->par_offset);
(USHORT*) (message->msg_buffer + missing_parameter->par_offset);
desc->dsc_missing = (*missing_flag) ? DSC_missing : 0; desc->dsc_missing = (*missing_flag) ? DSC_missing : 0;
} }
@ -386,8 +381,7 @@ dsc* EVAL_value(qli_nod* node)
case nod_variable: case nod_variable:
{ {
qli_fld* field = (qli_fld*) node->nod_arg[e_fld_field]; qli_fld* field = (qli_fld*) node->nod_arg[e_fld_field];
desc->dsc_missing = desc->dsc_missing = (field->fld_flags & FLD_missing) ? DSC_missing : 0;
(field->fld_flags & FLD_missing) ? DSC_missing : 0;
} }
return desc; return desc;
@ -401,8 +395,7 @@ dsc* EVAL_value(qli_nod* node)
return desc; return desc;
case nod_add: case nod_add:
if ((values[0]->dsc_missing & DSC_missing) || if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
(values[1]->dsc_missing & DSC_missing))
{ {
desc->dsc_missing = DSC_missing; desc->dsc_missing = DSC_missing;
return desc; return desc;
@ -422,8 +415,7 @@ dsc* EVAL_value(qli_nod* node)
return desc; return desc;
case nod_subtract: case nod_subtract:
if ((values[0]->dsc_missing & DSC_missing) || if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
(values[1]->dsc_missing & DSC_missing))
{ {
desc->dsc_missing = DSC_missing; desc->dsc_missing = DSC_missing;
return desc; return desc;
@ -444,8 +436,7 @@ dsc* EVAL_value(qli_nod* node)
return desc; return desc;
case nod_divide: case nod_divide:
if ((values[0]->dsc_missing & DSC_missing) || if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
(values[1]->dsc_missing & DSC_missing))
{ {
desc->dsc_missing = DSC_missing; desc->dsc_missing = DSC_missing;
return desc; return desc;
@ -456,8 +447,7 @@ dsc* EVAL_value(qli_nod* node)
return desc; return desc;
case nod_multiply: case nod_multiply:
if ((values[0]->dsc_missing & DSC_missing) || if ((values[0]->dsc_missing & DSC_missing) || (values[1]->dsc_missing & DSC_missing))
(values[1]->dsc_missing & DSC_missing))
{ {
desc->dsc_missing = DSC_missing; desc->dsc_missing = DSC_missing;
return desc; return desc;
@ -480,19 +470,16 @@ dsc* EVAL_value(qli_nod* node)
desc->dsc_missing = FALSE; desc->dsc_missing = FALSE;
switch (desc->dsc_dtype) { switch (desc->dsc_dtype) {
case dtype_short: case dtype_short:
*((SSHORT *) desc->dsc_address) = *((SSHORT *) desc->dsc_address) = -MOVQ_get_long(values[0], desc->dsc_scale);
-MOVQ_get_long(values[0], desc->dsc_scale);
break; break;
case dtype_long: case dtype_long:
*((SLONG *) desc->dsc_address) = *((SLONG *) desc->dsc_address) = -MOVQ_get_long(values[0], desc->dsc_scale);
-MOVQ_get_long(values[0], desc->dsc_scale);
break; break;
/* lets throw arithmetic not supported until fixed /* lets throw arithmetic not supported until fixed
case dtype_int64: case dtype_int64:
*((SINT64 *) desc->dsc_address) = *((SINT64 *) desc->dsc_address) = -MOVQ_get_long(values[0], desc->dsc_scale);
-MOVQ_get_long(values[0], desc->dsc_scale);
break; break;
*/ case dtype_real: */ case dtype_real:
@ -540,8 +527,7 @@ dsc* EVAL_value(qli_nod* node)
if (desc2->dsc_missing & DSC_missing) if (desc2->dsc_missing & DSC_missing)
return desc; return desc;
if (desc->dsc_dtype == dtype_long) if (desc->dsc_dtype == dtype_long)
*(SLONG *) desc->dsc_address += *(SLONG *) desc->dsc_address += MOVQ_get_long(desc2, desc->dsc_scale);
MOVQ_get_long(desc2, desc->dsc_scale);
else else
*(double *) desc->dsc_address += MOVQ_get_double(desc2); *(double *) desc->dsc_address += MOVQ_get_double(desc2);
} }
@ -551,8 +537,7 @@ dsc* EVAL_value(qli_nod* node)
case nod_format: case nod_format:
{ {
UCHAR* p = desc->dsc_address; UCHAR* p = desc->dsc_address;
PIC_edit(values[0], (pics*) node->nod_arg[e_fmt_picture], (TEXT**) &p, PIC_edit(values[0], (pics*) node->nod_arg[e_fmt_picture], (TEXT**) &p, desc->dsc_length);
desc->dsc_length);
desc->dsc_length = p - desc->dsc_address; desc->dsc_length = p - desc->dsc_address;
} }
return desc; return desc;
@ -734,22 +719,18 @@ static DSC *execute_prompt( qli_nod* node)
dsc* desc = &node->nod_desc; dsc* desc = &node->nod_desc;
vary* data = (vary*) desc->dsc_address; vary* data = (vary*) desc->dsc_address;
TEXT* value = TEXT* value = (desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
(desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
buffer : data->vary_string; buffer : data->vary_string;
const int length = const int length = (desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
(desc->dsc_length - 2 <= static_cast<int>(sizeof(buffer))) ?
sizeof(buffer) : desc->dsc_length - 2; sizeof(buffer) : desc->dsc_length - 2;
for (;;) { for (;;) {
++QLI_prompt_count; ++QLI_prompt_count;
if (node->nod_arg[e_prm_prompt]) { if (node->nod_arg[e_prm_prompt]) {
if (reprompt) if (reprompt)
sprintf(string, "\07%s %s: ", prompt[0], sprintf(string, "\07%s %s: ", prompt[0], (TEXT*) node->nod_arg[e_prm_prompt]);
(TEXT *) node->nod_arg[e_prm_prompt]);
else else
sprintf(string, "%s %s: ", prompt[1], sprintf(string, "%s %s: ", prompt[1], (TEXT*) node->nod_arg[e_prm_prompt]);
(TEXT *) node->nod_arg[e_prm_prompt]);
} }
else { else {
if (reprompt) if (reprompt)
@ -1270,12 +1251,10 @@ static bool string_boolean( qli_nod* node)
* or STARTS WITH. * or STARTS WITH.
* *
**************************************/ **************************************/
DSC *desc1, *desc2, *desc3; const DSC *desc1, *desc2, *desc3;
if (!(desc1 = EVAL_value(node->nod_arg[0])) || if (!(desc1 = EVAL_value(node->nod_arg[0])) || (desc1->dsc_missing & DSC_missing) ||
(desc1->dsc_missing & DSC_missing) || !(desc2 = EVAL_value(node->nod_arg[1])) || (desc2->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])) || (node->nod_arg[2] && (!(desc3 = EVAL_value(node->nod_arg[2])) ||
(desc3->dsc_missing & DSC_missing)))) (desc3->dsc_missing & DSC_missing))))
{ {
@ -1314,8 +1293,7 @@ static bool string_boolean( qli_nod* node)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
SSHORT l3 = 0; SSHORT l3 = 0;
while (!isc_get_segment(status_vector, &blob, (USHORT*) &l3, while (!isc_get_segment(status_vector, &blob, (USHORT*) &l3, buffer_length, buffer))
buffer_length, buffer))
{ {
if (string_function(node, l3, buffer, l2, p2)) { if (string_function(node, l3, buffer, l2, p2)) {
result = true; result = true;
@ -1391,8 +1369,7 @@ static bool string_function(
TEXT temp[16]; TEXT temp[16];
const TEXT* q1 = NULL; const TEXT* q1 = NULL;
if (node->nod_count > 2 && if (node->nod_count > 2 &&
MOVQ_get_string(EVAL_value(node->nod_arg[2]), &q1, (vary*) temp, MOVQ_get_string(EVAL_value(node->nod_arg[2]), &q1, (vary*) temp, sizeof(temp)))
sizeof(temp)))
{ {
c1 = *q1; 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; ISC_STATUS_ARRAY status_vector;
if (isc_open_blob2(status_vector, &dbb->dbb_handle, &dbb->dbb_transaction, if (isc_open_blob2(status_vector, &dbb->dbb_handle, &dbb->dbb_transaction,
&blob, (ISC_QUAD*) desc->dsc_address, bpb_length, &blob, (ISC_QUAD*) desc->dsc_address, bpb_length, bpb))
bpb))
{ {
ERRQ_database_error(dbb, status_vector); 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; qli_msg* message = NULL;
if (parameter) { if (parameter) {
message = parameter->par_message; message = parameter->par_message;
missing_flag = missing_flag = (USHORT *) (message->msg_buffer + parameter->par_offset);
(USHORT *) (message->msg_buffer + parameter->par_offset);
} }
try { try {
@ -573,8 +571,7 @@ static void commit_retaining( qli_nod* node)
return; return;
if (node->nod_type == nod_commit_retaining && if (node->nod_type == nod_commit_retaining &&
((node->nod_count > 1) || ((node->nod_count > 1) || (node->nod_count == 0 && QLI_databases->dbb_next)))
(node->nod_count == 0 && QLI_databases->dbb_next)))
{ {
node->nod_type = nod_prepare; node->nod_type = nod_prepare;
commit_retaining(node); commit_retaining(node);
@ -589,11 +586,9 @@ static void commit_retaining( qli_nod* node)
if (node->nod_count == 0) { if (node->nod_count == 0) {
for (DBB database = QLI_databases; database; for (DBB database = QLI_databases; database; database = database->dbb_next)
database = database->dbb_next)
{ {
if ((node->nod_type == nod_commit_retaining) if ((node->nod_type == nod_commit_retaining) && !(database->dbb_flags & DBB_prepared))
&& !(database->dbb_flags & DBB_prepared))
{ {
ERRQ_msg_put(465, database->dbb_symbol->sym_string); 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++) for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++)
{ {
DBB database = (DBB) *ptr; DBB database = (DBB) *ptr;
if ((node->nod_type == nod_commit_retaining) && if ((node->nod_type == nod_commit_retaining) && !(database->dbb_flags & DBB_prepared))
!(database->dbb_flags & DBB_prepared))
{ {
ERRQ_msg_put(465, database->dbb_symbol->sym_string); 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); dsc* to_desc = EVAL_parameter(parameter);
if (to_dbb == from_dbb && if (to_dbb == from_dbb &&
(!to_desc->dsc_sub_type || (!to_desc->dsc_sub_type || from_desc->dsc_sub_type == to_desc->dsc_sub_type))
from_desc->dsc_sub_type == to_desc->dsc_sub_type))
{ {
return false; 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, if (!from_blob.open(from_dbb->dbb_handle, from_dbb->dbb_transaction,
*(ISC_QUAD*) from_desc->dsc_address, bpb_length, *(ISC_QUAD*) from_desc->dsc_address, bpb_length, bpb))
bpb))
{ {
ERRQ_database_error(from_dbb, status_vector); ERRQ_database_error(from_dbb, status_vector);
} }
@ -782,8 +774,7 @@ static void execute_abort( qli_nod* node)
const TEXT* ptr = NULL; const TEXT* ptr = NULL;
UCHAR temp[80]; UCHAR temp[80];
const USHORT l = const USHORT l =
MOVQ_get_string(EVAL_value(node->nod_arg[0]), &ptr, MOVQ_get_string(EVAL_value(node->nod_arg[0]), &ptr, (vary*) temp, sizeof(temp));
(vary*) temp, sizeof(temp));
UCHAR msg[128]; UCHAR msg[128];
MOVQ_terminate(ptr, (SCHAR*) msg, l, sizeof(msg)); 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) { if (to->nod_type == nod_field) {
qli_nod* reference = to->nod_arg[e_fld_reference]; qli_nod* reference = to->nod_arg[e_fld_reference];
parameter = reference->nod_import; parameter = reference->nod_import;
if (to->nod_desc.dsc_dtype == dtype_blob && if (to->nod_desc.dsc_dtype == dtype_blob && from->nod_desc.dsc_dtype == dtype_blob &&
from->nod_desc.dsc_dtype == dtype_blob &&
copy_blob(from, parameter)) copy_blob(from, parameter))
{ {
return; return;
@ -830,8 +820,7 @@ static void execute_assignment( qli_nod* node)
if (parameter) if (parameter)
parameter = parameter->par_missing; parameter = parameter->par_missing;
assignment(from, EVAL_value(to), assignment(from, EVAL_value(to), node->nod_arg[e_asn_valid], initial, parameter);
node->nod_arg[e_asn_valid], initial, parameter);
// propagate the missing flag in variable assignments // propagate the missing flag in variable assignments
@ -943,9 +932,7 @@ static void execute_output( qli_nod* node)
// Set up error handling // Set up error handling
try { try {
// Finally, execute the query // Finally, execute the query
EXEC_execute(node->nod_arg[e_out_statement]); EXEC_execute(node->nod_arg[e_out_statement]);
fclose(print->prt_file); fclose(print->prt_file);
@ -1057,8 +1044,7 @@ static void map_data( qli_msg* message)
desc->dsc_address = message->msg_buffer + parameter->par_offset; desc->dsc_address = message->msg_buffer + parameter->par_offset;
qli_par* missing_parameter = parameter->par_missing; qli_par* missing_parameter = parameter->par_missing;
if (missing_parameter) { if (missing_parameter) {
USHORT* missing_flag = (USHORT*) (message->msg_buffer + USHORT* missing_flag = (USHORT*) (message->msg_buffer + missing_parameter->par_offset);
missing_parameter->par_offset);
*missing_flag = (desc->dsc_missing & DSC_missing) ? DSC_missing : 0; *missing_flag = (desc->dsc_missing & DSC_missing) ? DSC_missing : 0;
} }
@ -1142,8 +1128,7 @@ static void set_null( qli_msg* message)
* statements. * statements.
* *
**************************************/ **************************************/
for (qli_par* parameter = message->msg_parameters; parameter; for (qli_par* parameter = message->msg_parameters; parameter; parameter = parameter->par_next)
parameter = parameter->par_next)
{ {
qli_nod* from = parameter->par_value; qli_nod* from = parameter->par_value;
if (from->nod_type == nod_field) { if (from->nod_type == nod_field) {
@ -1177,11 +1162,11 @@ static void transaction_state( qli_nod* node, DBB database)
if (database->dbb_transaction) { if (database->dbb_transaction) {
if (node->nod_type == nod_commit_retaining) { if (node->nod_type == nod_commit_retaining) {
if (isc_commit_retaining(status, &database->dbb_transaction)) 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) { else if (node->nod_type == nod_prepare) {
if (isc_prepare_transaction(status, &database->dbb_transaction)) 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_RELATION,
CTX_VARIABLE, CTX_VARIABLE,
CTX_AGGREGATE, CTX_AGGREGATE,
CTX_UNION, //CTX_UNION,
CTX_STREAM CTX_STREAM
} CTX_T; } CTX_T;
@ -132,7 +132,7 @@ struct qli_map {
struct qli_msg { struct qli_msg {
blk msg_header; blk msg_header;
qli_req* msg_request; // Parent request 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 qli_msg* msg_next; // Next message in request
struct qli_par* msg_parameters; // Field instances struct qli_par* msg_parameters; // Field instances
USHORT msg_number; // Message number USHORT msg_number; // Message number
@ -157,7 +157,7 @@ struct qli_par {
// Print item block // Print item block
typedef enum itm_t typedef enum itm_t
{ {
item_value, item_value,
item_skip, item_skip,
item_column, item_column,
@ -182,12 +182,12 @@ struct qli_print_item {
USHORT itm_print_length; USHORT itm_print_length;
USHORT itm_header_offset; USHORT itm_header_offset;
USHORT itm_header_length; USHORT itm_header_length;
USHORT itm_header_segments; //USHORT itm_header_segments;
USHORT itm_count; // Number of lines to skip 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; FB_API_HANDLE itm_stream;
USHORT itm_kanji_fragment; // JPN: last kanji on line border //USHORT itm_kanji_fragment; // JPN: last kanji on line border
ISC_STATUS itm_blob_status; // JPN: status of the last blob fetch //ISC_STATUS itm_blob_status; // JPN: status of the last blob fetch
}; };
// itm_flags // 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_group_by = 5;
const int e_rse_having = 6; const int e_rse_having = 6;
const int e_rse_join_type = 7; const int e_rse_join_type = 7;
#ifdef PC_ENGINE const int e_rse_count = 8;
const int e_rse_index = 8;
#endif
const int e_rse_count = 9;
const int e_prt_list = 0; // List of print items const int e_prt_list = 0; // List of print items
const int e_prt_file_name = 1; // Output file name 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 void expand_values(qli_syntax*, qli_lls*);
static qli_ctx* find_context(const nam*, qli_lls*); static qli_ctx* find_context(const nam*, qli_lls*);
static int generate_fields(qli_ctx*, qli_lls*, qli_syntax*); 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 global_agg(const qli_syntax*, const qli_syntax*);
static bool invalid_nod_field(const qli_nod*, const qli_nod*); static bool invalid_nod_field(const qli_nod*, const qli_nod*);
static bool invalid_syn_field(const qli_syntax*, const qli_syntax*); 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; qli_fld* field;
for (qli_fld** ptr = &QLI_variables; field = *ptr; ptr = &field->fld_next) for (qli_fld** ptr = &QLI_variables; field = *ptr; ptr = &field->fld_next)
if (!strcmp if (!strcmp(field->fld_name->sym_string, variable->fld_name->sym_string))
(field->fld_name->sym_string, variable->fld_name->sym_string))
{ {
*ptr = field->fld_next; *ptr = field->fld_next;
ALLQ_release((FRB) field->fld_name); 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) if (from->nod_type == nod_prompt)
from->nod_arg[e_prm_field] = to->nod_arg[e_fld_field]; from->nod_arg[e_prm_field] = to->nod_arg[e_fld_field];
if (field->fld_validation) if (field->fld_validation)
node->nod_arg[e_asn_valid] = node->nod_arg[e_asn_valid] = expand_expression(field->fld_validation, left);
expand_expression(field->fld_validation, left);
} }
if (!node->nod_arg[e_asn_valid]) 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); boolean->nod_arg[0] = expand_expression(input->syn_arg[1], stack);
qli_nod* negation = make_node(nod_not, 1); qli_nod* negation = make_node(nod_not, 1);
negation->nod_arg[0] = boolean; negation->nod_arg[0] = boolean;
rse->nod_arg[e_rse_boolean] = rse->nod_arg[e_rse_boolean] = make_and(rse->nod_arg[e_rse_boolean], negation);
make_and(rse->nod_arg[e_rse_boolean], negation);
} }
return node; return node;
@ -621,11 +618,9 @@ static void expand_control_break( qli_brk** ptr, qli_lls* right)
control->brk_next = list; control->brk_next = list;
list = control; list = control;
if (control->brk_field) if (control->brk_field)
control->brk_field = control->brk_field = (qli_syntax*) expand_expression(control->brk_field, right);
(qli_syntax*) expand_expression(control->brk_field, right);
if (control->brk_line) if (control->brk_line)
control->brk_line = control->brk_line = (qli_syntax*) expand_print_list(control->brk_line, right);
(qli_syntax*) expand_print_list(control->brk_line, right);
} }
*ptr = list; *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]) { if (input->syn_arg[s_era_rse]) {
loop = make_node(nod_for, e_for_count); loop = make_node(nod_for, e_for_count);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_era_rse], loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_era_rse], &right);
&right);
} }
// Loop thru contexts counting them. // 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); node->nod_arg[e_stt_default] = expand_expression(value, stack);
if (input->syn_arg[s_prt_distinct] && node->nod_arg[e_stt_rse] if (input->syn_arg[s_prt_distinct] && node->nod_arg[e_stt_rse]
&& node->nod_arg[e_stt_value]) && 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 // count2 next 2 lines go
if (input->syn_type == nod_count) if (input->syn_type == nod_count)
node->nod_arg[e_stt_value] = 0; 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]) && if ((value = input->syn_arg[s_stt_value]) &&
(input->syn_arg[s_prt_distinct] (input->syn_arg[s_prt_distinct] || (input->syn_type != nod_agg_count)))
|| (input->syn_type != nod_agg_count)))
{ {
node->nod_arg[e_stt_value] = node->nod_arg[e_stt_value] = expand_expression(value, stack->lls_next);
expand_expression(value, stack->lls_next); if (input->syn_arg[s_prt_distinct] ||
if (input->syn_arg[s_prt_distinct] (input->syn_type == nod_agg_count && context->ctx_sub_rse))
|| (input->syn_type == nod_agg_count && context->ctx_sub_rse))
{ {
expand_distinct(context->ctx_sub_rse, expand_distinct(context->ctx_sub_rse, node->nod_arg[e_stt_value]);
node->nod_arg[e_stt_value]);
} }
} }
return post_map(node, context); return post_map(node, context);
@ -941,8 +933,7 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
case nod_format: case nod_format:
node = make_node(input->syn_type, e_fmt_count); node = make_node(input->syn_type, e_fmt_count);
node->nod_count = 1; node->nod_count = 1;
node->nod_arg[e_fmt_value] = node->nod_arg[e_fmt_value] = expand_expression(input->syn_arg[s_fmt_value], stack);
expand_expression(input->syn_arg[s_fmt_value], stack);
node->nod_arg[e_fmt_edit] = (qli_nod*) input->syn_arg[s_fmt_edit]; node->nod_arg[e_fmt_edit] = (qli_nod*) input->syn_arg[s_fmt_edit];
return node; return node;
@ -1053,10 +1044,8 @@ static qli_nod* expand_field( qli_syntax* input, qli_lls* stack, qli_syntax* sub
continue; continue;
} }
qli_ctx** ptr = qli_ctx** ptr = (qli_ctx**) stream_context->ctx_stream->nod_arg + e_rse_count;
(qli_ctx**) stream_context->ctx_stream->nod_arg + e_rse_count; const qli_ctx* const* const end = ptr + stream_context->ctx_stream->nod_count;
const qli_ctx* const* const end =
ptr + stream_context->ctx_stream->nod_count;
for (; ptr < end; ptr++) for (; ptr < end; ptr++)
if (*ptr == context) if (*ptr == context)
break; 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); 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_rse] = expand_rse(input->syn_arg[s_for_rse], &right);
node->nod_arg[e_for_statement] = node->nod_arg[e_for_statement] = expand_statement(input->syn_arg[s_for_statement], right, left);
expand_statement(input->syn_arg[s_for_statement], right, left);
return node; 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); qli_nod* node = make_node(input->syn_type, e_fun_count);
node->nod_count = 1; node->nod_count = 1;
qli_ctx* context; qli_ctx* context;
if (stack && (context = (qli_ctx*) stack->lls_object) if (stack && (context = (qli_ctx*) stack->lls_object) && (context->ctx_type == CTX_RELATION))
&& (context->ctx_type == CTX_RELATION))
{ {
if (context->ctx_primary) if (context->ctx_primary)
context = 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_function] = (qli_nod*) function;
node->nod_arg[e_fun_args] = node->nod_arg[e_fun_args] = expand_expression(input->syn_arg[s_fun_args], stack);
expand_expression(input->syn_arg[s_fun_args], stack);
return node; 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_nod** ptr2 = node->nod_arg;
qli_syntax** ptr = input->syn_arg; qli_syntax** ptr = input->syn_arg;
for (const qli_syntax* const* const end = ptr + input->syn_count; ptr < end; for (const qli_syntax* const* const end = ptr + input->syn_count; ptr < end; ptr++, ptr2++)
ptr++, ptr2++)
{ {
*ptr2 = expand_expression(*ptr, stack); *ptr2 = expand_expression(*ptr, stack);
post_map(*ptr2, context); 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]) { if (input->syn_arg[s_mod_rse]) {
loop = make_node(nod_for, e_for_count); loop = make_node(nod_for, e_for_count);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_mod_rse], loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_mod_rse], &right);
&right);
} }
qli_lls* contexts; 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]; qli_syntax* syn_list = input->syn_arg[s_prt_list];
if (syn_list) { if (syn_list) {
qli_syntax** sub = syn_list->syn_arg; qli_syntax** sub = syn_list->syn_arg;
for (const qli_syntax* const* const end = sub + syn_list->syn_count; for (const qli_syntax* const* const end = sub + syn_list->syn_count; sub < end; sub++)
sub < end; sub++)
{ {
qli_syntax* syn_item; const qli_syntax* syn_item;
if (((*sub)->syn_type == nod_print_item) if (((*sub)->syn_type == nod_print_item) &&
&& (syn_item = (*sub)->syn_arg[s_itm_value]) (syn_item = (*sub)->syn_arg[s_itm_value]) && (syn_item->syn_type == nod_star))
&& (syn_item->syn_type == nod_star))
{ {
count += generate_items(syn_item, new_right, (qli_lls*) &items, rse); 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])) { else if (syn_rse && (syn_list = syn_rse->syn_arg[s_rse_reduced])) {
qli_syntax** sub = syn_list->syn_arg; qli_syntax** sub = syn_list->syn_arg;
for (const qli_syntax* const* const end = sub + syn_list->syn_count; for (const qli_syntax* const* const end = sub + syn_list->syn_count; sub < end; sub += 2)
sub < end; sub += 2)
{ {
qli_print_item* item = (qli_print_item*) ALLOCD(type_itm); qli_print_item* item = (qli_print_item*) ALLOCD(type_itm);
item->itm_type = item_value; 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; qli_rel* relation = context->ctx_relation;
if (!relation || context->ctx_sub_rse) if (!relation || context->ctx_sub_rse)
continue; continue;
for (qli_fld* field = relation->rel_fields; field; for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
field = field->fld_next)
{ {
if ( if ((field->fld_system_flag &&
(field->fld_system_flag field->fld_system_flag != relation->rel_system_flag) ||
&& field->fld_system_flag != relation->rel_system_flag) field->fld_flags & FLD_array)
|| field->fld_flags & FLD_array)
{ {
continue; 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; loop->nod_arg[e_for_statement] = node;
node = loop; node = loop;
if (input->syn_arg[s_prt_order]) if (input->syn_arg[s_prt_order])
rse->nod_arg[e_rse_sort] = rse->nod_arg[e_rse_sort] = expand_sort(input->syn_arg[s_prt_order], new_right, list);
expand_sort(input->syn_arg[s_prt_order], new_right, list);
} }
return node; return node;
@ -1540,8 +1518,7 @@ static qli_nod* expand_print_list( qli_syntax* input, qli_lls* stack)
qli_lls* items = NULL; qli_lls* items = NULL;
qli_syntax** ptr = input->syn_arg; qli_syntax** ptr = input->syn_arg;
for (const qli_syntax* const* const end = ptr + input->syn_count; for (const qli_syntax* const* const end = ptr + input->syn_count; ptr < end; ptr++)
ptr < end; ptr++)
{ {
ALLQ_push((blk*) expand_print_item(*ptr, stack), &items); 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; node->nod_arg[e_sto_context] = (qli_nod*) context;
context->ctx_type = CTX_RELATION; context->ctx_type = CTX_RELATION;
context->ctx_rse = (qli_nod*) -1; context->ctx_rse = (qli_nod*) -1;
qli_rel* relation = context->ctx_relation = qli_rel* relation = context->ctx_relation = (qli_rel*) rel_node->syn_arg[s_rel_relation];
(qli_rel*) rel_node->syn_arg[s_rel_relation];
// If we don't already know about the relation, find out now. // 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 // First look for an exact field name match
qli_fld* fld; qli_fld* fld;
for (fld = ctx->ctx_relation->rel_fields; fld; for (fld = ctx->ctx_relation->rel_fields; fld; fld = fld->fld_next)
fld = fld->fld_next)
{ {
if (compare_symbols(field->fld_name, fld->fld_name)) if (compare_symbols(field->fld_name, fld->fld_name))
break; 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 // Next try, target field name matching source query name
if (!fld) if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld; for (fld = ctx->ctx_relation->rel_fields; fld; fld = fld->fld_next)
fld = fld->fld_next)
{ {
if (compare_symbols(field->fld_name, fld->fld_query_name)) if (compare_symbols(field->fld_name, fld->fld_query_name))
break; 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 nothing yet, look for any old match
if (!fld) if (!fld)
for (fld = ctx->ctx_relation->rel_fields; fld; for (fld = ctx->ctx_relation->rel_fields; fld; fld = fld->fld_next)
fld = fld->fld_next)
{ {
if (compare_symbols(field-> fld_query_name, if (compare_symbols(field-> fld_query_name, fld->fld_name) ||
fld->fld_name) compare_symbols(field->fld_query_name, fld->fld_query_name))
|| compare_symbols(field->fld_query_name,
fld->fld_query_name))
{ {
break; break;
} }
@ -1683,8 +1654,7 @@ static qli_nod* expand_restructure( qli_syntax* input, qli_lls* right, qli_lls*
if (fld) { if (fld) {
qli_nod* assignment = make_node(nod_assign, e_asn_count); qli_nod* assignment = make_node(nod_assign, e_asn_count);
assignment->nod_count = e_asn_count - 1; assignment->nod_count = e_asn_count - 1;
assignment->nod_arg[e_asn_to] = assignment->nod_arg[e_asn_to] = make_field(field, context);
make_field(field, context);
assignment->nod_arg[e_asn_from] = make_field(fld, ctx); assignment->nod_arg[e_asn_from] = make_field(fld, ctx);
ALLQ_push((blk*) assignment, &stack); ALLQ_push((blk*) assignment, &stack);
goto found_field; 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 // Process the FIRST clause before the context gets augmented
if (input->syn_arg[s_rse_first]) if (input->syn_arg[s_rse_first])
node->nod_arg[e_rse_first] = node->nod_arg[e_rse_first] = expand_expression(input->syn_arg[e_rse_first], old_stack);
expand_expression(input->syn_arg[e_rse_first], old_stack);
// Process relations // Process relations
@ -1778,12 +1747,10 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
} }
else { else {
context->ctx_type = CTX_RELATION; context->ctx_type = CTX_RELATION;
qli_rel* relation = context->ctx_relation = qli_rel* relation = context->ctx_relation = (qli_rel*) rel_node->syn_arg[s_rel_relation];
(qli_rel*) rel_node->syn_arg[s_rel_relation];
if (!(relation->rel_flags & REL_fields)) if (!(relation->rel_flags & REL_fields))
MET_fields(relation); MET_fields(relation);
qli_symbol* symbol = context->ctx_symbol = qli_symbol* symbol = context->ctx_symbol = (qli_symbol*) rel_node->syn_arg[s_rel_context];
(qli_symbol*) rel_node->syn_arg[s_rel_context];
if (symbol) if (symbol)
symbol->sym_object = (BLK) context; symbol->sym_object = (BLK) context;
if (over) { 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++) { for (USHORT j = 0; j < over->syn_count; j++) {
qli_syntax* field = over->syn_arg[j]; qli_syntax* field = over->syn_arg[j];
qli_nod* eql_node = make_node(nod_eql, 2); qli_nod* eql_node = make_node(nod_eql, 2);
eql_node->nod_arg[0] = eql_node->nod_arg[0] = expand_expression(field, short_stack);
expand_expression(field, short_stack); eql_node->nod_arg[1] = expand_expression(field, new_stack);
eql_node->nod_arg[1] =
expand_expression(field, new_stack);
boolean = make_and(eql_node, boolean); boolean = make_and(eql_node, boolean);
} }
ALLQ_pop(&short_stack); ALLQ_pop(&short_stack);
@ -1807,18 +1772,14 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
// Handle explicit boolean // Handle explicit boolean
if (input->syn_arg[e_rse_boolean]) if (input->syn_arg[e_rse_boolean])
boolean = make_and(boolean, boolean = make_and(boolean, expand_expression(input->syn_arg[e_rse_boolean], new_stack));
expand_expression(input->syn_arg[e_rse_boolean],
new_stack));
// Handle implicit boolean from SQL xxx IN (yyy FROM relation) // Handle implicit boolean from SQL xxx IN (yyy FROM relation)
if (input->syn_arg[s_rse_outer]) { if (input->syn_arg[s_rse_outer]) {
qli_nod* eql_node = make_node((enum nod_t)(IPTR)input->syn_arg[s_rse_op], 2); qli_nod* eql_node = make_node((enum nod_t)(IPTR)input->syn_arg[s_rse_op], 2);
eql_node->nod_arg[0] = eql_node->nod_arg[0] = expand_expression(input->syn_arg[s_rse_outer], old_stack);
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[1] =
expand_expression(input->syn_arg[s_rse_inner], new_stack);
if (input->syn_arg[s_rse_all_flag]) if (input->syn_arg[s_rse_all_flag])
eql_node = negate(eql_node); eql_node = negate(eql_node);
boolean = make_and(eql_node, boolean); boolean = make_and(eql_node, boolean);
@ -1833,19 +1794,13 @@ static qli_nod* expand_rse( qli_syntax* input, qli_lls** stack)
else else
node->nod_arg[e_rse_sort] = temp; 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]) if (input->syn_arg[s_rse_reduced])
node->nod_arg[e_rse_reduced] = node->nod_arg[e_rse_reduced] = expand_sort(input->syn_arg[e_rse_reduced], new_stack, 0);
expand_sort(input->syn_arg[e_rse_reduced], new_stack, 0);
if (input->syn_arg[s_rse_group_by]) if (input->syn_arg[s_rse_group_by])
parent_rse->nod_arg[e_rse_group_by] = parent_rse->nod_arg[e_rse_group_by] =
expand_group_by(input->syn_arg[s_rse_group_by], new_stack, expand_group_by(input->syn_arg[s_rse_group_by], new_stack, parent_context);
parent_context);
node->nod_arg[e_rse_join_type] = (qli_nod*) input->syn_arg[s_rse_join_type]; 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; qli_ctx* context = NULL;
ptr2 = node->nod_arg + e_rse_count; ptr2 = node->nod_arg + e_rse_count;
for (const qli_nod* const* const end = ptr2 + node->nod_count; for (const qli_nod* const* const end = ptr2 + node->nod_count; ptr2 < end; ptr2++)
ptr2 < end; ptr2++)
{ {
context = (qli_ctx*) *ptr2; context = (qli_ctx*) *ptr2;
context->ctx_parent = parent_context; 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); ALLQ_push((blk*) parent_context, stack);
if (input->syn_arg[s_rse_having]) if (input->syn_arg[s_rse_having])
parent_rse->nod_arg[e_rse_having] = parent_rse->nod_arg[e_rse_having] = expand_expression(input->syn_arg[s_rse_having], *stack);
expand_expression(input->syn_arg[s_rse_having], *stack);
return parent_rse; return parent_rse;
} }
@ -1960,13 +1913,11 @@ static qli_nod* expand_statement( qli_syntax* input, qli_lls* right, qli_lls* le
case nod_if: case nod_if:
node = make_node(input->syn_type, input->syn_count); node = make_node(input->syn_type, input->syn_count);
node->nod_arg[e_if_boolean] = node->nod_arg[e_if_boolean] = expand_expression(input->syn_arg[s_if_boolean], right);
expand_expression(input->syn_arg[s_if_boolean], right);
node->nod_arg[e_if_true] = node->nod_arg[e_if_true] =
expand_statement(input->syn_arg[s_if_true], right, left); expand_statement(input->syn_arg[s_if_true], right, left);
if (input->syn_arg[s_if_false]) if (input->syn_arg[s_if_false])
node->nod_arg[e_if_false] = node->nod_arg[e_if_false] = expand_statement(input->syn_arg[s_if_false], right, left);
expand_statement(input->syn_arg[s_if_false], right, left);
else else
node->nod_count = 2; node->nod_count = 2;
return node; return node;
@ -1994,8 +1945,7 @@ static qli_nod* expand_statement( qli_syntax* input, qli_lls* right, qli_lls* le
case nod_repeat: case nod_repeat:
node = make_node(input->syn_type, input->syn_count); node = make_node(input->syn_type, input->syn_count);
node->nod_arg[e_rpt_value] = node->nod_arg[e_rpt_value] = expand_expression(input->syn_arg[s_rpt_value], left);
expand_expression(input->syn_arg[s_rpt_value], left);
node->nod_arg[e_rpt_statement] = node->nod_arg[e_rpt_statement] =
expand_statement(input->syn_arg[s_rpt_statement], right, left); expand_statement(input->syn_arg[s_rpt_statement], right, left);
return node; 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]) { if (input->syn_arg[s_sto_rse]) {
loop = make_node(nod_for, e_for_count); loop = make_node(nod_for, e_for_count);
loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_sto_rse], loop->nod_arg[e_for_rse] = expand_rse(input->syn_arg[s_sto_rse], &right);
&right);
} }
qli_nod* node = make_node(input->syn_type, e_sto_count); 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; node->nod_arg[e_sto_context] = (qli_nod*) context;
context->ctx_type = CTX_RELATION; context->ctx_type = CTX_RELATION;
context->ctx_rse = (qli_nod*) -1; context->ctx_rse = (qli_nod*) -1;
qli_rel* relation = context->ctx_relation = qli_rel* relation = context->ctx_relation = (qli_rel*) rel_node->syn_arg[s_rel_relation];
(qli_rel*) rel_node->syn_arg[s_rel_relation];
if (!(relation->rel_flags & REL_fields)) if (!(relation->rel_flags & REL_fields))
MET_fields(relation); 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_values]) {
if (!input->syn_arg[s_sto_fields]) { if (!input->syn_arg[s_sto_fields]) {
qli_lls* stack = NULL; qli_lls* stack = NULL;
for (qli_fld* field = relation->rel_fields; field; for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
field = field->fld_next)
{ {
ALLQ_push((blk*) decompile_field(field, 0), &stack); 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 { else {
qli_lls* stack = NULL; qli_lls* stack = NULL;
for (qli_fld* field = relation->rel_fields; field; for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
field = field->fld_next)
{ {
if (field->fld_flags & FLD_computed) if (field->fld_flags & FLD_computed)
continue; continue;
if ( if ((field->fld_system_flag && field->fld_system_flag != relation->rel_system_flag) ||
(field->fld_system_flag field->fld_flags & FLD_array)
&& field->fld_system_flag != relation->rel_system_flag)
|| field->fld_flags & FLD_array)
{ {
continue; continue;
} }
@ -2182,8 +2126,7 @@ static void expand_values( qli_syntax* input, qli_lls* right)
while (temp) { while (temp) {
qli_ctx* context = (qli_ctx*) ALLQ_pop(&temp); qli_ctx* context = (qli_ctx*) ALLQ_pop(&temp);
value_count += value_count +=
generate_fields(context, (qli_lls*) &values, generate_fields(context, (qli_lls*) &values, input->syn_arg[s_sto_rse]);
input->syn_arg[s_sto_rse]);
} }
} }
else 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); qli_ctx* context = find_context((const nam*) value->syn_arg[0], right);
if (!context) if (!context)
IBERROR(154); // Msg154 unrecognized context IBERROR(154); // Msg154 unrecognized context
value_count += 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 { else {
ALLQ_push((blk*) value, &values); 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; int count = 0;
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 ( if ((field->fld_system_flag && field->fld_system_flag != relation->rel_system_flag) ||
(field->fld_system_flag field->fld_flags & FLD_array)
&& field->fld_system_flag != relation->rel_system_flag)
|| field->fld_flags & FLD_array)
{ {
continue; 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; qli_rel* relation = context->ctx_relation;
int count = 0; int count = 0;
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 ( if ((field->fld_system_flag && field->fld_system_flag != relation->rel_system_flag) ||
(field->fld_system_flag field->fld_flags & FLD_array)
&& field->fld_system_flag != relation->rel_system_flag)
|| field->fld_flags & FLD_array)
{ {
continue; continue;
} }
@ -2396,8 +2334,7 @@ static bool global_agg( const qli_syntax* item, const qli_syntax* group_list)
case nod_substr: case nod_substr:
{ {
const qli_syntax* const* ptr = item->syn_arg; const qli_syntax* const* ptr = item->syn_arg;
for (const qli_syntax* const* const end = ptr + item->syn_count; ptr < end; for (const qli_syntax* const* const end = ptr + item->syn_count; ptr < end; ptr++)
ptr++)
{ {
if ((*ptr)->syn_type == nod_constant) if ((*ptr)->syn_type == nod_constant)
continue; 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_fld* field = (qli_fld*) node->nod_arg[e_fld_field];
const qli_ctx* context = (qli_ctx*) node->nod_arg[e_fld_context]; const qli_ctx* context = (qli_ctx*) node->nod_arg[e_fld_context];
const qli_nod* const* ptr = list->nod_arg; const qli_nod* const* ptr = list->nod_arg;
for (const qli_nod* const* const end = ptr + list->nod_count; for (const qli_nod* const* const end = ptr + list->nod_count; ptr < end; ptr++)
ptr < end; ptr++)
{ {
if (field == (qli_fld*) (*ptr)->nod_arg[e_fld_field] if (field == (qli_fld*) (*ptr)->nod_arg[e_fld_field] &&
&& context == (qli_ctx*) (*ptr)->nod_arg[e_fld_context]) context == (qli_ctx*) (*ptr)->nod_arg[e_fld_context])
{ {
return false; return false;
} }
@ -2458,8 +2394,7 @@ static bool invalid_nod_field( const qli_nod* node, const qli_nod* list)
} }
else { else {
const qli_nod* const* ptr = node->nod_arg; const qli_nod* const* ptr = node->nod_arg;
for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ptr++)
ptr++)
{ {
switch ((*ptr)->nod_type) { switch ((*ptr)->nod_type) {
case nod_field: case nod_field:
@ -2541,8 +2476,7 @@ static bool invalid_syn_field( const qli_syntax* syn_node, const qli_syntax* lis
} }
else { else {
const qli_syntax* const* ptr = syn_node->syn_arg; const qli_syntax* const* ptr = syn_node->syn_arg;
for (const qli_syntax* const* const end = ptr + syn_node->syn_count; for (const qli_syntax* const* const end = ptr + syn_node->syn_count; ptr < end; ptr++)
ptr < end; ptr++)
{ {
switch ((*ptr)->syn_type) { switch ((*ptr)->syn_type) {
case nod_field: 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; assignment->nod_arg[e_asn_from] = prompt;
if (field->fld_validation) if (field->fld_validation)
assignment->nod_arg[e_asn_valid] = assignment->nod_arg[e_asn_valid] = expand_expression(field->fld_validation, stack);
expand_expression(field->fld_validation, stack);
else else
--assignment->nod_count; --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, /* If the value isn't a field, is qualified, or can be resolved,
it doesn't qualify for conversion. Return NULL. */ it doesn't qualify for conversion. Return NULL. */
if (input->syn_type != nod_field || if (input->syn_type != nod_field || input->syn_count != 1 || resolve(input, stack, &context))
input->syn_count != 1 || resolve(input, stack, &context))
{ {
return NULL; return NULL;
} }
@ -2867,11 +2799,10 @@ static qli_fld* resolve( qli_syntax* node, qli_lls* stack, qli_ctx** out_context
switch (context->ctx_type) { switch (context->ctx_type) {
case CTX_VARIABLE: case CTX_VARIABLE:
if (ptr == base) if (ptr == base)
for (field = context->ctx_variable; field; for (field = context->ctx_variable; field; field = field->fld_next)
field = field->fld_next)
{ {
if (compare_names(name, field->fld_name) if (compare_names(name, field->fld_name) ||
|| compare_names(name, field->fld_query_name)) compare_names(name, field->fld_query_name))
{ {
return field; 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); resolved = MET_declare(0, variable, fld_name);
else if (field_node->syn_count == 2) { else if (field_node->syn_count == 2) {
qli_symbol *symbol; qli_symbol *symbol;
for (symbol = rel_name->nam_symbol; symbol; for (symbol = rel_name->nam_symbol; symbol; symbol = symbol->sym_homonym)
symbol = symbol->sym_homonym)
{ {
if (symbol->sym_type == SYM_database) { if (symbol->sym_type == SYM_database) {
DBB dbb = (DBB) symbol->sym_object; DBB dbb = (DBB) symbol->sym_object;
@ -2969,21 +2899,17 @@ static void resolve_really( qli_fld* variable, const qli_syntax* field_node)
if (!resolved) { if (!resolved) {
for (DBB dbb = QLI_databases; dbb && !resolved; dbb = dbb->dbb_next) for (DBB dbb = QLI_databases; dbb && !resolved; dbb = dbb->dbb_next)
for (symbol = rel_name->nam_symbol; symbol; for (symbol = rel_name->nam_symbol; symbol; symbol = symbol->sym_homonym)
symbol = symbol->sym_homonym)
{ {
qli_rel* relation; qli_rel* relation;
if (symbol->sym_type == SYM_relation if (symbol->sym_type == SYM_relation &&
&& (relation = (qli_rel*) symbol->sym_object) (relation = (qli_rel*) symbol->sym_object) && relation->rel_database == dbb)
&& relation->rel_database == dbb)
{ {
if (!relation->rel_fields) if (!relation->rel_fields)
MET_fields(relation); MET_fields(relation);
for (field = relation->rel_fields; field; for (field = relation->rel_fields; field; field = field->fld_next)
field = field->fld_next)
{ {
resolved = local = compare_names(fld_name, resolved = local = compare_names(fld_name, field->fld_name);
field->fld_name);
if (resolved) if (resolved)
break; break;
} }

View File

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

View File

@ -26,6 +26,7 @@
// Logical column block // Logical column block
/*
typedef struct col { typedef struct col {
blk col_header; blk col_header;
col* col_next; // Next logical column col* col_next; // Next logical column
@ -34,6 +35,7 @@ typedef struct col {
USHORT col_column; // Starting column number USHORT col_column; // Starting column number
USHORT col_print_length; // Max print length USHORT col_print_length; // Max print length
} *COL; } *COL;
*/
/* Picture string elements: /* Picture string elements:
@ -74,7 +76,7 @@ typedef enum pic_t {
pic_numeric, pic_numeric,
pic_date, pic_date,
pic_float, pic_float,
pic_text // pic_text // unused
} PIC_T; } PIC_T;
// Picture string handling block // Picture string handling block
@ -88,7 +90,7 @@ struct pics {
USHORT pic_count; // Count of repeat characters USHORT pic_count; // Count of repeat characters
TEXT pic_character; // Last significant character TEXT pic_character; // Last significant character
PIC_T pic_type; // Type of edit 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_floats; // Character of floating things
USHORT pic_digits; // Digits of number USHORT pic_digits; // Digits of number
USHORT pic_hex_digits; // Hexidecimal digits USHORT pic_hex_digits; // Hexidecimal digits
@ -101,7 +103,7 @@ struct pics {
USHORT pic_nmonths; // Digits of numeric month USHORT pic_nmonths; // Digits of numeric month
USHORT pic_years; // Digits of year USHORT pic_years; // Digits of year
USHORT pic_julians; // Digits of julian days 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_brackets; // Pairs of deficit brackets
USHORT pic_exponents; // Exponential indicators USHORT pic_exponents; // Exponential indicators
USHORT pic_float_digits; // Floating digits 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; DBB dbb = request->req_database;
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
if (isc_compile_request(status_vector, &dbb->dbb_handle, if (isc_compile_request(status_vector, &dbb->dbb_handle, &request->req_handle, length,
&request->req_handle, length,
(const char*) rlb->rlb_base)) (const char*) rlb->rlb_base))
{ {
GEN_rlb_release (rlb); 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]; qli_map* map = (qli_map*) node->nod_arg[e_map_map];
const qli_ctx* context = (qli_ctx*) node->nod_arg[e_map_context]; const qli_ctx* context = (qli_ctx*) node->nod_arg[e_map_context];
if (context->ctx_request != request && if (context->ctx_request != request && map->map_node->nod_type == nod_field)
map->map_node->nod_type == nod_field)
{ {
gen_field(map->map_node, request); gen_field(map->map_node, request);
return; return;
@ -999,8 +997,7 @@ static void gen_field( qli_nod* node, qli_req* request)
if (args) { if (args) {
STUFF(args->nod_count); STUFF(args->nod_count);
qli_nod** ptr = args->nod_arg; qli_nod** ptr = args->nod_arg;
for (const qli_nod* const* const end = ptr + args->nod_count; for (const qli_nod* const* const end = ptr + args->nod_count; ptr < end; ++ptr)
ptr < end; ++ptr)
{ {
gen_expression(*ptr, request); gen_expression(*ptr, request);
} }
@ -1069,7 +1066,7 @@ static void gen_for( qli_nod* node, qli_req* request)
// Build assigments for all values referenced. // Build assigments for all values referenced.
for (const qli_par* parameter = message->msg_parameters; parameter; for (const qli_par* parameter = message->msg_parameters; parameter;
parameter = parameter->par_next) parameter = parameter->par_next)
{ {
if (parameter->par_value) { if (parameter->par_value) {
STUFF(blr_assignment); STUFF(blr_assignment);
@ -1465,8 +1462,7 @@ static void gen_request( qli_req* request)
// Build declarations for all messages. // Build declarations for all messages.
for (qli_msg* message = request->req_messages; message; for (qli_msg* message = request->req_messages; message; message = message->msg_next)
message = message->msg_next)
{ {
message->msg_length = 0; message->msg_length = 0;
for (param = message->msg_parameters; param; param = param->par_next) { 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++; param->par_parameter = message->msg_parameter++;
const USHORT alignment = type_alignments[desc->dsc_dtype]; const USHORT alignment = type_alignments[desc->dsc_dtype];
if (alignment) if (alignment)
message->msg_length = message->msg_length = FB_ALIGN(message->msg_length, alignment);
FB_ALIGN(message->msg_length, alignment);
param->par_offset = message->msg_length; param->par_offset = message->msg_length;
message->msg_length += desc->dsc_length; message->msg_length += desc->dsc_length;
qli_par* missing_param = param->par_missing; qli_par* missing_param = param->par_missing;
if (missing_param) { if (missing_param) {
missing_param->par_parameter = message->msg_parameter++; missing_param->par_parameter = message->msg_parameter++;
message->msg_length = message->msg_length = FB_ALIGN(message->msg_length, sizeof(USHORT));
FB_ALIGN(message->msg_length, sizeof(USHORT));
desc = &missing_param->par_desc; desc = &missing_param->par_desc;
missing_param->par_offset = message->msg_length; missing_param->par_offset = message->msg_length;
message->msg_length += desc->dsc_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; request->req_flags |= REQ_group_by;
STUFF(list->nod_count); STUFF(list->nod_count);
qli_nod** ptr = list->nod_arg; qli_nod** ptr = list->nod_arg;
for (const qli_nod* const* const end = ptr + list->nod_count; for (const qli_nod* const* const end = ptr + list->nod_count; ptr < end; ++ptr)
ptr < end; ++ptr)
{ {
gen_expression(*ptr, request); 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; request->req_flags |= REQ_project;
qli_nod** ptr = node->nod_arg; qli_nod** ptr = node->nod_arg;
for (qli_nod** const end = ptr + node->nod_count * 2; ptr < end; for (qli_nod** const end = ptr + node->nod_count * 2; ptr < end; ptr += 2)
ptr += 2)
{ {
if (operatr == blr_sort) if (operatr == blr_sort)
STUFF((ptr[1]) ? blr_descending : blr_ascending); STUFF((ptr[1]) ? blr_descending : blr_ascending);
@ -1698,8 +1690,7 @@ static void gen_statement( qli_nod* node, qli_req* request)
case nod_list: case nod_list:
{ {
qli_nod** ptr = node->nod_arg; qli_nod** ptr = node->nod_arg;
for (const qli_nod* const* const end = ptr + node->nod_count; for (const qli_nod* const* const end = ptr + node->nod_count; ptr < end; ++ptr)
ptr < end; ++ptr)
{ {
gen_statement(*ptr, request); 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*); 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"; *topic++ = "QLI";
NAM *ptr, *end; NAM *ptr, *end;
for (ptr = (NAM *) node->syn_arg, end = ptr + node->syn_count; ptr < end; for (ptr = (NAM *) node->syn_arg, end = ptr + node->syn_count; ptr < end; ptr++)
ptr++)
{ {
*topic++ = (*ptr)->nam_string; *topic++ = (*ptr)->nam_string;
} }
@ -141,7 +140,8 @@ static int additional_topics( const TEXT* parent, const TEXT* banner, const TEXT
USHORT topics = 0; USHORT topics = 0;
USHORT l = strlen(parent); 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) if (QLI_abort)
return 0; return 0;
const TEXT* p = X.TOPIC; const TEXT* p = X.TOPIC;
@ -257,7 +257,8 @@ static void print_topic(
TEXT* const next = p; TEXT* const next = p;
USHORT count = 0; 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 STARTING WITH * topics AND X.PARENT EQ parent) OR
(X.TOPIC = X.FACILITY AND X.TOPIC = *topics AND X.TOPIC = X.PARENT) (X.TOPIC = X.FACILITY AND X.TOPIC = *topics AND X.TOPIC = X.PARENT)
count++; count++;
@ -268,7 +269,8 @@ static void print_topic(
count = 0; 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 STARTING WITH * topics AND X.PARENT EQ parent) OR
(X.TOPIC = X.FACILITY AND X.TOPIC = *topics AND X.TOPIC = X.PARENT) (X.TOPIC = X.FACILITY AND X.TOPIC = *topics AND X.TOPIC = X.PARENT)
SORTED BY X.TOPIC SORTED BY X.TOPIC
@ -291,8 +293,7 @@ static void print_topic(
*p++ = *q++; *p++ = *q++;
*p = 0; *p = 0;
if (level < depth) if (level < depth)
print_topic(level + 1, depth, topics + 1, max_level, string, print_topic(level + 1, depth, topics + 1, max_level, string, error_flag);
error_flag);
else { else {
printf("\n%s\n\n", strip(string)); printf("\n%s\n\n", strip(string));
QLI_skip_line = true; QLI_skip_line = true;
@ -305,8 +306,7 @@ static void print_topic(
ERRQ_msg_format(81, sizeof(banner), banner, SafeArg() << INDENT); ERRQ_msg_format(81, sizeof(banner), banner, SafeArg() << INDENT);
// Msg81 %sSub-topics available: // Msg81 %sSub-topics available:
if (additional_topics(string, banner, INDENT)) if (additional_topics(string, banner, INDENT))
print_more(level, depth, topics, max_level, string, print_more(level, depth, topics, max_level, string, error_flag);
error_flag);
} }
END_FOR; 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) for (qli_symbol* old = hash_table[h]; old; old = old->sym_collision)
{ {
if (scompare(symbol->sym_string, symbol->sym_length, if (scompare(symbol->sym_string, symbol->sym_length, old->sym_string, old->sym_length))
old->sym_string, old->sym_length))
{ {
symbol->sym_homonym = old->sym_homonym; symbol->sym_homonym = old->sym_homonym;
old->sym_homonym = symbol; old->sym_homonym = symbol;
@ -152,7 +151,7 @@ qli_symbol* HSH_lookup(const SCHAR* string, int length)
scompare = scompare_sens; scompare = scompare_sens;
} }
for (qli_symbol* symbol = hash_table[hash(string, length)]; symbol; 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)) if (scompare(string, length, symbol->sym_string, symbol->sym_length))
return symbol; return symbol;

View File

@ -66,7 +66,7 @@ static int nextchar(const bool);
static void next_line(const bool); static void next_line(const bool);
static void retchar(); static void retchar();
static bool scan_number(SSHORT, TEXT **); static bool scan_number(SSHORT, TEXT **);
static int skip_white(void); static int skip_white();
static qli_lls* QLI_statements; static qli_lls* QLI_statements;
static int QLI_position; 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; qli_line* temp;
for (temp = QLI_line; for (temp = QLI_line; temp->line_next && QLI_statements; temp = temp->line_next)
temp->line_next && QLI_statements;
temp = temp->line_next)
{ {
if (temp->line_next->line_position == (IPTR) QLI_statements->lls_object) if (temp->line_next->line_position == (IPTR) QLI_statements->lls_object)
return; 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); qli_line* temp = (qli_line*) ALLOCPV(type_line, QLI_token->tok_length);
temp->line_source_blob = blob; temp->line_source_blob = blob;
strncpy(temp->line_source_name, QLI_token->tok_string, strncpy(temp->line_source_name, QLI_token->tok_string, QLI_token->tok_length);
QLI_token->tok_length);
temp->line_type = line_blob; temp->line_type = line_blob;
temp->line_database = database; temp->line_database = database;
temp->line_size = sizeof(temp->line_data); 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; *p++ = c;
QLI_token->tok_position = QLI_line->line_position + QLI_token->tok_position = QLI_line->line_position + QLI_line->line_ptr - QLI_line->line_data - 1;
QLI_line->line_ptr - QLI_line->line_data - 1;
// On end of file, generate furious but phone end of line tokens // 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 (QLI_line->line_type == line_blob) {
// If the current blob segment contains another line, use it // If the current blob segment contains another line, use it
if ((p = QLI_line->line_ptr) != QLI_line->line_data if ((p = QLI_line->line_ptr) != QLI_line->line_data && p[-1] == '\n' && *p)
&& p[-1] == '\n' && *p)
{ {
flag = true; flag = true;
} }
@ -995,8 +990,7 @@ static void next_line(const bool eof_ok)
p = QLI_line->line_data; p = QLI_line->line_data;
QLI_line->line_ptr = QLI_line->line_data; QLI_line->line_ptr = QLI_line->line_data;
flag = PRO_get_line(QLI_line->line_source_blob, p, flag = PRO_get_line(QLI_line->line_source_blob, p, QLI_line->line_size);
QLI_line->line_size);
if (flag && QLI_echo) if (flag && QLI_echo)
printf("%s", QLI_line->line_data); 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 #ifndef QLI_LEX_PROTO_H
#define QLI_LEX_PROTO_H #define QLI_LEX_PROTO_H
bool LEX_active_procedure (void); bool LEX_active_procedure ();
void LEX_edit (SLONG, SLONG); void LEX_edit (SLONG, SLONG);
qli_tok* LEX_edit_string(void); qli_tok* LEX_edit_string();
qli_tok* LEX_filename(void); qli_tok* LEX_filename();
void LEX_fini (void); void LEX_fini ();
void LEX_flush (void); void LEX_flush ();
bool LEX_get_line (const TEXT*, TEXT *, int); bool LEX_get_line (const TEXT*, TEXT *, int);
void LEX_init (void); void LEX_init ();
void LEX_mark_statement (void); void LEX_mark_statement ();
void LEX_pop_line (void); void LEX_pop_line ();
void LEX_procedure(dbb*, FB_API_HANDLE); void LEX_procedure(dbb*, FB_API_HANDLE);
bool LEX_push_file (const TEXT*, const bool); bool LEX_push_file (const TEXT*, const bool);
bool LEX_push_string (const TEXT* const); bool LEX_push_string (const TEXT* const);
void LEX_put_procedure (FB_API_HANDLE, SLONG, SLONG); void LEX_put_procedure (FB_API_HANDLE, SLONG, SLONG);
void LEX_real (void); void LEX_real ();
qli_lls* LEX_statement_list(void); qli_lls* LEX_statement_list();
qli_tok* LEX_token(void); qli_tok* LEX_token();
#endif // QLI_LEX_PROTO_H #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$FILES", "RDB$SHADOW_NUMBER", DBB_cap_shadowing },
{ "RDB$TYPES", "RDB$TYPE_NAME", DBB_cap_types }, { "RDB$TYPES", "RDB$TYPE_NAME", DBB_cap_types },
{ "RDB$FIELDS", "RDB$DIMENSIONS", DBB_cap_dimensions }, { "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$RELATION_FIELDS", "RDB$SYSTEM_FLAG", DBB_cap_rfr_sys_flag },
{ "RDB$FILTERS", "RDB$FUNCTION_NAME", DBB_cap_filters }, { "RDB$FILTERS", "RDB$FUNCTION_NAME", DBB_cap_filters },
{ "RDB$INDICES", "RDB$INDEX_TYPE", DBB_cap_index_type }, { "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$RELATION_NAME, relation->rel_symbol->sym_string);
strcpy(X.RDB$INDEX_NAME, symbol->sym_string); strcpy(X.RDB$INDEX_NAME, symbol->sym_string);
X.RDB$UNIQUE_FLAG = (node->syn_flags & s_dfi_flag_unique); 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$SEGMENT_COUNT = fields->syn_count;
X.RDB$INDEX_TYPE = X.RDB$INDEX_TYPE = (node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
(node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
END_STORE END_STORE
ON_ERROR ON_ERROR
rollback_update(database); rollback_update(database);
@ -281,8 +280,7 @@ void MET_define_index( qli_syntax* node)
MET_fields(relation); MET_fields(relation);
bool present = false; bool present = false;
for (qli_fld* field = relation->rel_fields; field; for (qli_fld* field = relation->rel_fields; field; field = field->fld_next)
field = field->fld_next)
{ {
if (!(strcmp((*ptr)->nam_string, field->fld_name->sym_string))) { if (!(strcmp((*ptr)->nam_string, field->fld_name->sym_string))) {
present = true; present = true;
@ -293,7 +291,7 @@ void MET_define_index( qli_syntax* node)
if (!present) { if (!present) {
rollback_update(database); rollback_update(database);
ERRQ_print_error(236, SafeArg() << (*ptr)->nam_string << 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 // 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); clone_fields(relation, source);
else { else {
USHORT position = 1; USHORT position = 1;
for (qli_fld* field = relation->rel_fields; field; for (qli_fld* field = relation->rel_fields; field; field = field->fld_next, position++)
field = field->fld_next, position++)
{ {
add_field(relation, field, position); add_field(relation, field, position);
} }
@ -432,8 +429,7 @@ void MET_define_sql_relation( qli_rel* relation)
STUFF_WORD(1); STUFF_WORD(1);
USHORT position = 1; USHORT position = 1;
for (qli_fld* field = relation->rel_fields; field; for (qli_fld* field = relation->rel_fields; field; field = field->fld_next, position++)
field = field->fld_next, position++)
{ {
add_sql_field(relation, field, position, rlb); 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]) FOR(REQUEST_HANDLE database->dbb_requests[REQ_relation_id])
X IN DB.RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ symbol->sym_string X IN DB.RDB$RELATIONS WITH X.RDB$RELATION_NAME EQ symbol->sym_string
relation->rel_id = X.RDB$RELATION_ID; relation->rel_id = X.RDB$RELATION_ID;
symbol = symbol = make_symbol(X.RDB$RELATION_NAME, sizeof(X.RDB$RELATION_NAME));
make_symbol(X.RDB$RELATION_NAME, sizeof(X.RDB$RELATION_NAME));
symbol->sym_type = SYM_relation; symbol->sym_type = SYM_relation;
symbol->sym_object = (BLK) relation; symbol->sym_object = (BLK) relation;
relation->rel_symbol = symbol; relation->rel_symbol = symbol;
@ -522,9 +517,11 @@ void MET_delete_database( DBB dbb)
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
if (isc_attach_database(status_vector, 0, dbb->dbb_filename, 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()))) reinterpret_cast<const char*>(dpb.getBuffer())))
ERRQ_database_error(dbb, status_vector); {
ERRQ_database_error(dbb, status_vector);
}
qli_lls* stack = NULL; qli_lls* stack = NULL;
@ -797,9 +794,8 @@ void MET_fields( qli_rel* relation)
field->fld_segment_length = 80; field->fld_segment_length = 80;
else { else {
field->fld_segment_length = field->fld_segment_length =
((RFL.RDB$SEGMENT_LENGTH) < 256 ((RFL.RDB$SEGMENT_LENGTH) < 256 && (RFL.RDB$SEGMENT_LENGTH > 0)) ?
&& (RFL.RDB$SEGMENT_LENGTH > RFL.RDB$SEGMENT_LENGTH : 255;
0)) ? RFL.RDB$SEGMENT_LENGTH : 255;
} }
ISC_QUAD* blob = & RFR.RDB$QUERY_HEADER; ISC_QUAD* blob = & RFR.RDB$QUERY_HEADER;
@ -813,23 +809,21 @@ void MET_fields( qli_rel* relation)
field->fld_flags |= FLD_computed; field->fld_flags |= FLD_computed;
field->fld_dtype = MET_get_datatype(RFL.RDB$FIELD_TYPE); field->fld_dtype = MET_get_datatype(RFL.RDB$FIELD_TYPE);
field->fld_length = field->fld_length = field_length(field->fld_dtype, RFL.RDB$FIELD_LENGTH);
field_length(field->fld_dtype, RFL.RDB$FIELD_LENGTH);
if (field->fld_dtype == dtype_varying) if (field->fld_dtype == dtype_varying)
field->fld_length += sizeof(SSHORT); field->fld_length += sizeof(SSHORT);
field->fld_sub_type = RFL.RDB$FIELD_SUB_TYPE; field->fld_sub_type = RFL.RDB$FIELD_SUB_TYPE;
field->fld_sub_type_missing = RFL.RDB$FIELD_SUB_TYPE.NULL; field->fld_sub_type_missing = RFL.RDB$FIELD_SUB_TYPE.NULL;
if (!RFL.RDB$MISSING_VALUE.NULL) if (!RFL.RDB$MISSING_VALUE.NULL)
field->fld_missing = field->fld_missing = missing_value(RFL.RDB$MISSING_VALUE, field->fld_name);
missing_value(RFL.RDB$MISSING_VALUE, field->fld_name);
if (!(field->fld_edit_string = if (!(field->fld_edit_string =
make_string(RFR.RDB$EDIT_STRING, sizeof(RFR.RDB$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_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); field->fld_validation = parse_blr_blob(RFL.RDB$VALIDATION_BLR, field->fld_name);
if (MET_dimensions(database, RFL.RDB$FIELD_NAME) > 0) if (MET_dimensions(database, RFL.RDB$FIELD_NAME) > 0)
field->fld_flags |= FLD_array; field->fld_flags |= FLD_array;
END_FOR END_FOR
@ -1005,7 +999,7 @@ void MET_index_info(DBB db,
p = fb_utils::exact_name(SEG.RDB$FIELD_NAME); p = fb_utils::exact_name(SEG.RDB$FIELD_NAME);
if (p + strlen(p) + 2 > buffer + bufsize) if (p + strlen(p) + 2 > buffer + bufsize)
break; break;
while (*p) { while (*p) {
*b++ = *p++; *b++ = *p++;
} }
@ -1109,7 +1103,7 @@ FB_API_HANDLE MET_meta_transaction(DBB database, bool update_flag)
if (!transaction && if (!transaction &&
((database->dbb_capabilities & DBB_cap_multi_trans) || ((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, if (isc_start_transaction(status_vector, &transaction, 1,
&database->dbb_handle, sizeof(tpb), tpb)) &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)) if (!(gds_trans = database->dbb_transaction))
gds_trans = MET_transaction(nod_start_trans, database); gds_trans = MET_transaction(nod_start_trans, database);
} }
// otherwise make one more effort to start the transaction
else if (!gds_trans) else if (!gds_trans)
{ {
// otherwise make one more effort to start the transaction
START_TRANSACTION START_TRANSACTION
ON_ERROR ON_ERROR
ERRQ_database_error(database, status_vector); 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_TYPE = blr_dtypes[field->fld_dtype];
X.RDB$FIELD_SCALE = field->fld_scale; X.RDB$FIELD_SCALE = field->fld_scale;
X.RDB$FIELD_LENGTH = (field->fld_dtype == dtype_varying) ? X.RDB$FIELD_LENGTH = (field->fld_dtype == dtype_varying) ?
field->fld_length - field->fld_length - sizeof(SSHORT) : field->fld_length;
sizeof(SSHORT) : field->fld_length;
} }
if (!field->fld_sub_type_missing) { if (!field->fld_sub_type_missing) {
X.RDB$FIELD_SUB_TYPE.NULL = FALSE; X.RDB$FIELD_SUB_TYPE.NULL = FALSE;
@ -1240,8 +1231,7 @@ void MET_modify_field( DBB database, qli_fld* field)
{ {
qli_rel* relation; qli_rel* relation;
if (symbol->sym_type == SYM_relation && if (symbol->sym_type == SYM_relation &&
(relation = (qli_rel*) symbol->sym_object) && (relation = (qli_rel*) symbol->sym_object) && relation->rel_database == database)
relation->rel_database == database)
{ {
delete_fields(relation); delete_fields(relation);
MET_fields(relation); MET_fields(relation);
@ -1279,11 +1269,9 @@ void MET_modify_index( qli_syntax* node)
if (node->syn_flags & s_dfi_flag_selectivity) if (node->syn_flags & s_dfi_flag_selectivity)
X.RDB$UNIQUE_FLAG = (node->syn_flags & s_dfi_flag_unique); X.RDB$UNIQUE_FLAG = (node->syn_flags & s_dfi_flag_unique);
if (node->syn_flags & s_dfi_flag_activity) if (node->syn_flags & s_dfi_flag_activity)
X.RDB$INDEX_INACTIVE = X.RDB$INDEX_INACTIVE = (node->syn_flags & s_dfi_flag_inactive) ? TRUE : FALSE;
(node->syn_flags & s_dfi_flag_inactive);
if (node->syn_flags & s_dfi_flag_order) if (node->syn_flags & s_dfi_flag_order)
X.RDB$INDEX_TYPE = X.RDB$INDEX_TYPE = (node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
(node->syn_flags & s_dfi_flag_descending) ? TRUE : FALSE;
if (node->syn_flags & s_dfi_flag_statistics) if (node->syn_flags & s_dfi_flag_statistics)
X.RDB$STATISTICS = -1.0; X.RDB$STATISTICS = -1.0;
END_MODIFY END_MODIFY
@ -1444,11 +1432,11 @@ void MET_ready( qli_syntax* node, USHORT create_flag)
dbb = (DBB) *ptr; dbb = (DBB) *ptr;
if (create_flag) if (create_flag)
isc_create_database(status_vector, 0, dbb->dbb_filename, 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); reinterpret_cast<const char*>(dpb.getBuffer()), 0);
else else
isc_attach_database(status_vector, 0, dbb->dbb_filename, 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())); reinterpret_cast<const char*>(dpb.getBuffer()));
if (status_vector[1]) if (status_vector[1])
break; 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$RELATION_NAME EQ relation_name->sym_string AND
X.RDB$FIELD_NAME EQ field_name->sym_string X.RDB$FIELD_NAME EQ field_name->sym_string
rollback_update(relation->rel_database); rollback_update(relation->rel_database);
ERRQ_print_error(251, SafeArg() << field_name->sym_string << ERRQ_print_error(251, SafeArg() << field_name->sym_string << relation_name->sym_string);
relation_name->sym_string);
// Msg251 Field %s already exists in relation %s // Msg251 Field %s already exists in relation %s
END_FOR END_FOR
ON_ERROR 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$RELATION_NAME EQ relation_name->sym_string AND
X.RDB$FIELD_NAME EQ field_name->sym_string X.RDB$FIELD_NAME EQ field_name->sym_string
rollback_update(relation->rel_database); rollback_update(relation->rel_database);
ERRQ_print_error(251, SafeArg() << field_name->sym_string << ERRQ_print_error(251, SafeArg() << field_name->sym_string << relation_name->sym_string);
relation_name->sym_string);
// Msg251 Field %s already exists in relation %s // Msg251 Field %s already exists in relation %s
END_FOR END_FOR
ON_ERROR 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(isc_dyn_fld_length);
STUFF_WORD(2); STUFF_WORD(2);
const USHORT l = (field->fld_dtype == dtype_varying) const USHORT l = (field->fld_dtype == dtype_varying) ?
? field->fld_length - sizeof(SSHORT) : field->fld_length; field->fld_length - sizeof(SSHORT) : field->fld_length;
STUFF_WORD(l); STUFF_WORD(l);
STUFF(isc_dyn_fld_scale); 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; ISC_STATUS_ARRAY status_vector;
DBB source_dbb = DBB source_dbb = (source->rel_database) ? source->rel_database : QLI_databases;
(source->rel_database) ? source->rel_database : QLI_databases;
DB = source_dbb->dbb_handle; DB = source_dbb->dbb_handle;
UserBlob source_blob(status_vector); 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 // Msg252 datatype can not be changed locally
} }
if (global_field if (global_field && !(check_global_field(database, NULL, global_field->sym_string)))
&&
!(check_global_field(database, NULL, global_field->sym_string)))
{ {
rollback_update(database); rollback_update(database);
ERRQ_print_error(253, global_field->sym_string); ERRQ_print_error(253, global_field->sym_string);
// Msg253 global field %s does not exist // Msg253 global field %s does not exist
} }
// Modify RFR // Modify RFR
USHORT count = 0; USHORT count = 0;
FOR(REQUEST_HANDLE database->dbb_requests[REQ_mdf_rfr]) FOR(REQUEST_HANDLE database->dbb_requests[REQ_mdf_rfr])
@ -1999,8 +1982,8 @@ static bool check_global_field(DBB database,
if (field->fld_dtype && if (field->fld_dtype &&
(X.RDB$FIELD_TYPE != blr_dtypes[field->fld_dtype] || (X.RDB$FIELD_TYPE != blr_dtypes[field->fld_dtype] ||
X.RDB$FIELD_LENGTH != static_cast<SLONG>( X.RDB$FIELD_LENGTH != static_cast<SLONG>(
((field->fld_dtype == dtype_varying) ? field->fld_length - ((field->fld_dtype == dtype_varying) ?
sizeof(SSHORT) : field->fld_length)) || field->fld_length - sizeof(SSHORT) : field->fld_length)) ||
X.RDB$FIELD_SCALE != field->fld_scale)) X.RDB$FIELD_SCALE != field->fld_scale))
{ {
rollback_update(database); rollback_update(database);
@ -2008,8 +1991,7 @@ static bool check_global_field(DBB database,
// Msg255 Datatype conflict with existing global field %s // Msg255 Datatype conflict with existing global field %s
} }
field->fld_dtype = MET_get_datatype(X.RDB$FIELD_TYPE); field->fld_dtype = MET_get_datatype(X.RDB$FIELD_TYPE);
field->fld_length = field->fld_length = field_length(field->fld_dtype, X.RDB$FIELD_LENGTH);
field_length(field->fld_dtype, X.RDB$FIELD_LENGTH);
if (field->fld_dtype == dtype_varying) { if (field->fld_dtype == dtype_varying) {
field->fld_length += sizeof(SSHORT); 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; field->fld_sub_type_missing = X.RDB$FIELD_SUB_TYPE.NULL;
if (!field->fld_edit_string) if (!field->fld_edit_string)
{ {
field->fld_edit_string = field->fld_edit_string = make_string(X.RDB$EDIT_STRING, sizeof(X.RDB$EDIT_STRING));
make_string(X.RDB$EDIT_STRING, sizeof(X.RDB$EDIT_STRING));
} }
if (!field->fld_query_name) if (!field->fld_query_name)
{ {
field->fld_query_name = field->fld_query_name = make_symbol(X.RDB$QUERY_NAME, sizeof(X.RDB$QUERY_NAME));
make_symbol(X.RDB$QUERY_NAME, sizeof(X.RDB$QUERY_NAME));
} }
if (!field->fld_query_header) if (!field->fld_query_header)
{ {
ISC_QUAD& blob = X.RDB$QUERY_HEADER; ISC_QUAD& blob = X.RDB$QUERY_HEADER;
if (!UserBlob::blobIsNull(blob)) if (!UserBlob::blobIsNull(blob))
{ {
field->fld_query_header = field->fld_query_header = get_query_header(database, blob);
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) && if ((source->rel_database->dbb_capabilities & DBB_cap_rfr_sys_flag) &&
(target->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 IN DB.RDB$RELATION_FIELDS WITH
S_RFR.RDB$FIELD_NAME = Y.RDB$FIELD_NAME AND S_RFR.RDB$FIELD_NAME = Y.RDB$FIELD_NAME AND
S_RFR.RDB$RELATION_NAME = Y.RDB$RELATION_NAME S_RFR.RDB$RELATION_NAME = Y.RDB$RELATION_NAME
if (!S_RFR.RDB$SYSTEM_FLAG.NULL) { if (!S_RFR.RDB$SYSTEM_FLAG.NULL) {
STUFF(isc_dyn_system_flag); STUFF(isc_dyn_system_flag);
STUFF_WORD(2); STUFF_WORD(2);
STUFF_WORD(S_RFR.RDB$SYSTEM_FLAG); STUFF_WORD(S_RFR.RDB$SYSTEM_FLAG);
} }
END_FOR END_FOR
ON_ERROR ON_ERROR
rollback_update(target->rel_database); rollback_update(target->rel_database);
ERRQ_database_error(source->rel_database, gds_status); ERRQ_database_error(source->rel_database, gds_status);
END_ERROR; END_ERROR;
}
if (!F.RDB$COMPUTED_BLR.NULL) 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 Y.RDB$FIELD_NAME = RFR.RDB$FIELD_SOURCE REDUCED TO Y.RDB$FIELD_NAME
if (!Y.RDB$COMPUTED_BLR.NULL || if (!Y.RDB$COMPUTED_BLR.NULL ||
(!fb_utils::implicit_domain(RFR.RDB$FIELD_NAME) && (!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; 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) || if ((A.RDB$FIELD_TYPE != Y.RDB$FIELD_TYPE) ||
(A.RDB$FIELD_LENGTH != Y.RDB$FIELD_LENGTH) || (A.RDB$FIELD_LENGTH != Y.RDB$FIELD_LENGTH) ||
(A.RDB$FIELD_SCALE.NULL != Y.RDB$FIELD_SCALE.NULL) || (A.RDB$FIELD_SCALE.NULL != Y.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_SCALE != Y.RDB$FIELD_SCALE)) || (A.RDB$FIELD_SUB_TYPE.NULL != Y.RDB$FIELD_SUB_TYPE.NULL) ||
(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_SUB_TYPE.NULL)
&& (A.RDB$FIELD_SUB_TYPE != Y.RDB$FIELD_SUB_TYPE)))
{ {
TEXT* name = ALLQ_malloc((SLONG) sizeof(Y.RDB$FIELD_NAME)); 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 (dbb->dbb_transaction)
if (isc_commit_transaction(status, &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 (dbb->dbb_proc_trans && (dbb->dbb_capabilities & DBB_cap_multi_trans))
if (isc_commit_transaction(status, &dbb->dbb_proc_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 (dbb->dbb_meta_trans && (dbb->dbb_capabilities & DBB_cap_multi_trans))
if (isc_commit_transaction(status, &dbb->dbb_meta_trans)) if (isc_commit_transaction(status, &dbb->dbb_meta_trans))
status = alt_vector; status = alt_vector;
isc_detach_database(status, &dbb->dbb_handle); isc_detach_database(status, &dbb->dbb_handle);
@ -2648,8 +2626,8 @@ static int field_length( USHORT dtype, USHORT length)
return sizeof(float); return sizeof(float);
case dtype_double: case dtype_double:
return sizeof(double); return sizeof(double);
case dtype_int64: case dtype_int64:
return sizeof(SINT64); return sizeof(SINT64);
case dtype_sql_time: case dtype_sql_time:
case dtype_sql_date: case dtype_sql_date:
@ -2687,7 +2665,7 @@ static void get_database_type( DBB new_dbb)
if (status_vector[1]) if (status_vector[1])
ERRQ_database_error(new_dbb, gds_status); ERRQ_database_error(new_dbb, gds_status);
UCHAR* p = buffer; const UCHAR* p = buffer;
while (*p != isc_info_end && p < buffer + sizeof(buffer)) { while (*p != isc_info_end && p < buffer + sizeof(buffer)) {
UCHAR item = *p++; UCHAR item = *p++;
@ -2737,10 +2715,13 @@ static TEXT *get_query_header( DBB database, ISC_QUAD& blob_id)
} }
TEXT* p = header; 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" // CVC: No bounds check here: it's assumed that 1024 is enough, but "p"
// might overflow "header" eventually. // might overflow "header" eventually.
for (;;) { for (;;) {
if (p >= end)
break;
size_t length; size_t length;
if (!blob.getSegment(sizeof(buffer), buffer, length)) if (!blob.getSegment(sizeof(buffer), buffer, length))
break; break;
@ -2751,10 +2732,10 @@ static TEXT *get_query_header( DBB database, ISC_QUAD& blob_id)
if (*q == '"') if (*q == '"')
do { do {
*p++ = *q++; *p++ = *q++;
} while (*q); } while (*q && p < end);
else { else {
*p++ = '"'; *p++ = '"';
while (*q) while (*q && p < end)
*p++ = *q++; *p++ = *q++;
*p++ = '"'; *p++ = '"';
} }
@ -2876,8 +2857,7 @@ static void install( dbb* old_dbb)
Y.RDB$ARGUMENT_POSITION EQ X.RDB$RETURN_ARGUMENT 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_dtype = MET_get_datatype(Y.RDB$FIELD_TYPE);
function->fun_return.dsc_length = function->fun_return.dsc_length =
field_length(function->fun_return.dsc_dtype, field_length(function->fun_return.dsc_dtype, Y.RDB$FIELD_LENGTH);
Y.RDB$FIELD_LENGTH);
function->fun_return.dsc_scale = Y.RDB$FIELD_SCALE; function->fun_return.dsc_scale = Y.RDB$FIELD_SCALE;
END_FOR END_FOR
ON_ERROR ON_ERROR
@ -2943,6 +2923,8 @@ static TEXT *make_string( TEXT* string, SSHORT length)
* trailing blanks. If there's nothing left, return NULL. * trailing blanks. If there's nothing left, return NULL.
* *
**************************************/ **************************************/
fb_assert(length > 0);
string[length] = 0; string[length] = 0;
if (!(length = truncate_string(string))) if (!(length = truncate_string(string)))
@ -2980,10 +2962,7 @@ static qli_symbol* make_symbol( TEXT* string, SSHORT length)
symbol->sym_length = length; symbol->sym_length = length;
TEXT* p = symbol->sym_name; TEXT* p = symbol->sym_name;
symbol->sym_string = p; symbol->sym_string = p;
do { memcpy(p, string, length);
*p++ = *string++;
} while (--length);
return symbol; 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); qli_syntax* element = parse_blr_blob(blob_id, symbol);
if (element) if (element)
return ((qli_const*) element->syn_arg[0]); 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 // Look for desireable fields in system relations
for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation; for (const rfr_tab_t* rel_field_table = rfr_table; rel_field_table->relation; rel_field_table++)
rel_field_table++)
{ {
FOR(REQUEST_HANDLE req) x IN DB.RDB$RELATION_FIELDS FOR(REQUEST_HANDLE req) x IN DB.RDB$RELATION_FIELDS
WITH x.RDB$RELATION_NAME = rel_field_table->relation 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]; qli_syntax* fields = node->syn_arg[s_grant_fields];
NAM* name = (NAM*) names->syn_arg; NAM* name = (NAM*) names->syn_arg;
for (NAM* const end = name + names->syn_count; for (NAM* const end = name + names->syn_count; name < end; name++)
name < end; name++)
{ {
if (fields->syn_count) { if (fields->syn_count) {
NAM* field = (NAM *) fields->syn_arg; NAM* field = (NAM *) fields->syn_arg;
@ -3540,8 +3517,7 @@ static void sql_grant_revoke( qli_syntax* node, USHORT type)
} }
} }
else else
stuff_priv(rlb, type, relation_name, privileges, stuff_priv(rlb, type, relation_name, privileges, (*name)->nam_string, NULL);
(*name)->nam_string, NULL);
} }
STUFF(isc_dyn_end); 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_index(qli_syntax*);
void MET_modify_relation(qli_rel*, qli_fld*); void MET_modify_relation(qli_rel*, qli_fld*);
void MET_ready(qli_syntax*, USHORT); 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_alter_table(qli_rel*, qli_fld*);
void MET_sql_cr_view(qli_syntax*); void MET_sql_cr_view(qli_syntax*);
void MET_sql_grant(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 void date_error(const TEXT*, const USHORT);
static double double_from_text(const dsc* desc); static double double_from_text(const dsc* desc);
static void timestamp_to_text(SLONG[2], DSC *); static void sql_date_to_text(const SLONG[1], DSC*);
static void sql_time_to_text(ULONG[1], DSC *); static void sql_time_to_text(const ULONG[1], DSC*);
static void sql_date_to_text(SLONG[1], DSC *); static void timestamp_to_text(const SLONG[2], DSC*);
static void mover_error(int, USHORT, USHORT); static void mover_error(int, USHORT, USHORT);
static void now_to_date(const tm*, SLONG[2]); static void now_to_date(const tm*, SLONG[2]);
static void numeric_to_text(const dsc*, dsc*); 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 // Handle the simple (matched) ones first
if (arg1->dsc_dtype == arg2->dsc_dtype && if (arg1->dsc_dtype == arg2->dsc_dtype && arg1->dsc_scale == arg2->dsc_scale)
arg1->dsc_scale == arg2->dsc_scale)
{ {
const UCHAR* p1 = arg1->dsc_address; const UCHAR* p1 = arg1->dsc_address;
const UCHAR* p2 = arg2->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[0] = date[0];
date2[1] = 0; date2[1] = 0;
isc_decode_date((ISC_QUAD*) date2, &times); isc_decode_date((const ISC_QUAD*) date2, &times);
TEXT temp[35]; TEXT temp[35];
sprintf(temp, "%2d-%.3s-%04d", times.tm_mday, 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[0] = 0;
date2[1] = date[0]; date2[1] = date[0];
isc_decode_date((ISC_QUAD*) date2, &times); isc_decode_date((const ISC_QUAD*) date2, &times);
TEXT temp[35]; TEXT temp[35];
sprintf(temp, " %2d:%.2d:%.2d.%.4"SLONGFORMAT, times.tm_hour, times.tm_min, 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; tm times;
isc_decode_date((ISC_QUAD*)date, &times); isc_decode_date((const ISC_QUAD*) date, &times);
TEXT temp[35]; TEXT temp[35];
sprintf(temp, "%2d-%.3s-%04d", times.tm_mday, 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) || if ((to->dsc_dtype == dtype_text && length > to->dsc_length) ||
(to->dsc_dtype == dtype_cstring && length >= to->dsc_length) || (to->dsc_dtype == dtype_cstring && length >= to->dsc_length) ||
(to->dsc_dtype == dtype_varying (to->dsc_dtype == dtype_varying && length > to->dsc_length - sizeof(SSHORT)))
&& length > to->dsc_length - sizeof(SSHORT)))
{ {
IBERROR(57); // Msg 57 overflow during conversion IBERROR(57); // Msg 57 overflow during conversion
} }
@ -1287,8 +1285,7 @@ static void numeric_to_text(const dsc* from, dsc* to)
return; return;
} }
*(SSHORT *) (to->dsc_address) = *(SSHORT *) (to->dsc_address) = (UCHAR *) q - to->dsc_address - sizeof(SSHORT);
(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 || if (times.tm_year != times2.tm_year ||
times.tm_mon != times2.tm_mon || times.tm_mday != times2.tm_mday) times.tm_mon != times2.tm_mon || times.tm_mday != times2.tm_mday)
{
date_error(string, length); date_error(string, length);
}
while (precision++ < 4) while (precision++ < 4)
components[6] *= 10; components[6] *= 10;

View File

@ -23,12 +23,12 @@
#include "firebird.h" #include "firebird.h"
int pipe(void) int pipe()
{ {
return -1; return -1;
} }
int vfork(void) int vfork()
{ {
return -1; 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 KWWORDS tok_keyword; // keyword number, if recognized
SLONG tok_position; // byte number in input stream SLONG tok_position; // byte number in input stream
USHORT tok_length; USHORT tok_length;
qli_tok* tok_next; //qli_tok* tok_next;
qli_tok* tok_prior; //qli_tok* tok_prior;
TEXT tok_string [2]; TEXT tok_string [2];
}; };
@ -65,8 +65,8 @@ enum line_t {
line_stdin, line_stdin,
line_blob, line_blob,
line_file, line_file,
line_string, line_string
line_edit //, line_edit
}; };
struct qli_line { struct qli_line {
@ -79,7 +79,7 @@ struct qli_line {
SLONG line_position; SLONG line_position;
FB_API_HANDLE line_source_blob; // Blob handle FB_API_HANDLE line_source_blob; // Blob handle
FILE* line_source_file; // File handle FILE* line_source_file; // File handle
enum line_t line_type; line_t line_type;
TEXT line_data[256]; TEXT line_data[256];
TEXT line_source_name[2]; TEXT line_source_name[2];
}; };

View File

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

View File

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

View File

@ -100,8 +100,7 @@ void PRO_commit( DBB database)
**************************************/ **************************************/
ISC_STATUS_ARRAY status_vector; ISC_STATUS_ARRAY status_vector;
if ((database->dbb_capabilities & DBB_cap_multi_trans) && if ((database->dbb_capabilities & DBB_cap_multi_trans) && !(LEX_active_procedure()))
!(LEX_active_procedure()))
{ {
if (isc_commit_transaction(status_vector, &database->dbb_proc_trans)) { if (isc_commit_transaction(status_vector, &database->dbb_proc_trans)) {
PRO_rollback(database); PRO_rollback(database);
@ -133,8 +132,7 @@ void PRO_copy_procedure(
FB_API_HANDLE old_blob; FB_API_HANDLE old_blob;
if (!old_database) { if (!old_database) {
for (old_database = QLI_databases; old_database; for (old_database = QLI_databases; old_database; old_database = old_database->dbb_next)
old_database = old_database->dbb_next)
{ {
if (old_blob = PRO_fetch_procedure(old_database, old_name)) if (old_blob = PRO_fetch_procedure(old_database, old_name))
break; break;
@ -145,7 +143,7 @@ void PRO_copy_procedure(
if (!old_blob) if (!old_blob)
ERRQ_print_error(70, old_name); ERRQ_print_error(70, old_name);
// Msg 70 procedure \"%s\" is undefined // Msg 70 procedure \"%s\" is undefined
if (new_database != old_database) if (new_database != old_database)
PRO_setup(new_database); PRO_setup(new_database);
@ -177,12 +175,11 @@ void PRO_copy_procedure(
ERRQ_database_error(new_database, status_vector); ERRQ_database_error(new_database, status_vector);
} }
USHORT length; USHORT length;
while (!(isc_get_segment(status_vector, &old_blob, &length, while (!(isc_get_segment(status_vector, &old_blob, &length, sizeof(buffer), buffer)))
sizeof(buffer), buffer)))
{ {
buffer[length] = 0; buffer[length] = 0;
if (isc_put_segment(status_vector, &new_blob, length, buffer)) 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(old_database, old_blob);
PRO_close(new_database, new_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 FOR(REQUEST_HANDLE database->dbb_edit_blob) X IN DB.QLI$PROCEDURES WITH
X.QLI$PROCEDURE_NAME EQ name X.QLI$PROCEDURE_NAME EQ name
MODIFY X USING MODIFY X USING
if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle, if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle, gds_trans, name))
gds_trans, name))
{ {
return; 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 STORE(REQUEST_HANDLE database->dbb_edit_store) X IN DB.QLI$PROCEDURES
X.QLI$PROCEDURE = gds_blob_null; X.QLI$PROCEDURE = gds_blob_null;
if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle, if (!BLOB_edit(&X.QLI$PROCEDURE, database->dbb_handle, gds_trans, name))
gds_trans, name))
{ {
return; return;
} }
@ -414,11 +409,10 @@ void PRO_invoke( DBB database, const TEXT* name)
{ {
ERRQ_print_error(71, SafeArg() << name << database->dbb_symbol->sym_string); 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 else
for (database = QLI_databases; database; for (database = QLI_databases; database; database = database->dbb_next)
database = database->dbb_next)
{ {
if (blob = PRO_fetch_procedure(database, name)) if (blob = PRO_fetch_procedure(database, name))
break; break;
@ -426,7 +420,7 @@ void PRO_invoke( DBB database, const TEXT* name)
if (!blob) if (!blob)
ERRQ_print_error(72, name); ERRQ_print_error(72, name);
// Msg 72 procedure \"%s\" is undefined // Msg 72 procedure \"%s\" is undefined
LEX_procedure((dbb*)database, blob); LEX_procedure((dbb*)database, blob);
LEX_token(); LEX_token();
@ -453,9 +447,8 @@ FB_API_HANDLE PRO_open_blob( DBB database, ISC_QUAD& blob_id)
USHORT bpb_length = p - bpb; USHORT bpb_length = p - bpb;
if (isc_open_blob2(status_vector, &database->dbb_handle, if (isc_open_blob2(status_vector, &database->dbb_handle, &database->dbb_proc_trans,
&database->dbb_proc_trans, &blob, &blob_id, &blob, &blob_id, bpb_length, bpb))
bpb_length, bpb))
{ {
ERRQ_database_error(database, status_vector); ERRQ_database_error(database, status_vector);
} }
@ -551,8 +544,7 @@ void PRO_scan( DBB database, extract_fn_t routine, void* arg)
while (*p && *p != ' ') { while (*p && *p != ' ') {
p++; p++;
} }
(*routine) (arg, X.QLI$PROCEDURE_NAME, p - X.QLI$PROCEDURE_NAME, (*routine) (arg, X.QLI$PROCEDURE_NAME, p - X.QLI$PROCEDURE_NAME, database, X.QLI$PROCEDURE);
database, X.QLI$PROCEDURE);
END_FOR END_FOR
} }
@ -637,7 +629,7 @@ FB_API_HANDLE PRO_transaction( DBB database, bool update_flag)
!(database->dbb_capabilities & DBB_cap_single_trans))) !(database->dbb_capabilities & DBB_cap_single_trans)))
{ {
if (isc_start_transaction(status_vector, &transaction, 1, 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; database->dbb_capabilities |= DBB_cap_single_trans;
} }
@ -805,7 +797,7 @@ static void create_qli_procedures( DBB dbb)
{ {
PRO_rollback(dbb); PRO_rollback(dbb);
IBERROR(73); 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), 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); PRO_rollback(dbb);
IBERROR(74); 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), 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); PRO_rollback(dbb);
IBERROR(75); 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), 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); PRO_rollback(dbb);
IBERROR(409); IBERROR(409);
// msg 409 Could not create QLI$PROCEDURES index // msg 409 Could not create QLI$PROCEDURES index
} }
dbb->dbb_flags |= DBB_procedures; 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;} //#define SWAP(a, b) {temp = a; a = b; b = temp;}
inline void swap_uchar(UCHAR*& a, UCHAR*& b) inline void swap_uchar(UCHAR*& a, UCHAR*& b)
{ {
UCHAR* temp = a; UCHAR* temp = a;
a = b; a = b;
b = temp; b = temp;
} }
@ -117,14 +117,13 @@ void RPT_report( qli_nod* loop)
// Force TOP breaks for all fields // Force TOP breaks for all fields
for (control = report->rpt_top_breaks; control; for (control = report->rpt_top_breaks; control; control = control->brk_next)
control = control->brk_next) FMT_print((qli_nod*) control->brk_line, print); FMT_print((qli_nod*) control->brk_line, print);
for (;;) { for (;;) {
// Check for bottom breaks. If we find one, force all lower breaks. // Check for bottom breaks. If we find one, force all lower breaks.
for (control = report->rpt_bottom_breaks; control; for (control = report->rpt_bottom_breaks; control; control = control->brk_next)
control = control->brk_next)
{ {
if (test_break(control, report, message)) { if (test_break(control, report, message)) {
swap_uchar(message->msg_buffer, report->rpt_buffer); swap_uchar(message->msg_buffer, report->rpt_buffer);
@ -140,8 +139,7 @@ void RPT_report( qli_nod* loop)
// Now check for top breaks. // Now check for top breaks.
for (control = report->rpt_top_breaks; control; for (control = report->rpt_top_breaks; control; control = control->brk_next)
control = control->brk_next)
{ {
if (test_break(control, report, message)) { if (test_break(control, report, message)) {
top_break(control, print); 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 USHORT get_window_size(int);
static void show_blob_info(ISC_QUAD&, ISC_QUAD&, USHORT, USHORT, DBB, const TEXT*); 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_blr(DBB, USHORT, ISC_QUAD&, USHORT, ISC_QUAD&);
static void show_datatype(DBB, USHORT, USHORT, SSHORT, SSHORT, USHORT, static void show_datatype(DBB, USHORT, USHORT, SSHORT, SSHORT, USHORT, USHORT);
USHORT);
static void show_dbb(DBB); static void show_dbb(DBB);
static void show_dbb_parameters(DBB); static void show_dbb_parameters(DBB);
static int show_field_detail(DBB, const TEXT*, const TEXT*, qli_syntax*); 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 void show_funcs(DBB);
static int show_funcs_detail(DBB); static int show_funcs_detail(DBB);
static int show_insecure_fields(DBB, const TEXT*, const TEXT*); 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 void show_gbl_field(qli_syntax*);
static int show_gbl_field_detail(DBB, const TEXT*); static int show_gbl_field_detail(DBB, const TEXT*);
static void show_gbl_fields(DBB); 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 USHORT show_security_classes_detail(DBB);
static void show_string(USHORT, TEXT*, USHORT, TEXT*); static void show_string(USHORT, TEXT*, USHORT, TEXT*);
static void show_sys_trigs(DBB); static void show_sys_trigs(DBB);
static void show_text_blob(DBB, const TEXT*, USHORT, ISC_QUAD*, USHORT, static void show_text_blob(DBB, const TEXT*, USHORT, ISC_QUAD*, USHORT, ISC_QUAD*, bool);
ISC_QUAD*, bool);
static void show_trig(qli_rel*); static void show_trig(qli_rel*);
static int show_trigger_detail(DBB, const TEXT*); static int show_trigger_detail(DBB, const TEXT*);
static void show_trigger_header(TEXT*, USHORT, USHORT, USHORT, ISC_QUAD&, static void show_trigger_header(TEXT*, USHORT, USHORT, USHORT, ISC_QUAD&, DBB, const TEXT*);
DBB, const TEXT*);
static void show_trigger_messages(DBB, const TEXT*); static void show_trigger_messages(DBB, const TEXT*);
static void show_trigger_status(TEXT*, USHORT, USHORT, USHORT); static void show_trigger_status(TEXT*, USHORT, USHORT, USHORT);
static void show_trigs(DBB); static void show_trigs(DBB);
static int show_triggers_detail(DBB); static int show_triggers_detail(DBB);
static void show_var(const nam*); static void show_var(const nam*);
static void show_vars(void); static void show_vars();
static void show_versions(void); static void show_versions();
static void show_view(qli_rel*); static void show_view(qli_rel*);
static int show_views_detail(DBB); static int show_views_detail(DBB);
static void view_info(DBB, const TEXT*, const TEXT*, SSHORT, SSHORT); 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++) { for (USHORT i = 0; i < node->syn_count; i++) {
const show_t sw = (enum show_t)(IPTR)*ptr++; const show_t sw = (enum show_t)(IPTR)*ptr++;
qli_syntax* value = *ptr++; qli_syntax* value = *ptr++;
if (sw != show_matching_language && if (sw != show_matching_language && sw != show_version &&
sw != show_version &&
sw != show_variable && sw != show_variables && CMD_check_ready()) sw != show_variable && sw != show_variables && CMD_check_ready())
{ {
return; return;
@ -172,8 +168,7 @@ void SHOW_stuff( qli_syntax* node)
case show_all: case show_all:
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) { for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) {
show_dbb(dbb); show_dbb(dbb);
for (relation = dbb->dbb_relations; relation; for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
relation = relation->rel_next)
{ {
if (!(relation->rel_flags & REL_system)) { if (!(relation->rel_flags & REL_system)) {
show_rel(relation); show_rel(relation);
@ -200,8 +195,7 @@ void SHOW_stuff( qli_syntax* node)
dbb = QLI_databases; dbb = QLI_databases;
show_dbb(dbb); show_dbb(dbb);
show_dbb_parameters(dbb); show_dbb_parameters(dbb);
for (relation = dbb->dbb_relations; relation; for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
relation = relation->rel_next)
{ {
if (!(relation->rel_flags & REL_system)) { if (!(relation->rel_flags & REL_system)) {
show_rel(relation); show_rel(relation);
@ -225,8 +219,7 @@ void SHOW_stuff( qli_syntax* node)
case show_db_fields: case show_db_fields:
dbb = (DBB) value; dbb = (DBB) value;
for (relation = dbb->dbb_relations; relation; for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
relation = relation->rel_next)
{ {
if (!(relation->rel_flags & REL_system)) { if (!(relation->rel_flags & REL_system)) {
show_rel(relation); show_rel(relation);
@ -294,8 +287,7 @@ void SHOW_stuff( qli_syntax* node)
} }
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) { for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next) {
show_dbb(dbb); show_dbb(dbb);
for (relation = dbb->dbb_relations; relation; for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
relation = relation->rel_next)
{ {
if (!(relation->rel_flags & (REL_system | REL_view))) { if (!(relation->rel_flags & (REL_system | REL_view))) {
show_rel(relation); show_rel(relation);
@ -311,8 +303,7 @@ void SHOW_stuff( qli_syntax* node)
case show_db_indices: case show_db_indices:
dbb = (DBB) value; dbb = (DBB) value;
show_dbb(dbb); show_dbb(dbb);
for (relation = dbb->dbb_relations; relation; for (relation = dbb->dbb_relations; relation; relation = relation->rel_next)
relation = relation->rel_next)
{ {
if (!(relation->rel_flags & (REL_system | REL_view))) { if (!(relation->rel_flags & (REL_system | REL_view))) {
show_rel(relation); show_rel(relation);
@ -341,6 +332,7 @@ void SHOW_stuff( qli_syntax* node)
} }
break; break;
/*
case show_forms: case show_forms:
if (value) if (value)
show_forms_db((DBB) value); show_forms_db((DBB) value);
@ -349,6 +341,7 @@ void SHOW_stuff( qli_syntax* node)
show_forms_db(dbb); show_forms_db(dbb);
} }
break; break;
*/
case show_function: case show_function:
show_func((QFN) value); show_func((QFN) value);
@ -780,15 +773,15 @@ static void show_datatype(
ERRQ_msg_partial(433); // Msg433 array 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) { if (scale) {
ERRQ_msg_partial(111, SafeArg() << scale); ERRQ_msg_partial(111, SafeArg() << scale);
// Msg111 , scale %d // Msg111 , scale %d
} }
} }
if (dtype == dtype_text || if (dtype == dtype_text || dtype == dtype_varying || dtype == dtype_cstring)
dtype == dtype_varying || dtype == dtype_cstring)
{ {
if (sub_type == 1) if (sub_type == 1)
ERRQ_msg_partial(112); // Msg112 , subtype fixed ERRQ_msg_partial(112); // Msg112 , subtype fixed
@ -846,9 +839,10 @@ static void show_dbb_parameters( DBB database)
return; return;
if (isc_database_info(status_vector, &database->dbb_handle, if (isc_database_info(status_vector, &database->dbb_handle,
sizeof(db_items), db_items, sizeof(db_items), db_items, sizeof(buffer), (char*) buffer))
sizeof(buffer), (char*) buffer)) {
ERRQ_database_error(database, status_vector); ERRQ_database_error(database, status_vector);
}
SLONG page_size = 0, allocation = 0; 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]) FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_dbb])
D IN RDB$DATABASE D IN RDB$DATABASE
show_string(260, D.RDB$SECURITY_CLASS, 0, NULL); show_string(260, D.RDB$SECURITY_CLASS, 0, NULL);
show_text_blob(database, "\t", 261, &D.RDB$DESCRIPTION, 0, show_text_blob(database, "\t", 261, &D.RDB$DESCRIPTION, 0, NULL, false);
NULL, false);
END_FOR; END_FOR;
} }
else { else {
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_dbb]) FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_dbb])
D IN RDB$DATABASE D IN RDB$DATABASE
show_text_blob(database, "\t", 262, &D.RDB$DESCRIPTION, 0, show_text_blob(database, "\t", 262, &D.RDB$DESCRIPTION, 0, NULL, false);
NULL, false);
END_FOR; END_FOR;
} }
@ -899,16 +891,13 @@ static void show_dbb_parameters( DBB database)
if (F.RDB$SHADOW_NUMBER) { if (F.RDB$SHADOW_NUMBER) {
if (!(F.RDB$FILE_FLAGS & FILE_conditional)) { if (!(F.RDB$FILE_FLAGS & FILE_conditional)) {
ERRQ_msg_put(385, SafeArg() << ERRQ_msg_put(385, SafeArg() << F.RDB$SHADOW_NUMBER <<
F.RDB$SHADOW_NUMBER << F.RDB$FILE_NAME << F.RDB$FILE_START);
F.RDB$FILE_NAME <<
F.RDB$FILE_START);
// Msg385 Shadow %d, File:%s starting at page %d // Msg385 Shadow %d, File:%s starting at page %d
} }
} }
else { else {
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << F.RDB$FILE_START);
F.RDB$FILE_START);
// Msg263 File:%s starting at page %d // Msg263 File:%s starting at page %d
} }
END_FOR; END_FOR;
@ -916,8 +905,7 @@ static void show_dbb_parameters( DBB database)
else { else {
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_files]) FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_files])
F IN DB.RDB$FILES SORTED BY F.RDB$FILE_START F IN DB.RDB$FILES SORTED BY F.RDB$FILE_START
ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << ERRQ_msg_put(263, SafeArg() << F.RDB$FILE_NAME << F.RDB$FILE_START);
F.RDB$FILE_START);
// Msg263 File:%s starting at page %d // Msg263 File:%s starting at page %d
END_FOR; END_FOR;
} }
@ -965,8 +953,7 @@ static int show_field_detail(
continue; continue;
const USHORT dimensions = MET_dimensions(database, F.RDB$FIELD_NAME); const USHORT dimensions = MET_dimensions(database, F.RDB$FIELD_NAME);
if (dimensions && idx_node && if (dimensions && idx_node && dimensions != idx_node->syn_arg[s_idx_count]->syn_count)
dimensions != idx_node->syn_arg[s_idx_count]->syn_count)
{ {
continue; continue;
} }
@ -992,31 +979,25 @@ static int show_field_detail(
if (!RFR.RDB$BASE_FIELD.NULL) { if (!RFR.RDB$BASE_FIELD.NULL) {
fb_utils::exact_name(RFR.RDB$BASE_FIELD); fb_utils::exact_name(RFR.RDB$BASE_FIELD);
view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, RFR.RDB$VIEW_CONTEXT, 0);
RFR.RDB$VIEW_CONTEXT, 0);
} }
show_text_blob(database, "\t", 266, &RFR.RDB$DESCRIPTION, 339, show_text_blob(database, "\t", 266, &RFR.RDB$DESCRIPTION, 339, &F.RDB$DESCRIPTION, false);
&F.RDB$DESCRIPTION, false);
ERRQ_msg_put(267); ERRQ_msg_put(267);
// Msg267 Datatype information: // Msg267 Datatype information:
printf("\t"); printf("\t");
show_datatype(database, MET_get_datatype(F.RDB$FIELD_TYPE), show_datatype(database, MET_get_datatype(F.RDB$FIELD_TYPE), F.RDB$FIELD_LENGTH,
F.RDB$FIELD_LENGTH, F.RDB$FIELD_SCALE, F.RDB$FIELD_SCALE, F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH, dimensions);
F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH, dimensions);
if (dimensions && !idx_node) if (dimensions && !idx_node)
array_dimensions(database, F.RDB$FIELD_NAME); array_dimensions(database, F.RDB$FIELD_NAME);
printf("\n"); printf("\n");
show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341, show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341, F.RDB$COMPUTED_BLR);
F.RDB$COMPUTED_BLR); show_blr(database, 342, F.RDB$VALIDATION_SOURCE, 342, F.RDB$VALIDATION_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(270, RFR.RDB$SECURITY_CLASS, 0, NULL);
show_string(271, RFR.RDB$QUERY_NAME, 271, F.RDB$QUERY_NAME); 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_string(273, RFR.RDB$EDIT_STRING, 273, F.RDB$EDIT_STRING);
show_text_blob(database, "\t", 275, &RFR.RDB$QUERY_HEADER, 275, show_text_blob(database, "\t", 275, &RFR.RDB$QUERY_HEADER, 275, &F.RDB$QUERY_HEADER, false);
&F.RDB$QUERY_HEADER, false);
END_FOR; END_FOR;
return count; return count;
@ -1072,7 +1053,7 @@ static void show_fields( qli_rel* relation, qli_fld* fields)
**************************************/ **************************************/
DBB database; DBB database;
// Find the long field name (including query name) // Find the long field name (including query name)
if (relation) { if (relation) {
if (!(relation->rel_flags & REL_fields)) if (!(relation->rel_flags & REL_fields))
@ -1114,14 +1095,13 @@ static void show_fields( qli_rel* relation, qli_fld* fields)
putchar(' '); putchar(' ');
show_datatype(database, field->fld_dtype, show_datatype(database, field->fld_dtype,
(field->fld_dtype == dtype_varying) ? (field->fld_dtype == dtype_varying) ?
field->fld_length - 2 : field->fld_length, field->fld_length - 2 : field->fld_length,
field->fld_scale, field->fld_scale, field->fld_sub_type, field->fld_segment_length,
field->fld_sub_type, field->fld_segment_length,
(field->fld_flags & FLD_array) ? 1 : 0); (field->fld_flags & FLD_array) ? 1 : 0);
if (database && field->fld_flags & FLD_array) if (database && field->fld_flags & FLD_array)
array_dimensions(database, field->fld_name->sym_string); array_dimensions(database, field->fld_name->sym_string);
if (field->fld_flags & FLD_computed) if (field->fld_flags & FLD_computed)
ERRQ_msg_put(119); // Msg119 (computed expression) ERRQ_msg_put(119); // Msg119 (computed expression)
else else
printf("\n"); printf("\n");
} }
@ -1155,8 +1135,7 @@ static void show_filt( QFL filter)
count = show_filter_detail(database, name->nam_string); count = show_filter_detail(database, name->nam_string);
if (!count) { if (!count) {
// Msg440 Filter %s is not defined in database %s. // Msg440 Filter %s is not defined in database %s.
ERRQ_msg_put(440, SafeArg() << name->nam_string << ERRQ_msg_put(440, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
database->dbb_symbol->sym_string);
} }
} }
else { else {
@ -1206,7 +1185,7 @@ static int show_filter_detail( DBB database, TEXT* filter_name)
count++; count++;
fb_utils::exact_name(filter_name); 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 << SafeArg() << filter_name << database->dbb_filename <<
database->dbb_symbol->sym_string); database->dbb_symbol->sym_string);
ERRQ_msg_put(445, F.RDB$MODULE_NAME); ERRQ_msg_put(445, F.RDB$MODULE_NAME);
@ -1267,7 +1246,7 @@ static int show_filters_detail( DBB database)
if (!count++) { if (!count++) {
ERRQ_msg_put(449, SafeArg() << database->dbb_filename << ERRQ_msg_put(449, SafeArg() << database->dbb_filename <<
database->dbb_symbol->sym_string); 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); show_names(F.RDB$FUNCTION_NAME, width, buffer);
END_FOR; END_FOR;
@ -1315,7 +1294,7 @@ static void show_fld( qli_syntax* field_node)
relation_name = (NAM) * ptr; relation_name = (NAM) * ptr;
else else
for (qli_symbol* symbol = ((NAM) * ptr)->nam_symbol; symbol; for (qli_symbol* symbol = ((NAM) * ptr)->nam_symbol; symbol;
symbol = symbol->sym_homonym) symbol = symbol->sym_homonym)
{ {
if (symbol->sym_type == SYM_database) { if (symbol->sym_type == SYM_database) {
database = (DBB) symbol->sym_object; database = (DBB) symbol->sym_object;
@ -1334,20 +1313,16 @@ static void show_fld( qli_syntax* field_node)
int count = 0; int count = 0;
if (database) { if (database) {
count += show_field_detail(database, string, count += show_field_detail(database, string, field_name->nam_string, NULL);
field_name->nam_string, NULL);
if (!count) { if (!count) {
ERRQ_msg_put(117, SafeArg() << s << database->dbb_symbol->sym_string); ERRQ_msg_put(117, SafeArg() << s << database->dbb_symbol->sym_string);
// Msg117 Field %s does not exist in database %s // Msg117 Field %s does not exist in database %s
} }
} }
else { else {
for (database = QLI_databases; database; for (database = QLI_databases; database; database = database->dbb_next)
database = database->dbb_next)
{ {
count += count += show_field_detail(database, string, field_name->nam_string, idx_node);
show_field_detail(database, string, field_name->nam_string,
idx_node);
} }
if (!count) { if (!count) {
ERRQ_msg_put(118, s); ERRQ_msg_put(118, s);
@ -1384,8 +1359,7 @@ static void show_func( QFN func)
count = show_func_detail(database, name->nam_string); count = show_func_detail(database, name->nam_string);
if (!count) { if (!count) {
// Msg422 Function %s is not defined in database %s. // Msg422 Function %s is not defined in database %s.
ERRQ_msg_put(422, SafeArg() << name->nam_string << ERRQ_msg_put(422, SafeArg() << name->nam_string << database->dbb_symbol->sym_string);
database->dbb_symbol->sym_string);
} }
} }
else { else {
@ -1438,12 +1412,12 @@ static int show_func_detail( DBB database, TEXT* func_name)
strcpy(func_name, F.RDB$FUNCTION_NAME); strcpy(func_name, F.RDB$FUNCTION_NAME);
if (F.RDB$QUERY_NAME[0]) { 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 << SafeArg() << F.RDB$FUNCTION_NAME << F.RDB$QUERY_NAME <<
database->dbb_filename << database->dbb_symbol->sym_string); database->dbb_filename << database->dbb_symbol->sym_string);
} }
else { 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 << SafeArg() << F.RDB$FUNCTION_NAME << database->dbb_filename <<
database->dbb_symbol->sym_string); database->dbb_symbol->sym_string);
} }
@ -1526,7 +1500,7 @@ static int show_funcs_detail( DBB database)
F IN RDB$FUNCTIONS F IN RDB$FUNCTIONS
SORTED BY F.RDB$FUNCTION_NAME SORTED BY F.RDB$FUNCTION_NAME
if (!count++) { if (!count++) {
// Msg416 Functions in database %s (%s): // Msg416 Functions in database %s (%s):
ERRQ_msg_put(416, SafeArg() << database->dbb_filename << ERRQ_msg_put(416, SafeArg() << database->dbb_filename <<
database->dbb_symbol->sym_string); database->dbb_symbol->sym_string);
} }
@ -1593,12 +1567,10 @@ static int show_insecure_fields(
if (!RFR.RDB$BASE_FIELD.NULL) { if (!RFR.RDB$BASE_FIELD.NULL) {
fb_utils::exact_name(RFR.RDB$BASE_FIELD); fb_utils::exact_name(RFR.RDB$BASE_FIELD);
view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, view_info(database, RFR.RDB$RELATION_NAME, RFR.RDB$BASE_FIELD, RFR.RDB$VIEW_CONTEXT, 0);
RFR.RDB$VIEW_CONTEXT, 0);
} }
show_text_blob(database, "\t", 339, &RFR.RDB$DESCRIPTION, 339, show_text_blob(database, "\t", 339, &RFR.RDB$DESCRIPTION, 339, &F.RDB$DESCRIPTION, false);
&F.RDB$DESCRIPTION, false);
ERRQ_msg_partial(340); // Msg340 Datatype information: ERRQ_msg_partial(340); // Msg340 Datatype information:
printf("\t"); printf("\t");
show_datatype(database, MET_get_datatype(F.RDB$FIELD_TYPE), 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, F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH,
MET_dimensions(database, F.RDB$FIELD_NAME)); MET_dimensions(database, F.RDB$FIELD_NAME));
printf("\n"); printf("\n");
show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341, show_blr(database, 341, F.RDB$COMPUTED_SOURCE, 341, F.RDB$COMPUTED_BLR);
F.RDB$COMPUTED_BLR); show_blr(database, 342, F.RDB$VALIDATION_SOURCE, 342, F.RDB$VALIDATION_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(343, RFR.RDB$QUERY_NAME, 343, F.RDB$QUERY_NAME);
show_string(346, RFR.RDB$EDIT_STRING, 346, F.RDB$EDIT_STRING); show_string(346, RFR.RDB$EDIT_STRING, 346, F.RDB$EDIT_STRING);
show_text_blob(database, "\t", 345, &RFR.RDB$QUERY_HEADER, 345, show_text_blob(database, "\t", 345, &RFR.RDB$QUERY_HEADER, 345, &F.RDB$QUERY_HEADER, false);
&F.RDB$QUERY_HEADER, false);
END_FOR; END_FOR;
return count; return count;
} }
/*
static void show_forms_db( DBB database) static void show_forms_db( DBB database)
{ {
/************************************** /**************************************
@ -1632,11 +1601,12 @@ static void show_forms_db( DBB database)
* Show what we know about forms * Show what we know about forms
* for one database. * for one database.
* *
**************************************/ **************************************./
ERRQ_msg_put(120, database->dbb_symbol->sym_string); ERRQ_msg_put(120, database->dbb_symbol->sym_string);
// Msg120 There are no forms defined for database %s // Msg120 There are no forms defined for database %s
} }
*/
static void show_gbl_field( qli_syntax* field_node) static void show_gbl_field( qli_syntax* field_node)
{ {
@ -1665,8 +1635,7 @@ static void show_gbl_field( qli_syntax* field_node)
} }
else { else {
NAM name = (NAM) *ptr; NAM name = (NAM) *ptr;
for (qli_symbol* symbol = name->nam_symbol; for (qli_symbol* symbol = name->nam_symbol; symbol; symbol = symbol->sym_homonym)
symbol; symbol = symbol->sym_homonym)
{ {
if (symbol->sym_type == SYM_database) { if (symbol->sym_type == SYM_database) {
database = (DBB) symbol->sym_object; 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, F.RDB$FIELD_SUB_TYPE, F.RDB$SEGMENT_LENGTH,
MET_dimensions(database, F.RDB$FIELD_NAME)); MET_dimensions(database, F.RDB$FIELD_NAME));
printf("\n"); printf("\n");
show_blr(database, 279, F.RDB$COMPUTED_SOURCE, 341, show_blr(database, 279, F.RDB$COMPUTED_SOURCE, 341, F.RDB$COMPUTED_BLR);
F.RDB$COMPUTED_BLR); show_blr(database, 280, F.RDB$VALIDATION_SOURCE, 342, F.RDB$VALIDATION_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(281, F.RDB$QUERY_NAME, 0, NULL);
show_string(282, F.RDB$EDIT_STRING, 0, NULL); show_string(282, F.RDB$EDIT_STRING, 0, NULL);
show_text_blob(database, "\t", 283, &F.RDB$QUERY_HEADER, 0, NULL, false); 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 { else {
for (database = QLI_databases; database; for (database = QLI_databases; database; database = database->dbb_next)
database = database->dbb_next)
{ {
count += show_gbl_fields_detail(database); count += show_gbl_fields_detail(database);
} }
@ -2091,10 +2057,8 @@ static void show_rel_detail( qli_rel* relation)
MET_meta_transaction(database, false); MET_meta_transaction(database, false);
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_rel_detail]) FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_rel_detail])
R IN RDB$RELATIONS WITH R IN RDB$RELATIONS WITH R.RDB$RELATION_NAME = relation_name
R.RDB$RELATION_NAME = relation_name show_text_blob(database, "\t", 291, &R.RDB$DESCRIPTION, 0, NULL, false);
show_text_blob(database, "\t", 291, &R.RDB$DESCRIPTION, 0,
NULL, false);
if (database->dbb_capabilities & DBB_cap_security) if (database->dbb_capabilities & DBB_cap_security)
FOR(REQUEST_HANDLE database->dbb_requests[REQ_show_rel_secur]) 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 ERRQ_msg_put(293, E.RDB$EXTERNAL_FILE); // Msg293 Stored in external file %s
END_FOR; 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 - Msg294 An erase trigger is defined for %s
// OBSOLETE - Msg295 A modify trigger is defined for %s // OBSOLETE - Msg295 A modify trigger is defined for %s
// OBSOLETE - Msg296 A store 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; msg = 0;
} }
printf("\t"); printf("\t");
show_trigger_status(X.RDB$TRIGGER_NAME, show_trigger_status(X.RDB$TRIGGER_NAME, X.RDB$TRIGGER_TYPE,
X.RDB$TRIGGER_TYPE, X.RDB$TRIGGER_INACTIVE, X.RDB$TRIGGER_SEQUENCE);
X.RDB$TRIGGER_INACTIVE,
X.RDB$TRIGGER_SEQUENCE);
} }
END_FOR; END_FOR;
} }
@ -2381,8 +2343,7 @@ static void show_trig( qli_rel* relation)
* *
**************************************/ **************************************/
if (!(show_trigger_detail(relation->rel_database, if (!(show_trigger_detail(relation->rel_database, relation->rel_symbol->sym_string)))
relation->rel_symbol->sym_string)))
{ {
ERRQ_msg_put(129, relation->rel_symbol->sym_string); ERRQ_msg_put(129, relation->rel_symbol->sym_string);
// Msg129 No triggers are defined for relation %s // 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); ERRQ_msg_format(msg_num, sizeof(trigger_active), trigger_active);
fb_utils::exact_name(name); fb_utils::exact_name(name);
ERRQ_msg_put(366, SafeArg() << name << trigger_type << sequence << ERRQ_msg_put(366, SafeArg() << name << trigger_type << sequence << trigger_active);
trigger_active); // Msg366 Name: %s, Type: %s, Sequence: %d, Active: %s // Msg366 Name: %s, Type: %s, Sequence: %d, Active: %s
} }
@ -2582,10 +2543,10 @@ static void show_trigs( DBB database)
else { else {
for (database = QLI_databases; database; database = database->dbb_next) for (database = QLI_databases; database; database = database->dbb_next)
if (!show_triggers_detail(database)) if (!show_triggers_detail(database))
{ {
ERRQ_msg_put(131, database->dbb_symbol->sym_string); ERRQ_msg_put(131, database->dbb_symbol->sym_string);
// Msg131 No triggers are defined in database %s // 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) { for (DBB dbb = QLI_databases; dbb; dbb = dbb->dbb_next) {
ERRQ_msg_put(134, dbb->dbb_filename); 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); 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); show_text_blob(dbb, "\t\t", 0, &RFR.RDB$DESCRIPTION, 0, NULL, false);
} }
if (!RFR.RDB$BASE_FIELD.NULL if (!RFR.RDB$BASE_FIELD.NULL && (dbb->dbb_capabilities & DBB_cap_multi_trans))
&& (dbb->dbb_capabilities & DBB_cap_multi_trans))
{ {
fb_utils::exact_name(RFR.RDB$BASE_FIELD); fb_utils::exact_name(RFR.RDB$BASE_FIELD);
view_info(dbb, RFR.RDB$RELATION_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_BOTTOM,
KW_BY, KW_BY,
KW_CHAR, KW_CHAR,
KW_CHOICE, //KW_CHOICE,
KW_CLOSE, //KW_CLOSE,
KW_COLLECTION, //KW_COLLECTION,
KW_COLLECTIONS, //KW_COLLECTIONS,
KW_COLON, KW_COLON,
KW_COLUMN, KW_COLUMN,
KW_COLUMNS, KW_COLUMNS,
KW_COLUMN_HEADER, KW_COLUMN_HEADER,
KW_COMMA, KW_COMMA,
KW_COMMIT, KW_COMMIT,
KW_COMPUTED, //KW_COMPUTED,
KW_CONTAINING, KW_CONTAINING,
KW_CONT_PROMPT, KW_CONT_PROMPT,
KW_COPY, KW_COPY,
KW_COUNT, KW_COUNT,
KW_CREATE, KW_CREATE,
KW_CROSS, KW_CROSS,
KW_CURSOR, //KW_CURSOR,
KW_DATABASE, KW_DATABASE,
KW_DATABASES, KW_DATABASES,
KW_DATE, KW_DATE,
@ -76,21 +76,21 @@ KW_EDIT,
KW_EDIT_STRING, KW_EDIT_STRING,
KW_ELSE, KW_ELSE,
KW_END, KW_END,
KW_END_CHOICE, //KW_END_CHOICE,
KW_END_FOR, //KW_END_FOR,
KW_END_MODIFY, //KW_END_MODIFY,
KW_END_PROCEDURE, KW_END_PROCEDURE,
KW_END_REPORT, KW_END_REPORT,
KW_END_STORE, //KW_END_STORE,
KW_END_STREAM, //KW_END_STREAM,
KW_ENTREE, //KW_ENTREE,
KW_EQ, KW_EQ,
KW_EQUALS, KW_EQUALS,
KW_ERASE, KW_ERASE,
KW_ESCAPE, KW_ESCAPE,
KW_EUC_JUSTIFY, //KW_EUC_JUSTIFY,
KW_EXACTCASE, KW_EXACTCASE,
KW_EXEC, //KW_EXEC,
KW_EXISTS, KW_EXISTS,
KW_EXIT, KW_EXIT,
#ifdef DEV_BUILD #ifdef DEV_BUILD
@ -115,7 +115,7 @@ KW_GE,
KW_GLOBAL, KW_GLOBAL,
KW_GRANT, KW_GRANT,
KW_GROUP, KW_GROUP,
KW_GROUPED, //KW_GROUPED,
KW_GT, KW_GT,
KW_HAVING, KW_HAVING,
KW_HELP, KW_HELP,
@ -133,7 +133,7 @@ KW_INTEGER,
KW_INTO, KW_INTO,
KW_IS, KW_IS,
KW_JOIN, KW_JOIN,
KW_LABEL, //KW_LABEL,
KW_LE, KW_LE,
KW_LEAVE, KW_LEAVE,
KW_LEFT, KW_LEFT,
@ -143,13 +143,13 @@ KW_LINES,
KW_LIST, KW_LIST,
KW_LONG, KW_LONG,
KW_LT, KW_LT,
KW_L_BRACE, //KW_L_BRACE,
KW_L_BRCKET, KW_L_BRCKET,
KW_MATCHES, KW_MATCHES,
KW_MATCHING_LANGUAGE, KW_MATCHING_LANGUAGE,
KW_MAX, KW_MAX,
KW_MEN, //KW_MEN,
KW_MENU, //KW_MENU,
KW_MIN, KW_MIN,
KW_MINUS, KW_MINUS,
KW_MISSING, KW_MISSING,
@ -163,7 +163,7 @@ KW_NULL,
KW_NUMERIC, KW_NUMERIC,
KW_OF, KW_OF,
KW_ON, KW_ON,
KW_OPEN, //KW_OPEN,
KW_OPTION, KW_OPTION,
KW_OR, KW_OR,
KW_ORDER, KW_ORDER,
@ -198,7 +198,7 @@ KW_RIGHT,
KW_RIGHT_PAREN, KW_RIGHT_PAREN,
KW_ROLLBACK, KW_ROLLBACK,
KW_RUNNING, KW_RUNNING,
KW_R_BRACE, //KW_R_BRACE,
KW_R_BRCKET, KW_R_BRCKET,
KW_SCALE, KW_SCALE,
KW_SECURITY_CLASS, KW_SECURITY_CLASS,
@ -228,16 +228,16 @@ KW_THEN,
KW_TO, KW_TO,
KW_TOP, KW_TOP,
KW_TOTAL, KW_TOTAL,
KW_TRIGGER, //KW_TRIGGER,
KW_TRIGGERS, KW_TRIGGERS,
KW_UNION, //KW_UNION,
KW_UNIQUE, KW_UNIQUE,
KW_UPDATE, KW_UPDATE,
KW_UPPERCASE, //KW_UPPERCASE,
KW_USER, KW_USER,
KW_USER_NAME, KW_USER_NAME,
KW_USING, KW_USING,
KW_VALID, //KW_VALID,
KW_VALUES, KW_VALUES,
KW_VARCHAR, KW_VARCHAR,
KW_VARIABLE, KW_VARIABLE,

View File

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