|
|
if (constant) | if (constant) |
{ | { |
request->append_number(gds_dyn_trg_sequence, | request->append_number(gds_dyn_trg_sequence, |
(SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0)); |
(SSHORT)(SLONG)(IPTR) (constant ? constant->nod_arg[0] : 0)); |
} | } |
| |
if ((constant = node->nod_arg[e_cnstr_type]) != NULL) | if ((constant = node->nod_arg[e_cnstr_type]) != NULL) |
{ | { |
const SSHORT type = (SSHORT)(SLONG) constant->nod_arg[0]; |
const SSHORT type = (SSHORT)(SLONG)(IPTR) constant->nod_arg[0]; |
request->append_number(gds_dyn_trg_type, type); | request->append_number(gds_dyn_trg_type, type); |
} | } |
| |
|
|
| |
switch (element->nod_type) { | switch (element->nod_type) { |
case nod_file_length: | case nod_file_length: |
start = (SLONG) (element->nod_arg[0]) + 1; |
start = (SLONG) (IPTR) (element->nod_arg[0]) + 1; |
break; | break; |
| |
default: | default: |
|
|
| |
case nod_group_commit_wait: | case nod_group_commit_wait: |
request->append_uchar(gds_dyn_log_group_commit_wait); | request->append_uchar(gds_dyn_log_group_commit_wait); |
temp_long = (SLONG) (element->nod_arg[0]); |
temp_long = (SLONG) (IPTR) (element->nod_arg[0]); |
request->append_ulong_with_length(temp_long); | request->append_ulong_with_length(temp_long); |
break; | break; |
| |
case nod_check_point_len: | case nod_check_point_len: |
request->append_uchar(gds_dyn_log_check_point_length); | request->append_uchar(gds_dyn_log_check_point_length); |
temp_long = (SLONG) (element->nod_arg[0]); |
temp_long = (SLONG) (IPTR) (element->nod_arg[0]); |
request->append_ulong_with_length(temp_long); | request->append_ulong_with_length(temp_long); |
break; | break; |
| |
case nod_num_log_buffers: | case nod_num_log_buffers: |
request->append_uchar(gds_dyn_log_num_of_buffers); | request->append_uchar(gds_dyn_log_num_of_buffers); |
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); |
temp_short = (SSHORT)(SLONG) (IPTR) (element->nod_arg[0]); |
request->append_ushort_with_length(temp_short); | request->append_ushort_with_length(temp_short); |
break; | break; |
| |
case nod_log_buffer_size: | case nod_log_buffer_size: |
request->append_uchar(gds_dyn_log_buffer_size); | request->append_uchar(gds_dyn_log_buffer_size); |
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); |
temp_short = (SSHORT)(SLONG) (IPTR) (element->nod_arg[0]); |
request->append_ushort_with_length(temp_short); | request->append_ushort_with_length(temp_short); |
break; | break; |
| |
|
|
request->append_number(gds_dyn_def_dimension, position); | request->append_number(gds_dyn_def_dimension, position); |
DSQL_NOD element = *ptr++; | DSQL_NOD element = *ptr++; |
request->append_uchar(gds_dyn_dim_lower); | request->append_uchar(gds_dyn_dim_lower); |
SLONG lrange = (SLONG) (element->nod_arg[0]); |
SLONG lrange = (SLONG) (IPTR) (element->nod_arg[0]); |
request->append_ulong_with_length(lrange); | request->append_ulong_with_length(lrange); |
element = *ptr; | element = *ptr; |
request->append_uchar(gds_dyn_dim_upper); | request->append_uchar(gds_dyn_dim_upper); |
SLONG hrange = (SLONG) (element->nod_arg[0]); |
SLONG hrange = (SLONG) (IPTR) (element->nod_arg[0]); |
request->append_ulong_with_length(hrange); | request->append_ulong_with_length(hrange); |
request->append_uchar(gds_dyn_end); | request->append_uchar(gds_dyn_end); |
if (lrange >= hrange) | if (lrange >= hrange) |
|
|
request->append_cstring(gds_dyn_def_filter, | request->append_cstring(gds_dyn_def_filter, |
((STR) (ptr[e_filter_name]))->str_data); | ((STR) (ptr[e_filter_name]))->str_data); |
request->append_number(gds_dyn_filter_in_subtype, | request->append_number(gds_dyn_filter_in_subtype, |
(SSHORT)(SLONG) ((ptr[e_filter_in_type])->nod_arg[0])); |
(SSHORT)(SLONG) (IPTR) ((ptr[e_filter_in_type])->nod_arg[0])); |
request->append_number(gds_dyn_filter_out_subtype, | request->append_number(gds_dyn_filter_out_subtype, |
(SSHORT)(SLONG) ((ptr[e_filter_out_type])->nod_arg[0])); |
(SSHORT)(SLONG) (IPTR) ((ptr[e_filter_out_type])->nod_arg[0])); |
request->append_cstring(gds_dyn_func_entry_point, | request->append_cstring(gds_dyn_func_entry_point, |
((STR) (ptr[e_filter_entry_pt]))->str_data); | ((STR) (ptr[e_filter_entry_pt]))->str_data); |
request->append_cstring(gds_dyn_func_module_name, | request->append_cstring(gds_dyn_func_module_name, |
|
|
gds_arg_gds, gds_dsql_shadow_number_err, 0); | gds_arg_gds, gds_dsql_shadow_number_err, 0); |
} | } |
| |
request->append_number(gds_dyn_def_shadow, (SSHORT)(SLONG) (ptr[e_shadow_number])); |
request->append_number(gds_dyn_def_shadow, (SSHORT)(SLONG) (IPTR) (ptr[e_shadow_number])); |
request->append_cstring(gds_dyn_def_file, ((STR) (ptr[e_shadow_name]))->str_data); | request->append_cstring(gds_dyn_def_file, ((STR) (ptr[e_shadow_name]))->str_data); |
request->append_number(gds_dyn_shadow_man_auto, | request->append_number(gds_dyn_shadow_man_auto, |
(SSHORT)(SLONG) ((ptr[e_shadow_man_auto])->nod_arg[0])); |
(SSHORT)(SLONG) (IPTR) ((ptr[e_shadow_man_auto])->nod_arg[0])); |
request->append_number(gds_dyn_shadow_conditional, | request->append_number(gds_dyn_shadow_conditional, |
(SSHORT)(SLONG) ((ptr[e_shadow_conditional])->nod_arg[0])); |
(SSHORT)(SLONG) (IPTR) ((ptr[e_shadow_conditional])->nod_arg[0])); |
| |
request->append_file_start(0); | request->append_file_start(0); |
| |
SLONG length = (SLONG) ptr[e_shadow_length]; |
SLONG length = (SLONG) (IPTR) ptr[e_shadow_length]; |
request->append_file_length(length); | request->append_file_length(length); |
| |
request->append_uchar(gds_dyn_end); | request->append_uchar(gds_dyn_end); |
|
|
| |
if (constant = node->nod_arg[e_trg_active]) | if (constant = node->nod_arg[e_trg_active]) |
request->append_number(gds_dyn_trg_inactive, | request->append_number(gds_dyn_trg_inactive, |
(SSHORT)(SLONG) constant->nod_arg[0]); |
(SSHORT)(SLONG) (IPTR) constant->nod_arg[0]); |
| |
if (constant = node->nod_arg[e_trg_position]) | if (constant = node->nod_arg[e_trg_position]) |
request->append_number(gds_dyn_trg_sequence, | request->append_number(gds_dyn_trg_sequence, |
(SSHORT)(SLONG) constant->nod_arg[0]); |
(SSHORT)(SLONG) (IPTR) constant->nod_arg[0]); |
| |
if (constant = node->nod_arg[e_trg_type]) { | if (constant = node->nod_arg[e_trg_type]) { |
request->append_number(gds_dyn_trg_type, (SSHORT)(SLONG) constant->nod_arg[0]); |
request->append_number(gds_dyn_trg_type, (SSHORT)(SLONG) (IPTR) constant->nod_arg[0]); |
trig_type = (USHORT)(ULONG) constant->nod_arg[0]; |
trig_type = (USHORT)(ULONG) (IPTR) constant->nod_arg[0]; |
} | } |
else { | else { |
assert(node->nod_type == nod_mod_trigger); | assert(node->nod_type == nod_mod_trigger); |
|
|
for (DSQL_NOD* ptr = temp->nod_arg; ptr < end; ++ptr) | for (DSQL_NOD* ptr = temp->nod_arg; ptr < end; ++ptr) |
{ | { |
DSQL_NOD message = *ptr; | DSQL_NOD message = *ptr; |
SSHORT number = (SSHORT)(SLONG) message->nod_arg[e_msg_number]; |
SSHORT number = (SSHORT)(SLONG) (IPTR) message->nod_arg[e_msg_number]; |
if (message->nod_type == nod_del_trigger_msg) | if (message->nod_type == nod_del_trigger_msg) |
{ | { |
request->append_number(gds_dyn_delete_trigger_msg, number); | request->append_number(gds_dyn_delete_trigger_msg, number); |
|
|
// CVC: This is case of "returns <type> [by value|reference]" | // CVC: This is case of "returns <type> [by value|reference]" |
/* Some data types can not be returned as value */ | /* Some data types can not be returned as value */ |
| |
if (((int)(SLONG) (ret_val_ptr[1]->nod_arg[0]) == FUN_value) && |
if (((int)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]) == FUN_value) && |
(field->fld_dtype == dtype_text || | (field->fld_dtype == dtype_text || |
field->fld_dtype == dtype_varying || | field->fld_dtype == dtype_varying || |
field->fld_dtype == dtype_cstring || | field->fld_dtype == dtype_cstring || |
|
|
// CVC: This is case of "returns parameter <N>" | // CVC: This is case of "returns parameter <N>" |
| |
| |
position = (SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0]); |
position = (SSHORT)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0]); |
/* Function modifies an argument whose value is the function return value */ | /* Function modifies an argument whose value is the function return value */ |
| |
if (!arguments || position > arguments->nod_count || position < 1) { | if (!arguments || position > arguments->nod_count || position < 1) { |
|
|
if (field->fld_dtype == dtype_blob) | if (field->fld_dtype == dtype_blob) |
{ | { |
/* CVC: I need to test returning blobs by descriptor before allowing the change there. For now, I ignore the return type specification. */ | /* CVC: I need to test returning blobs by descriptor before allowing the change there. For now, I ignore the return type specification. */ |
BOOLEAN free_it = ((SSHORT)(SLONG) ret_val_ptr[1]->nod_arg[0] < 0); |
BOOLEAN free_it = ((SSHORT)(SLONG) (IPTR) ret_val_ptr[1]->nod_arg[0] < 0); |
request->append_number(gds_dyn_def_function_arg, blob_position); | request->append_number(gds_dyn_def_function_arg, blob_position); |
request->append_number(gds_dyn_func_mechanism, | request->append_number(gds_dyn_func_mechanism, |
(SSHORT)(SLONG) ((free_it ? -1 : 1) * FUN_blob_struct)); | (SSHORT)(SLONG) ((free_it ? -1 : 1) * FUN_blob_struct)); |
|
|
{ | { |
request->append_number(gds_dyn_def_function_arg, (SSHORT) 0); | request->append_number(gds_dyn_def_function_arg, (SSHORT) 0); |
request->append_number(gds_dyn_func_mechanism, | request->append_number(gds_dyn_func_mechanism, |
(SSHORT)(SLONG) (ret_val_ptr[1]->nod_arg[0])); |
(SSHORT)(SLONG) (IPTR) (ret_val_ptr[1]->nod_arg[0])); |
} | } |
| |
request->append_cstring(gds_dyn_function_name, udf_name); | request->append_cstring(gds_dyn_function_name, udf_name); |
|
|
request->append_number(gds_dyn_def_function_arg, (SSHORT) position); | request->append_number(gds_dyn_def_function_arg, (SSHORT) position); |
| |
if (param_node [e_udf_param_type]) { | if (param_node [e_udf_param_type]) { |
SSHORT arg_mechanism = (SSHORT)(SLONG) (param_node [e_udf_param_type]->nod_arg [0]); |
SSHORT arg_mechanism = (SSHORT)(SLONG) (IPTR) (param_node [e_udf_param_type]->nod_arg [0]); |
request->append_number(gds_dyn_func_mechanism, arg_mechanism); | request->append_number(gds_dyn_func_mechanism, arg_mechanism); |
} | } |
else if (field->fld_dtype == dtype_blob) { | else if (field->fld_dtype == dtype_blob) { |
|
|
if (constant) | if (constant) |
{ | { |
request->append_number(gds_dyn_trg_sequence, | request->append_number(gds_dyn_trg_sequence, |
(SSHORT)(SLONG) (constant ? constant->nod_arg[0] : 0)); |
(SSHORT)(SLONG) (IPTR) (constant ? constant->nod_arg[0] : 0)); |
} | } |
| |
constant = node->nod_arg[e_cnstr_type]; | constant = node->nod_arg[e_cnstr_type]; |
if (constant) | if (constant) |
{ | { |
trig_type = (USHORT)(ULONG) constant->nod_arg[0]; |
trig_type = (USHORT)(ULONG)(IPTR) constant->nod_arg[0]; |
request->append_number(gds_dyn_trg_type, trig_type); | request->append_number(gds_dyn_trg_type, trig_type); |
} | } |
else | else |
|
|
| |
case nod_del_shadow: | case nod_del_shadow: |
request->append_number(gds_dyn_delete_shadow, | request->append_number(gds_dyn_delete_shadow, |
(SSHORT)(SLONG) (node->nod_arg[0])); |
(SSHORT)(SLONG) (IPTR) (node->nod_arg[0])); |
request->append_uchar(gds_dyn_end); | request->append_uchar(gds_dyn_end); |
break; | break; |
| |
|
|
| |
case nod_group_commit_wait: | case nod_group_commit_wait: |
request->append_uchar(gds_dyn_log_group_commit_wait); | request->append_uchar(gds_dyn_log_group_commit_wait); |
temp_long = (SLONG) (element->nod_arg[0]); |
temp_long = (SLONG)(IPTR) (element->nod_arg[0]); |
request->append_ulong_with_length(temp_long); | request->append_ulong_with_length(temp_long); |
break; | break; |
| |
case nod_check_point_len: | case nod_check_point_len: |
request->append_uchar(gds_dyn_log_check_point_length); | request->append_uchar(gds_dyn_log_check_point_length); |
temp_long = (SLONG) (element->nod_arg[0]); |
temp_long = (SLONG)(IPTR) (element->nod_arg[0]); |
request->append_ulong_with_length(temp_long); | request->append_ulong_with_length(temp_long); |
break; | break; |
| |
case nod_num_log_buffers: | case nod_num_log_buffers: |
request->append_uchar(gds_dyn_log_num_of_buffers); | request->append_uchar(gds_dyn_log_num_of_buffers); |
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); |
temp_short = (SSHORT)(SLONG)(IPTR) (element->nod_arg[0]); |
request->append_ushort_with_length(temp_short); | request->append_ushort_with_length(temp_short); |
break; | break; |
| |
case nod_log_buffer_size: | case nod_log_buffer_size: |
request->append_uchar(gds_dyn_log_buffer_size); | request->append_uchar(gds_dyn_log_buffer_size); |
temp_short = (SSHORT)(SLONG) (element->nod_arg[0]); |
temp_short = (SSHORT)(SLONG)(IPTR) (element->nod_arg[0]); |
request->append_ushort_with_length(temp_short); | request->append_ushort_with_length(temp_short); |
break; | break; |
case nod_drop_log: | case nod_drop_log: |
|
|
const_node = element->nod_arg[e_mod_fld_pos_new_position]; | 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. */ | /* CVC: Since now the parser accepts pos=1..N, let's subtract one here. */ |
constant = (SSHORT)(SLONG) const_node->nod_arg [0] - 1; |
constant = (SSHORT)(SLONG) (IPTR) const_node->nod_arg [0] - 1; |
| |
request->append_cstring(gds_dyn_rel_name, | request->append_cstring(gds_dyn_rel_name, |
relation_name->str_data); | relation_name->str_data); |