mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 00:43:03 +01:00
Backported fix for CORE-1501: Wrong access to SLONG data in dsql_nod
This commit is contained in:
parent
149aee9400
commit
543f986524
@ -857,20 +857,20 @@ static void check_constraint( dsql_req* request,
|
||||
// create the INSERT trigger
|
||||
|
||||
element->nod_arg[e_cnstr_type] =
|
||||
MAKE_constant((dsql_str*) PRE_STORE_TRIGGER, CONSTANT_SLONG);
|
||||
MAKE_const_slong(PRE_STORE_TRIGGER);
|
||||
define_constraint_trigger(request, element);
|
||||
|
||||
// create the UPDATE trigger
|
||||
|
||||
element->nod_arg[e_cnstr_type] =
|
||||
MAKE_constant((dsql_str*) PRE_MODIFY_TRIGGER, CONSTANT_SLONG);
|
||||
MAKE_const_slong(PRE_MODIFY_TRIGGER);
|
||||
define_constraint_trigger(request, element);
|
||||
|
||||
// create the DELETE trigger, if required
|
||||
if (delete_trigger_required)
|
||||
{
|
||||
element->nod_arg[e_cnstr_type] =
|
||||
MAKE_constant((dsql_str*) PRE_ERASE_TRIGGER, CONSTANT_SLONG);
|
||||
MAKE_const_slong(PRE_ERASE_TRIGGER);
|
||||
define_constraint_trigger(request, element);
|
||||
}
|
||||
|
||||
@ -936,7 +936,7 @@ static void create_view_triggers(dsql_req* request, dsql_nod* element,
|
||||
// create the UPDATE trigger
|
||||
|
||||
element->nod_arg[e_cnstr_type] =
|
||||
MAKE_constant((dsql_str*) PRE_MODIFY_TRIGGER, CONSTANT_SLONG);
|
||||
MAKE_const_slong(PRE_MODIFY_TRIGGER);
|
||||
|
||||
dsql_nod* base_and_node = 0;
|
||||
dsql_nod* base_relation = 0;
|
||||
@ -952,7 +952,7 @@ static void create_view_triggers(dsql_req* request, dsql_nod* element,
|
||||
// create the INSERT trigger
|
||||
|
||||
element->nod_arg[e_cnstr_type] =
|
||||
MAKE_constant((dsql_str*) PRE_STORE_TRIGGER, CONSTANT_SLONG);
|
||||
MAKE_const_slong(PRE_STORE_TRIGGER);
|
||||
define_view_trigger(request, element, NULL, items);
|
||||
|
||||
request->append_uchar(isc_dyn_end); // For triggers definition
|
||||
@ -1117,7 +1117,7 @@ static void define_constraint_trigger(dsql_req* request, dsql_nod* node)
|
||||
const dsql_nod* constant = node->nod_arg[e_cnstr_type];
|
||||
if (constant)
|
||||
{
|
||||
const SSHORT type = (SSHORT)(IPTR) constant->nod_arg[0];
|
||||
const SSHORT type = (SSHORT) constant->getConstant();
|
||||
request->append_number(isc_dyn_trg_type, type);
|
||||
}
|
||||
|
||||
@ -1230,7 +1230,7 @@ request->append_number(isc_dyn_rel_sql_protection, 1);
|
||||
switch (element->nod_type)
|
||||
{
|
||||
case nod_file_length:
|
||||
start = (IPTR) (element->nod_arg[0]) + 1;
|
||||
start = (IPTR) element->nod_arg[0] + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1549,11 +1549,11 @@ static void define_dimensions( dsql_req* request, const dsql_fld* field)
|
||||
request->append_number(isc_dyn_def_dimension, position);
|
||||
const dsql_nod* element = *ptr++;
|
||||
request->append_uchar(isc_dyn_dim_lower);
|
||||
const SLONG lrange = (IPTR) (element->nod_arg[0]);
|
||||
const SLONG lrange = element->getConstant();
|
||||
request->append_ulong_with_length(lrange);
|
||||
element = *ptr;
|
||||
request->append_uchar(isc_dyn_dim_upper);
|
||||
const SLONG hrange = (IPTR) (element->nod_arg[0]);
|
||||
const SLONG hrange = element->getConstant();
|
||||
request->append_ulong_with_length(hrange);
|
||||
request->append_uchar(isc_dyn_end);
|
||||
if (lrange >= hrange)
|
||||
@ -2007,7 +2007,7 @@ static SSHORT getBlobFilterSubType(dsql_req* request, const dsql_nod* node)
|
||||
switch (node->nod_desc.dsc_dtype)
|
||||
{
|
||||
case dtype_long:
|
||||
return (SSHORT)(IPTR)node->nod_arg[0];
|
||||
return (SSHORT) node->getConstant();
|
||||
case dtype_text:
|
||||
break;
|
||||
default:
|
||||
@ -2126,7 +2126,7 @@ static void define_collation( dsql_req* request)
|
||||
switch (attribute->nod_type)
|
||||
{
|
||||
case nod_collation_attr:
|
||||
request->append_number(isc_dyn_coll_attribute, (IPTR)(attribute->nod_arg[0]));
|
||||
request->append_number(isc_dyn_coll_attribute, (IPTR) attribute->nod_arg[0]);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -2936,9 +2936,9 @@ static void define_shadow(dsql_req* request)
|
||||
request->append_number(isc_dyn_def_shadow, (SSHORT)(IPTR) (ptr[e_shadow_number]));
|
||||
request->append_cstring(isc_dyn_def_file, ((dsql_str*) (ptr[e_shadow_name]))->str_data);
|
||||
request->append_number(isc_dyn_shadow_man_auto,
|
||||
(SSHORT)(IPTR) ((ptr[e_shadow_man_auto])->nod_arg[0]));
|
||||
(SSHORT) ptr[e_shadow_man_auto]->getConstant());
|
||||
request->append_number(isc_dyn_shadow_conditional,
|
||||
(SSHORT)(IPTR) ((ptr[e_shadow_conditional])->nod_arg[0]));
|
||||
(SSHORT) ptr[e_shadow_conditional]->getConstant());
|
||||
|
||||
request->append_file_start(0);
|
||||
|
||||
@ -3062,16 +3062,14 @@ static void define_trigger(dsql_req* request, NOD_TYPE op)
|
||||
|
||||
dsql_nod* constant = trigger_node->nod_arg[e_trg_active];
|
||||
if (constant)
|
||||
request->append_number(isc_dyn_trg_inactive,
|
||||
(SSHORT)(IPTR) constant->nod_arg[0]);
|
||||
request->append_number(isc_dyn_trg_inactive, (SSHORT) constant->getConstant());
|
||||
|
||||
if (constant = trigger_node->nod_arg[e_trg_position])
|
||||
request->append_number(isc_dyn_trg_sequence,
|
||||
(SSHORT)(IPTR) constant->nod_arg[0]);
|
||||
request->append_number(isc_dyn_trg_sequence, (SSHORT) constant->getConstant());
|
||||
|
||||
if (constant = trigger_node->nod_arg[e_trg_type]) {
|
||||
request->append_number(isc_dyn_trg_type, (SSHORT)(IPTR) constant->nod_arg[0]);
|
||||
trig_type = (USHORT)(IPTR) constant->nod_arg[0];
|
||||
request->append_number(isc_dyn_trg_type, (SSHORT) constant->getConstant());
|
||||
trig_type = (USHORT) constant->getConstant();
|
||||
}
|
||||
else {
|
||||
fb_assert(op == nod_mod_trigger);
|
||||
@ -3183,7 +3181,7 @@ static void define_udf( dsql_req* request)
|
||||
// CVC: This is case of "returns <type> [by value|reference]"
|
||||
// Some data types can not be returned as value
|
||||
|
||||
if (((int) (IPTR) (ret_val_ptr[1]->nod_arg[0]) == Jrd::FUN_value) &&
|
||||
if (((int) ret_val_ptr[1]->getConstant() == Jrd::FUN_value) &&
|
||||
(field->fld_dtype == dtype_text ||
|
||||
field->fld_dtype == dtype_varying ||
|
||||
field->fld_dtype == dtype_cstring ||
|
||||
@ -3226,7 +3224,7 @@ static void define_udf( dsql_req* request)
|
||||
|
||||
// CVC: This is case of "returns parameter <N>"
|
||||
|
||||
position = (SSHORT)(IPTR) (ret_val_ptr[1]->nod_arg[0]);
|
||||
position = (SSHORT) ret_val_ptr[1]->getConstant();
|
||||
// Function modifies an argument whose value is the function return value
|
||||
|
||||
if (!arguments || position > arguments->nod_count || position < 1)
|
||||
@ -3248,7 +3246,7 @@ static void define_udf( dsql_req* request)
|
||||
const dsql_nod* const* param_node = ret_arg->nod_arg;
|
||||
if (param_node[e_udf_param_type])
|
||||
{
|
||||
const SSHORT arg_mechanism = (SSHORT)(IPTR) (param_node[e_udf_param_type]->nod_arg[0]);
|
||||
const SSHORT arg_mechanism = (SSHORT) param_node[e_udf_param_type]->getConstant();
|
||||
if (arg_mechanism == Jrd::FUN_scalar_array)
|
||||
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) -607,
|
||||
isc_arg_gds, isc_random,
|
||||
@ -3268,7 +3266,7 @@ static void define_udf( dsql_req* request)
|
||||
{
|
||||
/* CVC: I need to test returning blobs by descriptor before allowing the
|
||||
change there. For now, I ignore the return type specification. */
|
||||
const bool free_it = ((SSHORT)(IPTR) ret_val_ptr[1]->nod_arg[0] < 0);
|
||||
const bool free_it = ((SSHORT) ret_val_ptr[1]->getConstant() < 0);
|
||||
request->append_number(isc_dyn_def_function_arg, blob_position);
|
||||
request->append_number(isc_dyn_func_mechanism,
|
||||
(SSHORT)(SLONG) ((free_it ? -1 : 1) * Jrd::FUN_blob_struct));
|
||||
@ -3279,7 +3277,7 @@ static void define_udf( dsql_req* request)
|
||||
{
|
||||
request->append_number(isc_dyn_def_function_arg, (SSHORT) 0);
|
||||
request->append_number(isc_dyn_func_mechanism,
|
||||
(SSHORT)(IPTR) (ret_val_ptr[1]->nod_arg[0]));
|
||||
(SSHORT) ret_val_ptr[1]->getConstant());
|
||||
}
|
||||
|
||||
request->append_cstring(isc_dyn_function_name, udf_name);
|
||||
@ -3315,7 +3313,7 @@ static void define_udf( dsql_req* request)
|
||||
request->append_number(isc_dyn_def_function_arg, position);
|
||||
|
||||
if (param_node[e_udf_param_type]) {
|
||||
const SSHORT arg_mechanism = (SSHORT)(IPTR) (param_node[e_udf_param_type]->nod_arg[0]);
|
||||
const SSHORT arg_mechanism = (SSHORT) param_node[e_udf_param_type]->getConstant();
|
||||
request->append_number(isc_dyn_func_mechanism, arg_mechanism);
|
||||
}
|
||||
else if (field->fld_dtype == dtype_blob) {
|
||||
@ -3908,7 +3906,7 @@ static void define_view_trigger( dsql_req* request, dsql_nod* node, dsql_nod* rs
|
||||
USHORT trig_type;
|
||||
if (constant)
|
||||
{
|
||||
trig_type = (USHORT)(IPTR) constant->nod_arg[0];
|
||||
trig_type = (USHORT) constant->getConstant();
|
||||
request->append_number(isc_dyn_trg_type, trig_type);
|
||||
}
|
||||
else
|
||||
@ -4494,7 +4492,7 @@ static void generate_dyn( dsql_req* request, dsql_nod* node)
|
||||
|
||||
case nod_del_shadow:
|
||||
request->append_number(isc_dyn_delete_shadow,
|
||||
(SSHORT)(IPTR) (node->nod_arg[0]));
|
||||
(SSHORT) (IPTR) node->nod_arg[0]);
|
||||
request->append_uchar(isc_dyn_end);
|
||||
break;
|
||||
|
||||
@ -4618,7 +4616,7 @@ static void make_comment(dsql_req* request)
|
||||
const dsql_nod* obj_type_node = node->nod_arg[e_comment_obj_type];
|
||||
fb_assert(obj_type_node->nod_type == nod_constant
|
||||
&& obj_type_node->nod_desc.dsc_dtype == dtype_long);
|
||||
const int obj_type = (IPTR) obj_type_node->nod_arg[0];
|
||||
const int obj_type = obj_type_node->getConstant();
|
||||
|
||||
UCHAR dyn_verb = 0;
|
||||
switch (obj_type)
|
||||
@ -5473,7 +5471,7 @@ static void modify_relation( dsql_req* request)
|
||||
const dsql_nod* const_node = element->nod_arg[e_mod_fld_pos_new_position];
|
||||
|
||||
// CVC: Since now the parser accepts pos=1..N, let's subtract one here.
|
||||
const SSHORT constant = (SSHORT)(IPTR) const_node->nod_arg[0] - 1;
|
||||
const SSHORT constant = (SSHORT) const_node->getConstant() - 1;
|
||||
|
||||
request->append_cstring(isc_dyn_rel_name,
|
||||
relation_name->str_data);
|
||||
|
@ -3489,7 +3489,7 @@ static ISC_STATUS execute_request(dsql_req* request,
|
||||
static SSHORT filter_sub_type( dsql_req* request, const dsql_nod* node)
|
||||
{
|
||||
if (node->nod_type == nod_constant)
|
||||
return (SSHORT)(IPTR) node->nod_arg[0];
|
||||
return (SSHORT) node->getConstant();
|
||||
|
||||
const dsql_par* parameter = (dsql_par*) node->nod_arg[e_par_parameter];
|
||||
const dsql_par* null = parameter->par_null;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* A Bison parser, made by GNU Bison 2.1. */
|
||||
/* A Bison parser, made by GNU Bison 1.875d. */
|
||||
|
||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@ -15,8 +15,8 @@
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA. */
|
||||
Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* As a special exception, when this file is copied by Bison into a
|
||||
Bison output file, you may use that output file without restriction.
|
||||
@ -312,7 +312,6 @@
|
||||
TIMEOUT = 538
|
||||
};
|
||||
#endif
|
||||
/* Tokens. */
|
||||
#define ACTIVE 258
|
||||
#define ADD 259
|
||||
#define AFTER 260
|
||||
|
@ -132,7 +132,7 @@ void GEN_expr( dsql_req* request, dsql_nod* node)
|
||||
|
||||
case nod_strlen:
|
||||
stuff(request, blr_strlen);
|
||||
stuff(request, *(SLONG *) node->nod_arg[e_strlen_type]->nod_desc.dsc_address);
|
||||
stuff(request, node->nod_arg[e_strlen_type]->getConstant());
|
||||
GEN_expr(request, node->nod_arg[e_strlen_value]);
|
||||
return;
|
||||
|
||||
@ -179,7 +179,7 @@ void GEN_expr( dsql_req* request, dsql_nod* node)
|
||||
if (node->nod_arg[0]) {
|
||||
const dsql_nod* const_node = node->nod_arg[0];
|
||||
fb_assert(const_node->nod_type == nod_constant);
|
||||
const int precision = (int)(IPTR) const_node->nod_arg[0];
|
||||
const int precision = (int) const_node->getConstant();
|
||||
stuff(request, blr_current_time2);
|
||||
stuff(request, precision);
|
||||
}
|
||||
@ -192,7 +192,7 @@ void GEN_expr( dsql_req* request, dsql_nod* node)
|
||||
if (node->nod_arg[0]) {
|
||||
const dsql_nod* const_node = node->nod_arg[0];
|
||||
fb_assert(const_node->nod_type == nod_constant);
|
||||
const int precision = (int)(IPTR) const_node->nod_arg[0];
|
||||
const int precision = (int) const_node->getConstant();
|
||||
stuff(request, blr_current_timestamp2);
|
||||
stuff(request, precision);
|
||||
}
|
||||
@ -904,7 +904,7 @@ void GEN_start_transaction( dsql_req* request, const dsql_nod* tran_node)
|
||||
sw_lock_timeout = true;
|
||||
if (ptr->nod_count == 1 && ptr->nod_arg[0]->nod_type == nod_constant)
|
||||
{
|
||||
const int lck_timeout = (int)(IPTR) ptr->nod_arg[0]->nod_arg[0];
|
||||
const int lck_timeout = (int) ptr->nod_arg[0]->getConstant();
|
||||
stuff(request, isc_tpb_lock_timeout);
|
||||
stuff(request, 2);
|
||||
stuff_word(request, lck_timeout);
|
||||
@ -1495,6 +1495,7 @@ static void gen_constant( dsql_req* request, dsc* desc, bool negate_value)
|
||||
value = *(SLONG *) p;
|
||||
if (negate_value)
|
||||
value = -value;
|
||||
//printf("gen.cpp = %p %d\n", *((void**)p), value);
|
||||
stuff_word(request, value);
|
||||
stuff_word(request, value >> 16);
|
||||
break;
|
||||
@ -2612,7 +2613,7 @@ static void gen_sort( dsql_req* request, dsql_nod* list)
|
||||
{
|
||||
dsql_nod* nulls_placement = (*ptr)->nod_arg[e_order_nulls];
|
||||
if (nulls_placement) {
|
||||
switch ((IPTR)nulls_placement->nod_arg[0]) {
|
||||
switch (nulls_placement->getConstant()) {
|
||||
case NOD_NULLS_FIRST:
|
||||
stuff(request, blr_nullsfirst);
|
||||
break;
|
||||
|
@ -86,6 +86,24 @@ static void make_parameter_names(dsql_par*, const dsql_nod*);
|
||||
|
||||
static const char* db_key_name = "DB_KEY";
|
||||
|
||||
dsql_nod* MAKE_const_slong(SLONG value)
|
||||
{
|
||||
tsql* tdsql = DSQL_get_thread_data();
|
||||
|
||||
dsql_nod* node = FB_NEW_RPT(*tdsql->getDefaultPool(), 1) dsql_nod;
|
||||
node->nod_type = nod_constant;
|
||||
node->nod_desc.dsc_dtype = dtype_long;
|
||||
node->nod_desc.dsc_length = sizeof(SLONG);
|
||||
node->nod_desc.dsc_scale = 0;
|
||||
node->nod_desc.dsc_sub_type = 0;
|
||||
node->nod_desc.dsc_address = (UCHAR*) node->nod_arg;
|
||||
|
||||
*((SLONG *) (node->nod_desc.dsc_address)) = value;
|
||||
//printf("make.cpp %p %d\n", node->nod_arg[0], value);
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -109,15 +127,15 @@ dsql_nod* MAKE_constant(dsql_str* constant, dsql_constant_type numeric_flag)
|
||||
|
||||
switch (numeric_flag)
|
||||
{
|
||||
case CONSTANT_SLONG:
|
||||
/* case CONSTANT_SLONG:
|
||||
node->nod_desc.dsc_dtype = dtype_long;
|
||||
node->nod_desc.dsc_length = sizeof(SLONG);
|
||||
node->nod_desc.dsc_scale = 0;
|
||||
node->nod_desc.dsc_sub_type = 0;
|
||||
node->nod_desc.dsc_address = (UCHAR*) node->nod_arg;
|
||||
node->nod_arg[0] = (dsql_nod*) constant;
|
||||
*((SLONG *) (node->nod_desc.dsc_address)) = (SLONG) (IPTR) constant;
|
||||
break;
|
||||
|
||||
*/
|
||||
case CONSTANT_DOUBLE:
|
||||
DEV_BLKCHK(constant, dsql_type_str);
|
||||
|
||||
@ -2042,11 +2060,11 @@ dsql_str* MAKE_tagged_string(const char* strvar, size_t length, const char* char
|
||||
**/
|
||||
dsql_nod* MAKE_trigger_type(dsql_nod* prefix_node, dsql_nod* suffix_node)
|
||||
{
|
||||
const long prefix = (long) prefix_node->nod_arg[0];
|
||||
const long suffix = (long) suffix_node->nod_arg[0];
|
||||
const SLONG prefix = prefix_node->getConstant();
|
||||
const SLONG suffix = suffix_node->getConstant();
|
||||
delete prefix_node;
|
||||
delete suffix_node;
|
||||
return MAKE_constant((dsql_str*) (prefix + suffix - 1), CONSTANT_SLONG);
|
||||
return MAKE_const_slong(prefix + suffix - 1);
|
||||
}
|
||||
|
||||
|
||||
@ -2316,8 +2334,7 @@ static void make_parameter_names(dsql_par* parameter, const dsql_nod* item)
|
||||
break;
|
||||
case nod_strlen:
|
||||
{
|
||||
const ULONG length_type =
|
||||
*(SLONG*)item->nod_arg[e_strlen_type]->nod_desc.dsc_address;
|
||||
const ULONG length_type = item->nod_arg[e_strlen_type]->getConstant();
|
||||
|
||||
switch (length_type)
|
||||
{
|
||||
|
@ -28,6 +28,7 @@
|
||||
|
||||
#include "../dsql/sym.h"
|
||||
|
||||
dsql_nod* MAKE_const_slong(SLONG);
|
||||
dsql_nod* MAKE_constant(class dsql_str*, dsql_constant_type);
|
||||
dsql_nod* MAKE_str_constant(class dsql_str*, SSHORT);
|
||||
class dsql_str* MAKE_cstring(const char*);
|
||||
|
@ -361,6 +361,12 @@ public:
|
||||
dsql_nod* nod_arg[1];
|
||||
|
||||
dsql_nod() : nod_type(nod_unknown_type), nod_count(0), nod_flags(0) {}
|
||||
SLONG getConstant() const
|
||||
{
|
||||
fb_assert(nod_type == nod_constant);
|
||||
fb_assert(nod_desc.dsc_dtype == dtype_long);
|
||||
return *((SLONG*) nod_arg);
|
||||
}
|
||||
};
|
||||
|
||||
// values of flags
|
||||
@ -415,7 +421,7 @@ enum nod_flags_vals {
|
||||
// Parameters to MAKE_constant
|
||||
enum dsql_constant_type {
|
||||
CONSTANT_STRING = 0, // stored as a string
|
||||
CONSTANT_SLONG = 1, // stored as a SLONG
|
||||
// CONSTANT_SLONG = 1, // stored as a SLONG
|
||||
CONSTANT_DOUBLE = 2, // stored as a string
|
||||
CONSTANT_DATE = 3, // stored as a SLONG
|
||||
CONSTANT_TIME = 4, // stored as a ULONG
|
||||
@ -753,7 +759,7 @@ enum node_args {
|
||||
e_cnstr_source,
|
||||
e_cnstr_count,
|
||||
|
||||
e_trg_name = 0, // nod_mod_trigger and nod_def trigger
|
||||
e_trg_name = 0, // nod_mod_trigger and nod_def_trigger
|
||||
e_trg_table,
|
||||
e_trg_active,
|
||||
e_trg_type,
|
||||
|
2285
src/dsql/parse.cpp
2285
src/dsql/parse.cpp
File diff suppressed because it is too large
Load Diff
245
src/dsql/parse.y
245
src/dsql/parse.y
@ -789,11 +789,11 @@ arg_desc : init_data_type udf_data_type param_mechanism
|
||||
param_mechanism :
|
||||
{ $$ = NULL; } /* Beware: ddl.cpp converts this to mean FUN_reference. */
|
||||
| BY KW_DESCRIPTOR
|
||||
{ $$ = MAKE_constant ((dsql_str*) Jrd::FUN_descriptor, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (Jrd::FUN_descriptor); }
|
||||
| BY SCALAR_ARRAY
|
||||
{ $$ = MAKE_constant ((dsql_str*) Jrd::FUN_scalar_array, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (Jrd::FUN_scalar_array); }
|
||||
| KW_NULL
|
||||
{ $$ = MAKE_constant ((dsql_str*) Jrd::FUN_ref_with_null, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (Jrd::FUN_ref_with_null); }
|
||||
;
|
||||
|
||||
return_value1 : return_value
|
||||
@ -806,20 +806,20 @@ return_value : init_data_type udf_data_type return_mechanism
|
||||
$1, $3); }
|
||||
| PARAMETER pos_short_integer
|
||||
{ $$ = make_node (nod_udf_return_value, (int) e_udf_param_count,
|
||||
NULL, MAKE_constant ((dsql_str*) $2, CONSTANT_SLONG));}
|
||||
NULL, MAKE_const_slong ((IPTR) $2));}
|
||||
;
|
||||
|
||||
return_mechanism :
|
||||
{ $$ = MAKE_constant ((dsql_str*) Jrd::FUN_reference, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (Jrd::FUN_reference); }
|
||||
| BY KW_VALUE
|
||||
{ $$ = MAKE_constant ((dsql_str*) Jrd::FUN_value, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (Jrd::FUN_value); }
|
||||
| BY KW_DESCRIPTOR
|
||||
{ $$ = MAKE_constant ((dsql_str*) Jrd::FUN_descriptor, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (Jrd::FUN_descriptor); }
|
||||
| FREE_IT
|
||||
{ $$ = MAKE_constant ((dsql_str*) (-1 * Jrd::FUN_reference), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (-1 * Jrd::FUN_reference); }
|
||||
/* FUN_refrence with FREE_IT is -ve */
|
||||
| BY KW_DESCRIPTOR FREE_IT
|
||||
{ $$ = MAKE_constant ((dsql_str*) (-1 * Jrd::FUN_descriptor), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (-1 * Jrd::FUN_descriptor); }
|
||||
;
|
||||
|
||||
|
||||
@ -833,7 +833,7 @@ blob_filter_subtype : symbol_blob_subtype_name
|
||||
{ $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_STRING); }
|
||||
|
|
||||
signed_short_integer
|
||||
{ $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $1); }
|
||||
;
|
||||
|
||||
/* CREATE metadata operations */
|
||||
@ -958,17 +958,17 @@ shadow_clause : pos_short_integer manual_auto conditional sql_string
|
||||
;
|
||||
|
||||
manual_auto : MANUAL
|
||||
{ $$ = MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (1); }
|
||||
| AUTO
|
||||
{ $$ = MAKE_constant ((dsql_str*) 0, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (0); }
|
||||
|
|
||||
{ $$ = MAKE_constant ((dsql_str*) 0, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (0); }
|
||||
;
|
||||
|
||||
conditional :
|
||||
{ $$ = MAKE_constant ((dsql_str*) 0, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (0); }
|
||||
| CONDITIONAL
|
||||
{ $$ = MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (1); }
|
||||
;
|
||||
|
||||
first_file_length :
|
||||
@ -1745,32 +1745,32 @@ fetch_seek_opt :
|
||||
| FIRST
|
||||
{ $$ = make_node (nod_fetch_seek, 2,
|
||||
// corresponds to (blr_bof_forward, 0)
|
||||
MAKE_constant ((dsql_str*) 3, CONSTANT_SLONG),
|
||||
MAKE_constant ((dsql_str*) 0, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (3),
|
||||
MAKE_const_slong (0)); }
|
||||
| LAST
|
||||
{ $$ = make_node (nod_fetch_seek, 2,
|
||||
// corresponds to (blr_eof_backward, 0)
|
||||
MAKE_constant ((dsql_str*) 4, CONSTANT_SLONG),
|
||||
MAKE_constant ((dsql_str*) 0, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (4),
|
||||
MAKE_const_slong (0)); }
|
||||
| PRIOR
|
||||
{ $$ = make_node (nod_fetch_seek, 2,
|
||||
// corresponds to (blr_backward, 1)
|
||||
MAKE_constant ((dsql_str*) 2, CONSTANT_SLONG),
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (2),
|
||||
MAKE_const_slong (1)); }
|
||||
| NEXT
|
||||
{ $$ = make_node (nod_fetch_seek, 2,
|
||||
// corresponds to (blr_forward, 1)
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG),
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (1),
|
||||
MAKE_const_slong (1)); }
|
||||
| ABSOLUTE value
|
||||
{ $$ = make_node (nod_fetch_seek, 2,
|
||||
// corresponds to (blr_bof_forward, value)
|
||||
MAKE_constant ((dsql_str*) 3, CONSTANT_SLONG),
|
||||
MAKE_const_slong (3),
|
||||
$2); }
|
||||
| RELATIVE value
|
||||
{ $$ = make_node (nod_fetch_seek, 2,
|
||||
// corresponds to (blr_forward, value)
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG),
|
||||
MAKE_const_slong (1),
|
||||
$2); }
|
||||
;
|
||||
*/
|
||||
@ -1923,9 +1923,9 @@ replace_trigger_clause : symbol_trigger_name FOR simple_table_name
|
||||
;
|
||||
|
||||
trigger_active : ACTIVE
|
||||
{ $$ = MAKE_constant ((dsql_str*) 0, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (0); }
|
||||
| INACTIVE
|
||||
{ $$ = MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (1); }
|
||||
|
|
||||
{ $$ = NULL; }
|
||||
;
|
||||
@ -1935,45 +1935,45 @@ trigger_type : trigger_type_prefix trigger_type_suffix
|
||||
;
|
||||
|
||||
trigger_type_prefix : BEFORE
|
||||
{ $$ = MAKE_constant ((dsql_str*) 0, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (0); }
|
||||
| AFTER
|
||||
{ $$ = MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (1); }
|
||||
;
|
||||
|
||||
trigger_type_suffix : INSERT
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 0, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (1, 0, 0)); }
|
||||
| UPDATE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 0, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (2, 0, 0)); }
|
||||
| KW_DELETE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 0, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (3, 0, 0)); }
|
||||
| INSERT OR UPDATE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 2, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (1, 2, 0)); }
|
||||
| INSERT OR KW_DELETE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 3, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (1, 3, 0)); }
|
||||
| UPDATE OR INSERT
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 1, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (2, 1, 0)); }
|
||||
| UPDATE OR KW_DELETE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 3, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (2, 3, 0)); }
|
||||
| KW_DELETE OR INSERT
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 1, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (3, 1, 0)); }
|
||||
| KW_DELETE OR UPDATE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 2, 0), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (3, 2, 0)); }
|
||||
| INSERT OR UPDATE OR KW_DELETE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 2, 3), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (1, 2, 3)); }
|
||||
| INSERT OR KW_DELETE OR UPDATE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (1, 3, 2), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (1, 3, 2)); }
|
||||
| UPDATE OR INSERT OR KW_DELETE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 1, 3), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (2, 1, 3)); }
|
||||
| UPDATE OR KW_DELETE OR INSERT
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (2, 3, 1), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (2, 3, 1)); }
|
||||
| KW_DELETE OR INSERT OR UPDATE
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 1, 2), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (3, 1, 2)); }
|
||||
| KW_DELETE OR UPDATE OR INSERT
|
||||
{ $$ = MAKE_constant ((dsql_str*)(IPTR) trigger_type_suffix (3, 2, 1), CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (trigger_type_suffix (3, 2, 1)); }
|
||||
;
|
||||
|
||||
trigger_position : POSITION nonneg_short_integer
|
||||
{ $$ = MAKE_constant ((dsql_str*) $2, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $2); }
|
||||
|
|
||||
{ $$ = NULL; }
|
||||
;
|
||||
@ -2052,10 +2052,10 @@ alter_op : DROP simple_column_name drop_behaviour
|
||||
/* CVC: From SQL, field positions start at 1, not zero. Think in ORDER BY, for example.
|
||||
| col_opt simple_column_name POSITION nonneg_short_integer
|
||||
{ $$ = make_node (nod_mod_field_pos, 2, $2,
|
||||
MAKE_constant ((dsql_str*) $4, CONSTANT_SLONG)); } */
|
||||
MAKE_const_slong ((IPTR) $4)); } */
|
||||
| col_opt simple_column_name POSITION pos_short_integer
|
||||
{ $$ = make_node(nod_mod_field_pos, 2, $2,
|
||||
MAKE_constant((dsql_str*) $4, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong((IPTR) $4)); }
|
||||
| col_opt alter_column_name TO simple_column_name
|
||||
{ $$ = make_node(nod_mod_field_name, 2, $2, $4); }
|
||||
| col_opt alter_col_name TYPE alter_data_type_or_domain
|
||||
@ -2156,7 +2156,7 @@ alter_index_clause : symbol_index_name ACTIVE
|
||||
|
||||
alter_sequence_clause : symbol_generator_name RESTART WITH signed_long_integer
|
||||
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $1,
|
||||
MAKE_constant ((dsql_str*) $4, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong ((IPTR) $4)); }
|
||||
| symbol_generator_name RESTART WITH NUMBER64BIT
|
||||
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $1,
|
||||
MAKE_constant((dsql_str*) $4, CONSTANT_SINT64)); }
|
||||
@ -2293,16 +2293,16 @@ array_spec : array_range
|
||||
array_range : signed_long_integer
|
||||
{ if ((IPTR) $1 < 1)
|
||||
$$ = make_node (nod_list, (int) 2,
|
||||
MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG),
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG));
|
||||
MAKE_const_slong ((IPTR) $1),
|
||||
MAKE_const_slong (1));
|
||||
else
|
||||
$$ = make_node (nod_list, (int) 2,
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG),
|
||||
MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG) ); }
|
||||
MAKE_const_slong (1),
|
||||
MAKE_const_slong ((IPTR) $1) ); }
|
||||
| signed_long_integer ':' signed_long_integer
|
||||
{ $$ = make_node (nod_list, (int) 2,
|
||||
MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG),
|
||||
MAKE_constant ((dsql_str*) $3, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong ((IPTR) $1),
|
||||
MAKE_const_slong ((IPTR) $3)); }
|
||||
;
|
||||
|
||||
simple_type : non_charset_simple_type
|
||||
@ -2700,7 +2700,7 @@ set : set_transaction
|
||||
|
||||
set_generator : SET GENERATOR symbol_generator_name TO signed_long_integer
|
||||
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $3,
|
||||
MAKE_constant ((dsql_str*) $5, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong ((IPTR) $5)); }
|
||||
| SET GENERATOR symbol_generator_name TO NUMBER64BIT
|
||||
{ $$ = make_node (nod_set_generator2, e_gen_id_count, $3,
|
||||
MAKE_constant((dsql_str*) $5, CONSTANT_SINT64)); }
|
||||
@ -2834,7 +2834,7 @@ tra_misc_options: NO AUTO UNDO
|
||||
;
|
||||
|
||||
tra_timeout: LOCK TIMEOUT nonneg_short_integer
|
||||
{ $$ = make_node(nod_lock_timeout, 1, MAKE_constant ((dsql_str*) $3, CONSTANT_SLONG)); }
|
||||
{ $$ = make_node(nod_lock_timeout, 1, MAKE_const_slong ((IPTR) $3)); }
|
||||
;
|
||||
|
||||
tbl_reserve_options: RESERVING restr_list
|
||||
@ -2889,47 +2889,47 @@ comment : COMMENT ON ddl_type0 IS ddl_desc
|
||||
;
|
||||
|
||||
ddl_type0 : DATABASE
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_database, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_database); }
|
||||
;
|
||||
|
||||
ddl_type1 : DOMAIN
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_domain, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_domain); }
|
||||
| TABLE
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_relation, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_relation); }
|
||||
| VIEW
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_view, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_view); }
|
||||
| PROCEDURE
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_procedure, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_procedure); }
|
||||
| TRIGGER
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_trigger, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_trigger); }
|
||||
| EXTERNAL FUNCTION
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_udf, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_udf); }
|
||||
| FILTER
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_blob_filter, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_blob_filter); }
|
||||
| EXCEPTION
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_exception, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_exception); }
|
||||
| GENERATOR
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_generator, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_generator); }
|
||||
| SEQUENCE
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_generator, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_generator); }
|
||||
| INDEX
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_index, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_index); }
|
||||
| ROLE
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_role, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_role); }
|
||||
| CHARACTER SET
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_charset, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_charset); }
|
||||
| COLLATION
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_collation, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_collation); }
|
||||
/*
|
||||
| SECURITY CLASS
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_sec_class, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_sec_class); }
|
||||
*/
|
||||
;
|
||||
|
||||
ddl_type2 : COLUMN
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_relation, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_relation); }
|
||||
| PARAMETER
|
||||
{ $$ = MAKE_constant((dsql_str*) ddl_procedure, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(ddl_procedure); }
|
||||
;
|
||||
|
||||
ddl_subname : '.' symbol_ddl_name
|
||||
@ -3032,7 +3032,7 @@ limit_clause : first_clause skip_clause end_limit
|
||||
;
|
||||
|
||||
first_clause : FIRST long_integer begin_limit
|
||||
{ $$ = MAKE_constant ((dsql_str*) $2, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $2); }
|
||||
| FIRST '(' value ')' begin_limit
|
||||
{ $$ = $3; }
|
||||
| FIRST parameter begin_limit
|
||||
@ -3040,7 +3040,7 @@ first_clause : FIRST long_integer begin_limit
|
||||
;
|
||||
|
||||
skip_clause : SKIP long_integer
|
||||
{ $$ = MAKE_constant ((dsql_str*) $2, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $2); }
|
||||
| SKIP '(' end_limit value ')'
|
||||
{ $$ = $4; }
|
||||
| SKIP parameter
|
||||
@ -3308,9 +3308,9 @@ order_direction : ASC
|
||||
;
|
||||
|
||||
nulls_placement : FIRST
|
||||
{ $$ = MAKE_constant((dsql_str*) NOD_NULLS_FIRST, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(NOD_NULLS_FIRST); }
|
||||
| LAST
|
||||
{ $$ = MAKE_constant((dsql_str*) NOD_NULLS_LAST, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong(NOD_NULLS_LAST); }
|
||||
;
|
||||
|
||||
nulls_clause : NULLS begin_first nulls_placement end_first
|
||||
@ -3328,10 +3328,10 @@ rows_clause : ROWS value
|
||||
/* equivalent to FIRST (upper_value - lower_value + 1) SKIP (lower_value - 1) */
|
||||
{ $$ = make_node (nod_rows, (int) e_rows_count,
|
||||
make_node (nod_subtract, 2, $2,
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG)),
|
||||
MAKE_const_slong (1)),
|
||||
make_node (nod_add, 2,
|
||||
make_node (nod_subtract, 2, $4, $2),
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG))); }
|
||||
MAKE_const_slong (1))); }
|
||||
|
|
||||
{ $$ = NULL; }
|
||||
;
|
||||
@ -3437,7 +3437,7 @@ blob_subtype_value_io : blob_subtype_io
|
||||
;
|
||||
|
||||
blob_subtype_io : signed_short_integer
|
||||
{ $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $1); }
|
||||
;
|
||||
|
||||
segment_clause_io : MAX_SEGMENT segment_length_io
|
||||
@ -3447,7 +3447,7 @@ segment_clause_io : MAX_SEGMENT segment_length_io
|
||||
;
|
||||
|
||||
segment_length_io : unsigned_short_integer
|
||||
{ $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $1); }
|
||||
| parameter
|
||||
;
|
||||
|
||||
@ -3679,35 +3679,35 @@ null_predicate : value IS KW_NULL
|
||||
trigger_action_predicate : INSERTING
|
||||
{ $$ = make_node (nod_eql, 2,
|
||||
make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_trigger_action, CONSTANT_SLONG)),
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_trigger_action)),
|
||||
MAKE_const_slong (1)); }
|
||||
| UPDATING
|
||||
{ $$ = make_node (nod_eql, 2,
|
||||
make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_trigger_action, CONSTANT_SLONG)),
|
||||
MAKE_constant ((dsql_str*) 2, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_trigger_action)),
|
||||
MAKE_const_slong (2)); }
|
||||
| DELETING
|
||||
{ $$ = make_node (nod_eql, 2,
|
||||
make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_trigger_action, CONSTANT_SLONG)),
|
||||
MAKE_constant ((dsql_str*) 3, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_trigger_action)),
|
||||
MAKE_const_slong (3)); }
|
||||
;
|
||||
|
||||
special_trigger_action_predicate : KW_INSERTING
|
||||
{ $$ = make_node (nod_eql, 2,
|
||||
make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_trigger_action, CONSTANT_SLONG)),
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_trigger_action)),
|
||||
MAKE_const_slong (1)); }
|
||||
| KW_UPDATING
|
||||
{ $$ = make_node (nod_eql, 2,
|
||||
make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_trigger_action, CONSTANT_SLONG)),
|
||||
MAKE_constant ((dsql_str*) 2, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_trigger_action)),
|
||||
MAKE_const_slong (2)); }
|
||||
| KW_DELETING
|
||||
{ $$ = make_node (nod_eql, 2,
|
||||
make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_trigger_action, CONSTANT_SLONG)),
|
||||
MAKE_constant ((dsql_str*) 3, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_trigger_action)),
|
||||
MAKE_const_slong (3)); }
|
||||
;
|
||||
|
||||
/* set values */
|
||||
@ -3826,7 +3826,7 @@ datetime_value_expression : CURRENT_DATE
|
||||
;
|
||||
|
||||
sec_precision_opt : '(' nonneg_short_integer ')'
|
||||
{ $$ = MAKE_constant ((dsql_str*) $2, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $2); }
|
||||
|
|
||||
{ $$ = NULL; }
|
||||
;
|
||||
@ -3848,7 +3848,7 @@ constant : u_constant
|
||||
u_numeric_constant : NUMERIC
|
||||
{ $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_STRING); }
|
||||
| NUMBER
|
||||
{ $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong ((IPTR) $1); }
|
||||
| FLOAT_NUMBER
|
||||
{ $$ = MAKE_constant ((dsql_str*) $1, CONSTANT_DOUBLE); }
|
||||
| NUMBER64BIT
|
||||
@ -3912,19 +3912,19 @@ current_role : CURRENT_ROLE
|
||||
|
||||
internal_info : CURRENT_CONNECTION
|
||||
{ $$ = make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_connection_id, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_connection_id)); }
|
||||
| CURRENT_TRANSACTION
|
||||
{ $$ = make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_transaction_id, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_transaction_id)); }
|
||||
| GDSCODE
|
||||
{ $$ = make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_gdscode, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_gdscode)); }
|
||||
| SQLCODE
|
||||
{ $$ = make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_sqlcode, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_sqlcode)); }
|
||||
| ROW_COUNT
|
||||
{ $$ = make_node (nod_internal_info, (int) e_internal_info_count,
|
||||
MAKE_constant ((dsql_str*) internal_rows_affected, CONSTANT_SLONG)); }
|
||||
MAKE_const_slong (internal_rows_affected)); }
|
||||
;
|
||||
|
||||
sql_string : STRING /* string in current charset */
|
||||
@ -4048,20 +4048,20 @@ length_expression : bit_length_expression
|
||||
|
||||
bit_length_expression : BIT_LENGTH '(' value ')'
|
||||
{ $$ = make_node(nod_strlen, (int) e_strlen_count,
|
||||
MAKE_constant((dsql_str*)blr_strlen_bit, CONSTANT_SLONG), $3); }
|
||||
MAKE_const_slong(blr_strlen_bit), $3); }
|
||||
;
|
||||
|
||||
char_length_expression : CHAR_LENGTH '(' value ')'
|
||||
{ $$ = make_node(nod_strlen, (int) e_strlen_count,
|
||||
MAKE_constant((dsql_str*)blr_strlen_char, CONSTANT_SLONG), $3); }
|
||||
MAKE_const_slong(blr_strlen_char), $3); }
|
||||
| CHARACTER_LENGTH '(' value ')'
|
||||
{ $$ = make_node(nod_strlen, (int) e_strlen_count,
|
||||
MAKE_constant((dsql_str*)blr_strlen_char, CONSTANT_SLONG), $3); }
|
||||
MAKE_const_slong(blr_strlen_char), $3); }
|
||||
;
|
||||
|
||||
octet_length_expression : OCTET_LENGTH '(' value ')'
|
||||
{ $$ = make_node(nod_strlen, (int) e_strlen_count,
|
||||
MAKE_constant((dsql_str*)blr_strlen_octet, CONSTANT_SLONG), $3); }
|
||||
MAKE_const_slong(blr_strlen_octet), $3); }
|
||||
;
|
||||
|
||||
string_value_function : substring_function
|
||||
@ -4078,33 +4078,33 @@ substring_function : SUBSTRING '(' value FROM value string_length_opt ')'
|
||||
compatible with the engine's implementation */
|
||||
{ $$ = make_node (nod_substr, (int) e_substr_count, $3,
|
||||
make_node (nod_subtract, 2, $5,
|
||||
MAKE_constant ((dsql_str*) 1, CONSTANT_SLONG)), $6); }
|
||||
MAKE_const_slong (1)), $6); }
|
||||
;
|
||||
|
||||
string_length_opt : FOR value
|
||||
{ $$ = $2; }
|
||||
|
|
||||
{ $$ = MAKE_constant ((dsql_str*) SHRT_POS_MAX, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (SHRT_POS_MAX); }
|
||||
;
|
||||
|
||||
trim_function : TRIM '(' trim_specification value FROM value ')'
|
||||
{ $$ = make_node (nod_trim, (int) e_trim_count, $3, $4, $6); }
|
||||
| TRIM '(' value FROM value ')'
|
||||
{ $$ = make_node (nod_trim, (int) e_trim_count,
|
||||
MAKE_constant ((dsql_str*)blr_trim_both, CONSTANT_SLONG), $3, $5); }
|
||||
MAKE_const_slong (blr_trim_both), $3, $5); }
|
||||
| TRIM '(' trim_specification FROM value ')'
|
||||
{ $$ = make_node (nod_trim, (int) e_trim_count, $3, NULL, $5); }
|
||||
| TRIM '(' value ')'
|
||||
{ $$ = make_node (nod_trim, (int) e_trim_count,
|
||||
MAKE_constant ((dsql_str*)blr_trim_both, CONSTANT_SLONG), NULL, $3); }
|
||||
MAKE_const_slong (blr_trim_both), NULL, $3); }
|
||||
;
|
||||
|
||||
trim_specification : BOTH
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_trim_both, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_trim_both); }
|
||||
| TRAILING
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_trim_trailing, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_trim_trailing); }
|
||||
| LEADING
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_trim_leading, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_trim_leading); }
|
||||
;
|
||||
|
||||
udf : symbol_UDF_name '(' value_list ')'
|
||||
@ -4177,10 +4177,10 @@ next_value_expression : NEXT KW_VALUE FOR symbol_generator_name
|
||||
{
|
||||
if (client_dialect >= SQL_DIALECT_V6_TRANSITION)
|
||||
$$ = make_node (nod_gen_id2, 2, $4,
|
||||
MAKE_constant((dsql_str*) 1, CONSTANT_SLONG));
|
||||
MAKE_const_slong(1));
|
||||
else
|
||||
$$ = make_node (nod_gen_id, 2, $4,
|
||||
MAKE_constant((dsql_str*) 1, CONSTANT_SLONG));
|
||||
MAKE_const_slong(1));
|
||||
}
|
||||
| GEN_ID '(' symbol_generator_name ',' value ')'
|
||||
{
|
||||
@ -4193,21 +4193,21 @@ next_value_expression : NEXT KW_VALUE FOR symbol_generator_name
|
||||
|
||||
|
||||
timestamp_part : YEAR
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_year, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_year); }
|
||||
| MONTH
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_month, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_month); }
|
||||
| DAY
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_day, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_day); }
|
||||
| HOUR
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_hour, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_hour); }
|
||||
| MINUTE
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_minute, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_minute); }
|
||||
| SECOND
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_second, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_second); }
|
||||
| WEEKDAY
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_weekday, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_weekday); }
|
||||
| YEARDAY
|
||||
{ $$ = MAKE_constant ((dsql_str*)blr_extract_yearday, CONSTANT_SLONG); }
|
||||
{ $$ = MAKE_const_slong (blr_extract_yearday); }
|
||||
;
|
||||
|
||||
all_noise : ALL
|
||||
@ -5160,6 +5160,7 @@ int LexerState::yylex (
|
||||
if (!have_decimal && (number <= MAX_SLONG))
|
||||
{
|
||||
yylval = (dsql_nod*) (IPTR) number;
|
||||
//printf ("parse.y %p %d\n", yylval, number);
|
||||
return NUMBER;
|
||||
}
|
||||
else
|
||||
|
@ -942,7 +942,7 @@ dsql_nod* PASS1_node(dsql_req* request, dsql_nod* input, bool proc_flag)
|
||||
dsql_nod* const_node = input->nod_arg[0];
|
||||
if (const_node) {
|
||||
fb_assert(const_node->nod_type == nod_constant);
|
||||
const int precision = (int)(IPTR) const_node->nod_arg[0];
|
||||
const int precision = (int) const_node->getConstant();
|
||||
fb_assert(precision >= 0);
|
||||
if (precision > MAX_TIME_PRECISION) {
|
||||
ERRD_post(isc_invalid_time_precision,
|
||||
@ -3171,10 +3171,10 @@ static void pass1_blob( dsql_req* request, dsql_nod* input)
|
||||
}
|
||||
}
|
||||
if (!blob->blb_from) {
|
||||
blob->blb_from = MAKE_constant((dsql_str*) 0, CONSTANT_SLONG);
|
||||
blob->blb_from = MAKE_const_slong(0);
|
||||
}
|
||||
if (!blob->blb_to) {
|
||||
blob->blb_to = MAKE_constant((dsql_str*) 0, CONSTANT_SLONG);
|
||||
blob->blb_to = MAKE_const_slong(0);
|
||||
}
|
||||
|
||||
for (parameter = blob->blb_open_in_msg->msg_parameters; parameter;
|
||||
@ -5052,7 +5052,7 @@ static dsql_nod* pass1_group_by_list(dsql_req* request, dsql_nod* input, dsql_no
|
||||
stack.push(frnode);
|
||||
}
|
||||
else if ((sub->nod_type == nod_constant) && (sub->nod_desc.dsc_dtype == dtype_long)) {
|
||||
const ULONG position = (IPTR) (sub->nod_arg[0]);
|
||||
const ULONG position = sub->getConstant();
|
||||
if ((position < 1) || !selectList ||
|
||||
(position > (ULONG) selectList->nod_count))
|
||||
{
|
||||
@ -6813,7 +6813,7 @@ static dsql_nod* pass1_sort( dsql_req* request, dsql_nod* input, dsql_nod* selec
|
||||
else if (node1->nod_type == nod_constant &&
|
||||
node1->nod_desc.dsc_dtype == dtype_long)
|
||||
{
|
||||
const ULONG position = (IPTR) (node1->nod_arg[0]);
|
||||
const ULONG position = node1->getConstant();
|
||||
if ((position < 1) || !selectList ||
|
||||
(position > (ULONG) selectList->nod_count))
|
||||
{
|
||||
@ -7095,7 +7095,7 @@ static dsql_nod* pass1_union( dsql_req* request, dsql_nod* input,
|
||||
isc_arg_gds, isc_order_by_err, // invalid ORDER BY clause.
|
||||
0);
|
||||
}
|
||||
const SLONG number = (IPTR) position->nod_arg[0];
|
||||
const SLONG number = position->getConstant();
|
||||
if (number < 1 || number > union_items->nod_count) {
|
||||
ERRD_post(isc_sqlerr, isc_arg_number, (SLONG) - 104,
|
||||
isc_arg_gds, isc_dsql_command_err,
|
||||
|
Loading…
Reference in New Issue
Block a user