mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 00:03:03 +01:00
Started the merge. More tomorrow.
This commit is contained in:
parent
aeac39d5b9
commit
871967363c
@ -53,7 +53,8 @@
|
||||
|
||||
#define BLKDEF(type, root, tail) { sizeof(root), tail },
|
||||
|
||||
static struct {
|
||||
static const struct
|
||||
{
|
||||
SSHORT typ_root_length;
|
||||
SSHORT typ_tail_length;
|
||||
} block_sizes[] = {
|
||||
@ -94,11 +95,7 @@ BLK ALLQ_alloc( PLB pool, UCHAR type, int count)
|
||||
if (tail)
|
||||
size += count * tail;
|
||||
|
||||
#ifndef VMS
|
||||
size = FB_ALIGN(size, ALIGNMENT);
|
||||
#else
|
||||
size = ((size + ALIGNMENT - 1) & ~(ALIGNMENT - 1));
|
||||
#endif
|
||||
|
||||
if (size <= 4 || size > 65535)
|
||||
ERRQ_bugcheck(2); // Msg2 bad block size
|
||||
@ -110,10 +107,12 @@ BLK ALLQ_alloc( PLB pool, UCHAR type, int count)
|
||||
FRB* best;
|
||||
size_t best_tail;
|
||||
|
||||
while (true) {
|
||||
while (true)
|
||||
{
|
||||
best = NULL;
|
||||
best_tail = 32767;
|
||||
for (FRB* ptr = &pool->plb_free; (free = *ptr); ptr = &free->frb_next)
|
||||
{
|
||||
if (free->frb_next && (SCHAR *) free >= (SCHAR *) free->frb_next)
|
||||
ERRQ_bugcheck(434); // memory pool free list is incorrect
|
||||
else if ((tail = free->frb_header.blk_length - size) >= 0
|
||||
@ -124,6 +123,7 @@ BLK ALLQ_alloc( PLB pool, UCHAR type, int count)
|
||||
if (tail == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (best)
|
||||
break;
|
||||
extend_pool(pool, size);
|
||||
@ -305,8 +305,10 @@ PLB ALLQ_pool(void)
|
||||
// Start by assigning a pool id
|
||||
|
||||
for (pool_id = 0; pool_id < global_pools->vec_count; pool_id++)
|
||||
{
|
||||
if (!(global_pools->vec_object[pool_id]))
|
||||
break;
|
||||
}
|
||||
|
||||
if (pool_id >= global_pools->vec_count)
|
||||
ALLQ_extend((BLK*) &global_pools, pool_id + 10);
|
||||
|
@ -37,9 +37,6 @@
|
||||
#include "../qli/meta_proto.h"
|
||||
#include "../qli/proc_proto.h"
|
||||
#include "../jrd/gds_proto.h"
|
||||
#ifdef VMS
|
||||
#include <descrip.h>
|
||||
#endif
|
||||
|
||||
using MsgFormat::SafeArg;
|
||||
|
||||
@ -52,7 +49,7 @@ static SCHAR db_items[] =
|
||||
{ gds_info_page_size, gds_info_allocation, gds_info_end };
|
||||
#endif
|
||||
|
||||
bool CMD_check_ready(void)
|
||||
bool CMD_check_ready()
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -178,8 +175,6 @@ void CMD_extract( qli_syntax* node)
|
||||
* Extract a series of procedures.
|
||||
*
|
||||
**************************************/
|
||||
DBB database;
|
||||
|
||||
FILE* file = (FILE*) EXEC_open_output((qli_nod*) node->syn_arg[1]);
|
||||
|
||||
qli_syntax* list = node->syn_arg[0];
|
||||
@ -189,8 +184,10 @@ void CMD_extract( qli_syntax* node)
|
||||
ptr < end; ptr++)
|
||||
{
|
||||
QPR proc = (QPR) *ptr;
|
||||
if (!(database = proc->qpr_database))
|
||||
DBB database = proc->qpr_database;
|
||||
if (!database)
|
||||
database = QLI_databases;
|
||||
|
||||
NAM name = proc->qpr_name;
|
||||
FB_API_HANDLE blob = PRO_fetch_procedure(database, name->nam_string);
|
||||
if (!blob) {
|
||||
@ -205,9 +202,7 @@ void CMD_extract( qli_syntax* node)
|
||||
}
|
||||
else {
|
||||
CMD_check_ready();
|
||||
for (database = QLI_databases; database;
|
||||
database =
|
||||
database->dbb_next)
|
||||
for (DBB database = QLI_databases; database; database = database->dbb_next)
|
||||
{
|
||||
PRO_scan(database, extract_procedure, file);
|
||||
}
|
||||
@ -439,49 +434,24 @@ void CMD_shell( qli_syntax* node)
|
||||
TEXT* p = buffer;
|
||||
const qli_const* constant = (qli_const*) node->syn_arg[0];
|
||||
if (constant) {
|
||||
const TEXT* q = (TEXT*) constant->con_data;
|
||||
USHORT l = constant->con_desc.dsc_length;
|
||||
const USHORT l = constant->con_desc.dsc_length;
|
||||
if (l)
|
||||
do {
|
||||
*p++ = *q++;
|
||||
} while (--l);
|
||||
memcpy(p, constant->con_data, l);
|
||||
|
||||
p += l;
|
||||
*p++ = ' ';
|
||||
*p = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef WIN_NT
|
||||
strcpy(buffer, "$SHELL");
|
||||
#else
|
||||
strcpy(buffer, "%ComSpec%");
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
struct dsc$descriptor desc, *ptr;
|
||||
if (constant) {
|
||||
desc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
desc.dsc$b_class = DSC$K_CLASS_S;
|
||||
desc.dsc$w_length = p - buffer;
|
||||
desc.dsc$a_pointer = buffer;
|
||||
ptr = &desc;
|
||||
}
|
||||
else
|
||||
ptr = NULL;
|
||||
int return_status = 0;
|
||||
int mask = 1;
|
||||
int status = lib$spawn(ptr, // Command to be executed
|
||||
NULL, // Command file
|
||||
NULL, // Output file
|
||||
&mask, // sub-process characteristics mask
|
||||
NULL, // sub-process name
|
||||
NULL, // returned process id
|
||||
&return_status, // completion status
|
||||
&15); // event flag for completion
|
||||
if (status & 1)
|
||||
while (!return_status)
|
||||
sys$waitfr(15);
|
||||
#else
|
||||
|
||||
system(buffer);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -506,6 +476,7 @@ void CMD_transaction( qli_syntax* node)
|
||||
return;
|
||||
|
||||
if (node->syn_type == nod_commit)
|
||||
{
|
||||
if ((node->syn_count > 1) ||
|
||||
(node->syn_count == 0 && QLI_databases->dbb_next))
|
||||
{
|
||||
@ -519,9 +490,11 @@ void CMD_transaction( qli_syntax* node)
|
||||
}
|
||||
else
|
||||
QLI_databases->dbb_flags |= DBB_prepared;
|
||||
}
|
||||
|
||||
|
||||
if (node->syn_count == 0) {
|
||||
if (node->syn_count == 0)
|
||||
{
|
||||
for (DBB db_iter = QLI_databases; db_iter; db_iter = db_iter->dbb_next)
|
||||
{
|
||||
if ((node->syn_type == nod_commit)
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "../qli/forma_proto.h"
|
||||
#include "../qli/meta_proto.h"
|
||||
#include "../jrd/dsc_proto.h"
|
||||
#include "../jrd/gdsassert.h"
|
||||
|
||||
const USHORT PROMPT_LENGTH = 80;
|
||||
|
||||
@ -353,8 +354,7 @@ static void compile_context( qli_nod* node, qli_req* request, bool internal_flag
|
||||
context->ctx_context = request->req_context++;
|
||||
context->ctx_message = request->req_receive;
|
||||
if (context->ctx_sub_rse)
|
||||
compile_rse(context->ctx_sub_rse, request, internal_flag, 0, 0,
|
||||
0);
|
||||
compile_rse(context->ctx_sub_rse, request, internal_flag, 0, 0, 0);
|
||||
if (context->ctx_stream)
|
||||
compile_context(context->ctx_stream, request, internal_flag);
|
||||
}
|
||||
@ -406,7 +406,6 @@ static qli_nod* compile_edit( qli_nod* node, qli_req* request)
|
||||
* Compile the "edit blob" expression.
|
||||
*
|
||||
**************************************/
|
||||
qli_nod* value;
|
||||
|
||||
/* Make sure there is a message. If there isn't a message, we
|
||||
can't find the target database. */
|
||||
@ -416,18 +415,18 @@ static qli_nod* compile_edit( qli_nod* node, qli_req* request)
|
||||
|
||||
// If there is an input blob, get it now.
|
||||
|
||||
if (value = node->nod_arg[e_edt_input]) {
|
||||
qli_nod* value = node->nod_arg[e_edt_input];
|
||||
if (value) {
|
||||
qli_fld* field = (qli_fld*) value->nod_arg[e_fld_field];
|
||||
if (value->nod_type != nod_field || field->fld_dtype != dtype_blob)
|
||||
IBERROR(356); // Msg356 EDIT argument must be a blob field
|
||||
node->nod_arg[e_edt_input] =
|
||||
compile_expression(value, request, false);
|
||||
node->nod_arg[e_edt_input] = compile_expression(value, request, false);
|
||||
}
|
||||
|
||||
node->nod_arg[e_edt_dbb] = (qli_nod*) request->req_database;
|
||||
node->nod_desc.dsc_dtype = dtype_blob;
|
||||
node->nod_desc.dsc_length = 8;
|
||||
node->nod_desc.dsc_address = (UCHAR *) & node->nod_arg[e_edt_id1];
|
||||
node->nod_desc.dsc_address = (UCHAR*) &node->nod_arg[e_edt_id1];
|
||||
|
||||
return node;
|
||||
}
|
||||
@ -596,7 +595,8 @@ static qli_nod* compile_expression( qli_nod* node, qli_req* request, bool intern
|
||||
case nod_substr:
|
||||
case nod_user_name:
|
||||
if (!internal_flag && request && request->req_receive &&
|
||||
computable(node, request)) {
|
||||
computable(node, request))
|
||||
{
|
||||
compile_expression(node, request, true);
|
||||
return make_reference(node, request->req_receive);
|
||||
}
|
||||
@ -725,6 +725,7 @@ static qli_nod* compile_field( qli_nod* node, qli_req* request, bool internal_fl
|
||||
if (internal_flag) {
|
||||
if (computable(node, request))
|
||||
return node;
|
||||
|
||||
qli_par* parm = make_parameter(request->req_send, node);
|
||||
node->nod_export = parm;
|
||||
parm->par_desc = node->nod_desc;
|
||||
@ -1115,6 +1116,7 @@ static qli_nod* compile_prompt( qli_nod* node)
|
||||
/* Allocate string buffer to hold data, a two byte count,
|
||||
a possible carriage return, and a null */
|
||||
|
||||
fb_assert(prompt_length <= MAX_USHORT - 2 - sizeof(SSHORT));
|
||||
prompt_length += 2 + sizeof(SSHORT);
|
||||
qli_str* string = (qli_str*) ALLOCDV(type_str, prompt_length);
|
||||
node->nod_arg[e_prm_string] = (qli_nod*) string;
|
||||
@ -1202,7 +1204,7 @@ static qli_req* compile_rse(
|
||||
qli_nod* node,
|
||||
qli_req* old_request,
|
||||
bool internal_flag,
|
||||
qli_msg** send, qli_msg** receive, DBB * database)
|
||||
qli_msg** send, qli_msg** receive, DBB* database)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -1220,7 +1222,7 @@ static qli_req* compile_rse(
|
||||
qli_req* request;
|
||||
DBB local_dbb;
|
||||
|
||||
qli_req* original_request = old_request;
|
||||
qli_req* const original_request = old_request;
|
||||
|
||||
if (!database) {
|
||||
local_dbb = NULL;
|
||||
@ -1565,11 +1567,9 @@ static bool computable( qli_nod* node, qli_req* request)
|
||||
if (!computable(context->ctx_stream, request))
|
||||
return false;
|
||||
}
|
||||
else if (context->ctx_relation->rel_database !=
|
||||
request->req_database)
|
||||
{
|
||||
else if (context->ctx_relation->rel_database != request->req_database)
|
||||
return false;
|
||||
}
|
||||
|
||||
context->ctx_request = request;
|
||||
}
|
||||
if ((sub = node->nod_arg[e_rse_boolean]) && !computable(sub, request))
|
||||
@ -1620,7 +1620,9 @@ static bool computable( qli_nod* node, qli_req* request)
|
||||
return false;
|
||||
if (!computable(node->nod_arg[e_for_rse], request) ||
|
||||
!computable(node->nod_arg[e_for_statement], request))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
case nod_store:
|
||||
@ -1689,10 +1691,11 @@ static bool computable( qli_nod* node, qli_req* request)
|
||||
case nod_concatenate:
|
||||
case nod_function:
|
||||
case nod_substr:
|
||||
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end;
|
||||
ptr++)
|
||||
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end; ptr++)
|
||||
{
|
||||
if (*ptr && !computable(*ptr, request))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
default:
|
||||
@ -1714,10 +1717,6 @@ static void make_descriptor( qli_nod* node, dsc* desc)
|
||||
* Fill out a descriptor based on an expression.
|
||||
*
|
||||
**************************************/
|
||||
qli_fld* field;
|
||||
qli_par* parameter;
|
||||
qli_map* map;
|
||||
qli_fun* function;
|
||||
USHORT dtype;
|
||||
|
||||
dsc desc1;
|
||||
@ -1732,26 +1731,34 @@ static void make_descriptor( qli_nod* node, dsc* desc)
|
||||
switch (node->nod_type) {
|
||||
case nod_field:
|
||||
case nod_variable:
|
||||
field = (qli_fld*) node->nod_arg[e_fld_field];
|
||||
desc->dsc_dtype = field->fld_dtype;
|
||||
desc->dsc_length = field->fld_length;
|
||||
desc->dsc_scale = field->fld_scale;
|
||||
desc->dsc_sub_type = field->fld_sub_type;
|
||||
{
|
||||
const qli_fld* field = (qli_fld*) node->nod_arg[e_fld_field];
|
||||
desc->dsc_dtype = field->fld_dtype;
|
||||
desc->dsc_length = field->fld_length;
|
||||
desc->dsc_scale = field->fld_scale;
|
||||
desc->dsc_sub_type = field->fld_sub_type;
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_reference:
|
||||
parameter = node->nod_import;
|
||||
*desc = parameter->par_desc;
|
||||
{
|
||||
qli_par* parameter = node->nod_import;
|
||||
*desc = parameter->par_desc;
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_map:
|
||||
map = (qli_map*) node->nod_arg[e_map_map];
|
||||
make_descriptor(map->map_node, desc);
|
||||
{
|
||||
qli_map* map = (qli_map*) node->nod_arg[e_map_map];
|
||||
make_descriptor(map->map_node, desc);
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_function:
|
||||
function = (qli_fun*) node->nod_arg[e_fun_function];
|
||||
*desc = function->fun_return;
|
||||
{
|
||||
qli_fun* function = (qli_fun*) node->nod_arg[e_fun_function];
|
||||
*desc = function->fun_return;
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_constant:
|
||||
@ -1761,16 +1768,20 @@ static void make_descriptor( qli_nod* node, dsc* desc)
|
||||
return;
|
||||
|
||||
case nod_concatenate:
|
||||
make_descriptor(node->nod_arg[0], &desc1);
|
||||
make_descriptor(node->nod_arg[1], &desc2);
|
||||
desc->dsc_scale = 0;
|
||||
desc->dsc_dtype = dtype_varying;
|
||||
desc->dsc_length = sizeof(USHORT) +
|
||||
string_length(&desc1) + string_length(&desc2);
|
||||
if (desc1.dsc_dtype <= dtype_any_text)
|
||||
desc->dsc_sub_type = desc1.dsc_sub_type;
|
||||
else
|
||||
desc->dsc_sub_type = ttype_ascii;
|
||||
{
|
||||
make_descriptor(node->nod_arg[0], &desc1);
|
||||
make_descriptor(node->nod_arg[1], &desc2);
|
||||
desc->dsc_scale = 0;
|
||||
desc->dsc_dtype = dtype_varying;
|
||||
ULONG len = sizeof(USHORT) + string_length(&desc1) + string_length(&desc2);
|
||||
if (len > MAX_USHORT) // Silent truncation for now.
|
||||
len = MAX_USHORT;
|
||||
desc->dsc_length = static_cast<USHORT>(len);
|
||||
if (desc1.dsc_dtype <= dtype_any_text)
|
||||
desc->dsc_sub_type = desc1.dsc_sub_type;
|
||||
else
|
||||
desc->dsc_sub_type = ttype_ascii;
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_add:
|
||||
@ -1964,9 +1975,10 @@ static qli_par* make_parameter( qli_msg* message, qli_nod* node)
|
||||
* new prompt at the end of the prompt list. Sigh.
|
||||
*
|
||||
**************************************/
|
||||
qli_par** ptr;
|
||||
qli_par** ptr = &message->msg_parameters;
|
||||
|
||||
for (ptr = &message->msg_parameters; *ptr; ptr = &(*ptr)->par_next);
|
||||
while (*ptr)
|
||||
ptr = &(*ptr)->par_next;
|
||||
|
||||
qli_par* parm = (qli_par*) ALLOCD(type_par);
|
||||
*ptr = parm;
|
||||
@ -1996,16 +2008,18 @@ static qli_nod* make_reference( qli_nod* node, qli_msg* message)
|
||||
* parameter2 style if necessary.
|
||||
*
|
||||
**************************************/
|
||||
qli_par* parm;
|
||||
|
||||
if (!message)
|
||||
ERRQ_bugcheck(363); // Msg363 missing message
|
||||
|
||||
// Look for an existing field reference
|
||||
qli_par* parm;
|
||||
|
||||
// Look for an existing field reference
|
||||
|
||||
for (parm = message->msg_parameters; parm; parm = parm->par_next)
|
||||
{
|
||||
if (CMP_node_match(parm->par_value, node))
|
||||
break;
|
||||
}
|
||||
|
||||
// Parameter doesn't exist -- make a new one.
|
||||
|
||||
|
@ -58,11 +58,7 @@
|
||||
using MsgFormat::SafeArg;
|
||||
|
||||
|
||||
#ifdef VMS
|
||||
const char* STARTUP_FILE = "QLI_STARTUP";
|
||||
#else
|
||||
const char* STARTUP_FILE = "HOME"; // Assume its Unix
|
||||
#endif
|
||||
|
||||
#ifndef SIGQUIT
|
||||
#define SIGQUIT SIGINT
|
||||
@ -75,7 +71,7 @@ extern TEXT *QLI_prompt;
|
||||
static void enable_signals(void);
|
||||
static bool process_statement(bool);
|
||||
static void CLIB_ROUTINE signal_arith_excp(USHORT, USHORT, USHORT);
|
||||
static void CLIB_ROUTINE signal_quit(void);
|
||||
static void CLIB_ROUTINE signal_quit(int);
|
||||
static bool yes_no(USHORT, const TEXT*);
|
||||
|
||||
struct answer_t {
|
||||
@ -128,11 +124,7 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
strcpy(QLI_prompt_string, "QLI> ");
|
||||
strcpy(QLI_cont_string, "CON> ");
|
||||
// Let's define the default number of columns on a machine by machine basis
|
||||
#ifdef VMS
|
||||
QLI_columns = 80;
|
||||
#else
|
||||
QLI_columns = 80;
|
||||
#endif
|
||||
#ifdef TRUSTED_AUTH
|
||||
QLI_trusted = false;
|
||||
#endif
|
||||
@ -148,10 +140,6 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
QLI_hex_output = false;
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
argc = VMS_parse(&argv, argc);
|
||||
#endif
|
||||
|
||||
SLONG debug_value; // aparently unneeded, see usage below.
|
||||
|
||||
const TEXT* const* const arg_end = argv + argc;
|
||||
@ -199,32 +187,21 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
{
|
||||
if (argv >= arg_end || **argv == '-')
|
||||
break;
|
||||
TEXT* r = QLI_default_password;
|
||||
const TEXT* const end = r + sizeof(QLI_default_password) - 1;
|
||||
for (const TEXT* q = fb_utils::get_passwd(*argv++); *q && r < end;)
|
||||
*r++ = *q++;
|
||||
*r = 0;
|
||||
if (argv >= arg_end || **argv == '-')
|
||||
break;
|
||||
}
|
||||
fb_utils::copy_terminate(QLI_default_password, fb_utils::get_passwd(*argv++),
|
||||
sizeof(QLI_default_password));
|
||||
break;
|
||||
|
||||
case 'T':
|
||||
sw_trace = true;
|
||||
break;
|
||||
|
||||
case 'U':
|
||||
{
|
||||
if (argv >= arg_end || **argv == '-')
|
||||
break;
|
||||
TEXT* r = QLI_default_user;
|
||||
const TEXT* const end = r + sizeof(QLI_default_user) - 1;
|
||||
for (const TEXT* q = *argv++; *q && r < end;)
|
||||
*r++ = *q++;
|
||||
*r = 0;
|
||||
if (argv >= arg_end || **argv == '-')
|
||||
break;
|
||||
}
|
||||
fb_utils::copy_terminate(QLI_default_user, *argv++, sizeof(QLI_default_user));
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
sw_verify = true;
|
||||
@ -267,20 +244,6 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
if (startup_file.length())
|
||||
LEX_push_file(startup_file.c_str(), false);
|
||||
|
||||
#ifdef VMS
|
||||
bool vms_tryagain_flag = false;
|
||||
if (startup_file.length())
|
||||
vms_tryagain_flag = LEX_push_file(startup_file.c_str(), false);
|
||||
|
||||
/* If default value of startup file wasn't altered by the use of -i,
|
||||
and LEX returned false (above), try the old logical name, QLI_INIT */
|
||||
|
||||
if (!vms_tryagain_flag && startup_file == STARTUP_FILE)
|
||||
{
|
||||
LEX_push_file("QLI_INIT", false);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (bool got_started = false; !got_started;)
|
||||
{
|
||||
got_started = true;
|
||||
@ -336,9 +299,9 @@ static void enable_signals(void)
|
||||
**************************************/
|
||||
typedef void (*new_handler) (int);
|
||||
|
||||
signal(SIGQUIT, (new_handler) signal_quit);
|
||||
signal(SIGINT, (new_handler) signal_quit);
|
||||
signal(SIGPIPE, (new_handler) signal_quit);
|
||||
signal(SIGQUIT, signal_quit);
|
||||
signal(SIGINT, signal_quit);
|
||||
signal(SIGPIPE, signal_quit);
|
||||
signal(SIGFPE, (new_handler) signal_arith_excp);
|
||||
}
|
||||
|
||||
@ -362,7 +325,6 @@ static bool process_statement(bool flush_flag)
|
||||
// Clear database active flags in preparation for a new statement
|
||||
|
||||
QLI_abort = false;
|
||||
blk* execution_tree = NULL;
|
||||
|
||||
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
|
||||
dbb->dbb_flags &= ~DBB_active;
|
||||
@ -437,29 +399,34 @@ static bool process_statement(bool flush_flag)
|
||||
if (syntax_tree->syn_type == nod_quit) {
|
||||
QLI_line = NULL;
|
||||
for (dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
|
||||
{
|
||||
if ((dbb->dbb_transaction) && (dbb->dbb_flags & DBB_updates))
|
||||
{
|
||||
if (yes_no(460, dbb->dbb_symbol->sym_string)) /* Msg460 Do you want to rollback updates for <dbb>? */
|
||||
MET_transaction(nod_rollback, dbb);
|
||||
else
|
||||
MET_transaction(nod_commit, dbb);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Expand the statement. It will return NULL is the statement was
|
||||
a command. An error will be unwound */
|
||||
|
||||
blk* expanded_tree = (BLK) EXP_expand(syntax_tree);
|
||||
qli_nod* expanded_tree = EXP_expand(syntax_tree);
|
||||
if (!expanded_tree)
|
||||
return false;
|
||||
|
||||
// Compile the statement
|
||||
|
||||
if (!(execution_tree = (BLK) CMPQ_compile((qli_nod*) expanded_tree)))
|
||||
qli_nod* execution_tree = CMPQ_compile(expanded_tree);
|
||||
if (!execution_tree)
|
||||
return false;
|
||||
|
||||
// Generate any BLR needed to support the request
|
||||
|
||||
if (!GEN_generate(( (qli_nod*) execution_tree)))
|
||||
if (!GEN_generate(execution_tree))
|
||||
return false;
|
||||
|
||||
if (QLI_statistics)
|
||||
@ -478,7 +445,7 @@ static bool process_statement(bool flush_flag)
|
||||
|
||||
// Execute the request, for better or worse
|
||||
|
||||
EXEC_top((qli_nod*) execution_tree);
|
||||
EXEC_top(execution_tree);
|
||||
|
||||
if (QLI_statistics)
|
||||
{
|
||||
@ -592,7 +559,7 @@ static void CLIB_ROUTINE signal_arith_excp(USHORT sig, USHORT code, USHORT scp)
|
||||
}
|
||||
|
||||
|
||||
static void CLIB_ROUTINE signal_quit(void)
|
||||
static void CLIB_ROUTINE signal_quit(int)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -647,7 +614,7 @@ static bool yes_no(USHORT number, const TEXT* arg1)
|
||||
buffer[0] = 0;
|
||||
if (!LEX_get_line(prompt, buffer, sizeof(buffer)))
|
||||
return true;
|
||||
for (answer_t* response = answer_table; *response->answer != '\0';
|
||||
for (const answer_t* response = answer_table; *response->answer != '\0';
|
||||
response++)
|
||||
{
|
||||
const TEXT* p = buffer;
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "../jrd/gds_proto.h"
|
||||
#include "../jrd/utl_proto.h"
|
||||
#include "../common/classes/UserBlob.h"
|
||||
#include "../jrd/gdsassert.h"
|
||||
|
||||
|
||||
static SLONG execute_any(qli_nod*);
|
||||
@ -255,7 +256,7 @@ void EVAL_break_increment( qli_nod* node)
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (desc2->dsc_missing)
|
||||
if (desc2->dsc_missing)
|
||||
return;
|
||||
|
||||
node->nod_arg[e_stt_default] = (qli_nod*) (IPTR) count;
|
||||
@ -352,14 +353,12 @@ dsc* EVAL_value(qli_nod* node)
|
||||
* Evaluate a value node.
|
||||
*
|
||||
**************************************/
|
||||
qli_fld* field;
|
||||
DSC *values[4];
|
||||
UCHAR *p;
|
||||
double d1;
|
||||
|
||||
// Start by evaluating sub-expressions (where appropriate)
|
||||
|
||||
dsc* desc = &node->nod_desc;
|
||||
fb_assert(node->nod_count < 5);
|
||||
qli_nod** ptr = node->nod_arg;
|
||||
const qli_nod* const* const end_ptr = ptr + node->nod_count;
|
||||
|
||||
@ -385,9 +384,11 @@ dsc* EVAL_value(qli_nod* node)
|
||||
return desc;
|
||||
|
||||
case nod_variable:
|
||||
field = (qli_fld*) node->nod_arg[e_fld_field];
|
||||
desc->dsc_missing =
|
||||
(field->fld_flags & FLD_missing) ? DSC_missing : 0;
|
||||
{
|
||||
qli_fld* field = (qli_fld*) node->nod_arg[e_fld_field];
|
||||
desc->dsc_missing =
|
||||
(field->fld_flags & FLD_missing) ? DSC_missing : 0;
|
||||
}
|
||||
return desc;
|
||||
|
||||
case nod_field:
|
||||
@ -408,7 +409,7 @@ dsc* EVAL_value(qli_nod* node)
|
||||
}
|
||||
desc->dsc_missing = FALSE;
|
||||
if (node->nod_flags & nod_date) {
|
||||
d1 = MOVQ_date_to_double(values[0]) + MOVQ_get_double(values[1]);
|
||||
double d1 = MOVQ_date_to_double(values[0]) + MOVQ_get_double(values[1]);
|
||||
MOVQ_double_to_date(d1, (SLONG*) desc->dsc_address);
|
||||
}
|
||||
else if (desc->dsc_dtype == dtype_long)
|
||||
@ -544,23 +545,24 @@ dsc* EVAL_value(qli_nod* node)
|
||||
else
|
||||
*(double *) desc->dsc_address += MOVQ_get_double(desc2);
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
return desc;
|
||||
|
||||
case nod_format:
|
||||
p = desc->dsc_address;
|
||||
PIC_edit(values[0], (pics*) node->nod_arg[e_fmt_picture], (TEXT**) &p,
|
||||
{
|
||||
UCHAR* p = desc->dsc_address;
|
||||
PIC_edit(values[0], (pics*) node->nod_arg[e_fmt_picture], (TEXT**) &p,
|
||||
desc->dsc_length);
|
||||
desc->dsc_length = p - desc->dsc_address;
|
||||
desc->dsc_length = p - desc->dsc_address;
|
||||
}
|
||||
return desc;
|
||||
|
||||
case nod_user_name:
|
||||
IBERROR(31); // Msg31 user name is supported only in RSEs temporarily
|
||||
|
||||
case nod_parameter:
|
||||
case nod_position:
|
||||
|
||||
case nod_substr:
|
||||
|
||||
case nod_via:
|
||||
|
||||
default:
|
||||
@ -628,18 +630,18 @@ static dsc* execute_concatenate( qli_nod* node, const dsc* value1, const dsc* va
|
||||
TEXT* p = avary->vary_string;
|
||||
length1 = MIN(length1, desc->dsc_length - 2);
|
||||
length2 = MAX(MIN(length2, desc->dsc_length - 2 - length1), 0);
|
||||
fb_assert(static_cast<ULONG>(length1) + length2 <= MAX_USHORT - 2)
|
||||
|
||||
if (length1)
|
||||
do {
|
||||
*p++ = *address1++;
|
||||
} while (--length1);
|
||||
{
|
||||
memcpy(p, address1, length1);
|
||||
p += length1;
|
||||
}
|
||||
|
||||
if (length2)
|
||||
do {
|
||||
*p++ = *address2++;
|
||||
} while (--length2);
|
||||
memcpy(p, address2, length2);
|
||||
|
||||
avary->vary_length = p - avary->vary_string;
|
||||
avary->vary_length = length1 + length2;
|
||||
|
||||
return desc;
|
||||
}
|
||||
@ -861,7 +863,7 @@ static bool like(
|
||||
p1++;
|
||||
}
|
||||
|
||||
return (l1) ? false : true;
|
||||
return l1 ? false : true;
|
||||
}
|
||||
|
||||
|
||||
@ -927,7 +929,7 @@ static bool matches(
|
||||
p1++;
|
||||
}
|
||||
|
||||
return (l1) ? false: true;
|
||||
return l1 ? false: true;
|
||||
}
|
||||
|
||||
|
||||
@ -1039,15 +1041,18 @@ static bool sleuth_check(
|
||||
else {
|
||||
++match;
|
||||
for (;;)
|
||||
{
|
||||
if (sleuth_check(flags, search, end_search, match, end_match))
|
||||
return true;
|
||||
else if (search < end_search) {
|
||||
if (search < end_search)
|
||||
{
|
||||
const UCHAR d = *search++;
|
||||
if (c != cond_upper(d, flags))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c == '?')
|
||||
@ -1060,16 +1065,21 @@ static bool sleuth_check(
|
||||
if (++match >= end_match)
|
||||
return true;
|
||||
for (;;)
|
||||
{
|
||||
if (sleuth_check(flags, search, end_search, match, end_match))
|
||||
return true;
|
||||
else if (++search >= end_search)
|
||||
if (++search >= end_search)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (c == '[') {
|
||||
const UCHAR* char_class = match;
|
||||
while (*match++ != ']')
|
||||
{
|
||||
if (match >= end_match)
|
||||
return false;
|
||||
}
|
||||
|
||||
const UCHAR* const end_class = match - 1;
|
||||
if (match >= end_match || *match != '*') {
|
||||
if (!sleuth_class(flags, char_class, end_class, *search++))
|
||||
@ -1078,14 +1088,17 @@ static bool sleuth_check(
|
||||
else {
|
||||
++match;
|
||||
for (;;)
|
||||
{
|
||||
if (sleuth_check(flags, search, end_search, match, end_match))
|
||||
return true;
|
||||
else if (search < end_search) {
|
||||
if (search < end_search)
|
||||
{
|
||||
if (!sleuth_class(flags, char_class, end_class, *search++))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (c == '+') {
|
||||
@ -1177,8 +1190,6 @@ static int sleuth_merge(
|
||||
* is not a bug.
|
||||
*
|
||||
**************************************/
|
||||
UCHAR c;
|
||||
|
||||
UCHAR* comb = combined;
|
||||
UCHAR* vector[128];
|
||||
UCHAR** v = vector;
|
||||
@ -1188,7 +1199,7 @@ static int sleuth_merge(
|
||||
// Parse control string into substitution strings and initializing string
|
||||
|
||||
while (control < end_control) {
|
||||
c = *control++;
|
||||
UCHAR c = *control++;
|
||||
if (*control == '=') {
|
||||
UCHAR** end_vector = vector + c;
|
||||
while (v <= end_vector)
|
||||
@ -1216,8 +1227,10 @@ static int sleuth_merge(
|
||||
|
||||
// Interpret matching string, substituting where appropriate
|
||||
|
||||
while (c = *match++) {
|
||||
UCHAR* p;
|
||||
UCHAR c;
|
||||
while (c = *match++)
|
||||
{
|
||||
const UCHAR* p;
|
||||
|
||||
// if we've got a defined character, slurp the definition
|
||||
if (c <= max_op && (p = vector[c])) {
|
||||
@ -1390,11 +1403,7 @@ static bool string_function(
|
||||
|
||||
// Handle MATCHES
|
||||
|
||||
if (node->nod_type == nod_matches)
|
||||
if (matches(p1, l1, p2, l2))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
return node->nod_type == nod_matches && matches(p1, l1, p2, l2);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,7 +78,8 @@ static void transaction_state(qli_nod*, DBB);
|
||||
|
||||
const int COUNT_ITEMS = 4;
|
||||
|
||||
static const SCHAR count_info[] = {
|
||||
static const SCHAR count_info[] =
|
||||
{
|
||||
isc_info_req_select_count,
|
||||
isc_info_req_insert_count,
|
||||
isc_info_req_update_count,
|
||||
@ -102,8 +103,10 @@ void EXEC_abort(void)
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
|
||||
for (qli_req* request = QLI_requests; request; request = request->req_next)
|
||||
{
|
||||
if (request->req_handle)
|
||||
isc_unwind_request(status_vector, &request->req_handle, 0);
|
||||
}
|
||||
|
||||
QLI_abort = true;
|
||||
}
|
||||
@ -125,7 +128,8 @@ void EXEC_execute( qli_nod* node)
|
||||
EXEC_poll_abort();
|
||||
|
||||
if (node) {
|
||||
switch (node->nod_type) {
|
||||
switch (node->nod_type)
|
||||
{
|
||||
case nod_abort:
|
||||
execute_abort(node);
|
||||
|
||||
@ -142,19 +146,20 @@ void EXEC_execute( qli_nod* node)
|
||||
qli_msg* message = (qli_msg*) node->nod_arg[e_era_message];
|
||||
if (message)
|
||||
EXEC_send(message);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_for:
|
||||
execute_for(node);
|
||||
return;
|
||||
|
||||
case nod_list:
|
||||
{
|
||||
qli_nod** ptr = node->nod_arg;
|
||||
for (USHORT i = 0; i < node->nod_count; i++)
|
||||
EXEC_execute(*ptr++);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_modify:
|
||||
execute_modify(node);
|
||||
@ -253,7 +258,7 @@ FB_API_HANDLE EXEC_open_blob( qli_nod* node)
|
||||
}
|
||||
|
||||
|
||||
file* EXEC_open_output(qli_nod* node)
|
||||
FILE* EXEC_open_output(qli_nod* node)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -271,21 +276,21 @@ file* EXEC_open_output(qli_nod* node)
|
||||
const TEXT* p = NULL;
|
||||
TEXT temp[64];
|
||||
SSHORT l = MOVQ_get_string(desc, &p, (vary*) temp, sizeof(temp));
|
||||
if (l >= MAXPATHLEN)
|
||||
l = MAXPATHLEN - 1;
|
||||
|
||||
TEXT filename[256];
|
||||
TEXT* q = filename;
|
||||
TEXT filename[MAXPATHLEN];
|
||||
if (l)
|
||||
do {
|
||||
*q++ = *p++;
|
||||
} while (--l);
|
||||
*q = 0;
|
||||
memcpy(filename, p, l);
|
||||
|
||||
filename[l] = 0;
|
||||
|
||||
// If output is to a file, just do it
|
||||
|
||||
if (!node->nod_arg[e_out_pipe]) {
|
||||
FILE* out_file = fopen(filename, FOPEN_WRITE_TYPE);
|
||||
if (out_file)
|
||||
return (file*) out_file;
|
||||
return out_file;
|
||||
|
||||
ERRQ_print_error(42, filename);
|
||||
// Msg42 Can't open output file %s
|
||||
@ -293,14 +298,10 @@ file* EXEC_open_output(qli_nod* node)
|
||||
|
||||
// Output is to a file. Setup file and fork process
|
||||
|
||||
#ifdef VMS
|
||||
IBERROR(35); // Msg35 output pipe is not supported on VMS
|
||||
#else
|
||||
|
||||
#ifdef WIN_NT
|
||||
FILE* out_file = _popen(filename, "w");
|
||||
if (out_file)
|
||||
return (file*) out_file;
|
||||
return out_file;
|
||||
#else
|
||||
TEXT* argv[20];
|
||||
TEXT** arg = argv;
|
||||
@ -336,11 +337,10 @@ file* EXEC_open_output(qli_nod* node)
|
||||
|
||||
FILE* out_file = fdopen(pair[1], "w");
|
||||
if (out_file)
|
||||
return (file*) out_file;
|
||||
return out_file;
|
||||
#endif
|
||||
|
||||
IBERROR(37); // Msg37 fdopen failed
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -384,7 +384,9 @@ DSC *EXEC_receive(qli_msg* message, qli_par* parameter)
|
||||
|
||||
if (isc_receive(status_vector, &request->req_handle, message->msg_number,
|
||||
message->msg_length, message->msg_buffer, 0))
|
||||
{
|
||||
db_error(request, status_vector);
|
||||
}
|
||||
|
||||
if (!parameter)
|
||||
return NULL;
|
||||
@ -434,7 +436,8 @@ void EXEC_start_request( qli_req* request, qli_msg* message)
|
||||
**************************************/
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
|
||||
if (message) {
|
||||
if (message)
|
||||
{
|
||||
map_data(message);
|
||||
if (!isc_start_and_send(status_vector, &request->req_handle,
|
||||
&request->req_database-> dbb_transaction,
|
||||
@ -444,7 +447,8 @@ void EXEC_start_request( qli_req* request, qli_msg* message)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (!isc_start_request(status_vector, &request->req_handle,
|
||||
&request->req_database-> dbb_transaction, 0))
|
||||
{
|
||||
@ -516,14 +520,10 @@ static DSC *assignment( qli_nod* from_node,
|
||||
|
||||
/* If there is a value present, do any assignment; otherwise null fill */
|
||||
|
||||
if (*missing_flag = to_desc->dsc_missing = from_desc->dsc_missing) {
|
||||
UCHAR* p = from_desc->dsc_address;
|
||||
USHORT l = from_desc->dsc_length;
|
||||
if (l) {
|
||||
do {
|
||||
*p++ = 0;
|
||||
} while (--l);
|
||||
}
|
||||
if (*missing_flag = to_desc->dsc_missing = from_desc->dsc_missing)
|
||||
{
|
||||
if (from_desc->dsc_length)
|
||||
memset(from_desc->dsc_address, 0, from_desc->dsc_length);
|
||||
}
|
||||
else {
|
||||
MOVQ_move(from_desc, to_desc);
|
||||
@ -954,12 +954,12 @@ static void execute_output( qli_nod* node)
|
||||
|
||||
EXEC_execute(node->nod_arg[e_out_statement]);
|
||||
memcpy(QLI_env, old_env, sizeof(QLI_env));
|
||||
fclose((FILE *) print->prt_file);
|
||||
fclose(print->prt_file);
|
||||
|
||||
}
|
||||
catch (const Firebird::Exception&) {
|
||||
if (print->prt_file) {
|
||||
fclose((FILE *) print->prt_file);
|
||||
fclose(print->prt_file);
|
||||
}
|
||||
memcpy(QLI_env, old_env, sizeof(QLI_env));
|
||||
throw;
|
||||
@ -1105,7 +1105,7 @@ static void print_counts( qli_req* request)
|
||||
|
||||
int length = 0;
|
||||
for (UCHAR* c = count_buffer; *c != isc_info_end; c += length) {
|
||||
UCHAR item = *c++;
|
||||
const UCHAR item = *c++;
|
||||
length = gds__vax_integer(c, 2);
|
||||
c += 2;
|
||||
const ULONG number = gds__vax_integer(c, length);
|
||||
|
@ -61,6 +61,9 @@ inline qli_rlb* CHECK_RLB(qli_rlb*& in)
|
||||
#define STUFF(blr) *rlb->rlb_data++ = blr
|
||||
#define STUFF_WORD(blr) {STUFF (blr); STUFF (blr >> 8);}
|
||||
|
||||
struct qli_msg; // forward decl.
|
||||
|
||||
|
||||
// Request block
|
||||
|
||||
struct qli_req {
|
||||
@ -69,10 +72,10 @@ struct qli_req {
|
||||
dbb* req_database; // Database for request
|
||||
FB_API_HANDLE req_handle; // Database request handle
|
||||
qli_rlb* req_blr;
|
||||
struct qli_msg* req_messages; // Messages associated with request
|
||||
struct qli_msg* req_receive; // Current receive message, if any
|
||||
struct qli_msg* req_send; // Current send message, if any
|
||||
struct qli_msg* req_continue; // Message to continue FOR loop after optional actions
|
||||
qli_msg* req_messages; // Messages associated with request
|
||||
qli_msg* req_receive; // Current receive message, if any
|
||||
qli_msg* req_send; // Current send message, if any
|
||||
qli_msg* req_continue; // Message to continue FOR loop after optional actions
|
||||
USHORT req_flags; // Flags for state of request compilation, etc.
|
||||
USHORT req_context; // Next available context
|
||||
USHORT req_msg_number; // Next available message number
|
||||
@ -107,7 +110,7 @@ struct qli_ctx {
|
||||
qli_nod* ctx_stream; // Stream of context
|
||||
struct qli_fld* ctx_variable; // Variable reference
|
||||
qli_req* ctx_request; // Request block
|
||||
struct qli_msg* ctx_message; // Message for data
|
||||
qli_msg* ctx_message; // Message for data
|
||||
qli_nod* ctx_rse; // RSE node for root context
|
||||
qli_nod* ctx_sub_rse; // RSE node aggregate
|
||||
qli_ctx* ctx_parent; // Parent context for map
|
||||
@ -130,8 +133,8 @@ struct qli_msg {
|
||||
blk msg_header;
|
||||
qli_req* msg_request; // Parent request
|
||||
qli_ctx* msg_context; // Contexts in message
|
||||
struct qli_msg* msg_next; // Next message in request
|
||||
struct qli_par* msg_parameters; // Field instances
|
||||
qli_msg* msg_next; // Next message in request
|
||||
struct qli_par* msg_parameters; // Field instances
|
||||
USHORT msg_number; // Message number
|
||||
USHORT msg_length; // Message length
|
||||
USHORT msg_parameter; // Next parameter number
|
||||
@ -194,7 +197,7 @@ const USHORT ITM_overlapped = 1; // Overlapped by another item
|
||||
|
||||
struct qli_prt {
|
||||
blk prt_header;
|
||||
struct file* prt_file; // FILE pointer
|
||||
FILE* prt_file; // FILE pointer
|
||||
struct qli_rpt* prt_report; // Report block (if report)
|
||||
void (*prt_new_page)(qli_prt*, bool); // New page routine, if any
|
||||
USHORT prt_lines_per_page;
|
||||
|
@ -27,7 +27,7 @@
|
||||
void EXEC_abort (void);
|
||||
void EXEC_execute(qli_nod*);
|
||||
FB_API_HANDLE EXEC_open_blob(qli_nod*);
|
||||
file* EXEC_open_output(qli_nod*);
|
||||
FILE* EXEC_open_output(qli_nod*);
|
||||
void EXEC_poll_abort (void);
|
||||
dsc* EXEC_receive(qli_msg*, qli_par*);
|
||||
void EXEC_send(qli_msg*);
|
||||
|
@ -462,12 +462,15 @@ static NAM decompile_symbol( qli_symbol* symbol)
|
||||
* (Needed to support SQL idiocies)
|
||||
*
|
||||
**************************************/
|
||||
int l = symbol->sym_length;
|
||||
const int l = symbol->sym_length;
|
||||
|
||||
NAM name = (NAM) ALLOCDV(type_nam, l);
|
||||
name->nam_length = l;
|
||||
name->nam_symbol = symbol;
|
||||
if (l)
|
||||
memcpy(name->nam_string, symbol->sym_string, l);
|
||||
|
||||
/*
|
||||
TEXT* p = name->nam_string;
|
||||
const TEXT* q = symbol->sym_string;
|
||||
|
||||
@ -477,6 +480,7 @@ static NAM decompile_symbol( qli_symbol* symbol)
|
||||
*p++ = c; //UPPER(c);
|
||||
|
||||
} while (--l);
|
||||
*/
|
||||
|
||||
return name;
|
||||
}
|
||||
@ -665,9 +669,6 @@ static void expand_edit_string( qli_nod* node, qli_print_item* item)
|
||||
* Default edit_string and query_header.
|
||||
*
|
||||
**************************************/
|
||||
qli_fun* function;
|
||||
qli_map* map;
|
||||
|
||||
switch (node->nod_type) {
|
||||
case nod_min:
|
||||
case nod_rpt_min:
|
||||
@ -707,8 +708,10 @@ static void expand_edit_string( qli_nod* node, qli_print_item* item)
|
||||
break;
|
||||
|
||||
case nod_map:
|
||||
map = (qli_map*) node->nod_arg[e_map_map];
|
||||
expand_edit_string(map->map_node, item);
|
||||
{
|
||||
qli_map* map = (qli_map*) node->nod_arg[e_map_map];
|
||||
expand_edit_string(map->map_node, item);
|
||||
}
|
||||
return;
|
||||
|
||||
case nod_field:
|
||||
@ -716,9 +719,11 @@ static void expand_edit_string( qli_nod* node, qli_print_item* item)
|
||||
break;
|
||||
|
||||
case nod_function:
|
||||
function = (qli_fun*) node->nod_arg[e_fun_function];
|
||||
if (!item->itm_query_header)
|
||||
item->itm_query_header = function->fun_symbol->sym_string;
|
||||
{
|
||||
qli_fun* function = (qli_fun*) node->nod_arg[e_fun_function];
|
||||
if (!item->itm_query_header)
|
||||
item->itm_query_header = function->fun_symbol->sym_string;
|
||||
}
|
||||
return;
|
||||
|
||||
default:
|
||||
@ -804,9 +809,7 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
|
||||
*
|
||||
**************************************/
|
||||
qli_nod* node;
|
||||
qli_const* constant;
|
||||
qli_ctx* context;
|
||||
NAM name;
|
||||
qli_syntax* value;
|
||||
|
||||
switch (input->syn_type) {
|
||||
@ -947,9 +950,11 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
|
||||
return expand_function(input, stack);
|
||||
|
||||
case nod_constant:
|
||||
node = make_node(input->syn_type, 0);
|
||||
constant = (qli_const*) input->syn_arg[0];
|
||||
node->nod_desc = constant->con_desc;
|
||||
{
|
||||
node = make_node(input->syn_type, 0);
|
||||
qli_const* constant = (qli_const*) input->syn_arg[0];
|
||||
node->nod_desc = constant->con_desc;
|
||||
}
|
||||
return node;
|
||||
|
||||
case nod_prompt:
|
||||
@ -958,9 +963,11 @@ static qli_nod* expand_expression( qli_syntax* input, qli_lls* stack)
|
||||
return node;
|
||||
|
||||
case nod_star:
|
||||
name = (NAM) input->syn_arg[0];
|
||||
ERRQ_print_error(141, name->nam_string);
|
||||
// Msg141 can't be used when a single element is required
|
||||
{
|
||||
NAM name = (NAM) input->syn_arg[0];
|
||||
ERRQ_print_error(141, name->nam_string);
|
||||
// Msg141 can't be used when a single element is required
|
||||
}
|
||||
|
||||
default:
|
||||
ERRQ_bugcheck(135); // Msg135 expand_expression: not yet implemented
|
||||
@ -1033,7 +1040,8 @@ static qli_nod* expand_field( qli_syntax* input, qli_lls* stack, qli_syntax* sub
|
||||
|
||||
if (!parent)
|
||||
return node;
|
||||
else if (context->ctx_parent != parent) {
|
||||
|
||||
if (context->ctx_parent != parent) {
|
||||
/* The parent context may be hidden because we are part of
|
||||
a stream context. Check out this possibility. */
|
||||
|
||||
@ -1103,7 +1111,7 @@ static qli_nod* expand_function( qli_syntax* input, qli_lls* stack)
|
||||
**************************************/
|
||||
qli_symbol* symbol = 0;
|
||||
qli_fun* function = 0;
|
||||
DBB database;
|
||||
DBB database = 0;
|
||||
|
||||
qli_nod* node = make_node(input->syn_type, e_fun_count);
|
||||
node->nod_count = 1;
|
||||
@ -1945,6 +1953,7 @@ static qli_nod* expand_statement( qli_syntax* input, qli_lls* right, qli_lls* le
|
||||
case nod_erase:
|
||||
routine = expand_erase;
|
||||
break;
|
||||
|
||||
case nod_for:
|
||||
routine = expand_for;
|
||||
break;
|
||||
@ -2106,7 +2115,9 @@ static qli_nod* expand_store( qli_syntax* input, qli_lls* right, qli_lls* left)
|
||||
(field->fld_system_flag
|
||||
&& field->fld_system_flag != relation->rel_system_flag)
|
||||
|| field->fld_flags & FLD_array)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
qli_nod* assignment = make_assignment(make_field(field, context), 0, 0);
|
||||
ALLQ_push((blk*) assignment, &stack);
|
||||
}
|
||||
@ -2519,11 +2530,12 @@ static bool invalid_syn_field( const qli_syntax* syn_node, const qli_syntax* lis
|
||||
gname = (NAM) element->syn_arg[1];
|
||||
}
|
||||
if (!strcmp(fname->nam_string, gname->nam_string))
|
||||
if (!gctx || !fctx
|
||||
|| !strcmp(fctx->nam_string, gctx->nam_string))
|
||||
{
|
||||
if (!gctx || !fctx || !strcmp(fctx->nam_string, gctx->nam_string))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -2799,8 +2811,10 @@ static qli_nod* post_map( qli_nod* node, qli_ctx* context)
|
||||
// Check to see if the item has already been posted
|
||||
|
||||
for (map = context->ctx_map; map; map = map->map_next)
|
||||
{
|
||||
if (CMP_node_match(node, map->map_node))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!map) {
|
||||
map = (qli_map*) ALLOCD(type_map);
|
||||
@ -2843,7 +2857,8 @@ static qli_fld* resolve( qli_syntax* node, qli_lls* stack, qli_ctx** out_context
|
||||
|
||||
NAM* base = (NAM*) node->syn_arg;
|
||||
|
||||
for (; stack; stack = stack->lls_next) {
|
||||
for (; stack; stack = stack->lls_next)
|
||||
{
|
||||
qli_ctx* context = (qli_ctx*) stack->lls_object;
|
||||
*out_context = context;
|
||||
NAM* ptr = base + node->syn_count;
|
||||
@ -2877,17 +2892,22 @@ static qli_fld* resolve( qli_syntax* node, qli_lls* stack, qli_ctx** out_context
|
||||
{
|
||||
if (ptr == base)
|
||||
return field;
|
||||
|
||||
name = *--ptr;
|
||||
|
||||
if (compare_names(name, relation->rel_symbol))
|
||||
{
|
||||
if (ptr == base)
|
||||
return field;
|
||||
else
|
||||
name = *--ptr;
|
||||
|
||||
name = *--ptr;
|
||||
}
|
||||
|
||||
if (compare_names(name, context->ctx_symbol))
|
||||
{
|
||||
if (ptr == base)
|
||||
return field;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -586,46 +586,36 @@ void FMT_put(const TEXT* line, qli_prt* print)
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Write out an output file. Write
|
||||
* fewer than 256 characters at a time
|
||||
* to avoid annoying VMS.
|
||||
* Write out an output file.
|
||||
*
|
||||
**************************************/
|
||||
for (const TEXT* pnewline = line; *pnewline; pnewline++)
|
||||
{
|
||||
if (*pnewline == '\n' || *pnewline == '\f')
|
||||
--print->prt_lines_remaining;
|
||||
|
||||
TEXT buffer[256];
|
||||
const TEXT* const end = buffer + sizeof(buffer) - 1;
|
||||
const TEXT* q = line;
|
||||
TEXT* p;
|
||||
}
|
||||
|
||||
if (print && print->prt_file)
|
||||
while (*q) {
|
||||
for (p = buffer; p < end && *q;)
|
||||
*p++ = *q++;
|
||||
*p = 0;
|
||||
fprintf((FILE *) print->prt_file, "%s", buffer);
|
||||
}
|
||||
{
|
||||
fprintf(print->prt_file, "%s", line);
|
||||
}
|
||||
else {
|
||||
while (*q) {
|
||||
for (p = buffer; p < end && *q;)
|
||||
*p++ = *q++;
|
||||
*p = 0;
|
||||
#ifdef DEV_BUILD
|
||||
if (QLI_hex_output) {
|
||||
// Hex mode output to assist debugging of multicharset work
|
||||
if (QLI_hex_output)
|
||||
{
|
||||
// Hex mode output to assist debugging of multicharset work
|
||||
|
||||
for (p = buffer; p < end && *p; p++)
|
||||
if (is_printable(*p))
|
||||
fprintf(stdout, "%c", *p);
|
||||
else
|
||||
fprintf(stdout, "[%2.2X]", *(UCHAR *) p);
|
||||
for (const TEXT* p = line; *p; p++)
|
||||
{
|
||||
if (is_printable(*p))
|
||||
fprintf(stdout, "%c", *p);
|
||||
else
|
||||
fprintf(stdout, "[%2.2X]", *(UCHAR*) p);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
fprintf(stdout, "%s", buffer);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
fprintf(stdout, "%s", line);
|
||||
QLI_skip_line = true;
|
||||
}
|
||||
}
|
||||
@ -1382,8 +1372,10 @@ static void report_break( qli_brk* control, qli_vec** columns_vec, const bool bo
|
||||
}
|
||||
|
||||
for (; control; control = control->brk_next)
|
||||
{
|
||||
if (control->brk_line)
|
||||
report_line((qli_nod*) control->brk_line, columns_vec);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -609,7 +609,8 @@ static void gen_compile( qli_req* request)
|
||||
ISC_STATUS_ARRAY status_vector;
|
||||
if (isc_compile_request(status_vector, &dbb->dbb_handle,
|
||||
&request->req_handle, length,
|
||||
(const char*) rlb->rlb_base)) {
|
||||
(const char*) rlb->rlb_base))
|
||||
{
|
||||
GEN_rlb_release (rlb);
|
||||
ERRQ_database_error(dbb, status_vector);
|
||||
}
|
||||
@ -682,7 +683,6 @@ static void gen_descriptor(const dsc* desc, qli_req* request)
|
||||
STUFF(desc->dsc_scale);
|
||||
break;
|
||||
|
||||
|
||||
case dtype_real:
|
||||
STUFF(blr_float);
|
||||
break;
|
||||
@ -1321,17 +1321,21 @@ static void gen_map(qli_map* map, qli_req* request)
|
||||
|
||||
USHORT count = 0;
|
||||
for (temp = map; temp; temp = temp->map_next)
|
||||
{
|
||||
if (temp->map_node->nod_type != nod_function)
|
||||
temp->map_position = count++;
|
||||
}
|
||||
|
||||
STUFF(blr_map);
|
||||
STUFF_WORD(count);
|
||||
|
||||
for (temp = map; temp; temp = temp->map_next)
|
||||
{
|
||||
if (temp->map_node->nod_type != nod_function) {
|
||||
STUFF_WORD(temp->map_position);
|
||||
gen_expression(temp->map_node, request);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,10 +43,6 @@ const char* INDENT = " ";
|
||||
const int COLUMN_WIDTH = 20;
|
||||
const int RIGHT_MARGIN = 70;
|
||||
|
||||
#ifdef VMS
|
||||
const char* TARGET = "[syshlp]help.fdb";
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
const char* TARGET = "help/help.fdb";
|
||||
#endif
|
||||
|
@ -87,12 +87,9 @@ void HSH_init(void)
|
||||
const qli_kword* qword = keywords;
|
||||
|
||||
for (int i = 0; i < FB_NELEM(keywords); i++, qword++) {
|
||||
const char* string = qword->keyword;
|
||||
while (*string)
|
||||
++string;
|
||||
qli_symbol* symbol = (qli_symbol*) ALLOCPV(type_sym, 0);
|
||||
symbol->sym_type = SYM_keyword;
|
||||
symbol->sym_length = string - qword->keyword;
|
||||
symbol->sym_length = strlen(qword->keyword);
|
||||
symbol->sym_string = qword->keyword;
|
||||
symbol->sym_keyword = (int) qword->id;
|
||||
HSH_insert(symbol, true);
|
||||
@ -118,6 +115,7 @@ void HSH_insert( qli_symbol* symbol, bool ignore_case)
|
||||
scompare_t scompare = ignore_case ? scompare_ins : scompare_sens;
|
||||
|
||||
for (qli_symbol* old = hash_table[h]; old; old = old->sym_collision)
|
||||
{
|
||||
if (scompare(symbol->sym_string, symbol->sym_length,
|
||||
old->sym_string, old->sym_length))
|
||||
{
|
||||
@ -125,6 +123,7 @@ void HSH_insert( qli_symbol* symbol, bool ignore_case)
|
||||
old->sym_homonym = symbol;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
symbol->sym_collision = hash_table[h];
|
||||
hash_table[h] = symbol;
|
||||
@ -178,25 +177,28 @@ void HSH_remove( qli_symbol* symbol)
|
||||
const int h = hash(symbol->sym_string, symbol->sym_length);
|
||||
|
||||
for (qli_symbol** next = &hash_table[h]; *next; next = &(*next)->sym_collision)
|
||||
if (symbol == *next) {
|
||||
{
|
||||
if (symbol == *next)
|
||||
{
|
||||
qli_symbol* homonym = symbol->sym_homonym;
|
||||
if (homonym) {
|
||||
homonym->sym_collision = symbol->sym_collision;
|
||||
*next = homonym;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
else
|
||||
*next = symbol->sym_collision;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (qli_symbol** ptr = &(*next)->sym_homonym; *ptr; ptr = &(*ptr)->sym_homonym)
|
||||
{
|
||||
if (symbol == *ptr) {
|
||||
*ptr = symbol->sym_homonym;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (qli_symbol** ptr = &(*next)->sym_homonym; *ptr; ptr = &(*ptr)->sym_homonym)
|
||||
if (symbol == *ptr) {
|
||||
*ptr = symbol->sym_homonym;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ERRQ_error(27); // Msg 27 HSH_remove failed
|
||||
}
|
||||
@ -217,7 +219,7 @@ static int hash(const SCHAR* string, int length)
|
||||
int value = 0;
|
||||
|
||||
while (length--) {
|
||||
const SCHAR c = *string++;
|
||||
const UCHAR c = *string++;
|
||||
value = (value << 1) + UPPER(c);
|
||||
}
|
||||
|
||||
|
113
src/qli/lex.cpp
113
src/qli/lex.cpp
@ -53,11 +53,6 @@ using MsgFormat::SafeArg;
|
||||
//#include <ctypes.h>
|
||||
//#endif
|
||||
|
||||
#ifdef VMS
|
||||
#include <descrip.h>
|
||||
const SLONG LIB$_INPSTRTRU = 0x15821c;
|
||||
#endif
|
||||
|
||||
#if (defined WIN_NT)
|
||||
#include <io.h> // isatty
|
||||
#endif
|
||||
@ -230,10 +225,13 @@ qli_tok* LEX_edit_string(void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while (!(classes(c) & (CHR_white | CHR_eol))) {
|
||||
while (!(classes(c) & (CHR_white | CHR_eol)))
|
||||
{
|
||||
*p++ = c;
|
||||
if (classes(c) & CHR_quote)
|
||||
for (;;) {
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
const SSHORT d = nextchar(false);
|
||||
if (d == '\n') {
|
||||
retchar();
|
||||
@ -243,6 +241,7 @@ qli_tok* LEX_edit_string(void)
|
||||
if (d == c)
|
||||
break;
|
||||
}
|
||||
}
|
||||
c = nextchar(true);
|
||||
}
|
||||
|
||||
@ -308,9 +307,11 @@ qli_tok* LEX_filename(void)
|
||||
for (;;) {
|
||||
c = nextchar(true);
|
||||
char char_class = classes(c);
|
||||
if (c == '"' && c != save) {
|
||||
if (c == '"' && c != save)
|
||||
{
|
||||
*p++ = c;
|
||||
for (;;) {
|
||||
for (;;)
|
||||
{
|
||||
c = nextchar(true);
|
||||
char_class = classes(c);
|
||||
if ((char_class & CHR_eol) || c == '"')
|
||||
@ -396,22 +397,25 @@ void LEX_flush(void)
|
||||
// Look for a semi-colon
|
||||
|
||||
if (QLI_semi)
|
||||
{
|
||||
while (QLI_line && QLI_token->tok_keyword != KW_SEMI)
|
||||
LEX_token();
|
||||
}
|
||||
else
|
||||
{
|
||||
while (QLI_line && QLI_token->tok_type != tok_eol)
|
||||
LEX_token();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(UNIX) || defined(WIN_NT)
|
||||
bool LEX_get_line(const TEXT* prompt,
|
||||
TEXT * buffer,
|
||||
int size)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* L E X _ g e t _ l i n e ( U N I X )
|
||||
* L E X _ g e t _ l i n e
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
@ -451,8 +455,8 @@ bool LEX_get_line(const TEXT* prompt,
|
||||
}
|
||||
if (QLI_abort)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
if (--size > 0)
|
||||
*p++ = c;
|
||||
@ -476,71 +480,6 @@ bool LEX_get_line(const TEXT* prompt,
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VMS
|
||||
bool LEX_get_line(const TEXT* prompt,
|
||||
TEXT * buffer,
|
||||
int size)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
* L E X _ g e t _ l i n e ( V M S )
|
||||
*
|
||||
**************************************
|
||||
*
|
||||
* Functional description
|
||||
* Give a prompt and read a line. If the line is terminated by
|
||||
* an EOL, return true. If the buffer is exhausted and non-blanks
|
||||
* would be discarded, return an error. If EOF is detected,
|
||||
* return false. Regardless, a null terminated string is returned.
|
||||
*
|
||||
**************************************/
|
||||
struct dsc$descriptor_s line_desc, prompt_desc;
|
||||
SLONG status;
|
||||
SSHORT length;
|
||||
|
||||
// We're going to add a null to the end, so don't read too much
|
||||
|
||||
--size;
|
||||
|
||||
line_desc.dsc$b_class = DSC$K_CLASS_S;
|
||||
line_desc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
line_desc.dsc$w_length = size;
|
||||
line_desc.dsc$a_pointer = buffer;
|
||||
|
||||
if (prompt) {
|
||||
prompt_desc.dsc$b_class = DSC$K_CLASS_S;
|
||||
prompt_desc.dsc$b_dtype = DSC$K_DTYPE_T;
|
||||
prompt_desc.dsc$w_length = strlen(prompt);
|
||||
prompt_desc.dsc$a_pointer = const_cast<TEXT*>(prompt); // safe cast
|
||||
status = lib$get_input(&line_desc, &prompt_desc, &length);
|
||||
}
|
||||
else
|
||||
status = lib$get_input(&line_desc, NULL, &length);
|
||||
|
||||
SCHAR* p = buffer + length;
|
||||
|
||||
if (!(status & 1)) {
|
||||
if (status != LIB$_INPSTRTRU)
|
||||
return false;
|
||||
buffer[0] = 0;
|
||||
IBERROR(476); // Msg 476 input line too long
|
||||
}
|
||||
else if (length < size)
|
||||
*p++ = '\n';
|
||||
|
||||
*p = 0;
|
||||
|
||||
if (sw_verify) {
|
||||
line_desc.dsc$w_length = length;
|
||||
lib$put_output(&line_desc);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
void LEX_init(void)
|
||||
@ -764,9 +703,8 @@ void LEX_put_procedure(FB_API_HANDLE blob, SLONG start, SLONG stop)
|
||||
}
|
||||
}
|
||||
const SSHORT l = p - buffer;
|
||||
if (l)
|
||||
if (isc_put_segment(status_vector, &blob, l, buffer))
|
||||
ERRQ_bugcheck(58); // Msg 58 isc_put_segment failed
|
||||
if (l && isc_put_segment(status_vector, &blob, l, buffer))
|
||||
ERRQ_bugcheck(58); // Msg 58 isc_put_segment failed
|
||||
}
|
||||
|
||||
fseek(trace_file, 0, 2);
|
||||
@ -970,8 +908,8 @@ static bool get_line(FILE * file,
|
||||
}
|
||||
if (QLI_abort)
|
||||
continue;
|
||||
else
|
||||
break;
|
||||
|
||||
break;
|
||||
}
|
||||
if (--length > 0)
|
||||
*p++ = c;
|
||||
@ -1134,9 +1072,12 @@ static void next_line(const bool eof_ok)
|
||||
// Dump output to the trace file
|
||||
|
||||
if (QLI_line->line_type == line_blob)
|
||||
{
|
||||
while (*p)
|
||||
p++;
|
||||
else {
|
||||
}
|
||||
else
|
||||
{
|
||||
while (*p)
|
||||
putc(*p++, trace_file);
|
||||
QLI_position += (TEXT *) p - QLI_line->line_data;
|
||||
@ -1186,8 +1127,6 @@ static bool scan_number(SSHORT c,
|
||||
**************************************/
|
||||
bool dot = false;
|
||||
|
||||
TEXT* p = *ptr;
|
||||
|
||||
// If this is a leading decimal point, check that the next
|
||||
// character is really a digit, otherwise backout
|
||||
|
||||
@ -1199,6 +1138,8 @@ static bool scan_number(SSHORT c,
|
||||
dot = true;
|
||||
}
|
||||
|
||||
TEXT* p = *ptr;
|
||||
|
||||
// Gobble up digits up to a single decimal point
|
||||
|
||||
for (;;) {
|
||||
|
@ -3251,16 +3251,20 @@ static qli_syntax* parse_blr( UCHAR ** ptr, qli_symbol* symbol)
|
||||
constant->con_desc.dsc_scale = scale;
|
||||
constant->con_desc.dsc_length = length;
|
||||
constant->con_desc.dsc_address = p = constant->con_data;
|
||||
if (dtype == dtype_text)
|
||||
switch (dtype)
|
||||
{
|
||||
case dtype_text:
|
||||
while (l--)
|
||||
*p++ = BLR_BYTE;
|
||||
else if (dtype == dtype_short) {
|
||||
*(SSHORT *) p = gds__vax_integer(blr, l);
|
||||
break;
|
||||
case dtype_short:
|
||||
*(SSHORT*) p = gds__vax_integer(blr, l);
|
||||
blr += l;
|
||||
}
|
||||
else if (dtype == dtype_long) {
|
||||
*(SLONG *) p = gds__vax_integer(blr, l);
|
||||
break;
|
||||
case dtype_long:
|
||||
*(SLONG*) p = gds__vax_integer(blr, l);
|
||||
blr += l;
|
||||
break;
|
||||
}
|
||||
node = make_node(nod_constant, 1);
|
||||
node->syn_count = 0;
|
||||
@ -3275,8 +3279,10 @@ static qli_syntax* parse_blr( UCHAR ** ptr, qli_symbol* symbol)
|
||||
node = make_node(operatr, args);
|
||||
arg = node->syn_arg;
|
||||
while (--args >= 0)
|
||||
{
|
||||
if (!(*arg++ = parse_blr(&blr, symbol)))
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
*ptr = blr;
|
||||
|
105
src/qli/mov.cpp
105
src/qli/mov.cpp
@ -31,6 +31,7 @@
|
||||
#include "../jrd/gds_proto.h"
|
||||
#include "../jrd/gdsassert.h"
|
||||
#include "../qli/mov_proto.h"
|
||||
#include "../common/utils_proto.h"
|
||||
|
||||
using MsgFormat::SafeArg;
|
||||
|
||||
@ -58,7 +59,8 @@ const char* const YESTERDAY = "YESTERDAY";
|
||||
|
||||
const int PRECISION = 10000;
|
||||
|
||||
struct dtypes_t {
|
||||
struct dtypes_t
|
||||
{
|
||||
USHORT type;
|
||||
const TEXT* description;
|
||||
};
|
||||
@ -156,36 +158,24 @@ int MOVQ_compare(const dsc* arg1, const dsc* arg2)
|
||||
if (length = arg2->dsc_length)
|
||||
do {
|
||||
if (*p1++ != *p2++)
|
||||
if (p1[-1] > p2[-1])
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (p1[-1] > p2[-1]) ? 1 : -1;
|
||||
} while (--length);
|
||||
if (length = arg1->dsc_length - arg2->dsc_length)
|
||||
do {
|
||||
if (*p1++ != ' ')
|
||||
if (p1[-1] > ' ')
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (p1[-1] > ' ') ? 1 : -1;
|
||||
} while (--length);
|
||||
return 0;
|
||||
}
|
||||
if (length = arg1->dsc_length)
|
||||
do {
|
||||
if (*p1++ != *p2++)
|
||||
if (p1[-1] > p2[-1])
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (p1[-1] > p2[-1]) ? 1 : -1;
|
||||
} while (--length);
|
||||
length = arg2->dsc_length - arg1->dsc_length;
|
||||
do {
|
||||
if (*p2++ != ' ')
|
||||
if (' ' > p2[-1])
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (' ' > p2[-1]) ? 1 : -1;
|
||||
} while (--length);
|
||||
return 0;
|
||||
}
|
||||
@ -204,36 +194,24 @@ int MOVQ_compare(const dsc* arg1, const dsc* arg2)
|
||||
if (length2)
|
||||
do {
|
||||
if (*p1++ != *p2++)
|
||||
if (p1[-1] > p2[-1])
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (p1[-1] > p2[-1]) ? 1 : -1;
|
||||
} while (--length2);
|
||||
if (fill > 0)
|
||||
do {
|
||||
if (*p1++ != ' ')
|
||||
if (p1[-1] > ' ')
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (p1[-1] > ' ') ? 1 : -1;
|
||||
} while (--fill);
|
||||
return 0;
|
||||
}
|
||||
if (length) {
|
||||
do {
|
||||
if (*p1++ != *p2++)
|
||||
if (p1[-1] > p2[-1])
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (p1[-1] > p2[-1]) ? 1 : -1;
|
||||
} while (--length);
|
||||
}
|
||||
do {
|
||||
if (*p2++ != ' ')
|
||||
if (' ' > p2[-1])
|
||||
return 1;
|
||||
else
|
||||
return -1;
|
||||
return (' ' > p2[-1]) ? 1 : -1;
|
||||
} while (++fill);
|
||||
return 0;
|
||||
}
|
||||
@ -376,21 +354,25 @@ int MOVQ_decompose(const TEXT* string, USHORT length, SLONG* return_value)
|
||||
|
||||
const TEXT* p = string;
|
||||
const TEXT* const end = p + length;
|
||||
for (; p < end; p++) {
|
||||
for (; p < end; p++)
|
||||
{
|
||||
if (*p == ',')
|
||||
continue;
|
||||
else if (DIGIT(*p)) {
|
||||
|
||||
if (DIGIT(*p)) {
|
||||
value = value * 10 + *p - '0';
|
||||
if (fraction)
|
||||
--scale;
|
||||
}
|
||||
else if (*p == '.')
|
||||
{
|
||||
if (fraction) {
|
||||
MOVQ_terminate(string, temp, length, sizeof(temp));
|
||||
ERRQ_error(411, temp);
|
||||
}
|
||||
else
|
||||
fraction = true;
|
||||
}
|
||||
else if (*p == '-' && !value && !sign)
|
||||
sign = true;
|
||||
else if (*p == '+' && !value && !sign)
|
||||
@ -412,7 +394,8 @@ int MOVQ_decompose(const TEXT* string, USHORT length, SLONG* return_value)
|
||||
if (p < end) {
|
||||
SSHORT exp = 0;
|
||||
sign = false;
|
||||
for (p++; p < end; p++) {
|
||||
for (p++; p < end; p++)
|
||||
{
|
||||
if (DIGIT(*p))
|
||||
exp = exp * 10 + *p - '0';
|
||||
else if (*p == '-' && !exp)
|
||||
@ -820,33 +803,27 @@ if (((ALT_DSC*) from)->dsc_combined_type == ((ALT_DSC*) to)->dsc_combined_type)
|
||||
length = MIN(length, to->dsc_length);
|
||||
SSHORT fill = to->dsc_length - length;
|
||||
if (length)
|
||||
do {
|
||||
*p++ = *s++;
|
||||
} while (--length);
|
||||
memcpy(p, s, length);
|
||||
if (fill > 0)
|
||||
do {
|
||||
*p++ = ' ';
|
||||
} while (--fill);
|
||||
memset(p + length, ' ', fill);
|
||||
return;
|
||||
}
|
||||
|
||||
case dtype_cstring:
|
||||
length = MIN(length, to->dsc_length - 1);
|
||||
if (length)
|
||||
do {
|
||||
*p++ = *s++;
|
||||
} while (--length);
|
||||
*p = 0;
|
||||
memcpy(p, s, length);
|
||||
p[length] = 0;
|
||||
return;
|
||||
|
||||
case dtype_varying:
|
||||
length = MIN(length, to->dsc_length - sizeof(SSHORT));
|
||||
((vary*) p)->vary_length = length;
|
||||
p = (UCHAR*) ((vary*) p)->vary_string;
|
||||
if (length)
|
||||
do {
|
||||
*p++ = *s++;
|
||||
} while (--length);
|
||||
{
|
||||
length = MIN(length, to->dsc_length - sizeof(SSHORT));
|
||||
vary* avary = reinterpret_cast<vary*>(p);
|
||||
avary->vary_length = length;
|
||||
if (length)
|
||||
memcpy(avary->vary_string, s, length);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -941,15 +918,11 @@ void MOVQ_terminate(const SCHAR* from,
|
||||
fb_assert(max_length != 0);
|
||||
if (length) {
|
||||
length = MIN(length, max_length - 1);
|
||||
do {
|
||||
*to++ = *from++;
|
||||
} while (--length);
|
||||
*to++ = '\0';
|
||||
}
|
||||
else {
|
||||
while (max_length-- && (*to++ = *from++));
|
||||
*--to = '\0';
|
||||
memcpy(to, from, length);
|
||||
to[length] = '\0';
|
||||
}
|
||||
else
|
||||
fb_utils::copy_terminate(to, from, max_length);
|
||||
}
|
||||
|
||||
|
||||
@ -981,19 +954,23 @@ static double double_from_text(const dsc* desc)
|
||||
bool fraction = false, sign = false;
|
||||
double value = 0;
|
||||
const TEXT* const end = p + length;
|
||||
for (; p < end; p++) {
|
||||
for (; p < end; p++)
|
||||
{
|
||||
if (*p == ',')
|
||||
continue;
|
||||
else if (DIGIT(*p)) {
|
||||
|
||||
if (DIGIT(*p)) {
|
||||
value = value * 10. + (*p - '0');
|
||||
if (fraction)
|
||||
scale++;
|
||||
}
|
||||
else if (*p == '.')
|
||||
{
|
||||
if (fraction)
|
||||
IBERROR(52); // Msg 52 conversion error
|
||||
else
|
||||
fraction = true;
|
||||
}
|
||||
else if (!value && *p == '-')
|
||||
sign = true;
|
||||
else if (!value && *p == '+')
|
||||
@ -1567,8 +1544,10 @@ static void string_to_time(const TEXT* string, USHORT length, SLONG date[2])
|
||||
}
|
||||
*t = 0;
|
||||
while (++p < end)
|
||||
{
|
||||
if (*p != ' ' && *p != '\t' && *p != 0)
|
||||
date_error(string, length);
|
||||
}
|
||||
|
||||
if (strcmp(temp, NOW) == 0) {
|
||||
now_to_date(today, date);
|
||||
|
@ -471,8 +471,10 @@ static DBB get_dbb( qli_symbol* symbol)
|
||||
**************************************/
|
||||
|
||||
for (; symbol; symbol = symbol->sym_homonym)
|
||||
{
|
||||
if (symbol->sym_type == SYM_database)
|
||||
return (DBB) symbol->sym_object;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -588,8 +590,7 @@ static qli_const* make_numeric_constant(const TEXT* string, USHORT length)
|
||||
constant->con_desc.dsc_address = constant->con_data;
|
||||
TEXT* p = (TEXT *) constant->con_desc.dsc_address;
|
||||
*p++ = '0';
|
||||
while (--length)
|
||||
*p++ = *string++;
|
||||
memcpy(p, string, --length);
|
||||
}
|
||||
|
||||
return constant;
|
||||
@ -609,11 +610,8 @@ static TEXT* make_string(const TEXT* address, USHORT length)
|
||||
*
|
||||
**************************************/
|
||||
qli_str* string = (qli_str*) ALLOCDV(type_str, length);
|
||||
TEXT* p = string->str_data;
|
||||
if (length)
|
||||
do {
|
||||
*p++ = *address++;
|
||||
} while (--length);
|
||||
memcpy(string->str_data, address, length);
|
||||
|
||||
return string->str_data;
|
||||
}
|
||||
@ -1266,7 +1264,6 @@ static qli_syntax* parse_drop(void)
|
||||
NOD_T type;
|
||||
DBB database;
|
||||
SSHORT l;
|
||||
TEXT* p;
|
||||
const TEXT* q;
|
||||
|
||||
PAR_real_token();
|
||||
@ -1302,10 +1299,7 @@ static qli_syntax* parse_drop(void)
|
||||
}
|
||||
database = (DBB) ALLOCDV(type_dbb, l);
|
||||
database->dbb_filename_length = l;
|
||||
p = database->dbb_filename;
|
||||
do {
|
||||
*p++ = *q++;
|
||||
} while (--l);
|
||||
memcpy(database->dbb_filename, q, l);
|
||||
PAR_token();
|
||||
|
||||
// parse an optional user name and password if given
|
||||
@ -1356,7 +1350,7 @@ static int parse_dtype( USHORT * length, USHORT * scale)
|
||||
**************************************/
|
||||
USHORT dtype;
|
||||
|
||||
KWWORDS keyword = QLI_token->tok_keyword;
|
||||
const KWWORDS keyword = QLI_token->tok_keyword;
|
||||
PAR_token();
|
||||
*scale = 0;
|
||||
|
||||
@ -1869,6 +1863,7 @@ static TEXT* parse_header(void)
|
||||
TEXT header[1024];
|
||||
|
||||
TEXT* p = header;
|
||||
const TEXT* end = p + sizeof(header);
|
||||
|
||||
while (true) {
|
||||
PAR_real();
|
||||
@ -1878,8 +1873,12 @@ static TEXT* parse_header(void)
|
||||
ERRQ_syntax(184); // Msg184 quoted header segment
|
||||
}
|
||||
const TEXT* q = QLI_token->tok_string;
|
||||
while (*q)
|
||||
while (*q && p < end)
|
||||
*p++ = *q++;
|
||||
|
||||
if (p == end && *q)
|
||||
ERRQ_syntax(184); // Msg184 quoted header segment
|
||||
|
||||
PAR_real_token();
|
||||
if (!PAR_match(KW_SLASH))
|
||||
break;
|
||||
@ -2208,9 +2207,7 @@ static qli_const* parse_literal(void)
|
||||
constant->con_desc.dsc_dtype = dtype_text;
|
||||
UCHAR* p = constant->con_desc.dsc_address = constant->con_data;
|
||||
if (constant->con_desc.dsc_length = l)
|
||||
do {
|
||||
*p++ = *q++;
|
||||
} while (--l);
|
||||
memcpy(p, q, l);
|
||||
}
|
||||
else if (QLI_token->tok_type == tok_number)
|
||||
constant = make_numeric_constant(QLI_token->tok_string,
|
||||
@ -3035,10 +3032,7 @@ static qli_syntax* parse_ready( NOD_T node_type)
|
||||
}
|
||||
DBB database = (DBB) ALLOCDV(type_dbb, l);
|
||||
database->dbb_filename_length = l;
|
||||
TEXT* p = database->dbb_filename;
|
||||
do {
|
||||
*p++ = *q++;
|
||||
} while (--l);
|
||||
memcpy(database->dbb_filename, q, l);
|
||||
PAR_token();
|
||||
|
||||
if (node_type == nod_def_database || node_type == nod_ready) {
|
||||
@ -3143,9 +3137,13 @@ static qli_syntax* parse_relational( USHORT * paren_count)
|
||||
const nod_t* rel_ops;
|
||||
|
||||
if (KEYWORD(KW_SEMI))
|
||||
{
|
||||
for (rel_ops = relationals; *rel_ops != (NOD_T) 0; rel_ops++)
|
||||
{
|
||||
if (expr1->syn_type == *rel_ops)
|
||||
return expr1;
|
||||
}
|
||||
}
|
||||
|
||||
bool negation = false;
|
||||
qli_syntax* node = NULL;
|
||||
@ -3242,8 +3240,10 @@ static qli_syntax* parse_relational( USHORT * paren_count)
|
||||
|
||||
default:
|
||||
for (rel_ops = relationals; *rel_ops != (NOD_T) 0; rel_ops++)
|
||||
{
|
||||
if (expr1->syn_type == *rel_ops)
|
||||
return expr1;
|
||||
}
|
||||
ERRQ_syntax(206); // Msg206 relational operatr
|
||||
}
|
||||
|
||||
@ -3406,6 +3406,7 @@ static qli_syntax* parse_report(void)
|
||||
PAR_real();
|
||||
if (PAR_match(KW_END_REPORT))
|
||||
break;
|
||||
|
||||
switch (next_keyword()) {
|
||||
case KW_PRINT:
|
||||
PAR_token();
|
||||
@ -3892,7 +3893,8 @@ static qli_syntax* parse_show(void)
|
||||
sw = show_matching_language;
|
||||
else if (PAR_match(KW_VERSION))
|
||||
sw = show_version;
|
||||
else if (PAR_match(KW_RELATION)) {
|
||||
else if (PAR_match(KW_RELATION))
|
||||
{
|
||||
if (!(value = (BLK) parse_qualified_relation()))
|
||||
ERRQ_syntax(216); // Msg216 relation name
|
||||
else
|
||||
@ -4135,20 +4137,21 @@ static qli_syntax* parse_sort(void)
|
||||
|
||||
while (true) {
|
||||
PAR_real();
|
||||
if (!sql_flag) {
|
||||
if (!sql_flag)
|
||||
{
|
||||
if (PAR_match(KW_ASCENDING)) {
|
||||
direction = 0;
|
||||
continue;
|
||||
}
|
||||
else if (PAR_match(KW_DESCENDING)) {
|
||||
if (PAR_match(KW_DESCENDING)) {
|
||||
direction = 1;
|
||||
continue;
|
||||
}
|
||||
else if (PAR_match(KW_EXACTCASE)) {
|
||||
if (PAR_match(KW_EXACTCASE)) {
|
||||
sensitive = false;
|
||||
continue;
|
||||
}
|
||||
else if (PAR_match(KW_ANYCASE)) {
|
||||
if (PAR_match(KW_ANYCASE)) {
|
||||
sensitive = true;
|
||||
continue;
|
||||
}
|
||||
@ -4501,21 +4504,23 @@ static qli_syntax* parse_sql_grant_revoke( USHORT type)
|
||||
privileges |= PRV_all;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (true) {
|
||||
PAR_real();
|
||||
if (PAR_match(KW_SELECT)) {
|
||||
privileges |= PRV_select;
|
||||
continue;
|
||||
}
|
||||
else if (PAR_match(KW_INSERT)) {
|
||||
if (PAR_match(KW_INSERT)) {
|
||||
privileges |= PRV_insert;
|
||||
continue;
|
||||
}
|
||||
else if (PAR_match(KW_DELETE)) {
|
||||
if (PAR_match(KW_DELETE)) {
|
||||
privileges |= PRV_delete;
|
||||
continue;
|
||||
}
|
||||
else if (PAR_match(KW_UPDATE)) {
|
||||
if (PAR_match(KW_UPDATE))
|
||||
{
|
||||
privileges |= PRV_update;
|
||||
|
||||
if (PAR_match(KW_COMMA))
|
||||
@ -4547,6 +4552,7 @@ static qli_syntax* parse_sql_grant_revoke( USHORT type)
|
||||
if (!PAR_match(KW_COMMA))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
node->syn_arg[s_grant_fields] = make_list(stack);
|
||||
|
||||
@ -4682,7 +4688,7 @@ static qli_syntax* parse_sql_join_clause( qli_syntax* left)
|
||||
* Parse a join relation clause.
|
||||
*
|
||||
**************************************/
|
||||
NOD_T join_type = parse_join_type();
|
||||
const NOD_T join_type = parse_join_type();
|
||||
if (join_type == (NOD_T) 0)
|
||||
return left;
|
||||
|
||||
@ -4935,10 +4941,12 @@ static qli_syntax* parse_sql_subquery(void)
|
||||
const nod_types* ntypes;
|
||||
const nod_types* const endtypes = statisticals + FB_NELEM(statisticals);
|
||||
for (ntypes = statisticals; ntypes < endtypes; ntypes++)
|
||||
{
|
||||
if (ntypes->nod_t_keyword == KW_none)
|
||||
return parse_sql_singleton_select();
|
||||
else if (ntypes->nod_t_keyword == keyword)
|
||||
if (ntypes->nod_t_keyword == keyword)
|
||||
break;
|
||||
}
|
||||
|
||||
fb_assert(ntypes < endtypes);
|
||||
if (ntypes >= endtypes)
|
||||
@ -5104,7 +5112,7 @@ static qli_syntax* parse_statistical(void)
|
||||
* Parse statistical expression.
|
||||
*
|
||||
**************************************/
|
||||
KWWORDS keyword = next_keyword();
|
||||
const KWWORDS keyword = next_keyword();
|
||||
PAR_token();
|
||||
|
||||
const nod_types* ntypes;
|
||||
@ -5447,8 +5455,6 @@ static qli_rel* resolve_relation( qli_symbol* db_symbol, qli_symbol* relation_sy
|
||||
* NULL (don't error!).
|
||||
*
|
||||
**************************************/
|
||||
qli_rel* relation;
|
||||
qli_symbol* temp;
|
||||
|
||||
// If we don't recognize the relation, punt.
|
||||
|
||||
@ -5460,26 +5466,30 @@ static qli_rel* resolve_relation( qli_symbol* db_symbol, qli_symbol* relation_sy
|
||||
|
||||
if (db_symbol) { /* && db_symbol->sym_type == SYM_database ? */
|
||||
for (; db_symbol; db_symbol = db_symbol->sym_homonym)
|
||||
for (temp = relation_symbol; temp; temp = temp->sym_homonym)
|
||||
{
|
||||
for (qli_symbol* temp = relation_symbol; temp; temp = temp->sym_homonym)
|
||||
if (temp->sym_type == SYM_relation)
|
||||
{
|
||||
relation = (qli_rel*) temp->sym_object;
|
||||
qli_rel* relation = (qli_rel*) temp->sym_object;
|
||||
if (relation->rel_database == (DBB) db_symbol->sym_object)
|
||||
return relation;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// No database qualifier, so search all databases.
|
||||
|
||||
for (DBB dbb = QLI_databases; dbb; dbb = dbb->dbb_next)
|
||||
for (temp = relation_symbol; temp; temp = temp->sym_homonym)
|
||||
{
|
||||
for (qli_symbol* temp = relation_symbol; temp; temp = temp->sym_homonym)
|
||||
if (temp->sym_type == SYM_relation)
|
||||
{
|
||||
relation = (qli_rel*) temp->sym_object;
|
||||
qli_rel* relation = (qli_rel*) temp->sym_object;
|
||||
if (relation->rel_database == dbb)
|
||||
return relation;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -716,9 +716,6 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
|
||||
bool negative = false;
|
||||
USHORT l, width, decimal_digits, w_digits, f_digits;
|
||||
|
||||
#ifdef VMS
|
||||
bool hack_for_vms_flag = false;
|
||||
#endif
|
||||
#ifdef WIN_NT
|
||||
bool hack_for_nt_flag = false;
|
||||
#endif
|
||||
@ -740,10 +737,6 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
|
||||
picture->pic_literals;
|
||||
decimal_digits = picture->pic_fractions;
|
||||
sprintf(temp, "%*.*e", width, decimal_digits, number);
|
||||
#ifdef VMS
|
||||
if (!decimal_digits)
|
||||
hack_for_vms_flag = true;
|
||||
#endif
|
||||
#ifdef WIN_NT
|
||||
hack_for_nt_flag = true;
|
||||
#endif
|
||||
@ -775,30 +768,12 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
|
||||
else
|
||||
decimal_digits = (width > 7) ? width - 7 : 0;
|
||||
sprintf(temp, "%.*e", decimal_digits, number);
|
||||
#ifdef VMS
|
||||
if (!decimal_digits)
|
||||
hack_for_vms_flag = true;
|
||||
#endif
|
||||
#ifdef WIN_NT
|
||||
hack_for_nt_flag = true;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef VMS
|
||||
/* If precision of 0 is specified to e- or f-format in VMS, the dec point
|
||||
is printed regardless. On no other platform is this the case; so take
|
||||
it out here. When/if this is ever fixed, ALL LINES IN THIS ROUTINE
|
||||
THAT RELATED TO 'hack_for_vms_flag' MAY BE DELETED. */
|
||||
|
||||
if (hack_for_vms_flag) {
|
||||
TEXT* p = temp;
|
||||
while (*p != '.')
|
||||
++p;
|
||||
while (*p = *(p + 1))
|
||||
++p;
|
||||
}
|
||||
#endif
|
||||
#ifdef WIN_NT
|
||||
/* On Windows NT exponents have three digits regardless of the magnitude
|
||||
of the number being formatted. To maintain compatiblity with other
|
||||
@ -858,15 +833,15 @@ static void edit_float( const dsc* desc, pics* picture, TEXT** output)
|
||||
case '9':
|
||||
case 'Z':
|
||||
{
|
||||
if (!(*p) || *p > '9' || *p < '0')
|
||||
if (!(*p) || *p > '9' || *p < '0')
|
||||
break;
|
||||
TEXT d = *p++;
|
||||
if (c == '9' && d == ' ')
|
||||
d = '0';
|
||||
else if (c == 'Z' && d == '0')
|
||||
d = ' ';
|
||||
*out++ = d;
|
||||
break;
|
||||
TEXT d = *p++;
|
||||
if (c == '9' && d == ' ')
|
||||
d = '0';
|
||||
else if (c == 'Z' && d == '0')
|
||||
d = ' ';
|
||||
*out++ = d;
|
||||
break;
|
||||
}
|
||||
|
||||
case '.':
|
||||
|
@ -577,14 +577,15 @@ void PRO_setup( DBB dbb)
|
||||
IBERROR(77);
|
||||
// Msg 77 database handle required
|
||||
|
||||
// If we don't have a QLI$PROCEDURES relation, and can't get one, punt
|
||||
|
||||
// If we don't have a QLI$PROCEDURES relation, and can't get one, punt
|
||||
/* CVC: We consider VMS dead.
|
||||
if (dbb->dbb_type == isc_info_db_impl_rdb_vms &&
|
||||
!(dbb->dbb_flags & DBB_procedures))
|
||||
{
|
||||
IBERROR(78);
|
||||
// Msg 78 QLI$PROCEDURES relation must be created with RDO in Rdb/VMS databases
|
||||
}
|
||||
// Msg 78 QLI$PROCEDURES relation must be created with RDO in Rdb/VMS databases
|
||||
*/
|
||||
|
||||
DB = dbb->dbb_handle;
|
||||
|
||||
|
@ -190,15 +190,13 @@ static void bottom_break( qli_brk* control, qli_prt* print)
|
||||
* Force all lower breaks then take break.
|
||||
*
|
||||
**************************************/
|
||||
qli_lls* stack;
|
||||
|
||||
if (!control)
|
||||
return;
|
||||
|
||||
if (control->brk_next)
|
||||
bottom_break(control->brk_next, print);
|
||||
|
||||
for (stack = control->brk_statisticals; stack; stack = stack->lls_next)
|
||||
for (qli_lls* stack = control->brk_statisticals; stack; stack = stack->lls_next)
|
||||
EVAL_break_compute((qli_nod*) stack->lls_object);
|
||||
|
||||
FMT_print((qli_nod*) control->brk_line, print);
|
||||
@ -217,11 +215,11 @@ static void increment_break( qli_brk* control)
|
||||
* Toss another record into running computations.
|
||||
*
|
||||
**************************************/
|
||||
qli_lls* stack;
|
||||
|
||||
for (; control; control = control->brk_next)
|
||||
for (stack = control->brk_statisticals; stack;
|
||||
stack = stack->lls_next) EVAL_break_increment((qli_nod*) stack->lls_object);
|
||||
{
|
||||
for (qli_lls* stack = control->brk_statisticals; stack; stack = stack->lls_next)
|
||||
EVAL_break_increment((qli_nod*) stack->lls_object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -237,11 +235,11 @@ static void initialize_break( qli_brk* control)
|
||||
* Execute a control break.
|
||||
*
|
||||
**************************************/
|
||||
qli_lls* stack;
|
||||
|
||||
for (; control; control = control->brk_next)
|
||||
for (stack = control->brk_statisticals; stack;
|
||||
stack = stack->lls_next) EVAL_break_init((qli_nod*) stack->lls_object);
|
||||
{
|
||||
for (qli_lls* stack = control->brk_statisticals; stack; stack = stack->lls_next)
|
||||
EVAL_break_init((qli_nod*) stack->lls_object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -311,11 +309,9 @@ static void top_break( qli_brk* control, qli_prt* print)
|
||||
* Execute a control break.
|
||||
*
|
||||
**************************************/
|
||||
qli_lls* stack;
|
||||
|
||||
for (; control; control = control->brk_next) {
|
||||
for (stack = control->brk_statisticals; stack;
|
||||
stack = stack->lls_next)
|
||||
for (; control; control = control->brk_next)
|
||||
{
|
||||
for (qli_lls* stack = control->brk_statisticals; stack; stack = stack->lls_next)
|
||||
{
|
||||
EVAL_break_compute((qli_nod*) stack->lls_object);
|
||||
}
|
||||
|
@ -95,10 +95,6 @@ int CLIB_ROUTINE main( int argc, char **argv)
|
||||
* the specified argc/argv to IBMGR_exec_line (see below).
|
||||
*
|
||||
**************************************/
|
||||
#ifdef VMS
|
||||
argc = VMS_parse(&argv, argc);
|
||||
#endif
|
||||
|
||||
|
||||
/* Let's see if we have something in
|
||||
environment variables
|
||||
|
@ -116,10 +116,6 @@ int main( int argc, char *argv[])
|
||||
p_upper_bound = c_upper_bound = d_upper_bound = BIG_NUMBER;
|
||||
USHORT pg_type = 0;
|
||||
|
||||
#ifdef VMS
|
||||
argc = VMS_parse(&argv, argc);
|
||||
#endif
|
||||
|
||||
const TEXT* const* const end = argv + argc;
|
||||
++argv;
|
||||
struct swc switch_space;
|
||||
|
Loading…
Reference in New Issue
Block a user