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

'struct' cleanup

This commit is contained in:
aafemt 2003-09-05 10:14:08 +00:00
parent a06e39240c
commit 1cee5265b8
25 changed files with 1705 additions and 1702 deletions

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: ada.cpp,v 1.16 2003-08-09 18:00:14 brodsom Exp $
// $Id: ada.cpp,v 1.17 2003-09-05 10:14:07 aafemt Exp $
//
#include "firebird.h"
@ -1530,7 +1530,8 @@ static void gen_dyn_execute( ACT action, int column)
{
DYN statement;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -1618,7 +1619,8 @@ static void gen_dyn_immediate( ACT action, int column)
DYN statement;
DBB database;
TEXT *transaction;
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -1688,7 +1690,8 @@ static void gen_dyn_open( ACT action, int column)
{
DYN statement;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -1738,7 +1741,8 @@ static void gen_dyn_prepare( ACT action, int column)
DYN statement;
DBB database;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
database = statement->dyn_database;
@ -2313,13 +2317,13 @@ static void gen_form_for( ACT action, int column)
GPRE_REQ request;
FORM form;
TEXT *status;
DBB dbb;
dbb* database;
int indent;
indent = column + INDENT;
request = action->act_request;
form = request->req_form;
dbb = request->req_database;
database = request->req_database;
status = status_vector(action);
// Get database attach and transaction started
@ -2332,7 +2336,7 @@ static void gen_form_for( ACT action, int column)
printa(column, "if %s = 0 then", request->req_form_handle);
printa(column, "interbase.load_form (%s %s%s, %s%s, %s, %d, \"%s\");",
status,
ada_package, dbb->dbb_name->sym_string,
ada_package, database->dbb_name->sym_string,
ada_package, request->req_trans,
request->req_form_handle,
strlen(form->form_name->sym_string), form->form_name->sym_string);
@ -2561,7 +2565,7 @@ static void gen_item_end( ACT action, int column)
GPRE_REQ request;
REF reference, master;
POR port;
DBB dbb;
dbb* database;
TEXT s[32], index[16];
request = action->act_request;
@ -2578,7 +2582,7 @@ static void gen_item_end( ACT action, int column)
return;
}
dbb = request->req_database;
database = request->req_database;
port = request->req_ports;
// Initialize field options
@ -2591,7 +2595,7 @@ static void gen_item_end( ACT action, int column)
printa(column,
"interbase.insert_sub_form (%s %s%s, %s%s, %s, isc_%d'address)",
status_vector(action),
ada_package, dbb->dbb_name->sym_string,
ada_package, database->dbb_name->sym_string,
ada_package, request->req_trans,
request->req_handle, port->por_ident);
}
@ -2697,17 +2701,17 @@ static void gen_menu( ACT action, int column)
static void gen_menu_display( ACT action, int column)
{
MENU menu;
MENU a_menu;
GPRE_REQ request, display_request;
request = action->act_request;
display_request = (GPRE_REQ) action->act_object;
menu = NULL;
a_menu = NULL;
for (action = request->req_actions; action; action = action->act_next)
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
@ -2716,13 +2720,13 @@ static void gen_menu_display( ACT action, int column)
ADA_WINDOW_PACKAGE,
request->req_handle,
display_request->req_length,
display_request->req_ident, menu->menu_title, menu->menu_title);
display_request->req_ident, a_menu->menu_title, a_menu->menu_title);
printa(column,
"\n\t\t\tisc_%d, isc_%dl, isc_%d, isc_%d);",
menu->menu_terminator,
menu->menu_entree_entree,
menu->menu_entree_entree, menu->menu_entree_value);
a_menu->menu_terminator,
a_menu->menu_entree_entree,
a_menu->menu_entree_entree, a_menu->menu_entree_value);
}
#endif
@ -2766,32 +2770,32 @@ static void gen_menu_entree( ACT action, int column)
static void gen_menu_entree_att( ACT action, int column)
{
MENU menu;
MENU a_menu;
SSHORT ident, length;
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
length = FALSE;
switch (action->act_type) {
case ACT_entree_text:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
break;
case ACT_entree_length:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
length = TRUE;
break;
case ACT_entree_value:
ident = menu->menu_entree_value;
ident = a_menu->menu_entree_value;
break;
case ACT_title_text:
ident = menu->menu_title;
ident = a_menu->menu_title;
break;
case ACT_title_length:
ident = menu->menu_title;
ident = a_menu->menu_title;
length = TRUE;
break;
case ACT_terminator:
ident = menu->menu_terminator;
ident = a_menu->menu_terminator;
break;
default:
ident = -1;
@ -2833,7 +2837,7 @@ static void gen_menu_for( ACT action, int column)
static void gen_menu_item_end( ACT action, int column)
{
GPRE_REQ request;
ENTREE entree;
ENTREE menu_entree;
if (action->act_pair->act_type == ACT_item_for) {
column += INDENT;
@ -2841,15 +2845,15 @@ static void gen_menu_item_end( ACT action, int column)
return;
}
entree = (ENTREE) action->act_pair->act_object;
menu_entree = (ENTREE) action->act_pair->act_object;
request = entree->entree_request;
align(column);
ib_fprintf(out_file,
"interbase.put_entree (%s, isc_%dl, isc_%d, isc_%d);",
request->req_handle,
entree->entree_entree,
entree->entree_entree, entree->entree_value);
menu_entree->entree_entree,
menu_entree->entree_entree, menu_entree->entree_value);
}
#endif
@ -2862,7 +2866,7 @@ static void gen_menu_item_end( ACT action, int column)
static void gen_menu_item_for( ACT action, int column)
{
ENTREE entree;
ENTREE menu_entree;
GPRE_REQ request;
if (action->act_type != ACT_item_for)
@ -2870,8 +2874,8 @@ static void gen_menu_item_for( ACT action, int column)
// Build stuff for item loop
entree = (ENTREE) action->act_object;
request = entree->entree_request;
menu_entree = (ENTREE) action->act_object;
request = menu_entree->entree_request;
printa(column, "loop");
column += INDENT;
@ -2879,10 +2883,11 @@ static void gen_menu_item_for( ACT action, int column)
printa(column,
"interbase.get_entree (%s, isc_%dl, isc_%d, isc_%d, isc_%d);",
request->req_handle,
entree->entree_entree,
entree->entree_entree, entree->entree_value, entree->entree_end);
menu_entree->entree_entree,
menu_entree->entree_entree, menu_entree->entree_value,
menu_entree->entree_end);
printa(column, "exit when isc_%d /= 0;", entree->entree_end);
printa(column, "exit when isc_%d /= 0;", menu_entree->entree_end);
}
#endif
@ -2895,55 +2900,52 @@ static void gen_menu_item_for( ACT action, int column)
static void gen_menu_request( GPRE_REQ request, int column)
{
ACT action;
MENU menu;
ENTREE entree;
menu = NULL;
entree = NULL;
MENU a_menu = NULL;
ENTREE menu_entree = NULL;
for (action = request->req_actions; action; action = action->act_next) {
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
else if (action->act_type == ACT_item_for
|| action->act_type == ACT_item_put) {
entree = (ENTREE) action->act_object;
menu_entree = (ENTREE) action->act_object;
break;
}
}
if (menu) {
menu->menu_title = CMP_next_ident();
menu->menu_terminator = CMP_next_ident();
menu->menu_entree_value = CMP_next_ident();
menu->menu_entree_entree = CMP_next_ident();
if (a_menu) {
a_menu->menu_title = CMP_next_ident();
a_menu->menu_terminator = CMP_next_ident();
a_menu->menu_entree_value = CMP_next_ident();
a_menu->menu_entree_entree = CMP_next_ident();
printa(column, "isc_%dl\t: %s;\t\t-- TITLE_LENGTH --",
menu->menu_title, USHORT_DCL);
a_menu->menu_title, USHORT_DCL);
printa(column, "isc_%d\t: string (1..81);\t\t-- TITLE_TEXT --",
menu->menu_title);
a_menu->menu_title);
printa(column, "isc_%d\t: %s;\t\t-- TERMINATOR --",
menu->menu_terminator, USHORT_DCL);
a_menu->menu_terminator, USHORT_DCL);
printa(column, "isc_%dl\t: %s;\t\t-- ENTREE_LENGTH --",
menu->menu_entree_entree, USHORT_DCL);
a_menu->menu_entree_entree, USHORT_DCL);
printa(column, "isc_%d\t: string (1..81);\t\t-- ENTREE_TEXT --",
menu->menu_entree_entree);
a_menu->menu_entree_entree);
printa(column, "isc_%d\t: %s;\t\t-- ENTREE_VALUE --",
menu->menu_entree_value, LONG_DCL);
a_menu->menu_entree_value, LONG_DCL);
}
if (entree) {
entree->entree_entree = CMP_next_ident();
entree->entree_value = CMP_next_ident();
entree->entree_end = CMP_next_ident();
if (menu_entree) {
menu_entree->entree_entree = CMP_next_ident();
menu_entree->entree_value = CMP_next_ident();
menu_entree->entree_end = CMP_next_ident();
printa(column, "isc_%dl\t: %s;\t\t-- ENTREE_LENGTH --",
entree->entree_entree, USHORT_DCL);
menu_entree->entree_entree, USHORT_DCL);
printa(column, "isc_%d\t: string (1..81);\t\t-- ENTREE_TEXT --",
entree->entree_entree);
menu_entree->entree_entree);
printa(column, "isc_%d\t: %s;\t\t-- ENTREE_VALUE --",
entree->entree_value, LONG_DCL);
menu_entree->entree_value, LONG_DCL);
printa(column, "isc_%d\t: %s;\t\t-- --",
entree->entree_end, USHORT_DCL);
menu_entree->entree_end, USHORT_DCL);
}
}
@ -3000,14 +3002,14 @@ static void gen_procedure( ACT action, int column)
TEXT *pattern;
GPRE_REQ request;
POR in_port, out_port;
DBB dbb;
dbb* database;
request = action->act_request;
in_port = request->req_vport;
out_port = request->req_primary;
dbb = request->req_database;
args.pat_database = dbb;
database = request->req_database;
args.pat_database = database;
args.pat_request = action->act_request;
args.pat_vector1 = status_vector(action);
args.pat_string2 = ada_null_address;
@ -3807,7 +3809,7 @@ static void gen_t_start( ACT action, int column)
{
DBB db;
GPRE_TRA trans;
TPB tpb;
tpb* tpb_iterator;
int count;
TEXT *filename;
@ -3825,9 +3827,12 @@ static void gen_t_start( ACT action, int column)
// and fill in the tpb vector (aka TEB).
count = 0;
for (tpb = trans->tra_tpb; tpb; tpb = tpb->tpb_tra_next) {
for (tpb_iterator = trans->tra_tpb;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
count++;
db = tpb->tpb_database;
db = tpb_iterator->tpb_database;
if (sw_auto)
if ((filename = db->dbb_runtime) || !(db->dbb_flags & DBB_sqlca)) {
printa(column, "if (%s%s = 0) then", ada_package,
@ -3838,9 +3843,9 @@ static void gen_t_start( ACT action, int column)
printa(column, "end if;");
}
printa(column, "isc_teb(%d).tpb_len := %d;", count, tpb->tpb_length);
printa(column, "isc_teb(%d).tpb_len := %d;", count, tpb_iterator->tpb_length);
printa(column, "isc_teb(%d).tpb_ptr := isc_tpb_%d'address;",
count, tpb->tpb_ident);
count, tpb_iterator->tpb_ident);
printa(column, "isc_teb(%d).dbb_ptr := %s%s'address;",
count, ada_package, db->dbb_name->sym_string);
}
@ -3860,16 +3865,16 @@ static void gen_t_start( ACT action, int column)
// Generate a TPB in the output file
//
static void gen_tpb( TPB tpb, int column)
static void gen_tpb(tpb* tpb_buffer, int column)
{
TEXT *text, buffer[80], c, *p;
int length;
printa(column, "isc_tpb_%d\t: CONSTANT interbase.tpb (1..%d) := (",
tpb->tpb_ident, tpb->tpb_length);
tpb_buffer->tpb_ident, tpb_buffer->tpb_length);
length = tpb->tpb_length;
text = (TEXT *) tpb->tpb_string;
length = tpb_buffer->tpb_length;
text = (TEXT *) tpb_buffer->tpb_string;
p = buffer;
while (--length) {

View File

@ -27,7 +27,7 @@
//
//____________________________________________________________
//
// $Id: c_cxx.cpp,v 1.22 2003-08-12 10:05:47 robocop Exp $
// $Id: c_cxx.cpp,v 1.23 2003-09-05 10:14:07 aafemt Exp $
//
#include "firebird.h"
@ -1492,10 +1492,10 @@ static void gen_database( ACT action, int column)
{
DBB db;
GPRE_REQ request;
TPB tpb;
tpb* tpb_iterator;
TEXT *scope;
#ifdef PYXIS
FORM form;
FORM a_form;
#endif
BOOLEAN all_static, all_extern;
SSHORT count, max_count;
@ -1515,9 +1515,9 @@ static void gen_database( ACT action, int column)
"isc_blob_null = {0,0};\t/* initializer for blobs */");
#ifdef PYXIS
for (db = isc_databases; db; db = db->dbb_next)
for (form = db->dbb_forms; form; form = form->form_next)
for (a_form = db->dbb_forms; a_form; a_form = a_form->form_next)
printa(column, "static isc_form_handle %s;\t\t/* form %s */",
form->form_handle, form->form_name->sym_string);
a_form->form_handle, a_form->form_name->sym_string);
#endif
if (sw_language == lang_c)
printa(column,
@ -1596,8 +1596,12 @@ static void gen_database( ACT action, int column)
column -= INDENT;
for (db = isc_databases; db; db = db->dbb_next)
for (tpb = db->dbb_tpbs; tpb; tpb = tpb->tpb_dbb_next)
gen_tpb(tpb, column);
for (tpb_iterator = db->dbb_tpbs;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_dbb_next)
{
gen_tpb(tpb_iterator, column);
}
// generate event parameter block for each event in module
@ -1785,7 +1789,8 @@ static void gen_dyn_execute( ACT action, int column)
DYN statement = (DYN) action->act_object;
TEXT *transaction;
TEXT s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
if (statement->dyn_trans) {
transaction = statement->dyn_trans;
@ -1861,7 +1866,8 @@ static void gen_dyn_immediate( ACT action, int column)
DYN statement;
DBB database;
TEXT *transaction;
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
database = statement->dyn_database;
@ -1928,7 +1934,8 @@ static void gen_dyn_open( ACT action, int column)
{
DYN statement;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -1975,7 +1982,8 @@ static void gen_dyn_open( ACT action, int column)
static void gen_dyn_prepare( ACT action, int column)
{
TEXT s[64], *transaction;
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
DYN statement = (DYN) action->act_object;
@ -2487,14 +2495,14 @@ static void gen_form_display( ACT action, int column)
GPRE_REQ request;
REF reference, master;
POR port;
DBB dbb;
DBB database;
TEXT s[32], out[16];
const char *status;
int code;
display = (FINT) action->act_object;
request = display->fint_request;
dbb = request->req_database;
database = request->req_database;
port = request->req_ports;
status = (action->act_error) ? status_name : NULL_STATUS;
@ -2515,7 +2523,7 @@ static void gen_form_display( ACT action, int column)
ib_fprintf(out_file,
"isc_drive_form (%s, &%s, &%s, &isc_window, &%s, &isc_%d, %s);",
status,
dbb->dbb_name->sym_string,
database->dbb_name->sym_string,
request->req_trans, request->req_handle, port->por_ident, out);
}
#endif
@ -2541,14 +2549,14 @@ static void gen_form_end( ACT action, int column)
static void gen_form_for( ACT action, int column)
{
GPRE_REQ request;
FORM form;
FORM a_form;
const char *status;
DBB dbb;
DBB database;
column += INDENT;
request = action->act_request;
form = request->req_form;
dbb = request->req_database;
a_form = request->req_form;
database = request->req_database;
status = (action->act_error) ? status_name : NULL_STATUS;
// Get database attach and transaction started
@ -2561,8 +2569,8 @@ static void gen_form_for( ACT action, int column)
printa(column, "if (!%s)", request->req_form_handle);
printa(column + INDENT,
"isc_load_form (%s, &%s, &%s, &%s, (short*) 0, \"%s\");", status,
dbb->dbb_name->sym_string, request->req_trans,
request->req_form_handle, form->form_name->sym_string);
database->dbb_name->sym_string, request->req_trans,
request->req_form_handle, a_form->form_name->sym_string);
// Get map compiled
@ -2805,7 +2813,7 @@ static void gen_item_end( ACT action, int column)
GPRE_REQ request;
REF reference, master;
POR port;
DBB dbb;
DBB database;
TEXT s[32];
const char *status;
@ -2821,7 +2829,7 @@ static void gen_item_end( ACT action, int column)
return;
}
dbb = request->req_database;
database = request->req_database;
port = request->req_ports;
status = (action->act_error) ? status_name : NULL_STATUS;
@ -2836,7 +2844,7 @@ static void gen_item_end( ACT action, int column)
ib_fprintf(out_file,
"isc_form_insert (%s, &%s, &%s, &%s, &isc_%d);",
status,
dbb->dbb_name->sym_string,
database->dbb_name->sym_string,
request->req_trans, request->req_handle, port->por_ident);
}
#endif
@ -2850,7 +2858,7 @@ static void gen_item_end( ACT action, int column)
static void gen_item_for( ACT action, int column)
{
GPRE_REQ request, parent;
FORM form;
FORM a_form;
TEXT *status, index[30];
request = action->act_request;
@ -2860,8 +2868,8 @@ static void gen_item_for( ACT action, int column)
}
column += INDENT;
form = request->req_form;
parent = form->form_parent;
a_form = request->req_form;
parent = a_form->form_parent;
status = status_vector(action);
@ -2944,17 +2952,17 @@ static void gen_menu( ACT action, int column)
static void gen_menu_display( ACT action, int column)
{
MENU menu;
MENU a_menu;
GPRE_REQ request, display_request;
request = action->act_request;
display_request = (GPRE_REQ) action->act_object;
menu = NULL;
a_menu = NULL;
for (action = request->req_actions; action; action = action->act_next)
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
@ -2963,13 +2971,13 @@ static void gen_menu_display( ACT action, int column)
status_vector(action),
request->req_handle,
display_request->req_ident,
display_request->req_ident, menu->menu_title, menu->menu_title);
display_request->req_ident, a_menu->menu_title, a_menu->menu_title);
printa(column,
"\t\t&isc_%d, &isc_%dl, isc_%d, &isc_%d);",
menu->menu_terminator,
menu->menu_entree_entree,
menu->menu_entree_entree, menu->menu_entree_value);
a_menu->menu_terminator,
a_menu->menu_entree_entree,
a_menu->menu_entree_entree, a_menu->menu_entree_value);
}
#endif
@ -2995,32 +3003,32 @@ static void gen_menu_entree( ACT action, int column)
static void gen_menu_entree_att( ACT action, int column)
{
MENU menu;
MENU a_menu;
SSHORT ident, length;
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
length = FALSE;
switch (action->act_type) {
case ACT_entree_text:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
break;
case ACT_entree_length:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
length = TRUE;
break;
case ACT_entree_value:
ident = menu->menu_entree_value;
ident = a_menu->menu_entree_value;
break;
case ACT_title_text:
ident = menu->menu_title;
ident = a_menu->menu_title;
break;
case ACT_title_length:
ident = menu->menu_title;
ident = a_menu->menu_title;
length = TRUE;
break;
case ACT_terminator:
ident = menu->menu_terminator;
ident = a_menu->menu_terminator;
break;
default:
ident = -1;
@ -3077,7 +3085,7 @@ static void gen_menu_for( ACT action, int column)
static void gen_menu_item_end( ACT action, int column)
{
GPRE_REQ request;
ENTREE entree;
ENTREE menu_entree;
if (action->act_pair->act_type == ACT_item_for) {
column += INDENT;
@ -3085,16 +3093,16 @@ static void gen_menu_item_end( ACT action, int column)
return;
}
entree = (ENTREE) action->act_pair->act_object;
request = entree->entree_request;
menu_entree = (ENTREE) action->act_pair->act_object;
request = menu_entree->entree_request;
align(column);
ib_fprintf(out_file,
"isc_put_entree (%s, &%s, &isc_%dl, isc_%d, &isc_%d);",
status_vector(action),
request->req_handle,
entree->entree_entree,
entree->entree_entree, entree->entree_value);
menu_entree->entree_entree,
menu_entree->entree_entree, menu_entree->entree_value);
}
#endif
@ -3107,7 +3115,7 @@ static void gen_menu_item_end( ACT action, int column)
static void gen_menu_item_for( ACT action, int column)
{
ENTREE entree;
ENTREE menu_entree;
GPRE_REQ request;
if (action->act_type != ACT_item_for)
@ -3115,8 +3123,8 @@ static void gen_menu_item_for( ACT action, int column)
// Build stuff for item loop
entree = (ENTREE) action->act_object;
request = entree->entree_request;
menu_entree = (ENTREE) action->act_object;
request = menu_entree->entree_request;
printa(column, "while (1)");
column += INDENT;
@ -3124,10 +3132,10 @@ static void gen_menu_item_for( ACT action, int column)
align(column);
printa(column,
"isc_get_entree (%s, &%s, &isc_%dl, isc_%d, &isc_%d, &isc_%d);",
status_vector(action), request->req_handle, entree->entree_entree,
entree->entree_entree, entree->entree_value, entree->entree_end);
status_vector(action), request->req_handle, menu_entree->entree_entree,
menu_entree->entree_entree, menu_entree->entree_value, menu_entree->entree_end);
printa(column, "if (isc_%d) break;", entree->entree_end);
printa(column, "if (isc_%d) break;", menu_entree->entree_end);
}
#endif
@ -3140,56 +3148,56 @@ static void gen_menu_item_for( ACT action, int column)
static void gen_menu_request( GPRE_REQ request)
{
ACT action;
MENU menu;
ENTREE entree;
MENU a_menu;
ENTREE menu_entree;
menu = NULL;
entree = NULL;
a_menu = NULL;
menu_entree = NULL;
for (action = request->req_actions; action; action = action->act_next) {
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
else if (action->act_type == ACT_item_for
|| action->act_type == ACT_item_put) {
entree = (ENTREE) action->act_object;
menu_entree = (ENTREE) action->act_object;
break;
}
}
if (menu) {
menu->menu_title = CMP_next_ident();
menu->menu_terminator = CMP_next_ident();
menu->menu_entree_value = CMP_next_ident();
menu->menu_entree_entree = CMP_next_ident();
if (a_menu) {
a_menu->menu_title = CMP_next_ident();
a_menu->menu_terminator = CMP_next_ident();
a_menu->menu_entree_value = CMP_next_ident();
a_menu->menu_entree_entree = CMP_next_ident();
printa(0, "static short isc_%dl;\t\t/* TITLE_LENGTH */",
menu->menu_title);
a_menu->menu_title);
printa(0, "static char isc_%d [81];\t\t/* TITLE_TEXT */",
menu->menu_title);
a_menu->menu_title);
printa(0, "static short isc_%d;\t\t/* TERMINATOR */",
menu->menu_terminator);
a_menu->menu_terminator);
printa(0, "static short isc_%dl;\t\t/* ENTREE_LENGTH */",
menu->menu_entree_entree);
a_menu->menu_entree_entree);
printa(0, "static char isc_%d [81];\t/* ENTREE_TEXT */",
menu->menu_entree_entree);
a_menu->menu_entree_entree);
printa(0, "static %s isc_%d;\t\t/* ENTREE_VALUE */\n",
DCL_LONG, menu->menu_entree_value);
DCL_LONG, a_menu->menu_entree_value);
}
if (entree) {
entree->entree_entree = CMP_next_ident();
entree->entree_value = CMP_next_ident();
entree->entree_end = CMP_next_ident();
if (menu_entree) {
menu_entree->entree_entree = CMP_next_ident();
menu_entree->entree_value = CMP_next_ident();
menu_entree->entree_end = CMP_next_ident();
printa(0, "static short isc_%dl;\t\t/* ENTREE_LENGTH */",
entree->entree_entree);
menu_entree->entree_entree);
printa(0, "static char isc_%d [81];\t/* ENTREE_TEXT */",
entree->entree_entree);
menu_entree->entree_entree);
printa(0, "static %s isc_%d;\t\t/* ENTREE_VALUE */",
DCL_LONG, entree->entree_value);
DCL_LONG, menu_entree->entree_value);
if (request->req_flags & REQ_menu_for_item)
printa(0, "static short isc_%d;\t\t/* ENTREE_END */\n",
entree->entree_end);
menu_entree->entree_end);
}
}
#endif
@ -3250,15 +3258,15 @@ static void gen_procedure( ACT action, int column)
TEXT *pattern;
GPRE_REQ request;
POR in_port, out_port;
DBB dbb;
dbb* database;
column += INDENT;
request = action->act_request;
in_port = request->req_vport;
out_port = request->req_primary;
dbb = request->req_database;
args.pat_database = dbb;
database = request->req_database;
args.pat_database = database;
args.pat_request = action->act_request;
args.pat_vector1 = status_vector(action);
args.pat_request = request;
@ -4042,7 +4050,7 @@ static void gen_t_start( ACT action, int column)
{
DBB db;
GPRE_TRA trans;
TPB tpb;
tpb* tpb_iterator;
TEXT *filename, *vector;
int remaining, length;
@ -4058,8 +4066,11 @@ static void gen_t_start( ACT action, int column)
// build a complete statement, including tpb's. Ready db's
if (sw_auto)
for (tpb = trans->tra_tpb; tpb; tpb = tpb->tpb_tra_next) {
db = tpb->tpb_database;
for (tpb_iterator = trans->tra_tpb;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
db = tpb_iterator->tpb_database;
if ((filename = db->dbb_runtime) || !(db->dbb_flags & DBB_sqlca)) {
printa(column, "if (!%s)", db->dbb_name->sym_string);
make_ready(db, filename, vector, (USHORT) (column + INDENT),
@ -4078,16 +4089,19 @@ static void gen_t_start( ACT action, int column)
strlen((trans->tra_handle) ? trans->tra_handle : transaction_name) -
31;
for (tpb = trans->tra_tpb; tpb; tpb = tpb->tpb_tra_next) {
if ((length = strlen(tpb->tpb_database->dbb_name->sym_string) + 22) >
for (tpb_iterator = trans->tra_tpb;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
if ((length = strlen(tpb_iterator->tpb_database->dbb_name->sym_string) + 22) >
remaining) {
align(column + INDENT);
remaining = 256 - column - INDENT;
}
remaining -= length;
ib_fprintf(out_file, ", &%s, (short) %d, isc_tpb_%d",
tpb->tpb_database->dbb_name->sym_string,
tpb->tpb_length, tpb->tpb_ident);
tpb_iterator->tpb_database->dbb_name->sym_string,
tpb_iterator->tpb_length, tpb_iterator->tpb_ident);
}
ib_fprintf(out_file, ");");
@ -4101,7 +4115,7 @@ static void gen_t_start( ACT action, int column)
// Generate a TPB in the output file
//
static void gen_tpb( TPB tpb, int column)
static void gen_tpb(tpb* tpb_buffer, int column)
{
TEXT *text, buffer[80], c, *p;
SSHORT length, tpb_length;
@ -4113,12 +4127,12 @@ static void gen_tpb( TPB tpb, int column)
for (length = 0; length < column; length++)
*p++ = ' ';
sprintf(p, "isc_tpb_%d [%d] = {", tpb->tpb_ident, tpb->tpb_length);
sprintf(p, "isc_tpb_%d [%d] = {", tpb_buffer->tpb_ident, tpb_buffer->tpb_length);
while (*p)
p++;
tpb_length = tpb->tpb_length;
text = (TEXT *) tpb->tpb_string;
tpb_length = tpb_buffer->tpb_length;
text = (TEXT *) tpb_buffer->tpb_string;
while (--tpb_length >= 0) {
c = *text++;

View File

@ -25,7 +25,7 @@
//
//____________________________________________________________
//
// $Id: cmd.cpp,v 1.10 2003-08-09 18:00:14 brodsom Exp $
// $Id: cmd.cpp,v 1.11 2003-09-05 10:14:07 aafemt Exp $
//
#include "firebird.h"
@ -260,13 +260,13 @@ CMD_compile_ddl(GPRE_REQ request)
// Add cache file to a database.
//
static void add_cache( GPRE_REQ request, ACT action, DBB dbb)
static void add_cache( GPRE_REQ request, ACT action, dbb* database)
{
FIL file;
TEXT file_name[254];
SSHORT l;
file = dbb->dbb_cache_file;
file = database->dbb_cache_file;
l = MIN((strlen(file->fil_name)), (sizeof(file_name) - 1));
strncpy(file_name, file->fil_name, l);
@ -435,7 +435,7 @@ static void alter_domain( GPRE_REQ request, ACT action)
GPRE_FLD field;
TEXT *default_source;
GPRE_NOD default_node;
CNSTRT cnstrt;
cnstrt* constraint;
field = (GPRE_FLD) action->act_object;
@ -460,11 +460,13 @@ static void alter_domain( GPRE_REQ request, ACT action)
if (field->fld_constraints) {
STUFF(gds_dyn_single_validation);
for (cnstrt = field->fld_constraints; cnstrt;
cnstrt =
cnstrt->cnstrt_next) if (cnstrt->
cnstrt_flags & CNSTRT_delete)
for (constraint = field->fld_constraints;
constraint;
constraint = constraint->cnstrt_next)
{
if (constraint->cnstrt_flags & CNSTRT_delete)
STUFF(gds_dyn_del_validation);
}
create_domain_constraint(request, action, field->fld_constraints);
}
@ -501,7 +503,7 @@ static void alter_table( GPRE_REQ request, ACT action)
{
GPRE_FLD field;
GPRE_REL relation;
CNSTRT cnstrt;
cnstrt* constraint;
TEXT *default_source;
// add relation name
@ -549,12 +551,14 @@ static void alter_table( GPRE_REQ request, ACT action)
// Check for any relation level ADD/DROP of constraints
if (relation->rel_constraints) {
for (cnstrt = relation->rel_constraints; cnstrt;
cnstrt =
cnstrt->cnstrt_next) if (cnstrt->
cnstrt_flags & CNSTRT_delete)
for (constraint = relation->rel_constraints;
constraint;
constraint = constraint->cnstrt_next)
{
if (constraint->cnstrt_flags & CNSTRT_delete)
put_cstring(request, gds_dyn_delete_rel_constraint,
(TEXT *) cnstrt->cnstrt_name);
(TEXT *) constraint->cnstrt_name);
}
create_constraint(request, action, relation->rel_constraints);
}
@ -567,7 +571,7 @@ static void alter_table( GPRE_REQ request, ACT action)
// Generate dyn for creating a CHECK constraint.
//
static void create_check_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt)
static void create_check_constraint( GPRE_REQ request, ACT action, cnstrt* constraint)
{
GPRE_TRG trigger;
@ -580,9 +584,9 @@ static void create_check_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt
// "insert violates CHECK constraint on table"
trigger->trg_message = NULL;
trigger->trg_boolean = cnstrt->cnstrt_boolean;
trigger->trg_source = (STR) ALLOC(cnstrt->cnstrt_text->txt_length + 1);
CPR_get_text((TEXT *) trigger->trg_source, cnstrt->cnstrt_text);
trigger->trg_boolean = constraint->cnstrt_boolean;
trigger->trg_source = (STR) ALLOC(constraint->cnstrt_text->txt_length + 1);
CPR_get_text((TEXT *) trigger->trg_source, constraint->cnstrt_text);
create_trigger(request, action, trigger,
reinterpret_cast < pfn_local_trigger_cb > (CME_expr));
@ -604,14 +608,14 @@ static void create_check_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt
// do a column by column comparison.
//
static void create_trg_firing_cond( GPRE_REQ request, CNSTRT cnstrt)
static void create_trg_firing_cond( GPRE_REQ request, cnstrt* constraint)
{
LLS prim_key_fld, field;
USHORT num_flds = 0, prim_key_num_flds = 0;
STR prim_key_fld_name;
// count primary key columns
field = prim_key_fld = cnstrt->cnstrt_referred_fields;
field = prim_key_fld = constraint->cnstrt_referred_fields;
assert(field != NULL);
@ -655,14 +659,14 @@ static void create_trg_firing_cond( GPRE_REQ request, CNSTRT cnstrt)
// for_key.column_2 = prim_key.column_2 and .... so on..
//
static void create_matching_blr( GPRE_REQ request, CNSTRT cnstrt)
static void create_matching_blr( GPRE_REQ request, cnstrt* constraint)
{
LLS field, for_key_fld, prim_key_fld;
USHORT for_key_num_flds = 0, prim_key_num_flds = 0, num_flds = 0;
STR for_key_fld_name, prim_key_fld_name;
// count primary key columns
field = prim_key_fld = cnstrt->cnstrt_referred_fields;
field = prim_key_fld = constraint->cnstrt_referred_fields;
assert(field != NULL);
@ -674,7 +678,7 @@ static void create_matching_blr( GPRE_REQ request, CNSTRT cnstrt)
assert(prim_key_num_flds > 0)
// count of foreign key columns
field = for_key_fld = cnstrt->cnstrt_fields;
field = for_key_fld = constraint->cnstrt_fields;
assert(field != NULL);
@ -749,7 +753,7 @@ static void create_default_blr(
// integrity) along with the trigger blr.
//
static void create_upd_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
static void create_upd_cascade_trg( GPRE_REQ request, ACT action, cnstrt* constraint)
{
LLS for_key_fld, prim_key_fld;
@ -757,8 +761,8 @@ static void create_upd_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
USHORT offset, length;
GPRE_REL relation;
for_key_fld = cnstrt->cnstrt_fields;
prim_key_fld = cnstrt->cnstrt_referred_fields;
for_key_fld = constraint->cnstrt_fields;
prim_key_fld = constraint->cnstrt_referred_fields;
relation = (GPRE_REL) action->act_object;
// no trigger name is generated here. Let the engine make one up
@ -770,7 +774,7 @@ static void create_upd_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
put_numeric(request, gds_dyn_trg_sequence, (SSHORT) 1);
put_numeric(request, gds_dyn_trg_inactive, (SSHORT) 0);
put_cstring(request, gds_dyn_rel_name,
(TEXT *) cnstrt->cnstrt_referred_rel);
(TEXT *) constraint->cnstrt_referred_rel);
// the trigger blr
@ -783,7 +787,7 @@ static void create_upd_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
else
STUFF(blr_version5);
create_trg_firing_cond(request, cnstrt);
create_trg_firing_cond(request, constraint);
STUFF(blr_begin);
STUFF(blr_begin);
@ -800,7 +804,7 @@ static void create_upd_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
STUFF(2);
// generate the blr for: foreign_key == primary_key
create_matching_blr(request, cnstrt);
create_matching_blr(request, constraint);
STUFF(blr_modify);
STUFF((SSHORT) 2);
@ -844,7 +848,7 @@ static void create_upd_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
// integrity) along with the trigger blr.
//
static void create_del_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
static void create_del_cascade_trg( GPRE_REQ request, ACT action, cnstrt* constraint)
{
GPRE_REL relation;
USHORT offset, length;
@ -860,7 +864,7 @@ static void create_del_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
put_numeric(request, gds_dyn_trg_sequence, (SSHORT) 1);
put_numeric(request, gds_dyn_trg_inactive, (SSHORT) 0);
put_cstring(request, gds_dyn_rel_name,
(TEXT *) cnstrt->cnstrt_referred_rel);
(TEXT *) constraint->cnstrt_referred_rel);
// the trigger blr
STUFF(gds_dyn_trg_blr);
@ -883,7 +887,7 @@ static void create_del_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
// the context for the foreign key relation
STUFF(2);
create_matching_blr(request, cnstrt);
create_matching_blr(request, constraint);
STUFF(blr_erase);
STUFF((SSHORT) 2);
@ -909,7 +913,7 @@ static void create_del_cascade_trg( GPRE_REQ request, ACT action, CNSTRT cnstrt)
static void create_set_default_trg(
GPRE_REQ request,
ACT action,
CNSTRT cnstrt, BOOLEAN on_upd_trg)
cnstrt* constraint, BOOLEAN on_upd_trg)
{
BOOLEAN search_for_default, search_for_column;
@ -920,14 +924,14 @@ static void create_set_default_trg(
USHORT offset, length;
GPRE_REL relation, rel;
GPRE_REQ req;
ACT act;
ACT request_action;
TEXT s[512];
TEXT default_val[BLOB_BUFFER_SIZE];
assert(request->req_actions->act_type == ACT_create_table ||
request->req_actions->act_type == ACT_alter_table);
for_key_fld = cnstrt->cnstrt_fields;
for_key_fld = constraint->cnstrt_fields;
relation = (GPRE_REL) action->act_object;
// no trigger name. It is generated by the engine
@ -941,7 +945,7 @@ static void create_set_default_trg(
put_numeric(request, gds_dyn_trg_sequence, (SSHORT) 1);
put_numeric(request, gds_dyn_trg_inactive, (SSHORT) 0);
put_cstring(request, gds_dyn_rel_name,
(TEXT *) cnstrt->cnstrt_referred_rel);
(TEXT *) constraint->cnstrt_referred_rel);
// the trigger blr
@ -959,7 +963,7 @@ static void create_set_default_trg(
// Note that the key could consist of multiple columns
if (on_upd_trg) {
create_trg_firing_cond(request, cnstrt);
create_trg_firing_cond(request, constraint);
STUFF(blr_begin);
STUFF(blr_begin);
}
@ -975,7 +979,7 @@ static void create_set_default_trg(
// the context for the foreign key relation
STUFF(2);
create_matching_blr(request, cnstrt);
create_matching_blr(request, constraint);
STUFF(blr_modify);
STUFF((SSHORT) 2);
@ -1050,10 +1054,10 @@ static void create_set_default_trg(
within the same application ... */
for (req = requests; req; req = req->req_next) {
if ((req->req_type == REQ_ddl) &&
(act = req->req_actions) &&
(act->act_type == ACT_create_table ||
act->act_type == ACT_alter_table) &&
(rel = (GPRE_REL) act->act_object) &&
(request_action = req->req_actions) &&
(request_action->act_type == ACT_create_table ||
request_action->act_type == ACT_alter_table) &&
(rel = (GPRE_REL) request_action->act_object) &&
(strcmp(rel->rel_symbol->sym_string,
relation->rel_symbol->sym_string) == 0)) {
/* ... then try to check for the default in memory */
@ -1094,10 +1098,10 @@ static void create_set_default_trg(
/* search for domain in memory */
for (req = requests; req; req = req->req_next) {
if ((req->req_type == REQ_ddl) &&
(act = req->req_actions) &&
((act->act_type == ACT_create_domain) ||
(act->act_type == ACT_alter_domain)) &&
(domain = (GPRE_FLD) act->act_object) &&
(request_action = req->req_actions) &&
((request_action->act_type == ACT_create_domain) ||
(request_action->act_type == ACT_alter_domain)) &&
(domain = (GPRE_FLD) request_action->act_object) &&
(strcmp(search_for_domain,
domain->fld_symbol->sym_string) == 0) &&
(domain->fld_default_value->nod_type != nod_erase)) {
@ -1180,7 +1184,7 @@ static void create_set_default_trg(
static void create_set_null_trg(
GPRE_REQ request,
ACT action, CNSTRT cnstrt, BOOLEAN on_upd_trg)
ACT action, cnstrt* constraint, BOOLEAN on_upd_trg)
{
LLS for_key_fld;
@ -1188,7 +1192,7 @@ static void create_set_null_trg(
USHORT offset, length;
GPRE_REL relation;
for_key_fld = cnstrt->cnstrt_fields;
for_key_fld = constraint->cnstrt_fields;
relation = (GPRE_REL) action->act_object;
// no trigger name. It is generated by the engine
@ -1202,7 +1206,7 @@ static void create_set_null_trg(
put_numeric(request, gds_dyn_trg_sequence, (SSHORT) 1);
put_numeric(request, gds_dyn_trg_inactive, (SSHORT) 0);
put_cstring(request, gds_dyn_rel_name,
(TEXT *) cnstrt->cnstrt_referred_rel);
(TEXT *) constraint->cnstrt_referred_rel);
// the trigger blr
@ -1220,7 +1224,7 @@ static void create_set_null_trg(
// Note that the key could consist of multiple columns
if (on_upd_trg) {
create_trg_firing_cond(request, cnstrt);
create_trg_firing_cond(request, constraint);
STUFF(blr_begin);
STUFF(blr_begin);
}
@ -1236,7 +1240,7 @@ static void create_set_null_trg(
// the context for the foreign key relation
STUFF(2);
create_matching_blr(request, cnstrt);
create_matching_blr(request, constraint);
STUFF(blr_modify);
STUFF((SSHORT) 2);
@ -1276,11 +1280,11 @@ static void create_set_null_trg(
// Get referred fields from memory/system tables
//
static void get_referred_fields( ACT action, CNSTRT cnstrt)
static void get_referred_fields( ACT action, cnstrt* constraint)
{
GPRE_REQ req;
GPRE_REL rel, relation;
ACT act;
ACT request_action;
CNSTRT cns;
TEXT s[512];
LLS field;
@ -1290,51 +1294,51 @@ static void get_referred_fields( ACT action, CNSTRT cnstrt)
for (req = requests; req; req = req->req_next) {
if ((req->req_type == REQ_ddl) &&
(act = req->req_actions) &&
(act->act_type == ACT_create_table ||
act->act_type == ACT_alter_table) &&
(rel = (GPRE_REL) act->act_object) &&
(request_action = req->req_actions) &&
(request_action->act_type == ACT_create_table ||
request_action->act_type == ACT_alter_table) &&
(rel = (GPRE_REL) request_action->act_object) &&
(strcmp(rel->rel_symbol->sym_string,
(const char *) cnstrt->cnstrt_referred_rel) == 0)) {
(const char *) constraint->cnstrt_referred_rel) == 0)) {
for (cns = rel->rel_constraints; cns; cns = cns->cnstrt_next)
if (cns->cnstrt_type == CNSTRT_PRIMARY_KEY) {
cnstrt->cnstrt_referred_fields = cns->cnstrt_fields;
constraint->cnstrt_referred_fields = cns->cnstrt_fields;
break;
}
if (!cnstrt->cnstrt_referred_fields && rel->rel_fields)
if (!constraint->cnstrt_referred_fields && rel->rel_fields)
for (cns = rel->rel_fields->fld_constraints; cns;
cns =
cns->cnstrt_next) if (cns->cnstrt_type ==
CNSTRT_PRIMARY_KEY) {
cnstrt->cnstrt_referred_fields = cns->cnstrt_fields;
constraint->cnstrt_referred_fields = cns->cnstrt_fields;
break;
}
if (cnstrt->cnstrt_referred_fields)
if (constraint->cnstrt_referred_fields)
break;
}
}
if (cnstrt->cnstrt_referred_fields == NULL)
if (constraint->cnstrt_referred_fields == NULL)
/* Nothing is in memory. Try to find in system tables */
cnstrt->cnstrt_referred_fields =
constraint->cnstrt_referred_fields =
MET_get_primary_key(relation->rel_database,
(TEXT *) cnstrt->cnstrt_referred_rel);
(TEXT *) constraint->cnstrt_referred_rel);
if (cnstrt->cnstrt_referred_fields == NULL) {
if (constraint->cnstrt_referred_fields == NULL) {
/* Nothing is in system tables. */
sprintf(s,
"\"REFERENCES %s\" without \"(column list)\" requires PRIMARY KEY on referenced table",
cnstrt->cnstrt_referred_rel->str_string);
constraint->cnstrt_referred_rel->str_string);
CPR_error(s);
}
else {
/* count both primary key and foreign key columns */
field = cnstrt->cnstrt_referred_fields;
field = constraint->cnstrt_referred_fields;
while (field) {
prim_key_num_flds++;
field = field->lls_next;
}
field = cnstrt->cnstrt_fields;
field = constraint->cnstrt_fields;
while (field) {
for_key_num_flds++;
field = field->lls_next;
@ -1342,7 +1346,7 @@ static void get_referred_fields( ACT action, CNSTRT cnstrt)
if (prim_key_num_flds != for_key_num_flds) {
sprintf(s,
"PRIMARY KEY column count in relation \"%s\" does not match FOREIGN KEY in relation \"%s\"",
cnstrt->cnstrt_referred_rel->str_string,
constraint->cnstrt_referred_rel->str_string,
relation->rel_symbol->sym_string);
CPR_error(s);
}
@ -1355,30 +1359,30 @@ static void get_referred_fields( ACT action, CNSTRT cnstrt)
// Generate dyn for creating a constraint.
//
static void create_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt)
static void create_constraint( GPRE_REQ request, ACT action, cnstrt* constraint)
{
LLS field;
STR string;
for (; cnstrt; cnstrt = cnstrt->cnstrt_next) {
if (cnstrt->cnstrt_flags & CNSTRT_delete)
for (; constraint; constraint = constraint->cnstrt_next) {
if (constraint->cnstrt_flags & CNSTRT_delete)
continue;
put_cstring(request, gds_dyn_rel_constraint,
(TEXT *) cnstrt->cnstrt_name);
(TEXT *) constraint->cnstrt_name);
if (cnstrt->cnstrt_type == CNSTRT_PRIMARY_KEY)
if (constraint->cnstrt_type == CNSTRT_PRIMARY_KEY)
STUFF(gds_dyn_def_primary_key);
else if (cnstrt->cnstrt_type == CNSTRT_UNIQUE)
else if (constraint->cnstrt_type == CNSTRT_UNIQUE)
STUFF(gds_dyn_def_unique);
else if (cnstrt->cnstrt_type == CNSTRT_FOREIGN_KEY)
else if (constraint->cnstrt_type == CNSTRT_FOREIGN_KEY)
STUFF(gds_dyn_def_foreign_key);
else if (cnstrt->cnstrt_type == CNSTRT_NOT_NULL) {
else if (constraint->cnstrt_type == CNSTRT_NOT_NULL) {
STUFF(gds_dyn_fld_not_null);
STUFF_END;
continue;
}
else if (cnstrt->cnstrt_type == CNSTRT_CHECK) {
create_check_constraint(request, action, cnstrt);
else if (constraint->cnstrt_type == CNSTRT_CHECK) {
create_check_constraint(request, action, constraint);
STUFF_END;
continue;
}
@ -1388,29 +1392,29 @@ static void create_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt)
STUFF_WORD(0);
if (cnstrt->cnstrt_type == CNSTRT_FOREIGN_KEY) {
if (constraint->cnstrt_type == CNSTRT_FOREIGN_KEY) {
/* If <referenced column list> is not specified try to catch
them right here */
if (cnstrt->cnstrt_referred_fields == NULL)
get_referred_fields(action, cnstrt);
if (constraint->cnstrt_referred_fields == NULL)
get_referred_fields(action, constraint);
if (cnstrt->cnstrt_fkey_def_type & REF_UPDATE_ACTION) {
if (constraint->cnstrt_fkey_def_type & REF_UPDATE_ACTION) {
STUFF(gds_dyn_foreign_key_update);
switch (cnstrt->cnstrt_fkey_def_type & REF_UPDATE_MASK) {
switch (constraint->cnstrt_fkey_def_type & REF_UPDATE_MASK) {
case REF_UPD_NONE:
STUFF(gds_dyn_foreign_key_none);
break;
case REF_UPD_CASCADE:
STUFF(gds_dyn_foreign_key_cascade);
create_upd_cascade_trg(request, action, cnstrt);
create_upd_cascade_trg(request, action, constraint);
break;
case REF_UPD_SET_DEFAULT:
STUFF(gds_dyn_foreign_key_default);
create_set_default_trg(request, action, cnstrt, TRUE);
create_set_default_trg(request, action, constraint, TRUE);
break;
case REF_UPD_SET_NULL:
STUFF(gds_dyn_foreign_key_null);
create_set_null_trg(request, action, cnstrt, TRUE);
create_set_null_trg(request, action, constraint, TRUE);
break;
default:
/* just in case */
@ -1419,23 +1423,23 @@ static void create_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt)
break;
}
}
if (cnstrt->cnstrt_fkey_def_type & REF_DELETE_ACTION) {
if (constraint->cnstrt_fkey_def_type & REF_DELETE_ACTION) {
STUFF(gds_dyn_foreign_key_delete);
switch (cnstrt->cnstrt_fkey_def_type & REF_DELETE_MASK) {
switch (constraint->cnstrt_fkey_def_type & REF_DELETE_MASK) {
case REF_DEL_NONE:
STUFF(gds_dyn_foreign_key_none);
break;
case REF_DEL_CASCADE:
STUFF(gds_dyn_foreign_key_cascade);
create_del_cascade_trg(request, action, cnstrt);
create_del_cascade_trg(request, action, constraint);
break;
case REF_DEL_SET_DEFAULT:
STUFF(gds_dyn_foreign_key_default);
create_set_default_trg(request, action, cnstrt, FALSE);
create_set_default_trg(request, action, constraint, FALSE);
break;
case REF_DEL_SET_NULL:
STUFF(gds_dyn_foreign_key_null);
create_set_null_trg(request, action, cnstrt, FALSE);
create_set_null_trg(request, action, constraint, FALSE);
break;
default:
/* just in case */
@ -1448,14 +1452,14 @@ static void create_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt)
else
put_numeric(request, gds_dyn_idx_unique, TRUE);
for (field = cnstrt->cnstrt_fields; field; field = field->lls_next) {
for (field = constraint->cnstrt_fields; field; field = field->lls_next) {
string = (STR) field->lls_object;
put_cstring(request, gds_dyn_fld_name, (TEXT *) string);
}
if (cnstrt->cnstrt_type == CNSTRT_FOREIGN_KEY) {
if (constraint->cnstrt_type == CNSTRT_FOREIGN_KEY) {
put_cstring(request, gds_dyn_idx_foreign_key,
(TEXT *) cnstrt->cnstrt_referred_rel);
for (field = cnstrt->cnstrt_referred_fields; field;
(TEXT *) constraint->cnstrt_referred_rel);
for (field = constraint->cnstrt_referred_fields; field;
field = field->lls_next) {
string = (STR) field->lls_object;
put_cstring(request, gds_dyn_idx_ref_column, (TEXT *) string);
@ -1664,25 +1668,25 @@ static void create_domain( GPRE_REQ request, ACT action)
// Generate dyn for creating a constraints for domains.
//
static void create_domain_constraint( GPRE_REQ request, ACT action, CNSTRT cnstrt)
static void create_domain_constraint(GPRE_REQ request, ACT action, cnstrt* constraint)
{
TEXT *source;
for (; cnstrt; cnstrt = cnstrt->cnstrt_next) {
if (cnstrt->cnstrt_flags & CNSTRT_delete)
for (; constraint; constraint = constraint->cnstrt_next) {
if (constraint->cnstrt_flags & CNSTRT_delete)
continue;
// **** this will be used later
// put_cstring (request, gds_dyn_rel_constraint, cnstrt->cnstrt_name);
// put_cstring (request, gds_dyn_rel_constraint, constraint->cnstrt_name);
//***
if (cnstrt->cnstrt_type == CNSTRT_CHECK) {
source = (TEXT *) ALLOC(cnstrt->cnstrt_text->txt_length + 1);
CPR_get_text(source, cnstrt->cnstrt_text);
if (constraint->cnstrt_type == CNSTRT_CHECK) {
source = (TEXT *) ALLOC(constraint->cnstrt_text->txt_length + 1);
CPR_get_text(source, constraint->cnstrt_text);
if (source != NULL)
put_cstring(request, gds_dyn_fld_validation_source, source);
put_blr(request, gds_dyn_fld_validation_blr,
cnstrt->cnstrt_boolean,
constraint->cnstrt_boolean,
reinterpret_cast < pfn_local_trigger_cb > (CME_expr));
}
}
@ -1914,7 +1918,7 @@ static BOOLEAN create_view( GPRE_REQ request, ACT action)
LLS stack;
SLC slice;
GPRE_REQ slice_req;
struct gpre_fld tmp_field;
gpre_fld tmp_field;
// add relation name
@ -2199,33 +2203,33 @@ static void declare_filter( GPRE_REQ request, ACT action)
static void declare_udf( GPRE_REQ request, ACT action)
{
DECL_UDF udf;
DECL_UDF udf_declaration;
GPRE_FLD field, next;
TEXT *udf_name;
SSHORT position, blob_position;
udf = (DECL_UDF) action->act_object;
udf_name = udf->decl_udf_name;
udf_declaration = (DECL_UDF) action->act_object;
udf_name = udf_declaration->decl_udf_name;
put_cstring(request, gds_dyn_def_function, udf_name);
put_cstring(request, gds_dyn_func_entry_point, udf->decl_udf_entry_point);
put_cstring(request, gds_dyn_func_module_name, udf->decl_udf_module_name);
put_cstring(request, gds_dyn_func_entry_point, udf_declaration->decl_udf_entry_point);
put_cstring(request, gds_dyn_func_module_name, udf_declaration->decl_udf_module_name);
// Reverse the order of arguments which parse left backwords.
//
//for (field = udf->decl_udf_arg_list, udf->decl_udf_arg_list = NULL; field; field = next)
//for (field = udf_declaration->decl_udf_arg_list, udf_declaration->decl_udf_arg_list = NULL; field; field = next)
// {
// next = field->fld_next;
// field->fld_next = udf->decl_udf_arg_list;
// udf->decl_udf_arg_list = field;
// field->fld_next = udf_declaration->decl_udf_arg_list;
// udf_declaration->decl_udf_arg_list = field;
// }
//
if (field = udf->decl_udf_return_type) {
if (field = udf_declaration->decl_udf_return_type) {
/* Function returns a value */
/* Some data types can not be returned as value */
if ((udf->decl_udf_return_mode == FUN_value) &&
if ((udf_declaration->decl_udf_return_mode == FUN_value) &&
(field->fld_dtype == dtype_text ||
field->fld_dtype == dtype_varying ||
field->fld_dtype == dtype_cstring ||
@ -2239,7 +2243,7 @@ static void declare_udf( GPRE_REQ request, ACT action)
if (field->fld_dtype == dtype_blob) {
blob_position = 1;
for (next = udf->decl_udf_arg_list; next; next = next->fld_next)
for (next = udf_declaration->decl_udf_arg_list; next; next = next->fld_next)
++blob_position;
put_numeric(request, gds_dyn_func_return_argument, blob_position);
}
@ -2254,7 +2258,7 @@ static void declare_udf( GPRE_REQ request, ACT action)
/* Function modifies an argument whose value is the function return value */
put_numeric(request, gds_dyn_func_return_argument,
udf->decl_udf_return_parameter);
udf_declaration->decl_udf_return_parameter);
}
// Now define all the arguments
@ -2267,7 +2271,7 @@ static void declare_udf( GPRE_REQ request, ACT action)
else {
put_numeric(request, gds_dyn_def_function_arg, 0);
put_numeric(request, gds_dyn_func_mechanism,
udf->decl_udf_return_mode);
udf_declaration->decl_udf_return_mode);
}
put_cstring(request, gds_dyn_function_name, udf_name);
@ -2276,7 +2280,7 @@ static void declare_udf( GPRE_REQ request, ACT action)
position = 1;
}
for (field = udf->decl_udf_arg_list; field; field = field->fld_next) {
for (field = udf_declaration->decl_udf_arg_list; field; field = field->fld_next) {
if (position > 10)
CPR_error
("External functions can not have more than 10 parameters");

View File

@ -25,7 +25,7 @@
//
//____________________________________________________________
//
// $Id: cme.cpp,v 1.6 2002-11-30 17:40:24 hippoman Exp $
// $Id: cme.cpp,v 1.7 2003-09-05 10:14:07 aafemt Exp $
//
#include "firebird.h"
@ -382,13 +382,13 @@ void CME_expr(GPRE_NOD node, GPRE_REQ request)
void CME_get_dtype( GPRE_NOD node, GPRE_FLD f)
{
struct gpre_fld field1, field2;
gpre_fld field1, field2;
SSHORT dtype_max;
TEXT *string;
MEL element;
REF reference;
GPRE_FLD tmp_field;
UDF udf;
udf* a_udf;
f->fld_dtype = 0;
f->fld_length = 0;
@ -944,13 +944,13 @@ void CME_get_dtype( GPRE_NOD node, GPRE_FLD f)
return;
case nod_udf:
udf = (UDF) node->nod_arg[1];
f->fld_dtype = udf->udf_dtype;
f->fld_length = udf->udf_length;
f->fld_scale = udf->udf_scale;
f->fld_sub_type = udf->udf_sub_type;
f->fld_ttype = udf->udf_ttype;
f->fld_charset_id = udf->udf_charset_id;
a_udf = (udf*) node->nod_arg[1];
f->fld_dtype = a_udf->udf_dtype;
f->fld_length = a_udf->udf_length;
f->fld_scale = a_udf->udf_scale;
f->fld_sub_type = a_udf->udf_sub_type;
f->fld_ttype = a_udf->udf_ttype;
f->fld_charset_id = a_udf->udf_charset_id;
return;
case nod_cast:
@ -1058,15 +1058,15 @@ void CME_relation(GPRE_CTX context, GPRE_REQ request)
// Generate blr for an rse node.
//
void CME_rse(RSE rse, GPRE_REQ request)
void CME_rse(rse* selection, GPRE_REQ request)
{
GPRE_NOD temp, union_node, *ptr, *end, list;
RSE sub_rse;
SSHORT i;
if (rse->rse_join_type == (NOD_T) 0)
if (selection->rse_join_type == (NOD_T) 0)
{
if ((rse->rse_flags & RSE_singleton) &&
if ((selection->rse_flags & RSE_singleton) &&
!(request->req_database->dbb_flags & DBB_v3))
{
STUFF(blr_singular);
@ -1078,11 +1078,11 @@ void CME_rse(RSE rse, GPRE_REQ request)
// Process unions, if any, otherwise process relations
if (union_node = rse->rse_union)
if (union_node = selection->rse_union)
{
STUFF(1);
STUFF(blr_union);
STUFF(rse->rse_context[0]->ctx_internal);
STUFF(selection->rse_context[0]->ctx_internal);
STUFF(union_node->nod_count);
ptr = union_node->nod_arg;
for (end = ptr + union_node->nod_count; ptr < end; ptr++)
@ -1092,7 +1092,7 @@ void CME_rse(RSE rse, GPRE_REQ request)
cmp_map(sub_rse->rse_map, request);
}
}
else if (sub_rse = rse->rse_aggregate)
else if (sub_rse = selection->rse_aggregate)
{
STUFF(1);
STUFF(blr_aggregate);
@ -1112,26 +1112,26 @@ void CME_rse(RSE rse, GPRE_REQ request)
}
else
{
STUFF(rse->rse_count);
for (i = 0; i < rse->rse_count; i++)
CME_relation(rse->rse_context[i], request);
STUFF(selection->rse_count);
for (i = 0; i < selection->rse_count; i++)
CME_relation(selection->rse_context[i], request);
}
// Process the clauses present
if (rse->rse_first)
if (selection->rse_first)
{
STUFF(blr_first);
CME_expr(rse->rse_first, request);
CME_expr(selection->rse_first, request);
}
if (rse->rse_boolean)
if (selection->rse_boolean)
{
STUFF(blr_boolean);
CME_expr(rse->rse_boolean, request);
CME_expr(selection->rse_boolean, request);
}
if (temp = rse->rse_sort)
if (temp = selection->rse_sort)
{
STUFF(blr_sort);
STUFF(temp->nod_count);
@ -1143,7 +1143,7 @@ void CME_rse(RSE rse, GPRE_REQ request)
}
}
if (temp = rse->rse_reduced)
if (temp = selection->rse_reduced)
{
STUFF(blr_project);
STUFF(temp->nod_count);
@ -1152,19 +1152,19 @@ void CME_rse(RSE rse, GPRE_REQ request)
CME_expr(*ptr++, request);
}
if (temp = rse->rse_plan)
if (temp = selection->rse_plan)
{
STUFF(blr_plan);
cmp_plan(temp, request);
}
if (rse->rse_join_type != (NOD_T) 0
&& rse->rse_join_type != nod_join_inner)
if (selection->rse_join_type != (NOD_T) 0
&& selection->rse_join_type != nod_join_inner)
{
STUFF(blr_join_type);
if (rse->rse_join_type == nod_join_left)
if (selection->rse_join_type == nod_join_left)
STUFF(blr_left);
else if (rse->rse_join_type == nod_join_right)
else if (selection->rse_join_type == nod_join_right)
STUFF(blr_right);
else
STUFF(blr_full);
@ -1580,14 +1580,14 @@ static GPRE_NOD cmp_literal( GPRE_NOD node, GPRE_REQ request)
// Generate a map for a union or aggregate rse.
//
static void cmp_map( MAP map, GPRE_REQ request)
static void cmp_map(map* a_map, GPRE_REQ request)
{
MEL element;
STUFF(blr_map);
STUFF_WORD(map->map_count);
STUFF_WORD(a_map->map_count);
for (element = map->map_elements; element; element = element->mel_next)
for (element = a_map->map_elements; element; element = element->mel_next)
{
STUFF_WORD(element->mel_position);
CME_expr(element->mel_expr, request);
@ -1781,12 +1781,12 @@ static void cmp_sdl_dtype( GPRE_FLD field, REF reference)
static GPRE_NOD cmp_udf( GPRE_NOD node, GPRE_REQ request)
{
GPRE_NOD list, *ptr, *end;
UDF udf;
udf* an_udf;
TEXT *p;
udf = (UDF) node->nod_arg[1];
an_udf = (udf*) node->nod_arg[1];
STUFF(blr_function);
p = udf->udf_function;
p = an_udf->udf_function;
STUFF(strlen(p));
while (*p)

View File

@ -25,7 +25,7 @@
//
//____________________________________________________________
//
// $Id: cmp.cpp,v 1.12 2003-02-27 16:05:13 brodsom Exp $
// $Id: cmp.cpp,v 1.13 2003-09-05 10:14:07 aafemt Exp $
//
#include "firebird.h"
@ -476,7 +476,7 @@ void CMP_t_start( GPRE_TRA trans)
DBB database;
RRL lock_block;
USHORT buff_len, tpb_len;
TPB tpb;
tpb* new_tpb;
// fill out a standard tpb buffer ahead of time so we know
// how large it is
@ -514,16 +514,16 @@ void CMP_t_start( GPRE_TRA trans)
if (trans->tra_flags & TRA_inc) {
if (database->dbb_flags & DBB_in_trans) {
tpb = (TPB) ALLOC(TPB_LEN(tpb_len));
tpb->tpb_length = tpb_len;
new_tpb = (tpb*) ALLOC(TPB_LEN(tpb_len));
new_tpb->tpb_length = tpb_len;
database->dbb_flags &= ~DBB_in_trans;
}
else
continue;
}
else if (!(trans->tra_flags & TRA_rrl)) {
tpb = (TPB) ALLOC(TPB_LEN(tpb_len));
tpb->tpb_length = tpb_len;
new_tpb = (tpb*) ALLOC(TPB_LEN(tpb_len));
new_tpb->tpb_length = tpb_len;
}
else if (database->dbb_rrls) {
p = rrl_buffer;
@ -538,8 +538,8 @@ void CMP_t_start( GPRE_TRA trans)
}
*p = 0;
buff_len = (p - rrl_buffer);
tpb = (TPB) ALLOC(TPB_LEN(buff_len + tpb_len));
tpb->tpb_length = buff_len + tpb_len;
new_tpb = (tpb*) ALLOC(TPB_LEN(buff_len + tpb_len));
new_tpb->tpb_length = buff_len + tpb_len;
database->dbb_rrls = NULL;
}
else /* this database isn't referenced */
@ -547,18 +547,18 @@ void CMP_t_start( GPRE_TRA trans)
/* link this into the TPB chains (GPRE_TRA and DBB) */
tpb->tpb_database = database;
tpb->tpb_dbb_next = database->dbb_tpbs;
database->dbb_tpbs = tpb;
tpb->tpb_tra_next = trans->tra_tpb;
trans->tra_tpb = tpb;
new_tpb->tpb_database = database;
new_tpb->tpb_dbb_next = database->dbb_tpbs;
database->dbb_tpbs = new_tpb;
new_tpb->tpb_tra_next = trans->tra_tpb;
trans->tra_tpb = new_tpb;
trans->tra_db_count++;
/* fill in the standard TPB and concatenate the relation names */
tpb->tpb_ident = CMP_next_ident();
new_tpb->tpb_ident = CMP_next_ident();
text = reinterpret_cast < char *>(tpb->tpb_string);
text = reinterpret_cast<char*>(new_tpb->tpb_string);
for (p = tpb_buffer; *p;)
*text++ = *p++;
if (trans->tra_flags & TRA_rrl)
@ -1051,17 +1051,17 @@ static void cmp_form( GPRE_REQ request)
REF reference, option, parent;
POR port;
GPRE_FLD field;
FORM form;
FORM request_form;
form = request->req_form;
request_form = request->req_form;
if (!form->form_handle) {
form->form_handle = (TEXT *) ALLOC(20);
sprintf(form->form_handle, ident_pattern, CMP_next_ident());
if (!request_form->form_handle) {
request_form->form_handle = (TEXT *) ALLOC(20);
sprintf(request_form->form_handle, ident_pattern, CMP_next_ident());
}
if (!request->req_form_handle)
request->req_form_handle = form->form_handle;
request->req_form_handle = request_form->form_handle;
request->req_blr = request->req_base = (UCHAR *) ALLOC(500);
request->req_length = 500;
@ -1083,7 +1083,7 @@ static void cmp_form( GPRE_REQ request)
else
cmp_port(port, request);
if (field = form->form_field) {
if (field = request_form->form_field) {
STUFF(PYXIS_MAP_SUB_FORM);
CMP_stuff_symbol(request, field->fld_symbol);
}
@ -1144,11 +1144,11 @@ static void cmp_loop( GPRE_REQ request)
GPRE_NOD node, list, *ptr, *end, counter;
POR primary;
GPRE_CTX for_context, update_context;
RSE rse;
rse* selection;
REF reference;
node = request->req_node;
rse = request->req_rse;
selection = request->req_rse;
primary = request->req_primary;
make_send(primary, request);
@ -1164,11 +1164,11 @@ static void cmp_loop( GPRE_REQ request)
CME_expr(lit0, request);
CME_expr(counter, request);
for_context = rse->rse_context[0];
for_context = selection->rse_context[0];
update_context = request->req_update;
STUFF(blr_for);
CME_rse(rse, request);
CME_rse(selection, request);
STUFF(blr_begin);
if (node->nod_type == nod_modify) {

View File

@ -27,7 +27,7 @@
//
//____________________________________________________________
//
// $Id: cob.cpp,v 1.23 2003-08-09 18:00:13 brodsom Exp $
// $Id: cob.cpp,v 1.24 2003-09-05 10:14:07 aafemt Exp $
//
// 2002.10.27 Sean Leyne - Completed removal of obsolete "DG_X86" port
// 2002.10.27 Sean Leyne - Code Cleanup, removed obsolete "UNIXWARE" port
@ -1820,9 +1820,9 @@ static void gen_database( ACT action)
TEXT *name, fname[80], *s, s1[40];
USHORT count, max_count;
#ifdef PYXIS
FORM form;
FORM a_form;
#endif
TPB tpb;
tpb* tpb_iterator;
POR port;
BLB blob;
BOOLEAN all_static, all_extern, dyn_immed;
@ -1872,21 +1872,25 @@ static void gen_database( ACT action)
}
#endif
for (tpb = db->dbb_tpbs; tpb; tpb = tpb->tpb_dbb_next)
gen_tpb(tpb);
for (tpb_iterator = db->dbb_tpbs;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_dbb_next)
{
gen_tpb(tpb_iterator);
}
#ifdef PYXIS
for (form = db->dbb_forms; form; form = form->form_next) {
for (a_form = db->dbb_forms; a_form; a_form = a_form->form_next) {
printa(names[COLUMN_0], FALSE,
"01 %s PIC S9(9) USAGE COMP VALUE IS 0.",
form->form_handle);
a_form->form_handle);
printa(names[COLUMN_0], FALSE,
"01 %sFL PIC S9(4) USAGE COMP VALUE IS %d.",
form->form_handle, strlen(form->form_name->sym_string));
a_form->form_handle, strlen(a_form->form_name->sym_string));
#ifndef VMS
printa(names[COLUMN_0], FALSE,
"01 %sFN PIC X(%d) VALUE IS \"%s\".", form->form_handle,
strlen(form->form_name->sym_string),
form->form_name->sym_string);
"01 %sFN PIC X(%d) VALUE IS \"%s\".", a_form->form_handle,
strlen(a_form->form_name->sym_string),
a_form->form_name->sym_string);
#endif
}
#endif
@ -2197,7 +2201,8 @@ static void gen_dyn_execute( ACT action)
{
DYN statement;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -2293,7 +2298,8 @@ static void gen_dyn_immediate( ACT action)
DYN statement;
DBB database;
TEXT *transaction, s[64], *s2;
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
#ifdef GIVING_SUPPORTED
#define GET_LEN_CALL_TEMPLATE "CALL %s USING %s GIVING %s"
@ -2388,7 +2394,8 @@ static void gen_dyn_open( ACT action)
{
DYN statement;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -2443,7 +2450,8 @@ static void gen_dyn_prepare( ACT action)
DYN statement;
DBB database;
TEXT *transaction, s[64], s2[64], s3[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
database = statement->dyn_database;
@ -2942,13 +2950,13 @@ static void gen_form_display( ACT action)
GPRE_REQ request;
REF reference, master;
POR port;
DBB dbb;
dbb* database;
TEXT s[32], out[16];
int code;
display = (FINT) action->act_object;
request = display->fint_request;
dbb = request->req_database;
database = request->req_database;
port = request->req_ports;
// Initialize field options
@ -2970,7 +2978,7 @@ static void gen_form_display( ACT action)
"CALL \"%s\" USING %s, %s%s, %s%s, %s%s, %s%s, %s%s%d, %s%s",
PYXIS_DRIVE_FORM,
status_vector(action),
BY_REF, dbb->dbb_name->sym_string,
BY_REF, database->dbb_name->sym_string,
BY_REF, request->req_trans,
BY_REF, names[ISC_WINDOW],
BY_REF, request->req_handle,
@ -3097,13 +3105,13 @@ static void gen_function( ACT function)
static void gen_form_for( ACT action)
{
GPRE_REQ request;
FORM form;
DBB dbb;
FORM a_form;
dbb* database;
TEXT s[64];
request = action->act_request;
form = request->req_form;
dbb = request->req_database;
a_form = request->req_form;
database = request->req_database;
// Get database attach and transaction started
@ -3117,14 +3125,14 @@ static void gen_form_for( ACT action)
#ifndef VMS
sprintf(s, "%s%sFN", BY_REF, request->req_form_handle);
#else
sprintf(s, "\'%s\'", form->form_name->sym_string);
sprintf(s, "\'%s\'", a_form->form_name->sym_string);
#endif
printa(names[COLUMN], TRUE,
"CALL \"%s\" USING %s, %s%s, %s%s, %s%s, %s%sFL, %s",
PYXIS_LOAD_FORM,
status_vector(action),
BY_REF, dbb->dbb_name->sym_string,
BY_REF, database->dbb_name->sym_string,
BY_REF, request->req_trans,
BY_REF, request->req_form_handle,
BY_REF, request->req_form_handle, s);
@ -3267,10 +3275,12 @@ static void gen_item_end( ACT action)
GPRE_REQ request;
REF reference;
POR port;
DBB dbb;
dbb* database;
TEXT s[32], index[16];
request = action->act_request;
database = request->req_database;
port = request->req_ports;
if (request->req_type == REQ_menu) {
gen_menu_item_end(action);
@ -3284,17 +3294,14 @@ static void gen_item_end( ACT action)
"CALL \"%s\" USING %s, %s%s, %s%s, %s%s, %s%s%d",
PYXIS_FETCH,
status_vector(action),
BY_REF, request->req_database->dbb_name->sym_string,
BY_REF, database->dbb_name->sym_string,
BY_REF, request->req_trans,
BY_REF, request->req_handle,
BY_REF, names[ISC_], request->req_ports->por_ident);
BY_REF, names[ISC_], port->por_ident);
printa(names[COLUMN], FALSE, "END-PERFORM");
return;
}
dbb = request->req_database;
port = request->req_ports;
// Initialize field options
for (reference = port->por_references; reference;
@ -3307,7 +3314,7 @@ static void gen_item_end( ACT action)
"CALL \"%s\" USING %s, %s%s, %s%s, %s%s, %s%s%d",
PYXIS_INSERT,
status_vector(action),
BY_REF, dbb->dbb_name->sym_string,
BY_REF, database->dbb_name->sym_string,
BY_REF, request->req_trans,
BY_REF, request->req_handle, BY_REF, names[ISC_], port->por_ident);
}
@ -3320,8 +3327,7 @@ static void gen_item_end( ACT action)
static void gen_item_for( ACT action)
{
GPRE_REQ request, parent;
FORM form;
GPRE_REQ request;
TEXT index[30];
request = action->act_request;
@ -3331,9 +3337,6 @@ static void gen_item_for( ACT action)
return;
}
form = request->req_form;
parent = form->form_parent;
// Get map compiled
printa(names[COLUMN], FALSE, "IF %s = 0 THEN", request->req_handle);
@ -3341,7 +3344,7 @@ static void gen_item_for( ACT action)
"CALL \"%s\" USING %s, %s%s, %s%s, %s%s%dL, %s%s%d",
PYXIS_COMPILE_SUB_MAP,
status_vector(action),
BY_REF, parent->req_handle,
BY_REF, request->req_form->form_parent->req_handle,
BY_REF, request->req_handle,
BY_REF, names[ISC_], request->req_ident,
BY_REF, names[ISC_], request->req_ident);
@ -3428,17 +3431,15 @@ static void gen_menu( ACT action)
static void gen_menu_display( ACT action)
{
MENU menu;
MENU a_menu = NULL;
GPRE_REQ request, display_request;
request = action->act_request;
display_request = (GPRE_REQ) action->act_object;
menu = NULL;
for (action = request->req_actions; action; action = action->act_next)
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
@ -3449,15 +3450,15 @@ static void gen_menu_display( ACT action)
BY_REF, request->req_handle,
BY_REF, names[ISC_], display_request->req_ident,
BY_REF, names[ISC_], display_request->req_ident,
BY_REF, names[ISC_], menu->menu_title,
BY_REF, names[ISC_], menu->menu_title);
BY_REF, names[ISC_], a_menu->menu_title,
BY_REF, names[ISC_], a_menu->menu_title);
printa(names[CONTINUE], TRUE,
"%s%s%d, %s%s%dL, %s%s%d, %s%s%d",
BY_REF, names[ISC_], menu->menu_terminator,
BY_REF, names[ISC_], menu->menu_entree_entree,
BY_REF, names[ISC_], menu->menu_entree_entree,
BY_REF, names[ISC_], menu->menu_entree_value);
BY_REF, names[ISC_], a_menu->menu_terminator,
BY_REF, names[ISC_], a_menu->menu_entree_entree,
BY_REF, names[ISC_], a_menu->menu_entree_entree,
BY_REF, names[ISC_], a_menu->menu_entree_value);
}
#endif
@ -3503,32 +3504,30 @@ static void gen_menu_entree( ACT action)
static void gen_menu_entree_att( ACT action)
{
MENU menu;
MENU a_menu = (MENU) action->act_object;
SSHORT ident, length;
menu = (MENU) action->act_object;
length = FALSE;
switch (action->act_type) {
case ACT_entree_text:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
break;
case ACT_entree_length:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
length = TRUE;
break;
case ACT_entree_value:
ident = menu->menu_entree_value;
ident = a_menu->menu_entree_value;
break;
case ACT_title_text:
ident = menu->menu_title;
ident = a_menu->menu_title;
break;
case ACT_title_length:
ident = menu->menu_title;
ident = a_menu->menu_title;
length = TRUE;
break;
case ACT_terminator:
ident = menu->menu_terminator;
ident = a_menu->menu_terminator;
break;
default:
ident = -1;
@ -3570,20 +3569,20 @@ static void gen_menu_for( ACT action)
static void gen_menu_item_end( ACT action)
{
GPRE_REQ request;
ENTREE entree;
ENTREE menu_entree;
entree = (ENTREE) action->act_pair->act_object;
request = entree->entree_request;
menu_entree = (ENTREE) action->act_pair->act_object;
request = menu_entree->entree_request;
if (action->act_pair->act_type == ACT_item_for) {
printa(names[COLUMN], TRUE,
"CALL \"%s\" USING %s%s, %s%s%dL, %s%s%d, %s%s%d, %s%s%d",
PYXIS_GET_ENTREE,
BY_REF, request->req_handle,
BY_REF, names[ISC_], entree->entree_entree,
BY_REF, names[ISC_], entree->entree_entree,
BY_REF, names[ISC_], entree->entree_value,
BY_REF, names[ISC_], entree->entree_end);
BY_REF, names[ISC_], menu_entree->entree_entree,
BY_REF, names[ISC_], menu_entree->entree_entree,
BY_REF, names[ISC_], menu_entree->entree_value,
BY_REF, names[ISC_], menu_entree->entree_end);
printa(names[COLUMN], FALSE, "END-PERFORM");
return;
@ -3594,9 +3593,9 @@ static void gen_menu_item_end( ACT action)
"CALL \"%s\" USING %s%s, %s%s%dL, %s%s%d, %s%s%d",
PYXIS_PUT_ENTREE,
BY_REF, request->req_handle,
BY_REF, names[ISC_], entree->entree_entree,
BY_REF, names[ISC_], entree->entree_entree,
BY_REF, names[ISC_], entree->entree_value);
BY_REF, names[ISC_], menu_entree->entree_entree,
BY_REF, names[ISC_], menu_entree->entree_entree,
BY_REF, names[ISC_], menu_entree->entree_value);
}
#endif
#ifdef PYXIS
@ -3608,7 +3607,7 @@ static void gen_menu_item_end( ACT action)
static void gen_menu_item_for( ACT action)
{
ENTREE entree;
ENTREE menu_entree;
GPRE_REQ request;
if (action->act_type != ACT_item_for)
@ -3616,21 +3615,21 @@ static void gen_menu_item_for( ACT action)
// Build stuff for item loop
entree = (ENTREE) action->act_object;
request = entree->entree_request;
menu_entree = (ENTREE) action->act_object;
request = menu_entree->entree_request;
printa(names[COLUMN],
TRUE,
"CALL \"%s\" USING %s%s, %s%s%dL, %s%s%d, %s%s%d, %s%s%d",
PYXIS_GET_ENTREE,
BY_REF, request->req_handle,
BY_REF, names[ISC_], entree->entree_entree,
BY_REF, names[ISC_], entree->entree_entree,
BY_REF, names[ISC_], entree->entree_value,
BY_REF, names[ISC_], entree->entree_end);
BY_REF, names[ISC_], menu_entree->entree_entree,
BY_REF, names[ISC_], menu_entree->entree_entree,
BY_REF, names[ISC_], menu_entree->entree_value,
BY_REF, names[ISC_], menu_entree->entree_end);
printa(names[COLUMN], FALSE, "PERFORM UNTIL %s%d NOT = 0",
names[ISC_], entree->entree_end);
names[ISC_], menu_entree->entree_end);
}
#endif
@ -3643,55 +3642,52 @@ static void gen_menu_item_for( ACT action)
static void gen_menu_request( GPRE_REQ request)
{
ACT action;
MENU menu;
ENTREE entree;
menu = NULL;
entree = NULL;
MENU a_menu = NULL;
ENTREE menu_entree = NULL;
for (action = request->req_actions; action; action = action->act_next) {
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
else if ((action->act_type == ACT_item_for)
|| (action->act_type == ACT_item_put)) {
entree = (ENTREE) action->act_object;
menu_entree = (ENTREE) action->act_object;
break;
}
}
if (menu) {
menu->menu_title = CMP_next_ident();
menu->menu_terminator = CMP_next_ident();
menu->menu_entree_value = CMP_next_ident();
menu->menu_entree_entree = CMP_next_ident();
if (a_menu) {
a_menu->menu_title = CMP_next_ident();
a_menu->menu_terminator = CMP_next_ident();
a_menu->menu_entree_value = CMP_next_ident();
a_menu->menu_entree_entree = CMP_next_ident();
printa(names[COLUMN_0], FALSE, "01 %%dL PIC S9(4) USAGE IS COMP.",
names[ISC_], menu->menu_title);
names[ISC_], a_menu->menu_title);
printa(names[COLUMN_0], FALSE, "01 %%d PIC X(81).",
names[ISC_], menu->menu_title);
names[ISC_], a_menu->menu_title);
printa(names[COLUMN_0], FALSE, "01 %%d PIC S9(4) USAGE IS COMP.",
names[ISC_], menu->menu_terminator);
names[ISC_], a_menu->menu_terminator);
printa(names[COLUMN_0], FALSE, "01 %%dL PIC S9(4) USAGE IS COMP.",
names[ISC_], menu->menu_entree_entree);
names[ISC_], a_menu->menu_entree_entree);
printa(names[COLUMN_0], FALSE, "01 %%d PIC X(81).",
names[ISC_], menu->menu_entree_entree);
names[ISC_], a_menu->menu_entree_entree);
printa(names[COLUMN_0], FALSE, "01 %%d PIC S9(9) USAGE IS COMP.",
names[ISC_], menu->menu_entree_value);
names[ISC_], a_menu->menu_entree_value);
}
if (entree) {
entree->entree_entree = CMP_next_ident();
entree->entree_value = CMP_next_ident();
entree->entree_end = CMP_next_ident();
if (menu_entree) {
menu_entree->entree_entree = CMP_next_ident();
menu_entree->entree_value = CMP_next_ident();
menu_entree->entree_end = CMP_next_ident();
printa(names[COLUMN_0], FALSE, "01 %s%dL PIC S9(4) USAGE IS COMP.",
names[ISC_], entree->entree_entree);
names[ISC_], menu_entree->entree_entree);
printa(names[COLUMN_0], FALSE, "01 %s%d PIC X(81).",
names[ISC_], entree->entree_entree);
names[ISC_], menu_entree->entree_entree);
printa(names[COLUMN_0], FALSE, "01 %s%d PIC S9(9) USAGE IS COMP.",
names[ISC_], entree->entree_value);
names[ISC_], menu_entree->entree_value);
printa(names[COLUMN_0], FALSE, "01 %s%d PIC S9(4) USAGE IS COMP.",
names[ISC_], entree->entree_end);
names[ISC_], menu_entree->entree_end);
}
}
@ -3740,15 +3736,13 @@ static void gen_procedure( ACT action)
TEXT *pattern;
GPRE_REQ request;
POR in_port, out_port;
DBB dbb;
USHORT column;
request = action->act_request;
in_port = request->req_vport;
out_port = request->req_primary;
dbb = request->req_database;
args.pat_database = dbb;
args.pat_database = request->req_database;
args.pat_request = action->act_request;
args.pat_vector1 = status_vector(action);
args.pat_request = request;
@ -4563,7 +4557,7 @@ static void gen_t_start( ACT action)
{
DBB db;
GPRE_TRA trans;
TPB tpb;
tpb* tpb_iterator;
TEXT *filename, dbname[80];
USHORT namelength;
@ -4577,8 +4571,11 @@ static void gen_t_start( ACT action)
// build a complete statement, including tpb's. Ready db's as gpre_req.
if (sw_auto)
for (tpb = trans->tra_tpb; tpb; tpb = tpb->tpb_tra_next) {
db = tpb->tpb_database;
for (tpb_iterator = trans->tra_tpb;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
db = tpb_iterator->tpb_database;
if ((filename = db->dbb_runtime) || !(db->dbb_flags & DBB_sqlca)) {
printa(names[COLUMN], FALSE, "IF %s = 0 THEN",
db->dbb_name->sym_string);
@ -4603,11 +4600,15 @@ static void gen_t_start( ACT action)
BY_REF, (trans->tra_handle) ? trans->tra_handle : names[ISC_TRANS],
BY_VALUE, trans->tra_db_count, END_VALUE);
for (tpb = trans->tra_tpb; tpb; tpb = tpb->tpb_tra_next)
for (tpb_iterator = trans->tra_tpb;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
printa(names[CONTINUE], TRUE, ", %s%s, %s%d%s, %s%s%d",
BY_REF, tpb->tpb_database->dbb_name->sym_string,
BY_VALUE, tpb->tpb_length, END_VALUE,
BY_REF, names[ISC_TPB_], tpb->tpb_ident);
BY_REF, tpb_iterator->tpb_database->dbb_name->sym_string,
BY_VALUE, tpb_iterator->tpb_length, END_VALUE,
BY_REF, names[ISC_TPB_], tpb_iterator->tpb_ident);
}
set_sqlcode(action);
@ -4619,7 +4620,7 @@ static void gen_t_start( ACT action)
// Initialize a TPB in the output file
//
static void gen_tpb( TPB tpb)
static void gen_tpb(tpb* tpb_buffer)
{
UCHAR *text, *c;
int length, char_len;
@ -4640,10 +4641,10 @@ static void gen_tpb( TPB tpb)
//
printa(names[COLUMN_0], FALSE, "01 %s%d.",
names[ISC_TPB_], tpb->tpb_ident);
names[ISC_TPB_], tpb_buffer->tpb_ident);
text = tpb->tpb_string;
char_len = tpb->tpb_length;
text = tpb_buffer->tpb_string;
char_len = tpb_buffer->tpb_length;
length = 1;
while (char_len) {
@ -4655,12 +4656,12 @@ static void gen_tpb( TPB tpb)
}
printa(names[COLUMN], FALSE, RAW_TPB_TEMPLATE,
names[ISC_TPB_], tpb->tpb_ident,
names[ISC_TPB_], tpb_buffer->tpb_ident,
names[UNDER], length++, tpb_hunk.longword_tpb);
}
sprintf(output_buffer, "%sEnd of data for %s%d\n",
names[COMMENT], names[ISC_TPB_], tpb->tpb_ident);
names[COMMENT], names[ISC_TPB_], tpb_buffer->tpb_ident);
COB_print_buffer(output_buffer, FALSE);
}

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: dyntable.cpp,v 1.3 2001-12-24 02:50:49 tamlin Exp $
// $Id: dyntable.cpp,v 1.4 2003-09-05 10:14:07 aafemt Exp $
//
#include "firebird.h"
@ -123,7 +123,7 @@ int *table[256];
main()
{
struct dyn *item;
dyn* item;
int max, *stuff, dyn;
SCHAR *table[256];

View File

@ -25,7 +25,7 @@
//
//____________________________________________________________
//
// $Id: exp.cpp,v 1.13 2003-08-09 18:00:13 brodsom Exp $
// $Id: exp.cpp,v 1.14 2003-09-05 10:14:07 aafemt Exp $
//
#include "firebird.h"
@ -142,7 +142,7 @@ GPRE_NOD EXP_array(GPRE_REQ request, GPRE_FLD field, SSHORT subscript_flag, SSHO
GPRE_FLD EXP_cast(GPRE_FLD field)
{
struct dtypes *dtype;
dtypes* dtype;
GPRE_FLD cast;
for (dtype = data_types;; dtype++)
@ -319,7 +319,7 @@ GPRE_FLD EXP_form_field(GPRE_CTX * rcontext)
GPRE_FLD field, child;
REF reference, parent;
GPRE_REQ request;
FORM form;
FORM a_form;
TEXT s[128];
if (!(symbol = token.tok_symbol) || symbol->sym_type != SYM_form_map)
@ -327,7 +327,7 @@ GPRE_FLD EXP_form_field(GPRE_CTX * rcontext)
*rcontext = context = symbol->sym_object;
request = context->ctx_request;
form = request->req_form;
a_form = request->req_form;
ADVANCE_TOKEN;
if (!MATCH(KW_DOT))
@ -366,9 +366,9 @@ GPRE_FLD EXP_form_field(GPRE_CTX * rcontext)
if (!
(field =
FORM_lookup_field(form, form->form_object, token.tok_string))) {
FORM_lookup_field(a_form, a_form->form_object, token.tok_string))) {
sprintf(s, "field \"%s\" is not defined in form %s", token.tok_string,
form->form_name->sym_string);
a_form->form_name->sym_string);
PAR_error(s);
}
@ -1622,7 +1622,7 @@ static GPRE_NOD par_relational( GPRE_REQ request)
REF reference;
GPRE_FLD field;
USHORT negation;
struct rel_ops *relop;
rel_ops* relop;
if (MATCH(KW_ANY)) {
expr = MAKE_NODE(nod_any, 1);
@ -1729,7 +1729,7 @@ static GPRE_NOD par_udf( GPRE_REQ request, USHORT type, GPRE_FLD field)
GPRE_NOD node;
SYM symbol;
LLS stack;
UDF udf;
udf* new_udf;
if (!request)
return NULL;
@ -1737,12 +1737,12 @@ static GPRE_NOD par_udf( GPRE_REQ request, USHORT type, GPRE_FLD field)
// Check for user defined functions
for (symbol = token.tok_symbol; symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_udf && (udf = (UDF) symbol->sym_object) &&
/* request->req_database == udf->udf_database && */
udf->udf_type == type) {
if (symbol->sym_type == SYM_udf && (new_udf = (UDF) symbol->sym_object) &&
/* request->req_database == new_udf->udf_database && */
new_udf->udf_type == type) {
node = MAKE_NODE(nod_udf, 2);
node->nod_count = 1;
node->nod_arg[1] = (GPRE_NOD) udf;
node->nod_arg[1] = (GPRE_NOD) new_udf;
ADVANCE_TOKEN;
if (!MATCH(KW_LEFT_PAREN))
EXP_left_paren(0);

View File

@ -28,12 +28,12 @@
/* Form instance */
typedef struct form {
struct dbb *form_dbb; /* Parent database */
struct form *form_next; /* Next form in database */
struct sym *form_name; /* Form name */
struct gpre_fld *form_fields; /* Form fields */
struct gpre_req *form_parent; /* Parent form request */
struct gpre_fld *form_field; /* Field in parent */
dbb* form_dbb; /* Parent database */
form* form_next; /* Next form in database */
sym* form_name; /* Form name */
gpre_fld* form_fields; /* Form fields */
gpre_req* form_parent; /* Parent form request */
gpre_fld* form_field; /* Field in parent */
int *form_object; /* Form data structure */
TEXT *form_handle; /* Runtime form handle */
} *FORM;
@ -41,13 +41,13 @@ typedef struct form {
/* Form Interaction */
typedef struct fint {
struct gpre_req *fint_request; /* Parent request */
gpre_req* fint_request; /* Parent request */
USHORT fint_flags; /* Misc crud */
struct lls *fint_display_fields; /* List of fields for display */
struct lls *fint_update_fields; /* List of fields for update */
struct lls *fint_wakeup_fields; /* List of fields for immediate wakeup */
struct lls *fint_position_fields; /* Field for cursor position */
struct lls *fint_override_fields; /* Fields to be left alone */
lls* fint_display_fields; /* List of fields for display */
lls* fint_update_fields; /* List of fields for update */
lls* fint_wakeup_fields; /* List of fields for immediate wakeup */
lls* fint_position_fields; /* Field for cursor position */
lls* fint_override_fields; /* Fields to be left alone */
} *FINT;
#define FINT_display_all 1
@ -61,14 +61,14 @@ typedef struct fint {
typedef struct entree {
struct gpre_req *entree_request; /* Parent request */
gpre_req* entree_request; /* Parent request */
USHORT entree_entree; /* ident for entree */
USHORT entree_value; /* ident for entree value */
USHORT entree_end; /* ident for end flag for get */
} *ENTREE;
typedef struct menu {
struct entree menu_entree; /* current/terminating entree */
entree menu_entree; /* current/terminating entree */
USHORT menu_title; /* ident for menu title */
USHORT menu_terminator; /* ident for menu terminator */
} *MENU;

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: ftn.cpp,v 1.21 2003-08-09 18:00:13 brodsom Exp $
// $Id: ftn.cpp,v 1.22 2003-09-05 10:14:07 aafemt Exp $
//
// 2002.10.28 Sean Leyne - Completed removal of obsolete "DGUX" port
// 2002.10.28 Sean Leyne - Completed removal of obsolete "SGI" port
@ -56,7 +56,7 @@ extern "C" {
extern DBB isc_databases;
extern GPRE_REQ requests;
extern IB_FILE *out_file;
extern struct dbd global_db_list[];
extern dbd global_db_list[];
extern USHORT global_db_count;
@ -161,9 +161,6 @@ static void gen_slice (ACT);
static void gen_start (ACT, POR);
static void gen_store (ACT);
static void gen_t_start (ACT);
#ifdef NOT_USED_OR_REPLACED
static void gen_tpb(TPB);
#endif
static void gen_tpb_data (TPB);
static void gen_tpb_decls (TPB);
static void gen_trans (ACT);
@ -1547,7 +1544,7 @@ static void gen_database( ACT action)
static void gen_database_data( ACT action)
{
DBB db;
TPB tpb;
tpb* tpb_iterator;
GPRE_REQ request;
BOOLEAN any_extern;
TEXT include_buffer[MAXPATHLEN];
@ -1567,8 +1564,12 @@ static void gen_database_data( ACT action)
else
any_extern = TRUE;
#endif
for (tpb = db->dbb_tpbs; tpb; tpb = tpb->tpb_dbb_next)
gen_tpb_data(tpb);
for (tpb_iterator = db->dbb_tpbs;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_dbb_next)
{
gen_tpb_data(tpb_iterator);
}
}
ib_fprintf(out_file,
@ -1611,7 +1612,7 @@ static void gen_database_decls( ACT action)
DBB db;
GPRE_REQ request;
POR port;
TPB tpb;
tpb* tpb_iterator;
BLB blob;
TEXT *name;
BOOLEAN all_static, dcl_ndx_var;
@ -1684,8 +1685,11 @@ static void gen_database_decls( ACT action)
"%sCHARACTER*256 ISC_%s %s{ database file name }\n",
COLUMN, name, INLINE_COMMENT);
for (tpb = db->dbb_tpbs; tpb; tpb = tpb->tpb_dbb_next) {
gen_tpb_decls(tpb);
for (tpb_iterator = db->dbb_tpbs;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_dbb_next)
{
gen_tpb_decls(tpb_iterator);
dcl_ndx_var = TRUE;
}
@ -1925,7 +1929,8 @@ static void gen_dyn_execute( ACT action)
#ifdef hpux
TEXT s2[64], s3[64];
#endif
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -2021,7 +2026,8 @@ static void gen_dyn_immediate( ACT action)
#ifdef hpux
TEXT s2[64], s3[64];
#endif
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -2119,7 +2125,8 @@ static void gen_dyn_open( ACT action)
#ifdef hpux
TEXT s2[64], s3[64];
#endif
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -2180,7 +2187,8 @@ static void gen_dyn_prepare( ACT action)
#ifdef hpux
TEXT * s2[64];
#endif
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
database = statement->dyn_database;
@ -2622,13 +2630,13 @@ static void gen_form_display( ACT action)
GPRE_REQ request;
REF reference, master;
POR port;
DBB dbb;
dbb* database;
TEXT s[32], out[16];
int code;
display = (FINT) action->act_object;
request = display->fint_request;
dbb = request->req_database;
database = request->req_database;
port = request->req_ports;
// Initialize field options
@ -2646,7 +2654,7 @@ static void gen_form_display( ACT action)
printa(COLUMN,
"CALL PYXIS__DRIVE_FORM (isc_status, %s, %s, isc_window, %s, %sisc_%d%s, %s%s%s)",
dbb->dbb_name->sym_string, request->req_trans, request->req_handle,
database->dbb_name->sym_string, request->req_trans, request->req_handle,
REF_1, port->por_ident, REF_2, REF_1, out, REF_2);
//
//status_and_stop (action);
@ -2673,13 +2681,9 @@ static void gen_form_end( ACT action)
static void gen_form_for( ACT action)
{
GPRE_REQ request;
FORM form;
DBB dbb;
request = action->act_request;
form = request->req_form;
dbb = request->req_database;
GPRE_REQ request = action->act_request;
FORM a_form = request->req_form;
dbb* database = request->req_database;
// Get database attach and transaction started
@ -2691,10 +2695,10 @@ static void gen_form_for( ACT action)
printa(COLUMN, "IF (%s .EQ. 0) THEN", request->req_form_handle);
printa(COLUMN_INDENT,
"CALL PYXIS__LOAD_FORM (isc_status, %s, %s, %s, %s%d%s, %s'%s'%s)",
dbb->dbb_name->sym_string, request->req_trans,
database->dbb_name->sym_string, request->req_trans,
request->req_form_handle, I2_1,
strlen(form->form_name->sym_string), I2_2, REF_1,
form->form_name->sym_string, REF_2);
strlen(a_form->form_name->sym_string), I2_2, REF_1,
a_form->form_name->sym_string, REF_2);
status_and_stop(action);
printa(COLUMN, "END IF");
@ -2866,7 +2870,7 @@ static void gen_item_end( ACT action)
GPRE_REQ request;
REF reference, master;
POR port;
DBB dbb;
dbb* database;
TEXT s[32], index[16];
request = action->act_request;
@ -2884,7 +2888,7 @@ static void gen_item_end( ACT action)
return;
}
dbb = request->req_database;
database = request->req_database;
port = request->req_ports;
// Initialize field options
@ -2896,7 +2900,7 @@ static void gen_item_end( ACT action)
printa(COLUMN,
"CALL PYXIS__INSERT (isc_status, %s, %s, %s, %sisc_%d%s)",
dbb->dbb_name->sym_string,
database->dbb_name->sym_string,
request->req_trans,
request->req_handle, REF_1, port->por_ident, REF_2);
//
@ -2913,7 +2917,6 @@ static void gen_item_end( ACT action)
static void gen_item_for( ACT action)
{
GPRE_REQ request, parent;
FORM form;
TEXT index[30];
request = action->act_request;
@ -2923,8 +2926,7 @@ static void gen_item_for( ACT action)
return;
}
form = request->req_form;
parent = form->form_parent;
parent = request->req_form->form_parent;
// Get map compiled
@ -3016,17 +3018,15 @@ static void gen_menu( ACT action)
static void gen_menu_display( ACT action)
{
MENU menu;
MENU a_menu = NULL;
GPRE_REQ request, display_request;
request = action->act_request;
display_request = (GPRE_REQ) action->act_object;
menu = NULL;
for (action = request->req_actions; action; action = action->act_next)
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
@ -3038,13 +3038,13 @@ static void gen_menu_display( ACT action)
printa(CONTINUE,
"isc_%dl, %sisc_%d%s,",
menu->menu_title, REF_1, menu->menu_title, REF_2);
a_menu->menu_title, REF_1, a_menu->menu_title, REF_2);
printa(CONTINUE,
"isc_%d, isc_%dl, %sisc_%d%s, isc_%d)",
menu->menu_terminator,
menu->menu_entree_entree,
REF_1, menu->menu_entree_entree, REF_2, menu->menu_entree_value);
a_menu->menu_terminator,
a_menu->menu_entree_entree,
REF_1, a_menu->menu_entree_entree, REF_2, a_menu->menu_entree_value);
}
#endif
#ifdef PYXIS
@ -3091,33 +3091,33 @@ static void gen_menu_entree( ACT action)
static void gen_menu_entree_att( ACT action)
{
MENU menu;
MENU a_menu;
SSHORT ident;
TEXT *length;
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
length = "";
switch (action->act_type) {
case ACT_entree_text:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
break;
case ACT_entree_length:
ident = menu->menu_entree_entree;
ident = a_menu->menu_entree_entree;
length = "l";
break;
case ACT_entree_value:
ident = menu->menu_entree_value;
ident = a_menu->menu_entree_value;
break;
case ACT_title_text:
ident = menu->menu_title;
ident = a_menu->menu_title;
break;
case ACT_title_length:
ident = menu->menu_title;
ident = a_menu->menu_title;
length = "l";
break;
case ACT_terminator:
ident = menu->menu_terminator;
ident = a_menu->menu_terminator;
break;
default:
ident = -1;
@ -3160,10 +3160,10 @@ static void gen_menu_for( ACT action)
static void gen_menu_item_end( ACT action)
{
GPRE_REQ request;
ENTREE entree;
ENTREE menu_entree;
entree = (ENTREE) action->act_pair->act_object;
request = entree->entree_request;
menu_entree = (ENTREE) action->act_pair->act_object;
request = menu_entree->entree_request;
if (action->act_pair->act_type == ACT_item_for) {
printa(COLUMN, "GOTO %d", request->req_top_label);
@ -3174,8 +3174,8 @@ static void gen_menu_item_end( ACT action)
printa(COLUMN,
"CALL PYXIS__PUT_ENTREE (%s, isc_%dl, %sisc_%d%s, isc_%d)",
request->req_handle,
entree->entree_entree,
REF_1, entree->entree_entree, REF_2, entree->entree_value);
menu_entree->entree_entree,
REF_1, menu_entree->entree_entree, REF_2, menu_entree->entree_value);
}
#endif
#ifdef PYXIS
@ -3187,7 +3187,7 @@ static void gen_menu_item_end( ACT action)
static void gen_menu_item_for( ACT action)
{
ENTREE entree;
ENTREE menu_entree;
GPRE_REQ request;
if (action->act_type != ACT_item_for)
@ -3195,8 +3195,8 @@ static void gen_menu_item_for( ACT action)
// Build stuff for item loop
entree = (ENTREE) action->act_object;
request = entree->entree_request;
menu_entree = (ENTREE) action->act_object;
request = menu_entree->entree_request;
request->req_top_label = next_label();
request->req_btm_label = next_label();
@ -3205,12 +3205,12 @@ static void gen_menu_item_for( ACT action)
printa(COLUMN,
"CALL PYXIS__GET_ENTREE (%s, isc_%dl, %sisc_%d%s, isc_%d, %sisc_%d%s)",
request->req_handle,
entree->entree_entree,
REF_1, entree->entree_entree, REF_2,
entree->entree_value, REF_1, entree->entree_end, REF_2);
menu_entree->entree_entree,
REF_1, menu_entree->entree_entree, REF_2,
menu_entree->entree_value, REF_1, menu_entree->entree_end, REF_2);
printa(COLUMN, "IF (isc_%d .NE. 0) GOTO %d\n",
entree->entree_end, request->req_btm_label);
menu_entree->entree_end, request->req_btm_label);
}
#endif
#ifdef PYXIS
@ -3222,55 +3222,52 @@ static void gen_menu_item_for( ACT action)
static void gen_menu_request( GPRE_REQ request)
{
ACT action;
MENU menu;
ENTREE entree;
menu = NULL;
entree = NULL;
MENU a_menu = NULL;
ENTREE menu_entree = NULL;
for (action = request->req_actions; action; action = action->act_next) {
if (action->act_type == ACT_menu_for) {
menu = (MENU) action->act_object;
a_menu = (MENU) action->act_object;
break;
}
else if ((action->act_type == ACT_item_for)
|| (action->act_type == ACT_item_put)) {
entree = (ENTREE) action->act_object;
menu_entree = (ENTREE) action->act_object;
break;
}
}
if (menu) {
menu->menu_title = CMP_next_ident();
menu->menu_terminator = CMP_next_ident();
menu->menu_entree_value = CMP_next_ident();
menu->menu_entree_entree = CMP_next_ident();
if (a_menu) {
a_menu->menu_title = CMP_next_ident();
a_menu->menu_terminator = CMP_next_ident();
a_menu->menu_entree_value = CMP_next_ident();
a_menu->menu_entree_entree = CMP_next_ident();
ib_fprintf(out_file, "%sINTEGER*2 isc_%dl %s{ TITLE_LENGTH }\n",
COLUMN, menu->menu_title, INLINE_COMMENT);
COLUMN, a_menu->menu_title, INLINE_COMMENT);
ib_fprintf(out_file, "%sCHARACTER*81 isc_%d %s{ TITLE_TEXT }\n",
COLUMN, menu->menu_title, INLINE_COMMENT);
COLUMN, a_menu->menu_title, INLINE_COMMENT);
ib_fprintf(out_file, "%sINTEGER*2 isc_%d %s{ TERMINATOR }\n",
COLUMN, menu->menu_terminator, INLINE_COMMENT);
COLUMN, a_menu->menu_terminator, INLINE_COMMENT);
ib_fprintf(out_file, "%sINTEGER*2 isc_%dl %s{ ENTREE_LENGTH }\n",
COLUMN, menu->menu_entree_entree, INLINE_COMMENT);
COLUMN, a_menu->menu_entree_entree, INLINE_COMMENT);
ib_fprintf(out_file, "%sCHARACTER*81 isc_%d %s{ ENTREE_TEXT }\n",
COLUMN, menu->menu_entree_entree, INLINE_COMMENT);
COLUMN, a_menu->menu_entree_entree, INLINE_COMMENT);
ib_fprintf(out_file, "%sINTEGER*4 isc_%d %s{ ENTREE_VALUE }\n\n",
COLUMN, menu->menu_entree_value, INLINE_COMMENT);
COLUMN, a_menu->menu_entree_value, INLINE_COMMENT);
}
if (entree) {
entree->entree_entree = CMP_next_ident();
entree->entree_value = CMP_next_ident();
entree->entree_end = CMP_next_ident();
if (menu_entree) {
menu_entree->entree_entree = CMP_next_ident();
menu_entree->entree_value = CMP_next_ident();
menu_entree->entree_end = CMP_next_ident();
ib_fprintf(out_file, "%sINTEGER*2 isc_%dl %s{ ENTREE_LENGTH }\n",
COLUMN, entree->entree_entree, INLINE_COMMENT);
COLUMN, menu_entree->entree_entree, INLINE_COMMENT);
ib_fprintf(out_file, "%sCHARACTER*81 isc_%d %s{ ENTREE_TEXT }\n",
COLUMN, entree->entree_entree, INLINE_COMMENT);
COLUMN, menu_entree->entree_entree, INLINE_COMMENT);
ib_fprintf(out_file, "%sINTEGER*4 isc_%d %s{ ENTREE_VALUE }\n",
COLUMN, entree->entree_value, INLINE_COMMENT);
COLUMN, menu_entree->entree_value, INLINE_COMMENT);
ib_fprintf(out_file, "%sINTEGER*2 isc_%d %s{ }\n\n",
COLUMN, entree->entree_end, INLINE_COMMENT);
COLUMN, menu_entree->entree_end, INLINE_COMMENT);
}
}
#endif
@ -3325,15 +3322,15 @@ static void gen_procedure( ACT action)
TEXT *pattern;
GPRE_REQ request;
POR in_port, out_port;
DBB dbb;
dbb* database;
USHORT column = 6;
request = action->act_request;
in_port = request->req_vport;
out_port = request->req_primary;
dbb = request->req_database;
args.pat_database = dbb;
database = request->req_database;
args.pat_database = database;
args.pat_request = action->act_request;
args.pat_vector1 = status_vector(action);
args.pat_request = request;
@ -4208,7 +4205,7 @@ static void gen_t_start( ACT action)
{
DBB db;
GPRE_TRA trans;
TPB tpb;
tpb* tpb_iterator;
#ifdef hpux
int count;
#endif
@ -4224,8 +4221,11 @@ static void gen_t_start( ACT action)
// build a complete statement, including tpb's. Ready db's as req.
if (sw_auto)
for (tpb = trans->tra_tpb; tpb; tpb = tpb->tpb_tra_next) {
db = tpb->tpb_database;
for (tpb_iterator = trans->tra_tpb;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
db = tpb_iterator->tpb_database;
if ((filename = db->dbb_runtime) || !(db->dbb_flags & DBB_sqlca)) {
printa(COLUMN, "IF (%s .EQ. 0) THEN",
db->dbb_name->sym_string);
@ -4239,12 +4239,15 @@ static void gen_t_start( ACT action)
// If this is hpux we should be building a teb vector here
// with the tpb address and length specified
for (tpb = trans->tra_tpb, count = 0; tpb; tpb = tpb->tpb_tra_next) {
for (tpb_iterator = trans->tra_tpb, count = 0;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
count++;
db = tpb->tpb_database;
printa(COLUMN, "ISC_TEB%d_LEN = %d", count, tpb->tpb_length);
db = tpb_iterator->tpb_database;
printa(COLUMN, "ISC_TEB%d_LEN = %d", count, tpb_iterator->tpb_length);
printa(COLUMN, "ISC_TEB%d_TPB = ISC_BADDRESS (ISC_TPB_%d)",
count, tpb->tpb_ident);
count, tpb_iterator->tpb_ident);
printa(COLUMN, "ISC_TEB%d_DBB = ISC_BADDRESS (%s)",
count, db->dbb_name->sym_string);
}
@ -4261,10 +4264,15 @@ static void gen_t_start( ACT action)
(trans->tra_handle) ? trans->tra_handle : "GDS__TRANS",
I2CONST_1, trans->tra_db_count, I2CONST_2);
for (tpb = trans->tra_tpb; tpb; tpb = tpb->tpb_tra_next)
for (tpb_iterator = trans->tra_tpb;
tpb_iterator;
tpb_iterator = tpb_iterator->tpb_tra_next)
{
printa(CONTINUE, ", %s, %s%d%s, isc_tpb_%d",
tpb->tpb_database->dbb_name->sym_string,
I2CONST_1, tpb->tpb_length, I2CONST_2, tpb->tpb_ident);
tpb_iterator->tpb_database->dbb_name->sym_string,
I2CONST_1, tpb_iterator->tpb_length, I2CONST_2,
tpb_iterator->tpb_ident);
}
printa(CONTINUE, ")");
#endif
@ -4278,7 +4286,7 @@ static void gen_t_start( ACT action)
// Initialize a TPB in the output file
//
static void gen_tpb_data( TPB tpb)
static void gen_tpb_data(tpb* tpb_buffer)
{
TEXT *p;
UCHAR *text, *c;
@ -4295,12 +4303,12 @@ static void gen_tpb_data( TPB tpb)
// fields.
//
length = (tpb->tpb_length + (sizeof(SLONG) - 1)) / sizeof(SLONG);
length = (tpb_buffer->tpb_length + (sizeof(SLONG) - 1)) / sizeof(SLONG);
printa(COLUMN, "DATA ISC_TPB_%d /", tpb->tpb_ident, COMMA, length);
printa(COLUMN, "DATA ISC_TPB_%d /", tpb_buffer->tpb_ident, COMMA, length);
text = tpb->tpb_string;
length = tpb->tpb_length;
text = tpb_buffer->tpb_string;
length = tpb_buffer->tpb_length;
strcpy(output_buffer, CONTINUE);
for (p = output_buffer; *p; p++);
@ -4320,7 +4328,7 @@ static void gen_tpb_data( TPB tpb)
FTN_print_buffer(output_buffer);
sprintf(output_buffer, "%sEnd of data for ISC_TPB_%d\n",
COMMENT, tpb->tpb_ident);
COMMENT, tpb_buffer->tpb_ident);
FTN_print_buffer(output_buffer);
}
@ -4331,14 +4339,14 @@ static void gen_tpb_data( TPB tpb)
// TPB in the output file
//
static void gen_tpb_decls( TPB tpb)
static void gen_tpb_decls(tpb* tpb_buffer)
{
int length;
length = (tpb->tpb_length + (sizeof(SLONG) - 1)) / sizeof(SLONG);
length = (tpb_buffer->tpb_length + (sizeof(SLONG) - 1)) / sizeof(SLONG);
ib_fprintf(out_file,
"%sINTEGER*4 ISC_TPB_%d(%d) %s{ transaction parameters }\n",
COLUMN, tpb->tpb_ident, length, INLINE_COMMENT);
COLUMN, tpb_buffer->tpb_ident, length, INLINE_COMMENT);
}
@ -5168,54 +5176,6 @@ static void gen_function( ACT function)
gen_name(s, port->por_references, TRUE));
}
#ifdef NOT_USED_OR_REPLACED
//____________________________________________________________
//
// Generate a TPB in the output file
//
static void gen_tpb( TPB tpb)
{
TEXT *text, buffer[80], c, *p;
SSHORT length, tpb_length;
printa("%sstatic char\n", COLUMN);
p = buffer;
for (length = 0; length < 4; length++)
*p++ = ' ';
sprintf(p, "isc_tpb_%d [%d] = {", tpb->tpb_ident, tpb->tpb_length);
while (*p)
p++;
tpb_length = tpb->tpb_length;
text = (TEXT *) tpb->tpb_string;
while (--tpb_length >= 0) {
c = *text++;
if ((c >= 'A' && c <= 'Z') || c == '$' || c == '_')
sprintf(p, "'%c'", c);
else
sprintf(p, "%d", c);
while (*p)
p++;
if (tpb_length)
*p++ = ',';
if (p - buffer > 60) {
*p = 0;
ib_fprintf(out_file, " %s\n", buffer);
p = buffer;
for (length = 0; length < 8; length++)
*p++ = ' ';
*p = 0;
}
}
ib_fprintf(out_file, "%s};\n", buffer);
}
#endif
//____________________________________________________________
//
// Substitute for a variable reference.

View File

@ -20,7 +20,7 @@
//
// All Rights Reserved.
// Contributor(s): ______________________________________.
// $Id: gpre.cpp,v 1.28 2003-08-20 19:08:00 brodsom Exp $
// $Id: gpre.cpp,v 1.29 2003-09-05 10:14:07 aafemt Exp $
// Revision 1.2 2000/11/16 15:54:29 fsg
// Added new switch -verbose to gpre that will dump
// parsed lines to stderr
@ -42,7 +42,7 @@
//
//____________________________________________________________
//
// $Id: gpre.cpp,v 1.28 2003-08-20 19:08:00 brodsom Exp $
// $Id: gpre.cpp,v 1.29 2003-09-05 10:14:07 aafemt Exp $
//
#define GPRE_MAIN
@ -131,7 +131,7 @@ static TEXT input_buffer[512], *input_char;
static DBB sw_databases;
static USHORT sw_first;
//static jmp_buf fatal_env;
struct tok prior_token;
tok prior_token;
static TEXT *comment_start, *comment_stop;
typedef void (*pfn_gen_routine) (ACT, int);
@ -161,10 +161,10 @@ typedef struct ext_table_t
gpre_cmd_switch ext_in_sw;
TEXT* in;
TEXT* out;
} *EXT_TAB;
};
static struct ext_table_t dml_ext_table[] =
static ext_table_t dml_ext_table[] =
{
{ lang_c, IN_SW_GPRE_C, ".e", ".c" },
@ -258,8 +258,8 @@ int main(int argc, char* argv[])
TEXT spare_file_name[256];
TEXT spare_out_file_name[256];
BOOLEAN renamed, explicit_;
EXT_TAB ext_tab;
struct sw_tab_t sw_table[IN_SW_GPRE_COUNT];
ext_table_t* ext_tab;
sw_tab_t sw_table[IN_SW_GPRE_COUNT];
#ifdef VMS
IB_FILE *temp;
TEXT temp_name[256];
@ -454,7 +454,7 @@ int main(int argc, char* argv[])
// adding in the language switch in case we inferred it rather than parsing it.
//
EXT_TAB src_ext_tab = dml_ext_table;
ext_table_t* src_ext_tab = dml_ext_table;
while (src_ext_tab->ext_language != sw_language) {
++src_ext_tab;
@ -814,7 +814,7 @@ int main(int argc, char* argv[])
//
if (!sw_standard_out) {
EXT_TAB out_src_ext_tab = src_ext_tab;
ext_table_t* out_src_ext_tab = src_ext_tab;
if (use_lang_internal_gxx_output) {
out_src_ext_tab = dml_ext_table;
while (out_src_ext_tab->ext_language != lang_internal_cxx) {
@ -1245,36 +1245,36 @@ TXT CPR_start_text()
TOK CPR_token()
{
TOK tok;
TOK token;
SYM symbol;
tok = get_token();
if (!tok)
token = get_token();
if (!token)
return NULL;
if (tok->tok_type == tok_introducer) {
symbol = MSC_find_symbol(HSH_lookup(tok->tok_string + 1), SYM_charset);
if (token->tok_type == tok_introducer) {
symbol = MSC_find_symbol(HSH_lookup(token->tok_string + 1), SYM_charset);
if (!symbol) {
TEXT err_buffer[100];
sprintf(err_buffer, "Character set not recognized: '%.50s'",
tok->tok_string);
token->tok_string);
CPR_error(err_buffer);
}
tok = get_token();
token = get_token();
switch (sw_sql_dialect) {
case 1:
if (!(QUOTED(tok->tok_type)))
if (!(QUOTED(token->tok_type)))
CPR_error("Can only tag quoted strings with character set");
else
tok->tok_charset = symbol;
token->tok_charset = symbol;
break;
default:
if (!(SINGLE_QUOTED(tok->tok_type)))
if (!(SINGLE_QUOTED(token->tok_type)))
CPR_error("Can only tag quoted strings with character set");
else
tok->tok_charset = symbol;
token->tok_charset = symbol;
break;
}
@ -1284,20 +1284,20 @@ TOK CPR_token()
else if (default_lc_ctype && text_subtypes) {
switch (sw_sql_dialect) {
case 1:
if (QUOTED(tok->tok_type)){
tok->tok_charset = MSC_find_symbol(HSH_lookup(default_lc_ctype),
if (QUOTED(token->tok_type)){
token->tok_charset = MSC_find_symbol(HSH_lookup(default_lc_ctype),
SYM_charset);
}
break;
default:
if (SINGLE_QUOTED(tok->tok_type)){
tok->tok_charset = MSC_find_symbol(HSH_lookup(default_lc_ctype),
if (SINGLE_QUOTED(token->tok_type)){
token->tok_charset = MSC_find_symbol(HSH_lookup(default_lc_ctype),
SYM_charset);
}
break;
}
}
return tok;
return token;
}
@ -1554,7 +1554,7 @@ static void finish_based( ACT action)
MET_get_relation(db, (TEXT *) based_on->bas_rel_name, "");
if (!relation) {
sprintf(s, "relation %s is not defined in database %s",
based_on->bas_rel_name, based_on->bas_db_name);
based_on->bas_rel_name->str_string, based_on->bas_db_name->str_string);
CPR_error(s);
continue;
}
@ -1573,7 +1573,7 @@ static void finish_based( ACT action)
}
else {
sprintf(s, "database %s is not defined",
based_on->bas_db_name);
based_on->bas_db_name->str_string);
CPR_error(s);
continue;
}
@ -1590,8 +1590,8 @@ static void finish_based( ACT action)
than one database. */
sprintf(s, "field %s in relation %s ambiguous",
based_on->bas_fld_name,
based_on->bas_rel_name);
based_on->bas_fld_name->str_string,
based_on->bas_rel_name->str_string);
CPR_error(s);
break;
}
@ -1603,7 +1603,7 @@ static void finish_based( ACT action)
continue;
if (!relation && !field) {
sprintf(s, "relation %s is not defined",
based_on->bas_rel_name);
based_on->bas_rel_name->str_string);
CPR_error(s);
continue;
}
@ -1611,7 +1611,8 @@ static void finish_based( ACT action)
if (!field) {
sprintf(s, "field %s is not defined in relation %s",
based_on->bas_fld_name, based_on->bas_rel_name);
based_on->bas_fld_name->str_string,
based_on->bas_rel_name->str_string);
CPR_error(s);
continue;
}
@ -1675,8 +1676,8 @@ static BOOLEAN get_switches(int argc,
TEXT** file_array)
{
TEXT *p, *q, *string;
IN_SW_TAB in_sw_tab;
SW_TAB sw_tab;
IN_SW_TAB in_sw_table_iterator;
SW_TAB sw_table_iterator;
USHORT in_sw;
//
@ -1685,7 +1686,7 @@ static BOOLEAN get_switches(int argc,
// we try to open the file.
//
sw_tab = sw_table;
sw_table_iterator = sw_table;
for (--argc; argc; argc--)
{
@ -1714,10 +1715,12 @@ static BOOLEAN get_switches(int argc,
{
/* iterate through the switch table, looking for matches */
sw_tab++;
sw_tab->sw_in_sw = IN_SW_GPRE_0;
for (in_sw_tab = in_sw_table; q = in_sw_tab->in_sw_name;
in_sw_tab++) {
sw_table_iterator++;
sw_table_iterator->sw_in_sw = IN_SW_GPRE_0;
for (in_sw_table_iterator = in_sw_table;
q = in_sw_table_iterator->in_sw_name;
in_sw_table_iterator++)
{
p = string + 1;
/* handle orphaned hyphen case */
@ -1729,7 +1732,7 @@ static BOOLEAN get_switches(int argc,
while (*p) {
if (!*++p) {
sw_tab->sw_in_sw = (gpre_cmd_switch)in_sw_tab->in_sw;
sw_table_iterator->sw_in_sw = (gpre_cmd_switch)in_sw_table_iterator->in_sw;
}
if (UPPER7(*p) != *q++) {
break;
@ -1740,7 +1743,7 @@ static BOOLEAN get_switches(int argc,
if (!*p)
break;
}
in_sw = sw_tab->sw_in_sw;
in_sw = sw_table_iterator->sw_in_sw;
}
}
@ -1757,17 +1760,17 @@ static BOOLEAN get_switches(int argc,
switch (in_sw) {
case IN_SW_GPRE_C:
sw_language = lang_c;
sw_tab--;
sw_table_iterator--;
break;
case IN_SW_GPRE_CXX:
sw_language = lang_cxx;
sw_tab--;
sw_table_iterator--;
break;
case IN_SW_GPRE_CPLUSPLUS:
sw_language = lang_cplusplus;
sw_tab--;
sw_table_iterator--;
break;
case IN_SW_GPRE_GXX:
@ -1783,29 +1786,29 @@ static BOOLEAN get_switches(int argc,
case IN_SW_GPRE_G:
sw_language = lang_internal;
sw_tab--;
sw_table_iterator--;
break;
#ifdef GPRE_FORTRAN
case IN_SW_GPRE_F:
sw_language = lang_fortran;
sw_tab--;
sw_table_iterator--;
break;
#endif
#ifdef GPRE_PASCAL
case IN_SW_GPRE_P:
sw_language = lang_pascal;
sw_tab--;
sw_table_iterator--;
break;
#endif
case IN_SW_GPRE_X:
sw_external = TRUE;
sw_tab--;
sw_table_iterator--;
break;
#ifdef GPRE_COBOL
case IN_SW_GPRE_COB:
sw_language = lang_cobol;
sw_tab--;
sw_table_iterator--;
break;
#endif
case IN_SW_GPRE_LANG_INTERNAL :
@ -1951,8 +1954,8 @@ static BOOLEAN get_switches(int argc,
}
}
sw_tab++;
sw_tab->sw_in_sw = IN_SW_GPRE_0;
sw_table_iterator++;
sw_table_iterator->sw_in_sw = IN_SW_GPRE_0;
return TRUE;
}
@ -2661,20 +2664,26 @@ static void pass2( SLONG start_position)
static void print_switches()
{
IN_SW_TAB in_sw_tab;
IN_SW_TAB in_sw_table_iterator;
ib_fprintf(ib_stderr, "\tlegal switches are:\n");
for (in_sw_tab = gpre_in_sw_table; in_sw_tab->in_sw; in_sw_tab++) {
if (in_sw_tab->in_sw_text) {
ib_fprintf(ib_stderr, "%s%s\n", in_sw_tab->in_sw_name,
in_sw_tab->in_sw_text);
for (in_sw_table_iterator = gpre_in_sw_table;
in_sw_table_iterator->in_sw;
in_sw_table_iterator++)
{
if (in_sw_table_iterator->in_sw_text) {
ib_fprintf(ib_stderr, "%s%s\n", in_sw_table_iterator->in_sw_name,
in_sw_table_iterator->in_sw_text);
}
}
ib_fprintf(ib_stderr, "\n\tand the internal 'illegal' switches are:\n");
for (in_sw_tab = gpre_in_sw_table; in_sw_tab->in_sw; in_sw_tab++) {
if (!in_sw_tab->in_sw_text) {
ib_fprintf(ib_stderr, "%s\n", in_sw_tab->in_sw_name);
for (in_sw_table_iterator = gpre_in_sw_table;
in_sw_table_iterator->in_sw;
in_sw_table_iterator++)
{
if (!in_sw_table_iterator->in_sw_text) {
ib_fprintf(ib_stderr, "%s\n", in_sw_table_iterator->in_sw_name);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -26,7 +26,7 @@
*
*____________________________________________________________
*
* $Id: gpre_meta.epp,v 1.22 2003-08-30 02:12:44 brodsom Exp $
* $Id: gpre_meta.epp,v 1.23 2003-09-05 10:14:07 aafemt Exp $
*/
#include "firebird.h"
@ -47,7 +47,7 @@
#define MAX_USER_LENGTH 33
#define MAX_PASSWORD_LENGTH 33
DATABASE DB = FILENAME "yachts.lnk" RUNTIME dbb->dbb_filename;
DATABASE DB = FILENAME "yachts.lnk" RUNTIME database->dbb_filename;
extern enum lang_t sw_language;
extern USHORT sw_cstring;
@ -63,8 +63,8 @@ static SCHAR db_version_info[] = { gds__info_base_level };
#endif
static SLONG array_size(GPRE_FLD);
static void get_array(DBB, TEXT *, GPRE_FLD);
static int get_intl_char_subtype(SSHORT *, UCHAR *, USHORT, DBB);
static void get_array(dbb*, TEXT *, GPRE_FLD);
static int get_intl_char_subtype(SSHORT *, UCHAR *, USHORT, dbb*);
static int resolve_charset_and_collation(SSHORT *, UCHAR *, UCHAR *);
static int symbol_length(TEXT *);
#ifdef NOT_USED_OR_REPLACED
@ -119,7 +119,7 @@ GPRE_FLD MET_context_field( GPRE_CTX context, char *string)
* database can't be opened, return FALSE.
*/
BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
BOOLEAN MET_database(dbb* database, BOOLEAN print_version)
{
SCHAR dpb[MAX_PASSWORD_LENGTH + MAX_USER_LENGTH + 5], *d, *p;
static const UCHAR sql_version_info[] = { isc_info_base_level,
@ -143,14 +143,14 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
#ifndef REQUESTER
if (sw_language == lang_internal) {
JRDMET_init(dbb);
JRDMET_init(database);
return TRUE;
}
#endif
DB = NULL;
if (!dbb->dbb_filename) {
if (!database->dbb_filename) {
CPR_error("No database specified");
return FALSE;
}
@ -160,15 +160,15 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
*/
d = dpb;
if (dbb->dbb_c_user || dbb->dbb_c_password) {
if (database->dbb_c_user || database->dbb_c_password) {
*d++ = gds_dpb_version1;
if (p = dbb->dbb_c_user) {
if (p = database->dbb_c_user) {
*d++ = gds_dpb_user_name;
*d++ = strlen(p);
while (*p)
*d++ = *p++;
}
if (p = dbb->dbb_c_password) {
if (p = database->dbb_c_password) {
*d++ = gds_dpb_password;
*d++ = strlen(p);
while (*p)
@ -177,7 +177,7 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
}
if (gds__attach_database
(gds_status, 0, dbb->dbb_filename, &DB, d - &dpb[0], dpb)) {
(gds_status, 0, database->dbb_filename, &DB, d - &dpb[0], dpb)) {
/* We failed to attach, try in read only mode just in case
if (d == dpb)
*d++ = gds_dpb_version1;
@ -185,17 +185,17 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
*d++ = 1;
*d++ = TRUE;
if (gds__attach_database
(gds_status, 0, dbb->dbb_filename, &DB, d - &dpb[0], dpb)) {
(gds_status, 0, database->dbb_filename, &DB, d - &dpb[0], dpb)) {
*/
gds__print_status(gds_status);
return FALSE;
//}
}
dbb->dbb_handle = DB;
database->dbb_handle = DB;
if (sw_version && print_version) {
ib_printf(" Version(s) for database \"%s\"\n", dbb->dbb_filename);
ib_printf(" Version(s) for database \"%s\"\n", database->dbb_filename);
gds__version(&DB, NULL, NULL);
}
@ -315,7 +315,7 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
*/
case gds__info_base_level:
dbb->dbb_base_level = (USHORT) data[1];
database->dbb_base_level = (USHORT) data[1];
break;
default:
@ -339,7 +339,7 @@ BOOLEAN MET_database(DBB dbb, BOOLEAN print_version)
USHORT MET_domain_lookup(GPRE_REQ request, GPRE_FLD field, char *string)
{
SYM symbol;
DBB dbb;
dbb* database;
SCHAR name[NAME_SIZE];
GPRE_FLD d_field;
SSHORT found = FALSE;
@ -368,15 +368,15 @@ USHORT MET_domain_lookup(GPRE_REQ request, GPRE_FLD field, char *string)
if (!request)
return FALSE;
dbb = request->req_database;
if (dbb->dbb_flags & DBB_sqlca)
database = request->req_database;
if (database->dbb_flags & DBB_sqlca)
return FALSE;
DB = dbb->dbb_handle;
gds_trans = dbb->dbb_transaction;
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
if (!(dbb->dbb_flags & DBB_v3)) {
FOR(REQUEST_HANDLE dbb->dbb_domain_request)
if (!(database->dbb_flags & DBB_v3)) {
FOR(REQUEST_HANDLE database->dbb_domain_request)
F IN RDB$FIELDS WITH F.RDB$FIELD_NAME EQ name found = TRUE;
field->fld_length = F.RDB$FIELD_LENGTH;
field->fld_scale = F.RDB$FIELD_SCALE;
@ -413,7 +413,7 @@ USHORT MET_domain_lookup(GPRE_REQ request, GPRE_FLD field, char *string)
END_FOR;
}
else {
FOR(REQUEST_HANDLE dbb->dbb_domain_request)
FOR(REQUEST_HANDLE database->dbb_domain_request)
F IN RDB$FIELDS WITH F.RDB$FIELD_NAME EQ name found = TRUE;
field->fld_length = F.RDB$FIELD_LENGTH;
field->fld_scale = F.RDB$FIELD_SCALE;
@ -450,7 +450,7 @@ USHORT MET_domain_lookup(GPRE_REQ request, GPRE_FLD field, char *string)
* Gets the default value for a domain of an existing table
*/
BOOLEAN MET_get_domain_default(DBB dbb,
BOOLEAN MET_get_domain_default(dbb* database,
TEXT * domain_name,
TEXT * buffer, USHORT buff_length)
{
@ -468,20 +468,20 @@ BOOLEAN MET_get_domain_default(DBB dbb,
strcpy(name, domain_name);
has_default = FALSE;
if (dbb == NULL)
if (database == NULL)
return FALSE;
if ((dbb->dbb_handle == NULL) && !MET_database(dbb, FALSE))
if ((database->dbb_handle == NULL) && !MET_database(database, FALSE))
CPR_exit(FINI_ERROR);
assert(dbb->dbb_transaction == NULL);
assert(database->dbb_transaction == NULL);
gds_trans = NULL;
DB = dbb->dbb_handle;
DB = database->dbb_handle;
START_TRANSACTION;
FOR(REQUEST_HANDLE dbb->dbb_domain_request)
FOR(REQUEST_HANDLE database->dbb_domain_request)
GPRE_FLD IN RDB$FIELDS WITH
GPRE_FLD.RDB$FIELD_NAME EQ name if (!GPRE_FLD.RDB$DEFAULT_VALUE.NULL) {
blob_id = &GPRE_FLD.RDB$DEFAULT_VALUE;
@ -552,7 +552,7 @@ BOOLEAN MET_get_column_default(GPRE_REL relation,
TEXT * column_name,
TEXT * buffer, USHORT buff_length)
{
DBB dbb;
dbb* database;
FRBRD *DB, *gds_trans;
SCHAR name[NAME_SIZE];
SSHORT length;
@ -566,20 +566,20 @@ BOOLEAN MET_get_column_default(GPRE_REL relation,
strcpy(name, column_name);
has_default = FALSE;
if ((dbb = relation->rel_database) == NULL)
if ((database = relation->rel_database) == NULL)
return FALSE;
if ((dbb->dbb_handle == NULL) && !MET_database(dbb, FALSE))
if ((database->dbb_handle == NULL) && !MET_database(database, FALSE))
CPR_exit(FINI_ERROR);
assert(dbb->dbb_transaction == NULL);
assert(database->dbb_transaction == NULL);
gds_trans = NULL;
DB = dbb->dbb_handle;
DB = database->dbb_handle;
START_TRANSACTION;
FOR(REQUEST_HANDLE dbb->dbb_field_request)
FOR(REQUEST_HANDLE database->dbb_field_request)
RFR IN RDB$RELATION_FIELDS CROSS F IN RDB$FIELDS WITH
RFR.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND
RFR.RDB$FIELD_NAME EQ name AND
@ -652,7 +652,7 @@ BOOLEAN MET_get_column_default(GPRE_REL relation,
* of the fields.
*/
LLS MET_get_primary_key(DBB dbb, TEXT * relation_name)
LLS MET_get_primary_key(dbb* database, TEXT * relation_name)
{
LLS fields = NULL, *ptr_fields;
FRBRD *DB, *gds_trans;
@ -662,22 +662,22 @@ LLS MET_get_primary_key(DBB dbb, TEXT * relation_name)
strcpy(name, relation_name);
if (dbb == NULL)
if (database == NULL)
return NULL;
if ((dbb->dbb_handle == NULL) && !MET_database(dbb, FALSE))
if ((database->dbb_handle == NULL) && !MET_database(database, FALSE))
CPR_exit(FINI_ERROR);
assert(dbb->dbb_transaction == NULL);
assert(database->dbb_transaction == NULL);
gds_trans = NULL;
DB = dbb->dbb_handle;
DB = database->dbb_handle;
START_TRANSACTION;
ptr_fields = &fields;
FOR(REQUEST_HANDLE dbb->dbb_primary_key_request)
FOR(REQUEST_HANDLE database->dbb_primary_key_request)
X IN RDB$INDICES CROSS
Y IN RDB$INDEX_SEGMENTS
OVER RDB$INDEX_NAME CROSS
@ -713,7 +713,7 @@ GPRE_FLD MET_field(GPRE_REL relation, char *string)
{
SYM symbol;
GPRE_FLD field;
DBB dbb;
dbb* database;
SCHAR name[NAME_SIZE];
SSHORT length;
@ -734,17 +734,17 @@ GPRE_FLD MET_field(GPRE_REL relation, char *string)
if (sw_language == lang_internal)
return NULL;
dbb = relation->rel_database;
database = relation->rel_database;
if (dbb->dbb_flags & DBB_sqlca)
if (database->dbb_flags & DBB_sqlca)
return NULL;
DB = dbb->dbb_handle;
gds_trans = dbb->dbb_transaction;
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
field = NULL;
if (!(dbb->dbb_flags & DBB_v3)) {
FOR(REQUEST_HANDLE dbb->dbb_field_request)
if (!(database->dbb_flags & DBB_v3)) {
FOR(REQUEST_HANDLE database->dbb_field_request)
RFR IN RDB$RELATION_FIELDS CROSS F IN RDB$FIELDS WITH
RFR.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND
RFR.RDB$FIELD_NAME EQ name AND
@ -774,8 +774,8 @@ GPRE_FLD MET_field(GPRE_REL relation, char *string)
break;
}
if (F.RDB$DIMENSIONS && !(dbb->dbb_flags & DBB_no_arrays))
get_array(dbb, F.RDB$FIELD_NAME, field);
if (F.RDB$DIMENSIONS && !(database->dbb_flags & DBB_no_arrays))
get_array(database, F.RDB$FIELD_NAME, field);
if ((field->fld_dtype <= dtype_any_text)
|| (field->fld_dtype == dtype_blob)) {
@ -801,7 +801,7 @@ GPRE_FLD MET_field(GPRE_REL relation, char *string)
END_FOR;
}
else {
FOR(REQUEST_HANDLE dbb->dbb_field_request)
FOR(REQUEST_HANDLE database->dbb_field_request)
RFR IN RDB$RELATION_FIELDS CROSS F IN RDB$FIELDS WITH
RFR.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME AND
RFR.RDB$FIELD_NAME EQ name AND
@ -830,8 +830,8 @@ GPRE_FLD MET_field(GPRE_REL relation, char *string)
break;
}
if (!(dbb->dbb_flags & DBB_no_arrays))
get_array(dbb, F.RDB$FIELD_NAME, field);
if (!(database->dbb_flags & DBB_no_arrays))
get_array(database, F.RDB$FIELD_NAME, field);
field->fld_ttype =
INTL_CS_COLL_TO_TTYPE(field->fld_charset_id,
@ -856,7 +856,7 @@ GPRE_FLD MET_field(GPRE_REL relation, char *string)
GPRE_NOD MET_fields(GPRE_CTX context)
{
DBB dbb;
dbb* database;
GPRE_FLD field;
LLS stack;
GPRE_NOD node, field_node;
@ -900,13 +900,13 @@ GPRE_NOD MET_fields(GPRE_CTX context)
if (sw_language == lang_internal)
return NULL;
dbb = relation->rel_database;
DB = dbb->dbb_handle;
gds_trans = dbb->dbb_transaction;
database = relation->rel_database;
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
count = 0;
stack = NULL;
FOR(REQUEST_HANDLE dbb->dbb_flds_request)
FOR(REQUEST_HANDLE database->dbb_flds_request)
RFR IN RDB$RELATION_FIELDS CROSS GPRE_FLD IN RDB$FIELDS WITH
RFR.RDB$FIELD_SOURCE EQ GPRE_FLD.RDB$FIELD_NAME AND
RFR.RDB$RELATION_NAME EQ relation->rel_symbol->sym_string
@ -937,34 +937,38 @@ GPRE_NOD MET_fields(GPRE_CTX context)
* Shutdown all attached databases.
*/
void MET_fini( DBB end)
void MET_fini(dbb* end)
{
DBB dbb;
dbb* database;
for (dbb = isc_databases; dbb && dbb != end; dbb = dbb->dbb_next)
if (DB = dbb->dbb_handle) {
if (gds_trans = dbb->dbb_transaction)
for (database = isc_databases;
database && database != end;
database = database->dbb_next)
{
if (DB = database->dbb_handle) {
if (gds_trans = database->dbb_transaction)
COMMIT;
FINISH;
dbb->dbb_handle = NULL;
dbb->dbb_transaction = NULL;
database->dbb_handle = NULL;
database->dbb_transaction = NULL;
dbb->dbb_field_request = NULL;
dbb->dbb_flds_request = NULL;
dbb->dbb_relation_request = NULL;
dbb->dbb_procedure_request = NULL;
dbb->dbb_udf_request = NULL;
dbb->dbb_trigger_request = NULL;
dbb->dbb_proc_prms_request = NULL;
dbb->dbb_proc_prm_fld_request = NULL;
dbb->dbb_index_request = NULL;
dbb->dbb_type_request = NULL;
dbb->dbb_array_request = NULL;
dbb->dbb_dimension_request = NULL;
dbb->dbb_domain_request = NULL;
dbb->dbb_generator_request = NULL;
dbb->dbb_view_request = NULL;
dbb->dbb_primary_key_request = NULL;
database->dbb_field_request = NULL;
database->dbb_flds_request = NULL;
database->dbb_relation_request = NULL;
database->dbb_procedure_request = NULL;
database->dbb_udf_request = NULL;
database->dbb_trigger_request = NULL;
database->dbb_proc_prms_request = NULL;
database->dbb_proc_prm_fld_request = NULL;
database->dbb_index_request = NULL;
database->dbb_type_request = NULL;
database->dbb_array_request = NULL;
database->dbb_dimension_request = NULL;
database->dbb_domain_request = NULL;
database->dbb_generator_request = NULL;
database->dbb_view_request = NULL;
database->dbb_primary_key_request = NULL;
}
}
}
@ -975,7 +979,7 @@ void MET_fini( DBB end)
* If found, return string. If not, return NULL.
*/
SCHAR *MET_generator(TEXT * string, DBB dbb)
SCHAR *MET_generator(TEXT * string, dbb* database)
{
SYM symbol;
SCHAR name[NAME_SIZE];
@ -984,7 +988,7 @@ SCHAR *MET_generator(TEXT * string, DBB dbb)
for (symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym)
if ((symbol->sym_type == SYM_generator) &&
(dbb == (DBB) (symbol->sym_object))) return symbol->sym_string;
(database == (dbb*) (symbol->sym_object))) return symbol->sym_string;
return NULL;
}
@ -1086,7 +1090,7 @@ USHORT MET_get_dtype(USHORT blr_dtype, USHORT sub_type, USHORT * length)
* This function has been cloned into MET_get_udf
*/
GPRE_PRC MET_get_procedure(DBB dbb, TEXT * string, TEXT * owner_name)
GPRE_PRC MET_get_procedure(dbb* database, TEXT * string, TEXT * owner_name)
{
SYM symbol;
GPRE_FLD *fld_list, field;
@ -1101,7 +1105,7 @@ GPRE_PRC MET_get_procedure(DBB dbb, TEXT * string, TEXT * owner_name)
for (symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_procedure &&
(procedure = (GPRE_PRC) symbol->sym_object) &&
procedure->prc_database == dbb &&
procedure->prc_database == database &&
(!owner[0] ||
(procedure->prc_owner
&& !strcmp(owner, procedure->prc_owner->sym_string)))) break;
@ -1112,7 +1116,7 @@ GPRE_PRC MET_get_procedure(DBB dbb, TEXT * string, TEXT * owner_name)
if (procedure->prc_flags & PRC_scanned)
return procedure;
FOR(REQUEST_HANDLE dbb->dbb_procedure_request)
FOR(REQUEST_HANDLE database->dbb_procedure_request)
X IN RDB$PROCEDURES WITH X.RDB$PROCEDURE_ID = procedure->prc_id;
for (type = 0; type < 2; type++) {
@ -1122,13 +1126,13 @@ GPRE_PRC MET_get_procedure(DBB dbb, TEXT * string, TEXT * owner_name)
else
fld_list = &procedure->prc_inputs;
FOR(REQUEST_HANDLE dbb->dbb_proc_prms_request)
FOR(REQUEST_HANDLE database->dbb_proc_prms_request)
Y IN RDB$PROCEDURE_PARAMETERS WITH
Y.RDB$PROCEDURE_NAME EQ name AND
Y.RDB$PARAMETER_TYPE EQ type
SORTED BY DESCENDING Y.RDB$PARAMETER_NUMBER count++;
FOR(REQUEST_HANDLE dbb->dbb_proc_prm_fld_request)
FOR(REQUEST_HANDLE database->dbb_proc_prm_fld_request)
F IN RDB$FIELDS WITH
Y.RDB$FIELD_SOURCE EQ F.RDB$FIELD_NAME
field = (GPRE_FLD) ALLOC(FLD_LEN);
@ -1200,7 +1204,7 @@ GPRE_PRC MET_get_procedure(DBB dbb, TEXT * string, TEXT * owner_name)
* Return a relation block (if name is found) or NULL.
*/
GPRE_REL MET_get_relation(DBB dbb, TEXT * string, TEXT * owner_name)
GPRE_REL MET_get_relation(dbb* database, TEXT * string, TEXT * owner_name)
{
SYM symbol;
GPRE_REL relation;
@ -1212,7 +1216,7 @@ GPRE_REL MET_get_relation(DBB dbb, TEXT * string, TEXT * owner_name)
for (symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_relation &&
(relation = (GPRE_REL) symbol->sym_object) &&
relation->rel_database == dbb &&
relation->rel_database == database &&
(!owner[0] ||
(relation->rel_owner
&& !strcmp(owner,
@ -1246,28 +1250,28 @@ INTLSYM MET_get_text_subtype(SSHORT ttype)
* This function was cloned from MET_get_procedure
*/
UDF MET_get_udf(DBB dbb, TEXT * string)
UDF MET_get_udf(dbb* database, TEXT * string)
{
SYM symbol;
GPRE_FLD field;
UDF udf;
udf* the_udf;
SCHAR name[NAME_SIZE];
strcpy(name, string);
udf = NULL;
the_udf = NULL;
for (symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_udf &&
(udf = (UDF) symbol->sym_object) && udf->udf_database == dbb)
(the_udf = (udf*) symbol->sym_object) && the_udf->udf_database == database)
break;
if (!udf)
if (!the_udf)
return NULL;
if (udf->udf_flags & UDF_scanned)
return udf;
if (the_udf->udf_flags & UDF_scanned)
return the_udf;
if (dbb->dbb_flags & DBB_v3) {
if (database->dbb_flags & DBB_v3) {
/* Version of V4 request without new V4 metadata */
FOR(REQUEST_HANDLE dbb->dbb_udf_request)
FOR(REQUEST_HANDLE database->dbb_udf_request)
UDF_DEF IN RDB$FUNCTIONS CROSS
UDF_ARG IN RDB$FUNCTION_ARGUMENTS
WITH UDF_DEF.RDB$FUNCTION_NAME EQ name AND
@ -1276,9 +1280,9 @@ UDF MET_get_udf(DBB dbb, TEXT * string)
SORTED BY DESCENDING UDF_ARG.RDB$ARGUMENT_POSITION;
field = (GPRE_FLD) ALLOC(FLD_LEN);
field->fld_next = udf->udf_inputs;
udf->udf_inputs = field;
udf->udf_args++;
field->fld_next = the_udf->udf_inputs;
the_udf->udf_inputs = field;
the_udf->udf_args++;
field->fld_position = UDF_ARG.RDB$ARGUMENT_POSITION;
field->fld_length = UDF_ARG.RDB$FIELD_LENGTH;
field->fld_scale = UDF_ARG.RDB$FIELD_SCALE;
@ -1300,7 +1304,7 @@ UDF MET_get_udf(DBB dbb, TEXT * string)
}
else {
/* Same request as above, but with V4 metadata also fetched */
FOR(REQUEST_HANDLE dbb->dbb_udf_request)
FOR(REQUEST_HANDLE database->dbb_udf_request)
UDF_DEF IN RDB$FUNCTIONS CROSS
UDF_ARG IN RDB$FUNCTION_ARGUMENTS
WITH UDF_DEF.RDB$FUNCTION_NAME EQ name AND
@ -1309,9 +1313,9 @@ UDF MET_get_udf(DBB dbb, TEXT * string)
SORTED BY DESCENDING UDF_ARG.RDB$ARGUMENT_POSITION;
field = (GPRE_FLD) ALLOC(FLD_LEN);
field->fld_next = udf->udf_inputs;
udf->udf_inputs = field;
udf->udf_args++;
field->fld_next = the_udf->udf_inputs;
the_udf->udf_inputs = field;
the_udf->udf_args++;
field->fld_position = UDF_ARG.RDB$ARGUMENT_POSITION;
field->fld_length = UDF_ARG.RDB$FIELD_LENGTH;
field->fld_scale = UDF_ARG.RDB$FIELD_SCALE;
@ -1339,9 +1343,9 @@ UDF MET_get_udf(DBB dbb, TEXT * string)
END_FOR;
}
udf->udf_flags |= UDF_scanned;
the_udf->udf_flags |= UDF_scanned;
return udf;
return the_udf;
}
@ -1356,17 +1360,17 @@ GPRE_REL MET_get_view_relation(GPRE_REQ request,
char *view_name,
char *relation_or_alias, USHORT level)
{
DBB dbb;
dbb* database;
TEXT *p;
GPRE_REL relation;
dbb = request->req_database;
DB = dbb->dbb_handle;
gds_trans = dbb->dbb_transaction;
database = request->req_database;
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
relation = NULL;
FOR(REQUEST_HANDLE dbb->dbb_view_request, LEVEL level)
FOR(REQUEST_HANDLE database->dbb_view_request, LEVEL level)
X IN RDB$VIEW_RELATIONS WITH
X.RDB$VIEW_NAME EQ view_name
for (p = X.RDB$CONTEXT_NAME; *p && *p != ' '; p++);
@ -1377,7 +1381,7 @@ GPRE_REL MET_get_view_relation(GPRE_REQ request,
if (!strcmp(X.RDB$RELATION_NAME, relation_or_alias) ||
!strcmp(X.RDB$CONTEXT_NAME, relation_or_alias))
return MET_get_relation(dbb, X.RDB$RELATION_NAME, "");
return MET_get_relation(database, X.RDB$RELATION_NAME, "");
if (relation =
MET_get_view_relation(request, X.RDB$RELATION_NAME, relation_or_alias,
@ -1396,7 +1400,7 @@ GPRE_REL MET_get_view_relation(GPRE_REQ request,
* Return an index block (if name is found) or NULL.
*/
IND MET_index(DBB dbb, TEXT * string)
IND MET_index(dbb* database, TEXT * string)
{
SYM symbol;
IND index;
@ -1409,24 +1413,24 @@ IND MET_index(DBB dbb, TEXT * string)
for (symbol = HSH_lookup(name); symbol; symbol = symbol->sym_homonym)
if (symbol->sym_type == SYM_index &&
(index = (IND) symbol->sym_object) &&
index->ind_relation->rel_database == dbb)
index->ind_relation->rel_database == database)
return index;
if (sw_language == lang_internal)
return NULL;
if (dbb->dbb_flags & DBB_sqlca)
if (database->dbb_flags & DBB_sqlca)
return NULL;
DB = dbb->dbb_handle;
gds_trans = dbb->dbb_transaction;
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
index = NULL;
FOR(REQUEST_HANDLE dbb->dbb_index_request)
FOR(REQUEST_HANDLE database->dbb_index_request)
X IN RDB$INDICES WITH X.RDB$INDEX_NAME EQ name
index = (IND) ALLOC(IND_LEN);
index->ind_symbol = symbol = MSC_symbol(SYM_index, name, length, (GPRE_CTX) index);
index->ind_relation = MET_get_relation(dbb, X.RDB$RELATION_NAME, "");
index->ind_relation = MET_get_relation(database, X.RDB$RELATION_NAME, "");
HSH_insert(symbol);
END_FOR;
@ -1442,13 +1446,13 @@ IND MET_index(DBB dbb, TEXT * string)
* into the symbol (hash) table.
*/
void MET_load_hash_table( DBB dbb)
void MET_load_hash_table(dbb* database)
{
GPRE_REL relation;
GPRE_PRC procedure;
SYM symbol;
GPRE_FLD dbkey;
UDF udf;
udf* an_udf;
TEXT *p;
FRBRD *handle, *handle2;
USHORT post_v3_flag;
@ -1462,20 +1466,20 @@ void MET_load_hash_table( DBB dbb)
if (sw_language == lang_internal)
return;
if (!dbb->dbb_handle)
if (!MET_database(dbb, FALSE))
if (!database->dbb_handle)
if (!MET_database(database, FALSE))
CPR_exit(FINI_ERROR);
if (dbb->dbb_transaction)
if (database->dbb_transaction)
/* we must have already loaded this one */
return;
gds_trans = NULL;
DB = dbb->dbb_handle;
DB = database->dbb_handle;
START_TRANSACTION;
dbb->dbb_transaction = gds_trans;
database->dbb_transaction = gds_trans;
handle = handle2 = NULL;
/* Determine if the database is V3. */
@ -1491,16 +1495,16 @@ void MET_load_hash_table( DBB dbb)
gds__release_request(gds_status, &handle);
if (!post_v3_flag)
dbb->dbb_flags |= DBB_v3;
database->dbb_flags |= DBB_v3;
/* Pick up all relations (necessary to parse parts of the GDML grammar) */
if (dbb->dbb_flags & DBB_v3) {
if (database->dbb_flags & DBB_v3) {
FOR(REQUEST_HANDLE handle)
X IN RDB$RELATIONS relation = (GPRE_REL) ALLOC(REL_LEN);
relation->rel_database = dbb;
relation->rel_next = dbb->dbb_relations;
dbb->dbb_relations = relation;
relation->rel_database = database;
relation->rel_next = database->dbb_relations;
database->dbb_relations = relation;
relation->rel_id = X.RDB$RELATION_ID;
relation->rel_symbol = symbol =
MSC_symbol(SYM_relation, X.RDB$RELATION_NAME,
@ -1518,9 +1522,9 @@ void MET_load_hash_table( DBB dbb)
else {
FOR(REQUEST_HANDLE handle)
X IN RDB$RELATIONS relation = (GPRE_REL) ALLOC(REL_LEN);
relation->rel_database = dbb;
relation->rel_next = dbb->dbb_relations;
dbb->dbb_relations = relation;
relation->rel_database = database;
relation->rel_next = database->dbb_relations;
database->dbb_relations = relation;
relation->rel_id = X.RDB$RELATION_ID;
relation->rel_symbol = symbol =
MSC_symbol(SYM_relation, X.RDB$RELATION_NAME,
@ -1547,9 +1551,9 @@ void MET_load_hash_table( DBB dbb)
FOR(REQUEST_HANDLE handle)
X IN RDB$PROCEDURES procedure = (GPRE_PRC) ALLOC(REL_LEN);
procedure->prc_database = dbb;
procedure->prc_next = (GPRE_PRC) dbb->dbb_procedures;
dbb->dbb_procedures = (GPRE_REL) procedure;
procedure->prc_database = database;
procedure->prc_next = (GPRE_PRC) database->dbb_procedures;
database->dbb_procedures = (GPRE_REL) procedure;
procedure->prc_id = X.RDB$PROCEDURE_ID;
procedure->prc_symbol = symbol =
MSC_symbol(SYM_procedure, X.RDB$PROCEDURE_NAME,
@ -1577,24 +1581,24 @@ void MET_load_hash_table( DBB dbb)
length = symbol_length(p);
p[length] = 0;
udf = (UDF) ALLOC(UDF_LEN + length);
strcpy(udf->udf_function, p);
udf->udf_database = dbb;
udf->udf_type = FUN.RDB$FUNCTION_TYPE;
an_udf = (udf*) ALLOC(UDF_LEN + length);
strcpy(an_udf->udf_function, p);
an_udf->udf_database = database;
an_udf->udf_type = FUN.RDB$FUNCTION_TYPE;
if (length = symbol_length(FUN.RDB$QUERY_NAME)) {
p = FUN.RDB$QUERY_NAME;
p[length] = 0;
}
udf->udf_symbol = symbol = MSC_symbol(SYM_udf, p, strlen(p), (GPRE_CTX) udf);
an_udf->udf_symbol = symbol = MSC_symbol(SYM_udf, p, strlen(p), (GPRE_CTX) an_udf);
HSH_insert(symbol);
udf->udf_length = ARG.RDB$FIELD_LENGTH;
udf->udf_scale = ARG.RDB$FIELD_SCALE;
udf->udf_sub_type = ARG.RDB$FIELD_SUB_TYPE;
udf->udf_dtype =
an_udf->udf_length = ARG.RDB$FIELD_LENGTH;
an_udf->udf_scale = ARG.RDB$FIELD_SCALE;
an_udf->udf_sub_type = ARG.RDB$FIELD_SUB_TYPE;
an_udf->udf_dtype =
MET_get_dtype(ARG.RDB$FIELD_TYPE, ARG.RDB$FIELD_SUB_TYPE,
&udf->udf_length);
&an_udf->udf_length);
if (post_v3_flag) {
FOR(REQUEST_HANDLE handle2)
@ -1607,9 +1611,9 @@ void MET_load_hash_table( DBB dbb)
V4ARG.RDB$FUNCTION_NAME EQ ARG.RDB$FUNCTION_NAME AND
V4ARG.RDB$ARGUMENT_POSITION EQ ARG.RDB$ARGUMENT_POSITION;
udf->udf_charset_id = V4ARG.RDB$CHARACTER_SET_ID;
udf->udf_ttype =
INTL_CS_COLL_TO_TTYPE(udf->udf_charset_id, COLL.RDB$COLLATION_ID);
an_udf->udf_charset_id = V4ARG.RDB$CHARACTER_SET_ID;
an_udf->udf_ttype =
INTL_CS_COLL_TO_TTYPE(an_udf->udf_charset_id, COLL.RDB$COLLATION_ID);
END_FOR;
@ -1634,7 +1638,7 @@ void MET_load_hash_table( DBB dbb)
p[length] = 0;
iname = (INTLSYM) ALLOC(INTLSYM_LEN + length);
strcpy(iname->intlsym_name, p);
iname->intlsym_database = dbb;
iname->intlsym_database = database;
iname->intlsym_symbol = symbol =
MSC_symbol(SYM_collate, p, strlen(p), (GPRE_CTX) iname);
HSH_insert(symbol);
@ -1684,7 +1688,7 @@ void MET_load_hash_table( DBB dbb)
p[length] = 0;
iname = (INTLSYM) ALLOC(INTLSYM_LEN + length);
strcpy(iname->intlsym_name, p);
iname->intlsym_database = dbb;
iname->intlsym_database = database;
iname->intlsym_symbol = symbol =
MSC_symbol(SYM_charset, p, strlen(p), (GPRE_CTX) iname);
HSH_insert(symbol);
@ -1728,9 +1732,9 @@ void MET_load_hash_table( DBB dbb)
p = DBB.RDB$CHARACTER_SET_NAME;
length = symbol_length(p);
p[length] = 0;
dbb->dbb_def_charset = (TEXT *) ALLOC(length + 1);
strcpy(dbb->dbb_def_charset, p);
if (!MSC_find_symbol(HSH_lookup(dbb->dbb_def_charset), SYM_charset))
database->dbb_def_charset = (TEXT *) ALLOC(length + 1);
strcpy(database->dbb_def_charset, p);
if (!MSC_find_symbol(HSH_lookup(database->dbb_def_charset), SYM_charset))
CPR_warn("Default character set for database is not known");
END_FOR ON_ERROR
/* Assume V3 Db, no default charset */
@ -1743,7 +1747,7 @@ void MET_load_hash_table( DBB dbb)
FOR(REQUEST_HANDLE handle)
X IN RDB$GENERATORS
symbol = MSC_symbol(SYM_generator, X.RDB$GENERATOR_NAME,
symbol_length(X.RDB$GENERATOR_NAME), (GPRE_CTX) dbb);
symbol_length(X.RDB$GENERATOR_NAME), (GPRE_CTX) database);
HSH_insert(symbol);
END_FOR ON_ERROR END_ERROR;
@ -1754,20 +1758,20 @@ void MET_load_hash_table( DBB dbb)
* request (if any) (and if we can)
*/
if (dbb->dbb_c_lc_ctype) {
if (database->dbb_c_lc_ctype) {
if (get_intl_char_subtype
(&dbb->dbb_char_subtype, (UCHAR*) dbb->dbb_c_lc_ctype,
strlen(dbb->dbb_c_lc_ctype), dbb))
dbb->dbb_know_subtype = 1;
(&database->dbb_char_subtype, (UCHAR*) database->dbb_c_lc_ctype,
strlen(database->dbb_c_lc_ctype), database))
database->dbb_know_subtype = 1;
else {
TEXT buffer[200];
sprintf(buffer, "Cannot recognize character set '%s'",
dbb->dbb_c_lc_ctype);
database->dbb_c_lc_ctype);
PAR_error(buffer);
}
sw_know_interp = dbb->dbb_know_subtype;
sw_interp = dbb->dbb_char_subtype;
sw_know_interp = database->dbb_know_subtype;
sw_interp = database->dbb_char_subtype;
}
}
@ -1836,7 +1840,7 @@ GPRE_REL MET_make_relation(SCHAR * name)
BOOLEAN MET_type(GPRE_FLD field, TEXT * string, SSHORT * ptr)
{
GPRE_REL relation;
DBB dbb;
dbb* database;
SYM symbol;
TYP type;
UCHAR buffer[32]; /* BASED ON RDB$TYPES.RDB$TYPE_NAME */
@ -1851,16 +1855,16 @@ BOOLEAN MET_type(GPRE_FLD field, TEXT * string, SSHORT * ptr)
}
relation = field->fld_relation;
dbb = relation->rel_database;
DB = dbb->dbb_handle;
gds_trans = dbb->dbb_transaction;
database = relation->rel_database;
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
/* Force the name to uppercase, using C locale rules for uppercasing */
for (p = buffer; *string && p < &buffer[sizeof(buffer) - 1];
p++, string++) *p = UPPER7(*string);
*p = '\0';
FOR(REQUEST_HANDLE dbb->dbb_type_request)
FOR(REQUEST_HANDLE database->dbb_type_request)
X IN RDB$TYPES WITH X.RDB$FIELD_NAME EQ field->fld_global->sym_string AND
X.RDB$TYPE_NAME EQ buffer {
type = (TYP) ALLOC(TYP_LEN);
@ -1884,16 +1888,16 @@ BOOLEAN MET_type(GPRE_FLD field, TEXT * string, SSHORT * ptr)
* FALSE otherwise
*/
BOOLEAN MET_trigger_exists(DBB dbb, TEXT* trigger_name)
BOOLEAN MET_trigger_exists(dbb* database, TEXT* trigger_name)
{
char name[NAME_SIZE];
strcpy(name, trigger_name);
DB = dbb->dbb_handle;
gds_trans = dbb->dbb_transaction;
DB = database->dbb_handle;
gds_trans = database->dbb_transaction;
FOR(REQUEST_HANDLE dbb->dbb_trigger_request)
FOR(REQUEST_HANDLE database->dbb_trigger_request)
TRIG IN RDB$TRIGGERS WITH TRIG.RDB$TRIGGER_NAME EQ name return TRUE;
END_FOR;
@ -1928,7 +1932,7 @@ static SLONG array_size( GPRE_FLD field)
* See if field is array.
*/
static void get_array( DBB dbb, TEXT * field_name, GPRE_FLD field)
static void get_array(dbb* database, TEXT * field_name, GPRE_FLD field)
{
GPRE_FLD sub_field;
ARY array_block;
@ -1936,7 +1940,7 @@ static void get_array( DBB dbb, TEXT * field_name, GPRE_FLD field)
array_block = NULL;
FOR(REQUEST_HANDLE dbb->dbb_array_request)
FOR(REQUEST_HANDLE database->dbb_array_request)
F IN RDB$FIELDS WITH F.RDB$FIELD_NAME EQ field_name if (F.RDB$DIMENSIONS) {
sub_field = (GPRE_FLD) ALLOC(FLD_LEN);
*sub_field = *field;
@ -1948,7 +1952,7 @@ static void get_array( DBB dbb, TEXT * field_name, GPRE_FLD field)
(ARY) ALLOC(ARY_LEN(F.RDB$DIMENSIONS));
array_block->ary_dtype = sub_field->fld_dtype;
} END_FOR ON_ERROR {
dbb->dbb_flags |= DBB_no_arrays;
database->dbb_flags |= DBB_no_arrays;
return;
}
END_ERROR;
@ -1956,7 +1960,7 @@ static void get_array( DBB dbb, TEXT * field_name, GPRE_FLD field)
if (!array_block)
return;
FOR(REQUEST_HANDLE dbb->dbb_dimension_request)
FOR(REQUEST_HANDLE database->dbb_dimension_request)
D IN RDB$FIELD_DIMENSIONS WITH D.RDB$FIELD_NAME EQ field_name
SORTED BY ASCENDING D.RDB$DIMENSION
array_block->ary_rpt[D.RDB$DIMENSION].ary_lower = D.RDB$LOWER_BOUND;
@ -2000,7 +2004,7 @@ static void get_array( DBB dbb, TEXT * field_name, GPRE_FLD field)
static int get_intl_char_subtype(
SSHORT * id,
UCHAR * name, USHORT length, DBB dbb)
UCHAR * name, USHORT length, dbb* database)
{
UCHAR buffer[32]; /* BASED ON RDB$COLLATION_NAME */
UCHAR *p;
@ -2009,13 +2013,13 @@ static int get_intl_char_subtype(
assert(id != NULL);
assert(name != NULL);
assert(dbb != NULL);
assert(database != NULL);
DB = dbb->dbb_handle;
DB = database->dbb_handle;
if (!DB)
return (0);
gds_trans = dbb->dbb_transaction;
gds_trans = database->dbb_transaction;
end_name = name + length;
/* Force key to uppercase, following C locale rules for uppercasing

View File

@ -26,7 +26,7 @@
*
*____________________________________________________________
*
* $Id: gpre_meta_boot.cpp,v 1.15 2003-04-10 06:21:49 aafemt Exp $
* $Id: gpre_meta_boot.cpp,v 1.16 2003-09-05 10:14:08 aafemt Exp $
*/
#include "firebird.h"
@ -888,7 +888,7 @@ ISC_STATUS API_ROUTINE isc_print_blr(SCHAR * blr,
(SCHAR *) callback_argument, language);
}
extern "C" void DLL_EXPORT CVT_move (struct dsc * a, struct dsc * b, FPTR_VOID c)
extern "C" void DLL_EXPORT CVT_move(dsc* a, dsc* b, FPTR_VOID c)
{
assert(0);
/* Not available in boot_gpre */

View File

@ -19,7 +19,7 @@
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
* $Id: gpreswi.h,v 1.8 2003-07-02 12:57:41 brodsom Exp $
* $Id: gpreswi.h,v 1.9 2003-09-05 10:14:08 aafemt Exp $
* Revision 1.2 2000/11/16 15:54:29 fsg
* Added new switch -verbose to gpre that will dump
* parsed lines to stderr
@ -114,7 +114,7 @@ typedef struct sw_tab_t
} *SW_TAB;
static struct in_sw_tab_t gpre_in_sw_table[] =
static in_sw_tab_t gpre_in_sw_table[] =
{
#ifdef GPRE_ADA
{IN_SW_GPRE_ADA , 0, "ADA" , 0, 0, 0, FALSE, 0, 0, "\t\textended ADA program"},

View File

@ -25,7 +25,7 @@
//
//____________________________________________________________
//
// $Id: hsh.cpp,v 1.10 2003-02-10 13:28:18 eku Exp $
// $Id: hsh.cpp,v 1.11 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
@ -85,18 +85,18 @@ void HSH_init(void)
SCHAR *string;
SYM symbol, *ptr;
int i;
struct word *word;
word* a_word;
for (ptr = hash_table, i = 0; i < HASH_SIZE; i++)
*ptr++ = NULL;
fflush(stdout);
for (i = 0, word = keywords; i < FB_NELEM(keywords); i++, word++) {
for (string = word->keyword; *string; string++);
for (i = 0, a_word = keywords; i < FB_NELEM(keywords); i++, a_word++) {
for (string = a_word->keyword; *string; string++);
symbol = (SYM) ALLOC(SYM_LEN);
symbol->sym_type = SYM_keyword;
symbol->sym_string = word->keyword;
symbol->sym_keyword = (int) word->id;
symbol->sym_string = a_word->keyword;
symbol->sym_keyword = (int) a_word->id;
HSH_insert(symbol);
symbol->sym_object = (GPRE_CTX) key_symbols;
key_symbols = symbol;

View File

@ -26,7 +26,7 @@
//
//____________________________________________________________
//
// $Id: jrdmet.cpp,v 1.7 2003-02-13 09:58:19 dimitr Exp $
// $Id: jrdmet.cpp,v 1.8 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
@ -69,7 +69,7 @@ void JRDMET_init( DBB db)
const UCHAR *relfld;
const UCHAR *fld;
int n;
struct gfld *gfield;
gfld* gfield;
relfld = relfields;

View File

@ -25,10 +25,10 @@
//
//____________________________________________________________
//
// $Id: msc.cpp,v 1.6 2003-07-02 12:57:41 brodsom Exp $
// $Id: msc.cpp,v 1.7 2003-09-05 10:14:08 aafemt Exp $
//
//
//$Id: msc.cpp,v 1.6 2003-07-02 12:57:41 brodsom Exp $
//$Id: msc.cpp,v 1.7 2003-09-05 10:14:08 aafemt Exp $
//
// ***************************************************
@ -64,7 +64,7 @@ extern "C" {
extern ACT cur_routine;
typedef struct spc {
struct spc *spc_next;
spc* spc_next;
SLONG spc_remaining;
} *SPC;
@ -108,7 +108,7 @@ UCHAR *MSC_alloc(int size)
if (!space || size > space->spc_remaining) {
n = MAX(size, 4096);
if (!(next = (SPC) gds__alloc((SLONG) (n + sizeof(struct spc)))))
if (!(next = (SPC) gds__alloc((SLONG) (n + sizeof(spc)))))
CPR_error("virtual memory exhausted");
#ifdef DEBUG_GDS_ALLOC
/* For V4.0 we don't care about gpre specific memory leaks */
@ -120,7 +120,7 @@ UCHAR *MSC_alloc(int size)
}
space->spc_remaining -= size;
p = blk = ((UCHAR *) space + sizeof(struct spc) + space->spc_remaining);
p = blk = ((UCHAR *) space + sizeof(spc) + space->spc_remaining);
end = p + size;
while (p < end)
@ -145,7 +145,7 @@ UCHAR *MSC_alloc_permanent(int size)
if (!permanent_space || size > permanent_space->spc_remaining) {
n = MAX(size, 4096);
if (!(next = (SPC) gds__alloc((SLONG) (n + sizeof(struct spc)))))
if (!(next = (SPC) gds__alloc((SLONG) (n + sizeof(spc)))))
CPR_error("virtual memory exhausted");
#ifdef DEBUG_GDS_ALLOC
/* For V4.0 we don't care about gpre specific memory leaks */
@ -158,7 +158,7 @@ UCHAR *MSC_alloc_permanent(int size)
permanent_space->spc_remaining -= size;
p = blk =
((UCHAR *) permanent_space + sizeof(struct spc) +
((UCHAR *) permanent_space + sizeof(spc) +
permanent_space->spc_remaining);
end = p + size;

View File

@ -20,7 +20,7 @@
//
// All Rights Reserved.
// Contributor(s): ______________________________________.
// $Id: par.cpp,v 1.23 2003-09-01 07:48:27 brodsom Exp $
// $Id: par.cpp,v 1.24 2003-09-05 10:14:08 aafemt Exp $
// Revision 1.2 2000/11/27 09:26:13 fsg
// Fixed bugs in gpre to handle PYXIS forms
// and allow edit.e and fred.e to go through
@ -37,7 +37,7 @@
//
//____________________________________________________________
//
// $Id: par.cpp,v 1.23 2003-09-01 07:48:27 brodsom Exp $
// $Id: par.cpp,v 1.24 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
@ -2778,7 +2778,7 @@ static ACT par_menu_for()
PUSH((GPRE_NOD) request, &cur_menu);
action = MAKE_ACTION(request, ACT_menu_for);
menu = (MENU) ALLOC(sizeof(struct menu));
menu = (MENU) ALLOC(sizeof(menu));
action->act_object = (REF) menu;
menu->menu_request = request;
@ -2813,7 +2813,7 @@ static ACT par_menu_item_for( SYM symbol, GPRE_CTX context, ACT_T type)
action = MAKE_ACTION(request, type);
PUSH((GPRE_NOD) action, (LLS *) & cur_item);
entree = (ENTREE) ALLOC(sizeof(struct entree));
entree = (ENTREE) ALLOC(sizeof(entree));
action->act_object = (REF) entree;
entree->entree_request = parent;

View File

@ -50,17 +50,17 @@ enum tok_t {
typedef struct tok {
enum tok_t tok_type; /* type of token */
struct sym *tok_symbol; /* hash block if recognized */
sym* tok_symbol; /* hash block if recognized */
KWWORDS tok_keyword; /* keyword number, if recognized */
SLONG tok_position; /* byte number in input stream */
USHORT tok_length;
USHORT tok_white_space;
SCHAR tok_string[MAXSYMLEN];
USHORT tok_first; /* first token in a statement */
struct sym *tok_charset; /* Character set of token */
sym* tok_charset; /* Character set of token */
} *TOK;
#define TOK_LEN sizeof (struct tok)
#define TOK_LEN sizeof(tok)
#ifdef PARSER_MAIN
#define EXTERN
@ -68,7 +68,7 @@ typedef struct tok {
#define EXTERN extern
#endif
EXTERN struct tok token;
EXTERN tok token;
#undef EXTERN

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: pas.cpp,v 1.12 2003-08-12 10:05:47 robocop Exp $
// $Id: pas.cpp,v 1.13 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
@ -1663,7 +1663,8 @@ static void gen_dyn_execute( ACT action, int column)
{
DYN statement;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
GPRE_NOD var_list;
int i;
@ -1739,7 +1740,8 @@ static void gen_dyn_immediate( ACT action, int column)
DYN statement;
DBB database;
TEXT *transaction;
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
statement = (DYN) action->act_object;
if (statement->dyn_trans) {
@ -1806,7 +1808,8 @@ static void gen_dyn_open( ACT action, int column)
{
DYN statement;
TEXT *transaction, s[64];
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
GPRE_NOD var_list;
int i;
@ -1860,7 +1863,8 @@ static void gen_dyn_open( ACT action, int column)
static void gen_dyn_prepare( ACT action, int column)
{
TEXT s[64], *transaction;
struct gpre_req *request, req_const;
gpre_req* request;
gpre_req req_const;
DYN statement = (DYN) action->act_object;
if (statement->dyn_trans) {

View File

@ -24,7 +24,7 @@
//
//____________________________________________________________
//
// $Id: pat.cpp,v 1.8 2003-04-01 11:49:30 brodsom Exp $
// $Id: pat.cpp,v 1.9 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
@ -120,7 +120,7 @@ static struct ops {
void PATTERN_expand( USHORT column, TEXT * pattern, PAT * args)
{
struct ops *operator_;
ops* operator_;
TEXT buffer[512], c, *p, temp1[16], temp2[16];
USHORT sw_ident, sw_gen, n;
SSHORT value; /* value needs to be signed since some of the

View File

@ -25,7 +25,7 @@
//
//____________________________________________________________
//
// $Id: pretty.cpp,v 1.12 2003-08-15 10:23:44 aafemt Exp $
// $Id: pretty.cpp,v 1.13 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
@ -133,7 +133,8 @@ int PRETTY_print_cdb( SCHAR * blr,
int (*routine) (), SCHAR * user_arg, SSHORT language)
{
struct ctl ctl_, *control;
ctl ctl_buffer;
ctl* control = &ctl_buffer;
SCHAR temp[32];
SSHORT parameter;
SSHORT level = 0;
@ -142,8 +143,6 @@ int PRETTY_print_cdb( SCHAR * blr,
int offset = 0;
control = &ctl_;
if (!routine) {
routine = (int (*)()) ib_printf;
user_arg = "%.4d %s\n";
@ -196,11 +195,11 @@ int PRETTY_print_dyn(
int (*routine) (), SCHAR * user_arg, SSHORT language)
{
struct ctl ctl, *control;
ctl ctl_buffer;
ctl* control = &ctl_buffer;
int offset;
SSHORT version, level;
control = &ctl;
offset = level = 0;
if (!routine) {
@ -246,12 +245,12 @@ PRETTY_print_form_map(SCHAR * blr,
int (*routine) (), SCHAR * user_arg, SSHORT language)
{
struct ctl ctl, *control;
ctl ctl_buffer;
ctl* control = &ctl_buffer;
SCHAR c;
int offset, n;
SSHORT version, level;
control = &ctl;
offset = level = 0;
if (!routine) {
@ -356,12 +355,12 @@ PRETTY_print_menu(SCHAR * blr,
int (*routine) (), SCHAR * user_arg, SSHORT language)
{
struct ctl ctl, *control;
ctl ctl_buffer;
ctl* control = &ctl_buffer;
SCHAR c;
int offset;
SSHORT version, level;
control = &ctl;
offset = level = 0;
if (!routine) {
@ -427,11 +426,11 @@ PRETTY_print_sdl(SCHAR * blr,
int (*routine) (), SCHAR * user_arg, SSHORT language)
{
struct ctl ctl, *control;
ctl ctl_buffer;
ctl* control = &ctl_buffer;
int offset;
SSHORT version, level;
control = &ctl;
offset = level = 0;
if (!routine) {

View File

@ -37,7 +37,7 @@
//
//____________________________________________________________
//
// $Id: sqe.cpp,v 1.11 2003-08-31 12:27:46 robocop Exp $
// $Id: sqe.cpp,v 1.12 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
#include <stdio.h>
@ -62,7 +62,7 @@ extern "C" {
#define ERROR_LENGTH 256
struct scope {
struct gpre_ctx *req_contexts;
gpre_ctx* req_contexts;
USHORT req_scope_level; /* scope level for SQL subquery parsing */
USHORT req_in_aggregate; /* now processing value expr for aggr */
USHORT req_in_select_list; /* processing select list */
@ -73,10 +73,10 @@ struct scope {
};
extern ACT cur_routine;
extern struct tok prior_token;
extern tok prior_token;
static BOOLEAN compare_expr(GPRE_NOD, GPRE_NOD);
static GPRE_NOD copy_fields(GPRE_NOD, MAP);
static GPRE_NOD copy_fields(GPRE_NOD, map*);
static GPRE_NOD explode_asterisk(GPRE_NOD, int, RSE);
static GPRE_NOD explode_asterisk_all(GPRE_NOD, int, RSE, BOOLEAN);
static GPRE_FLD get_ref(GPRE_NOD);
@ -109,11 +109,11 @@ static void par_terminating_parens(USHORT *, USHORT *);
static GPRE_NOD par_udf(GPRE_REQ);
static GPRE_NOD par_udf_or_field(GPRE_REQ, BOOLEAN);
static GPRE_NOD par_udf_or_field_with_collate(GPRE_REQ, BOOLEAN);
static GPRE_NOD post_fields(GPRE_NOD, MAP);
static GPRE_NOD post_fields(GPRE_NOD, map*);
static GPRE_NOD post_map(GPRE_NOD, MAP);
static GPRE_NOD post_select_list(GPRE_NOD, MAP);
static void pop_scope(GPRE_REQ, struct scope *);
static void push_scope(GPRE_REQ, struct scope *);
static GPRE_NOD post_select_list(GPRE_NOD, map*);
static void pop_scope(GPRE_REQ, scope*);
static void push_scope(GPRE_REQ, scope*);
static GPRE_FLD resolve(GPRE_NOD, GPRE_CTX, GPRE_CTX *, ACT *);
static GPRE_CTX resolve_asterisk(TOK, RSE);
static void set_ref(GPRE_NOD, GPRE_FLD);
@ -124,13 +124,13 @@ static void dialect1_bad_type(USHORT);
typedef struct ops {
struct ops {
enum nod_t rel_op;
enum kwwords rel_kw;
enum nod_t rel_negation;
} OPS;
};
static OPS rel_ops[] = {
static ops rel_ops[] = {
{ nod_eq, KW_EQ, nod_ne },
{ nod_eq, KW_EQUALS, nod_ne },
{ nod_ne, KW_NE, nod_eq },
@ -145,7 +145,7 @@ static OPS rel_ops[] = {
{ nod_ansi_any, KW_none, nod_ansi_any },
{ nod_ansi_all, KW_none, nod_ansi_all }};
#ifdef NOT_USED_OR_REPLACED
static OPS scalar_stat_ops[] = {
static ops scalar_stat_ops[] = {
{ nod_count, KW_COUNT, nod_any },
{ nod_max, KW_MAX, nod_any },
{ nod_min, KW_MIN, nod_any },
@ -154,7 +154,7 @@ static OPS scalar_stat_ops[] = {
{ nod_average, KW_AVERAGE, nod_any },
{ nod_via, KW_none, nod_any}};
#endif
static OPS stat_ops[] = {
static ops stat_ops[] = {
{ nod_agg_count, KW_COUNT, nod_any },
{ nod_agg_max, KW_MAX, nod_any },
{ nod_agg_min, KW_MIN, nod_any },
@ -339,7 +339,7 @@ GPRE_NOD SQE_field(GPRE_REQ request, BOOLEAN aster_ok)
SLC slice;
ACT action;
TEXT s[ERROR_LENGTH];
struct tok hold_token;
tok hold_token;
slc::slc_repeat * tail_ptr;
assert_IS_REQ(request);
@ -894,7 +894,7 @@ REF SQE_post_reference(GPRE_REQ request, GPRE_FLD field, GPRE_CTX context, GPRE_
// otherwise FALSE.
//
BOOLEAN SQE_resolve(GPRE_NOD node, GPRE_REQ request, RSE rse)
BOOLEAN SQE_resolve(GPRE_NOD node, GPRE_REQ request, rse* selection)
{
REF reference;
GPRE_CTX context;
@ -923,7 +923,7 @@ BOOLEAN SQE_resolve(GPRE_NOD node, GPRE_REQ request, RSE rse)
ptr = node->nod_arg;
end = ptr + node->nod_count;
for (; ptr < end; ptr++)
result |= SQE_resolve(*ptr, request, rse);
result |= SQE_resolve(*ptr, request, selection);
return result;
case nod_agg_max:
@ -932,7 +932,7 @@ BOOLEAN SQE_resolve(GPRE_NOD node, GPRE_REQ request, RSE rse)
case nod_agg_average:
case nod_agg_count:
if (node->nod_arg[0]) {
SQE_resolve(node->nod_arg[0], request, rse);
SQE_resolve(node->nod_arg[0], request, selection);
node_arg = node->nod_arg[0];
reference = (REF) node_arg->nod_arg[0];
if (node_arg->nod_type == nod_field && reference &&
@ -947,16 +947,16 @@ BOOLEAN SQE_resolve(GPRE_NOD node, GPRE_REQ request, RSE rse)
ptr = node->nod_arg[0]->nod_arg;
end = ptr + node->nod_arg[0]->nod_count;
for (; ptr < end; ptr++)
result |= SQE_resolve(*ptr, request, rse);
result |= SQE_resolve(*ptr, request, selection);
}
return result;
case nod_gen_id:
return SQE_resolve(node->nod_arg[0], request, rse);
return SQE_resolve(node->nod_arg[0], request, selection);
// ** Begin date/time/timestamp support *
case nod_extract:
result |= SQE_resolve(node->nod_arg[1], request, rse);
result |= SQE_resolve(node->nod_arg[1], request, selection);
return result;
// ** End date/time/timestamp support *
@ -981,9 +981,9 @@ BOOLEAN SQE_resolve(GPRE_NOD node, GPRE_REQ request, RSE rse)
&& (field = resolve(node, context, 0, &slice_action))) break;
}
else
for (i = 0; i < rse->rse_count; i++) {
for (i = 0; i < selection->rse_count; i++) {
if (field =
resolve(node, rse->rse_context[i], &context,
resolve(node, selection->rse_context[i], &context,
&slice_action)) break;
}
@ -1033,7 +1033,8 @@ RSE SQE_select(GPRE_REQ request, USHORT view_flag)
GPRE_NOD node;
LLS context_stack;
GPRE_CTX context;
MAP map, old_map;
map* new_map;
map* old_map;
BOOLEAN have_union;
assert_IS_REQ(request);
@ -1073,13 +1074,13 @@ RSE SQE_select(GPRE_REQ request, USHORT view_flag)
node->nod_arg[0] = (GPRE_NOD) rse1;
node->nod_arg[1] = (GPRE_NOD) rse2;
rse1->rse_map = map = (MAP) ALLOC(sizeof(struct map));
map->map_context = context;
select->rse_fields = post_select_list(rse1->rse_fields, map);
rse1->rse_map = new_map = (map*) ALLOC(sizeof(map));
new_map->map_context = context;
select->rse_fields = post_select_list(rse1->rse_fields, new_map);
rse2->rse_map = map = (MAP) ALLOC(sizeof(struct map));
map->map_context = context;
post_select_list(rse2->rse_fields, map);
rse2->rse_map = new_map = (map*) ALLOC(sizeof(map));
new_map->map_context = context;
post_select_list(rse2->rse_fields, new_map);
select->rse_into = rse1->rse_into;
if (!union_all)
@ -1265,7 +1266,7 @@ static BOOLEAN compare_expr( GPRE_NOD node1, GPRE_NOD node2)
// Copy a field list for a SELECT against an artificial context.
//
static GPRE_NOD copy_fields( GPRE_NOD fields, MAP map)
static GPRE_NOD copy_fields( GPRE_NOD fields, map* fields_map)
{
GPRE_NOD list;
USHORT i;
@ -1275,7 +1276,7 @@ static GPRE_NOD copy_fields( GPRE_NOD fields, MAP map)
list = MAKE_NODE(nod_list, fields->nod_count);
for (i = 0; i < fields->nod_count; i++)
list->nod_arg[i] = post_fields(fields->nod_arg[i], map);
list->nod_arg[i] = post_fields(fields->nod_arg[i], fields_map);
return list;
}
@ -1286,7 +1287,7 @@ static GPRE_NOD copy_fields( GPRE_NOD fields, MAP map)
// Expand an '*' in a field list to the corresponding fields.
//
static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, RSE rse)
static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, rse* selection)
{
GPRE_CTX context;
GPRE_NOD node;
@ -1299,7 +1300,7 @@ static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, RSE rse)
if (q_token = (TOK) node->nod_arg[0]) {
/* expand for single relation */
if (context = resolve_asterisk(q_token, rse))
if (context = resolve_asterisk(q_token, selection))
fields = merge_fields(fields, MET_fields(context), n, TRUE);
else {
sprintf(s, "columns \"%s.*\" cannot be resolved",
@ -1310,7 +1311,7 @@ static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, RSE rse)
else {
/* expand for all relations in context list */
fields = explode_asterisk_all(fields, n, rse, TRUE);
fields = explode_asterisk_all(fields, n, selection, TRUE);
}
return fields;
@ -1323,15 +1324,15 @@ static GPRE_NOD explode_asterisk( GPRE_NOD fields, int n, RSE rse)
// in the context list.
//
static GPRE_NOD explode_asterisk_all( GPRE_NOD fields, int n, RSE rse, BOOLEAN replace)
static GPRE_NOD explode_asterisk_all( GPRE_NOD fields, int n, rse* selection, BOOLEAN replace)
{
GPRE_CTX context;
int i, old_count;
assert_IS_NOD(fields);
for (i = 0; i < rse->rse_count; i++) {
context = rse->rse_context[i];
for (i = 0; i < selection->rse_count; i++) {
context = selection->rse_context[i];
old_count = fields->nod_count;
if (context->ctx_stream)
fields =
@ -1354,7 +1355,7 @@ static GPRE_NOD explode_asterisk_all( GPRE_NOD fields, int n, RSE rse, BOOLEAN r
static GPRE_FLD get_ref( GPRE_NOD expr)
{
REF ref;
ref* reference;
GPRE_NOD *ptr, *end, node;
GPRE_FLD field;
MEL element;
@ -1371,13 +1372,13 @@ static GPRE_FLD get_ref( GPRE_NOD expr)
switch (expr->nod_type) {
case nod_field:
ref = (REF) expr->nod_arg[0];
return ref->ref_field;
reference = (ref*) expr->nod_arg[0];
return reference->ref_field;
case nod_array:
ref = (REF) expr->nod_arg[0];
return ref->ref_field->fld_array;
reference = (ref*) expr->nod_arg[0];
return reference->ref_field->fld_array;
case nod_agg_count:
case nod_agg_max:
@ -1426,10 +1427,11 @@ static GPRE_NOD implicit_any(
GPRE_NOD value, enum nod_t comparison, enum nod_t any_all)
{
GPRE_NOD value2, node, node2, field_list;
RSE rse, sub;
rse* selection;
rse* sub;
GPRE_CTX original;
BOOLEAN distinct;
struct scope previous_scope;
scope previous_scope;
assert_IS_REQ(request);
assert_IS_NOD(value);
@ -1452,17 +1454,17 @@ static GPRE_NOD implicit_any(
field_list = MAKE_NODE(nod_list, 1);
field_list->nod_arg[0] = value2;
rse = par_rse(request, field_list, distinct);
value2 = rse->rse_fields->nod_arg[0];
selection = par_rse(request, field_list, distinct);
value2 = selection->rse_fields->nod_arg[0];
if (sub = rse->rse_aggregate) {
if (sub = selection->rse_aggregate) {
if (validate_references(value2, sub->rse_group_by))
PAR_error
("simple column reference not allowed in aggregate context");
if (sub->rse_group_by) {
node = MSC_binary(comparison, value, value2);
pair(node->nod_arg[0], node->nod_arg[1]);
rse->rse_boolean = merge(rse->rse_boolean, node);
selection->rse_boolean = merge(selection->rse_boolean, node);
if (any_all == nod_ansi_all)
node = MAKE_NODE(nod_ansi_all, 1);
else if (!(request->req_database->dbb_flags & DBB_v3))
@ -1470,12 +1472,12 @@ static GPRE_NOD implicit_any(
else
node = MAKE_NODE(nod_any, 1);
node->nod_count = 0;
node->nod_arg[0] = (GPRE_NOD) rse;
node->nod_arg[0] = (GPRE_NOD) selection;
}
else {
node2 = MAKE_NODE(nod_via, 3);
node2->nod_count = 0;
node2->nod_arg[0] = (GPRE_NOD) rse;
node2->nod_arg[0] = (GPRE_NOD) selection;
node2->nod_arg[2] = MAKE_NODE(nod_null, 0);
node2->nod_arg[1] = value2;
node = MSC_binary(comparison, value, node2);
@ -1485,7 +1487,7 @@ static GPRE_NOD implicit_any(
else {
node = MSC_binary(comparison, value, value2);
pair(node->nod_arg[0], node->nod_arg[1]);
rse->rse_boolean = merge(rse->rse_boolean, node);
selection->rse_boolean = merge(selection->rse_boolean, node);
if (any_all == nod_ansi_all)
node = MAKE_NODE(nod_ansi_all, 1);
else if (!(request->req_database->dbb_flags & DBB_v3))
@ -1493,10 +1495,10 @@ static GPRE_NOD implicit_any(
else
node = MAKE_NODE(nod_any, 1);
node->nod_count = 0;
node->nod_arg[0] = (GPRE_NOD) rse;
node->nod_arg[0] = (GPRE_NOD) selection;
}
EXP_rse_cleanup(rse);
EXP_rse_cleanup(selection);
pop_scope(request, &previous_scope);
request->req_in_subselect--;
@ -1950,7 +1952,7 @@ static GPRE_CTX par_join_clause( GPRE_REQ request, GPRE_CTX context1)
GPRE_CTX context2;
NOD_T join_type;
GPRE_NOD node;
RSE rse;
rse* selection;
assert_IS_REQ(request);
@ -1966,15 +1968,15 @@ static GPRE_CTX par_join_clause( GPRE_REQ request, GPRE_CTX context1)
node = SQE_boolean(request, NULL);
rse = (RSE) ALLOC(RSE_LEN(2));
rse->rse_count = 2;
rse->rse_context[0] = context1;
rse->rse_context[1] = context2;
rse->rse_boolean = node;
rse->rse_join_type = join_type;
selection = (rse*) ALLOC(RSE_LEN(2));
selection->rse_count = 2;
selection->rse_context[0] = context1;
selection->rse_context[1] = context2;
selection->rse_boolean = node;
selection->rse_join_type = join_type;
context1 = MAKE_CONTEXT(request);
context1->ctx_stream = rse;
context1->ctx_stream = selection;
return par_join_clause(request, context1);
}
@ -2056,10 +2058,10 @@ static GPRE_NOD par_multiply(
static GPRE_NOD par_not( GPRE_REQ request, USHORT * paren_count)
{
RSE rse;
rse* selection;
GPRE_NOD node, expr, field;
enum nod_t type;
struct scope saved_scope;
scope saved_scope;
assert_IS_REQ(request);
@ -2088,12 +2090,12 @@ static GPRE_NOD par_not( GPRE_REQ request, USHORT * paren_count)
node = MAKE_NODE(type, 1);
node->nod_count = 0;
rse = par_rse(request, 0, FALSE);
node->nod_arg[0] = (GPRE_NOD) rse;
selection = par_rse(request, 0, FALSE);
node->nod_arg[0] = (GPRE_NOD) selection;
if (field) {
SQE_resolve(field, 0, rse);
SQE_resolve(field, 0, selection);
expr = MSC_unary(nod_missing, field);
rse->rse_boolean = merge(negate(expr), rse->rse_boolean);
selection->rse_boolean = merge(negate(expr), selection->rse_boolean);
}
EXP_rse_cleanup((RSE) node->nod_arg[0]);
pop_scope(request, &saved_scope);
@ -2118,7 +2120,7 @@ static void par_order(
{
GPRE_NOD sort, *ptr, values;
LLS items, directions;
MAP map;
map* request_map;
int count, direction;
USHORT i;
@ -2160,8 +2162,8 @@ static void par_order(
if (union_f)
SYNTAX_ERROR("<column position in union>");
sort = SQE_value(request, FALSE, 0, 0);
if (request && (map = request->req_map))
sort = post_map(sort, map);
if (request && (request_map = request->req_map))
sort = post_map(sort, request_map);
}
if (MATCH(KW_ASCENDING))
direction = FALSE;
@ -2362,8 +2364,8 @@ static GPRE_NOD par_primitive_value(
{
GPRE_NOD node, node_arg;
REF reference;
OPS *op;
MAP map;
ops *op;
map* tmp_map;
USHORT distinct, local_count;
ACT action;
KWWORDS kw_word;
@ -2439,7 +2441,7 @@ static GPRE_NOD par_primitive_value(
EXP_left_paren("left parenthesis in statistical function");
distinct = MATCH(KW_DISTINCT);
if (request) {
map = request->req_map;
tmp_map = request->req_map;
request->req_map = NULL;
++request->req_in_aggregate;
}
@ -2458,9 +2460,9 @@ static GPRE_NOD par_primitive_value(
node->nod_arg[1] = node->nod_arg[0];
EXP_match_paren();
if (request) {
if (map)
node = post_map(node, map);
request->req_map = map;
if (tmp_map)
node = post_map(node, tmp_map);
request->req_map = tmp_map;
--request->req_in_aggregate;
}
return node;
@ -2540,7 +2542,7 @@ static GPRE_NOD par_relational( GPRE_REQ request, USHORT * paren_count)
{
GPRE_NOD node, expr1, expr2;
REF ref_value;
OPS *op;
ops *op;
int negation;
USHORT local_flag;
NOD_T *relational_ops;
@ -2654,7 +2656,7 @@ static GPRE_NOD par_relational( GPRE_REQ request, USHORT * paren_count)
static RSE par_rse( GPRE_REQ request, GPRE_NOD fields, BOOLEAN distinct)
{
GPRE_CTX context;
MAP map;
map* subselect_map;
GPRE_NOD *ptr, *end, node;
RSE select, sub_rse;
BOOLEAN aggregate;
@ -2752,15 +2754,15 @@ static RSE par_rse( GPRE_REQ request, GPRE_NOD fields, BOOLEAN distinct)
PAR_error
("simple column reference not allowed in aggregate context");
sub_rse = select;
sub_rse->rse_map = map = (MAP) ALLOC(sizeof(struct map));
sub_rse->rse_map = subselect_map = (map*) ALLOC(sizeof(map));
if (select->rse_group_by)
request->req_map = map;
map->map_context = MAKE_CONTEXT(request);
request->req_map = subselect_map;
subselect_map->map_context = MAKE_CONTEXT(request);
select = (RSE) ALLOC(RSE_LEN(0));
select->rse_aggregate = sub_rse;
if (fields)
select->rse_fields = copy_fields(sub_rse->rse_fields, map);
select->rse_fields = copy_fields(sub_rse->rse_fields, subselect_map);
if (MATCH(KW_HAVING)) {
++request->req_in_having_clause;
@ -2844,7 +2846,7 @@ static GPRE_NOD par_stat( GPRE_REQ request)
GPRE_NOD item;
RSE select;
BOOLEAN distinct;
struct scope previous_scope;
scope previous_scope;
assert_IS_REQ(request);
@ -2946,7 +2948,8 @@ static GPRE_NOD par_udf( GPRE_REQ request)
{
GPRE_NOD node;
GPRE_NOD *input;
UDF udf, tmp_udf;
udf* an_udf;
udf* tmp_udf;
USHORT local_count;
GPRE_FLD field;
SCHAR s[ERROR_LENGTH];
@ -2963,47 +2966,47 @@ static GPRE_NOD par_udf( GPRE_REQ request)
if ((QUOTED(token.tok_type)) || token.tok_type == tok_ident)
SQL_resolve_identifier("<Udf Name>", s);
if (request->req_database)
udf = MET_get_udf(request->req_database, token.tok_string);
an_udf = MET_get_udf(request->req_database, token.tok_string);
else {
/* no database was specified, check the metadata for all the databases
for the existence of the udf */
udf = NULL;
an_udf = NULL;
for (db = isc_databases; db; db = db->dbb_next)
if (tmp_udf = MET_get_udf(db, token.tok_string))
if (udf) {
if (an_udf) {
/* udf was found in more than one database */
sprintf(s, "UDF %s is ambiguous", token.tok_string);
PAR_error(s);
}
else {
udf = tmp_udf;
an_udf = tmp_udf;
request->req_database = db;
}
}
if (udf) {
if (an_udf) {
if ((SQL_DIALECT_V5 == sw_sql_dialect) &&
((dtype_sql_date == udf->udf_dtype) ||
(dtype_sql_time == udf->udf_dtype) ||
(dtype_int64 == udf->udf_dtype)))
dialect1_bad_type(udf->udf_dtype);
((dtype_sql_date == an_udf->udf_dtype) ||
(dtype_sql_time == an_udf->udf_dtype) ||
(dtype_int64 == an_udf->udf_dtype)))
dialect1_bad_type(an_udf->udf_dtype);
node = MAKE_NODE(nod_udf, 2);
node->nod_count = 1;
node->nod_arg[1] = (GPRE_NOD) udf;
node->nod_arg[1] = (GPRE_NOD) an_udf;
ADVANCE_TOKEN;
EXP_left_paren(0);
if (!(token.tok_keyword == KW_RIGHT_PAREN)) {
/* parse udf parameter references */
node->nod_arg[0] = SQE_list(SQE_value, request, FALSE);
if (udf->udf_args != node->nod_arg[0]->nod_count)
if (an_udf->udf_args != node->nod_arg[0]->nod_count)
PAR_error("count of UDF parameters doesn't match definition");
/* Match parameter types to the declared parameters */
for (input = node->nod_arg[0]->nod_arg,
field = udf->udf_inputs;
field = an_udf->udf_inputs;
field;
input++, field = field->fld_next)
SQE_post_field(*input, field);
@ -3059,7 +3062,7 @@ static GPRE_NOD par_udf( GPRE_REQ request)
if (MATCH(KW_YEAR) || MATCH(KW_MONTH) || MATCH(KW_DAY) ||
MATCH(KW_HOUR) || MATCH(KW_MINUTE) || MATCH(KW_SECOND) ||
MATCH(KW_WEEKDAY) || MATCH(KW_YEARDAY)) {
node->nod_arg[0] = (struct gpre_nod *) kw_word;
node->nod_arg[0] = (gpre_nod*) kw_word;
if (!MATCH(KW_FROM))
SYNTAX_ERROR("FROM");
}
@ -3149,7 +3152,7 @@ static GPRE_NOD par_udf_or_field_with_collate( GPRE_REQ request, BOOLEAN aster_o
// not the computations around them.
//
static GPRE_NOD post_fields( GPRE_NOD node, MAP map)
static GPRE_NOD post_fields( GPRE_NOD node, map* to_map)
{
GPRE_NOD *ptr, *end;
@ -3171,11 +3174,11 @@ static GPRE_NOD post_fields( GPRE_NOD node, MAP map)
case nod_agg_total:
case nod_agg_count:
case nod_map_ref:
return post_map(node, map);
return post_map(node, to_map);
case nod_udf:
case nod_gen_id:
node->nod_arg[0] = post_fields(node->nod_arg[0], map);
node->nod_arg[0] = post_fields(node->nod_arg[0], to_map);
break;
case nod_list:
@ -3189,11 +3192,11 @@ static GPRE_NOD post_fields( GPRE_NOD node, MAP map)
case nod_negate:
for (ptr = node->nod_arg, end = ptr + node->nod_count; ptr < end;
ptr++)
*ptr = post_fields(*ptr, map);
*ptr = post_fields(*ptr, to_map);
break;
// ** Begin date/time/timestamp support *
case nod_extract:
node->nod_arg[1] = post_fields(node->nod_arg[1], map);
node->nod_arg[1] = post_fields(node->nod_arg[1], to_map);
break;
// ** End date/time/timestamp support *
}
@ -3209,7 +3212,7 @@ static GPRE_NOD post_fields( GPRE_NOD node, MAP map)
// than the expression itself).
//
static GPRE_NOD post_map( GPRE_NOD node, MAP map)
static GPRE_NOD post_map( GPRE_NOD node, map* to_map)
{
MEL element;
@ -3220,22 +3223,22 @@ static GPRE_NOD post_map( GPRE_NOD node, MAP map)
if (node->nod_type == nod_map_ref) {
element = (MEL) node->nod_arg[0];
if (element->mel_context == map->map_context)
if (element->mel_context == to_map->map_context)
return node;
}
for (element = map->map_elements; element; element = element->mel_next)
for (element = to_map->map_elements; element; element = element->mel_next)
if (compare_expr(node, element->mel_expr))
return MSC_unary(nod_map_ref, (GPRE_NOD) element);
// We need to make up a new map reference
element = (MEL) ALLOC(sizeof(struct mel));
element->mel_next = map->map_elements;
map->map_elements = element;
element->mel_position = map->map_count++;
element = (MEL) ALLOC(sizeof(mel));
element->mel_next = to_map->map_elements;
to_map->map_elements = element;
element->mel_position = to_map->map_count++;
element->mel_expr = node;
element->mel_context = map->map_context;
element->mel_context = to_map->map_context;
// Make up a reference to the map element
@ -3252,7 +3255,7 @@ static GPRE_NOD post_map( GPRE_NOD node, MAP map)
// a UNION. See BUG_8021 & BUG_8000 for examples.
//
static GPRE_NOD post_select_list( GPRE_NOD fields, MAP map)
static GPRE_NOD post_select_list( GPRE_NOD fields, map* to_map)
{
GPRE_NOD list;
USHORT i;
@ -3262,7 +3265,7 @@ static GPRE_NOD post_select_list( GPRE_NOD fields, MAP map)
list = MAKE_NODE(nod_list, fields->nod_count);
for (i = 0; i < fields->nod_count; i++)
list->nod_arg[i] = post_map(fields->nod_arg[i], map);
list->nod_arg[i] = post_map(fields->nod_arg[i], to_map);
return list;
}
@ -3273,7 +3276,7 @@ static GPRE_NOD post_select_list( GPRE_NOD fields, MAP map)
// Restore saved scoping information to the request block
//
static void pop_scope( GPRE_REQ request, struct scope *save_scope)
static void pop_scope(GPRE_REQ request, scope* save_scope)
{
assert_IS_REQ(request);
@ -3292,7 +3295,7 @@ static void pop_scope( GPRE_REQ request, struct scope *save_scope)
// Save scoping information from the request block
//
static void push_scope( GPRE_REQ request, struct scope *save_scope)
static void push_scope(GPRE_REQ request, scope* save_scope)
{
assert_IS_REQ(request);
@ -3451,15 +3454,15 @@ static GPRE_FLD resolve(
// If successful, return the context. Otherwise return NULL.
//
static GPRE_CTX resolve_asterisk( TOK q_token, RSE rse)
static GPRE_CTX resolve_asterisk( TOK q_token, rse* selection)
{
GPRE_CTX context;
RSE rs_stream;
SYM symbol;
int i;
for (i = 0; i < rse->rse_count; i++) {
context = rse->rse_context[i];
for (i = 0; i < selection->rse_count; i++) {
context = selection->rse_context[i];
if (rs_stream = context->ctx_stream) {
if (context = resolve_asterisk(q_token, rs_stream))
return context;

View File

@ -25,7 +25,7 @@
//
//____________________________________________________________
//
// $Id: sql.cpp,v 1.14 2003-07-04 16:45:22 brodsom Exp $
// $Id: sql.cpp,v 1.15 2003-09-05 10:14:08 aafemt Exp $
//
#include "firebird.h"
@ -752,7 +752,7 @@ void SQL_par_field_dtype( GPRE_REQ request, GPRE_FLD field, BOOLEAN udf)
// Check for array declaration
if ((keyword != KW_BLOB) && !udf && (MATCH(KW_L_BRCKET))) {
field->fld_array_info = (struct ary *) ALLOC(sizeof(struct ary));
field->fld_array_info = (ary*) ALLOC(sizeof(ary));
par_array(field);
}
@ -1699,7 +1699,7 @@ static ACT act_create_database(void)
action = MAKE_ACTION(request, ACT_create_database);
mdb = (MDBB) ALLOC(sizeof(struct mdbb));
mdb = (MDBB) ALLOC(sizeof(mdbb));
mdb->mdbb_database = db;
action->act_object = (REF) mdb;
action->act_whenever = gen_whenever();
@ -1985,7 +1985,7 @@ static ACT act_create_table(void)
GPRE_FLD *ptr;
GPRE_REQ request;
GPRE_REL relation;
CNSTRT *cnstrt;
cnstrt** constraint_ptr;
GPRE_CTX context;
TEXT *string;
@ -2026,7 +2026,7 @@ static ACT act_create_table(void)
EXP_left_paren(0);
ptr = &relation->rel_fields;
cnstrt = &relation->rel_constraints;
constraint_ptr = &relation->rel_constraints;
for (;;) {
switch (token.tok_keyword) {
@ -2035,8 +2035,8 @@ static ACT act_create_table(void)
case KW_UNIQUE:
case KW_FOREIGN:
case KW_CHECK:
*cnstrt = par_table_constraint(request, relation);
cnstrt = &(*cnstrt)->cnstrt_next;
*constraint_ptr = par_table_constraint(request, relation);
constraint_ptr = &(*constraint_ptr)->cnstrt_next;
break;
default:
@ -2507,7 +2507,7 @@ static ACT act_declare_udf(void)
{
ACT action;
GPRE_REQ request;
DECL_UDF udf;
DECL_UDF udf_declaration;
GPRE_FLD *ptr, field;
SLONG return_parameter;
@ -2519,9 +2519,9 @@ static ACT act_declare_udf(void)
PAR_error
("Can only DECLARE EXTERNAL FUNCTION in context of single database");
udf = (DECL_UDF) ALLOC(DECL_UDF_LEN);
udf->decl_udf_name = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", udf->decl_udf_name);
udf_declaration = (DECL_UDF) ALLOC(DECL_UDF_LEN);
udf_declaration->decl_udf_name = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", udf_declaration->decl_udf_name);
if (token.tok_length > NAME_SIZE)
PAR_error("external function name too long");
ADVANCE_TOKEN;
@ -2529,9 +2529,9 @@ static ACT act_declare_udf(void)
// create action block
action = MAKE_ACTION(request, ACT_declare_udf);
action->act_whenever = gen_whenever();
action->act_object = (REF) udf;
action->act_object = (REF) udf_declaration;
ptr = &udf->decl_udf_arg_list;
ptr = &udf_declaration->decl_udf_arg_list;
while (TRUE) {
if (MATCH(KW_RETURNS)) {
if (MATCH(KW_PARAMETER)) {
@ -2539,19 +2539,19 @@ static ACT act_declare_udf(void)
if (return_parameter > 10)
PAR_error("return parameter not in range");
assert(return_parameter <= MAX_SSHORT);
udf->decl_udf_return_parameter = (SSHORT) return_parameter;
udf_declaration->decl_udf_return_parameter = (SSHORT) return_parameter;
}
else {
field = (GPRE_FLD) ALLOC(FLD_LEN);
field->fld_flags |= (FLD_meta | FLD_meta_cstring);
SQL_par_field_dtype(request, field, TRUE);
SQL_adjust_field_dtype(field);
udf->decl_udf_return_type = field;
udf_declaration->decl_udf_return_type = field;
MATCH(KW_BY);
if (MATCH(KW_VALUE))
udf->decl_udf_return_mode = FUN_value;
udf_declaration->decl_udf_return_mode = FUN_value;
else
udf->decl_udf_return_mode = FUN_reference;
udf_declaration->decl_udf_return_mode = FUN_reference;
}
break;
}
@ -2567,12 +2567,12 @@ static ACT act_declare_udf(void)
}
if (MATCH(KW_ENTRY_POINT))
udf->decl_udf_entry_point = extract_string(TRUE);
udf_declaration->decl_udf_entry_point = extract_string(TRUE);
else
SYNTAX_ERROR("ENTRY_POINT");
if (MATCH(KW_MODULE_NAME))
udf->decl_udf_module_name = extract_string(TRUE);
udf_declaration->decl_udf_module_name = extract_string(TRUE);
else
SYNTAX_ERROR("MODULE_NAME");
@ -2592,7 +2592,7 @@ static ACT act_delete(void)
ACT action;
GPRE_REQ request;
GPRE_REL relation;
RSE rse;
rse* selection;
GPRE_CTX context;
UPD update;
SYM alias;
@ -2646,13 +2646,13 @@ static ACT act_delete(void)
}
request->req_trans = transaction;
relation = SQL_relation(request, r_name, db_name, owner_name, TRUE);
rse = request->req_rse;
for (i = 0; i < rse->rse_count; i++) {
context = rse->rse_context[i];
selection = request->req_rse;
for (i = 0; i < selection->rse_count; i++) {
context = selection->rse_context[i];
if (context->ctx_relation == relation)
break;
}
if (i == rse->rse_count)
if (i == selection->rse_count)
PAR_error("table not in request");
update->upd_request = request;
update->upd_source = context;
@ -2670,9 +2670,9 @@ static ACT act_delete(void)
relation = SQL_relation(request, r_name, db_name, owner_name, TRUE);
request->req_rse = rse = (RSE) ALLOC(RSE_LEN(1));
rse->rse_count = 1;
rse->rse_context[0] = context = MAKE_CONTEXT(request);
request->req_rse = selection = (rse*) ALLOC(RSE_LEN(1));
selection->rse_count = 1;
selection->rse_context[0] = context = MAKE_CONTEXT(request);
context->ctx_relation = relation;
if (alias && !token.tok_symbol) {
@ -2685,7 +2685,7 @@ static ACT act_delete(void)
}
if (where)
rse->rse_boolean = SQE_boolean(request, 0);
selection->rse_boolean = SQE_boolean(request, 0);
request->req_node = MAKE_NODE(nod_erase, 0);
action = MAKE_ACTION(request, ACT_loop);
@ -2802,7 +2802,7 @@ static ACT act_drop(void)
GPRE_REL relation;
SYM symbol;
SCHAR *db_string;
TEXT *str;
TEXT *identifier_name;
SLONG num;
switch (token.tok_keyword) {
@ -2833,11 +2833,11 @@ static ACT act_drop(void)
else
PAR_error("Can only DROP DOMAIN in context of single database");
ADVANCE_TOKEN;
str = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", str);
identifier_name = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", identifier_name);
action = MAKE_ACTION(request, ACT_drop_domain);
action->act_whenever = gen_whenever();
action->act_object = (REF) str;
action->act_object = (REF) identifier_name;
ADVANCE_TOKEN;
return action;
@ -2848,11 +2848,11 @@ static ACT act_drop(void)
else
PAR_error("Can only DROP FILTER in context of single database");
ADVANCE_TOKEN;
str = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", str);
identifier_name = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", identifier_name);
action = MAKE_ACTION(request, ACT_drop_filter);
action->act_whenever = gen_whenever();
action->act_object = (REF) str;
action->act_object = (REF) identifier_name;
ADVANCE_TOKEN;
return action;
@ -2868,19 +2868,19 @@ static ACT act_drop(void)
PAR_error
("Can only DROP EXTERNAL FUNCTION in context of a single database");
str = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", str);
identifier_name = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", identifier_name);
action = MAKE_ACTION(request, ACT_drop_udf);
action->act_whenever = gen_whenever();
action->act_object = (REF) str;
action->act_object = (REF) identifier_name;
ADVANCE_TOKEN;
return action;
case KW_INDEX:
request = MAKE_REQUEST(REQ_ddl);
ADVANCE_TOKEN;
str = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", str);
identifier_name = (TEXT *) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<identifier>", identifier_name);
index = make_index(request, token.tok_string);
action = MAKE_ACTION(request, ACT_drop_index);
action->act_whenever = gen_whenever();
@ -4452,7 +4452,7 @@ static ACT act_update(void)
ACT action, slice_action;
GPRE_REQ request, slice_request;
GPRE_REL relation;
RSE rse;
rse* selection;
GPRE_CTX input_context, update_context;
GPRE_NOD set_list, *end_list, set_item, modify, *ptr;
UPD update;
@ -4551,14 +4551,14 @@ static ACT act_update(void)
/* Given the target relation, find the input context for the modify */
rse = request->req_rse;
for (i = 0; i < rse->rse_count; i++) {
input_context = rse->rse_context[i];
selection = request->req_rse;
for (i = 0; i < selection->rse_count; i++) {
input_context = selection->rse_context[i];
if (input_context->ctx_relation == relation)
break;
}
if (i == rse->rse_count)
if (i == selection->rse_count)
PAR_error("table not in request");
/* Resolve input fields first */
@ -4644,9 +4644,9 @@ static ACT act_update(void)
// Generate record select expression, then resolve input values
request->req_rse = rse = (RSE) ALLOC(RSE_LEN(1));
rse->rse_count = 1;
rse->rse_context[0] = input_context;
request->req_rse = selection = (rse*) ALLOC(RSE_LEN(1));
selection->rse_count = 1;
selection->rse_context[0] = input_context;
if (!alias && !token.tok_symbol)
/* may have a relation name put parser didn't know it when it parsed it */
@ -4654,13 +4654,13 @@ static ACT act_update(void)
for (ptr = set_list->nod_arg; ptr < end_list; ptr++) {
set_item = *ptr;
SQE_resolve(set_item->nod_arg[0], request, rse);
SQE_resolve(set_item->nod_arg[0], request, selection);
}
// Process boolean, if any
if (where)
rse->rse_boolean = SQE_boolean(request, 0);
selection->rse_boolean = SQE_boolean(request, 0);
// Resolve update fields to update context
@ -4703,7 +4703,7 @@ static ACT act_update(void)
pair(set_item->nod_arg[0], set_item->nod_arg[1]);
}
request->req_node = modify = MAKE_NODE(nod_modify, 1);;
request->req_node = modify = MAKE_NODE(nod_modify, 1);
modify->nod_arg[0] = set_list;
action = MAKE_ACTION(request, ACT_loop);
@ -4749,7 +4749,7 @@ static ACT act_whenever(void)
else if ((MATCH(KW_GO) && MATCH(KW_TO)) || MATCH(KW_GOTO)) {
MATCH(KW_COLON);
l = token.tok_length;
label = (SWE) ALLOC(sizeof(struct swe) + l);
label = (SWE) ALLOC(sizeof(swe) + l);
label->swe_condition = condition;
if (label->swe_length = l) {
p = label->swe_label;
@ -4858,7 +4858,7 @@ static FIL define_cache(void)
TEXT *string;
TEXT err_string[256];
file = (FIL) ALLOC(sizeof(struct fil));
file = (FIL) ALLOC(sizeof(fil));
if (QUOTED(token.tok_type)) {
file->fil_name = string = (TEXT *) ALLOC(token.tok_length + 1);
COPY(token.tok_string, token.tok_length, string);
@ -4895,7 +4895,7 @@ static FIL define_file(void)
FIL file;
TEXT *string;
file = (FIL) ALLOC(sizeof(struct fil));
file = (FIL) ALLOC(sizeof(fil));
if (QUOTED(token.tok_type)) {
file->fil_name = string = (TEXT *) ALLOC(token.tok_length + 1);
COPY(token.tok_string, token.tok_length, string);
@ -4939,7 +4939,7 @@ static FIL define_log_file( BOOLEAN log_serial)
TEXT *string;
TEXT err_string[256];
file = (FIL) ALLOC(sizeof(struct fil));
file = (FIL) ALLOC(sizeof(fil));
if (QUOTED(token.tok_type)) {
file->fil_name = string = (TEXT *) ALLOC(token.tok_length + 1);
COPY(token.tok_string, token.tok_length, string);
@ -5089,7 +5089,7 @@ static SWE gen_whenever(void)
if (proto = whenever[i]) {
prior = label;
l = proto->swe_length;
label = (SWE) ALLOC(sizeof(struct swe) + l);
label = (SWE) ALLOC(sizeof(swe) + l);
label->swe_next = prior;
label->swe_condition = proto->swe_condition;
if (l) {
@ -5380,7 +5380,7 @@ static SSHORT par_char_set(void)
static void par_computed( GPRE_REQ request, GPRE_FLD field)
{
CMPF cmp;
struct gpre_fld save_fld;
gpre_fld save_fld;
MATCH(KW_BY);
@ -5507,7 +5507,7 @@ static GPRE_FLD par_field( GPRE_REQ request, GPRE_REL relation)
{
GPRE_FLD field;
// *IND index;
CNSTRT *cnstrt;
cnstrt** constraint_ref;
int in_constraints;
GPRE_NOD literal_node;
@ -5560,7 +5560,7 @@ static GPRE_FLD par_field( GPRE_REQ request, GPRE_REL relation)
// Check for any column level constraints
cnstrt = &field->fld_constraints;
constraint_ref = &field->fld_constraints;
in_constraints = TRUE;
while (in_constraints) {
@ -5571,8 +5571,8 @@ static GPRE_FLD par_field( GPRE_REQ request, GPRE_REL relation)
case KW_REFERENCES:
case KW_CHECK:
case KW_NOT:
*cnstrt = par_field_constraint(request, field, relation);
cnstrt = &(*cnstrt)->cnstrt_next;
*constraint_ref = par_field_constraint(request, field, relation);
constraint_ref = &(*constraint_ref)->cnstrt_next;
break;
default:
@ -5613,16 +5613,14 @@ static GPRE_FLD par_field( GPRE_REQ request, GPRE_REL relation)
static CNSTRT par_field_constraint( GPRE_REQ request, GPRE_FLD for_field, GPRE_REL relation)
{
enum kwwords keyword;
CNSTRT cnstrt;
cnstrt* new_constraint = (cnstrt*) ALLOC(CNSTRT_LEN);
STR field_name;
cnstrt = (CNSTRT) ALLOC(CNSTRT_LEN);
if (token.tok_keyword == KW_CONSTRAINT) {
ADVANCE_TOKEN;
cnstrt->cnstrt_name = (STR) ALLOC(NAME_SIZE + 1);
new_constraint->cnstrt_name = (STR) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<constraint name>",
(TEXT *) cnstrt->cnstrt_name);
(TEXT *) new_constraint->cnstrt_name);
if (token.tok_length > NAME_SIZE)
PAR_error("Constraint name too long");
ADVANCE_TOKEN;
@ -5633,7 +5631,7 @@ static CNSTRT par_field_constraint( GPRE_REQ request, GPRE_FLD for_field, GPRE_R
ADVANCE_TOKEN;
if (!MATCH(KW_NULL))
SYNTAX_ERROR("NULL");
cnstrt->cnstrt_type = CNSTRT_NOT_NULL;
new_constraint->cnstrt_type = CNSTRT_NOT_NULL;
for_field->fld_flags |= FLD_not_null;
break;
@ -5644,26 +5642,26 @@ static CNSTRT par_field_constraint( GPRE_REQ request, GPRE_FLD for_field, GPRE_R
if (keyword == KW_PRIMARY) {
if (!MATCH(KW_KEY))
SYNTAX_ERROR("KEY");
cnstrt->cnstrt_type = CNSTRT_PRIMARY_KEY;
new_constraint->cnstrt_type = CNSTRT_PRIMARY_KEY;
}
else if (keyword == KW_REFERENCES) {
cnstrt->cnstrt_type = CNSTRT_FOREIGN_KEY;
new_constraint->cnstrt_type = CNSTRT_FOREIGN_KEY;
}
else
cnstrt->cnstrt_type = CNSTRT_UNIQUE;
new_constraint->cnstrt_type = CNSTRT_UNIQUE;
/* Set field for PRIMARY KEY or FOREIGN KEY or UNIQUE constraint */
field_name = (STR) ALLOC(NAME_SIZE + 1);
strcpy((char *) field_name, for_field->fld_symbol->sym_string);
PUSH((GPRE_NOD) field_name, &cnstrt->cnstrt_fields);
PUSH((GPRE_NOD) field_name, &new_constraint->cnstrt_fields);
if (keyword == KW_REFERENCES) {
/* Relation name for foreign key */
cnstrt->cnstrt_referred_rel = (STR) ALLOC(NAME_SIZE + 1);
new_constraint->cnstrt_referred_rel = (STR) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("referred <table name>",
(TEXT *) cnstrt->cnstrt_referred_rel);
(TEXT *) new_constraint->cnstrt_referred_rel);
if (token.tok_length > NAME_SIZE)
PAR_error("Referred table name too long");
ADVANCE_TOKEN;
@ -5673,16 +5671,16 @@ static CNSTRT par_field_constraint( GPRE_REQ request, GPRE_FLD for_field, GPRE_R
field_name = (STR) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<column name>", (TEXT *) field_name);
PUSH((GPRE_NOD) field_name, &cnstrt->cnstrt_referred_fields);
PUSH((GPRE_NOD) field_name, &new_constraint->cnstrt_referred_fields);
CPR_token();
EXP_match_paren();
}
if (token.tok_keyword == KW_ON) {
par_fkey_extension(cnstrt);
par_fkey_extension(new_constraint);
ADVANCE_TOKEN;
if (token.tok_keyword == KW_ON) {
par_fkey_extension(cnstrt);
par_fkey_extension(new_constraint);
ADVANCE_TOKEN;
}
}
@ -5691,17 +5689,17 @@ static CNSTRT par_field_constraint( GPRE_REQ request, GPRE_FLD for_field, GPRE_R
case KW_CHECK:
ADVANCE_TOKEN;
cnstrt->cnstrt_type = CNSTRT_CHECK;
cnstrt->cnstrt_text = CPR_start_text();
cnstrt->cnstrt_boolean = SQE_boolean(request, 0);
CPR_end_text(cnstrt->cnstrt_text);
new_constraint->cnstrt_type = CNSTRT_CHECK;
new_constraint->cnstrt_text = CPR_start_text();
new_constraint->cnstrt_boolean = SQE_boolean(request, 0);
CPR_end_text(new_constraint->cnstrt_text);
break;
default:
PAR_error("Invalid constraint type");
}
return cnstrt;
return new_constraint;
}
@ -5906,18 +5904,16 @@ static void par_fkey_extension( CNSTRT cnstrt)
static CNSTRT par_table_constraint( GPRE_REQ request, GPRE_REL relation)
{
enum kwwords keyword;
CNSTRT cnstrt;
cnstrt* constraint = (cnstrt*) ALLOC(CNSTRT_LEN);
LLS *fields;
STR field_name;
USHORT num_for_key_flds = 0, num_prim_key_flds = 0;
cnstrt = (CNSTRT) ALLOC(CNSTRT_LEN);
if (token.tok_keyword == KW_CONSTRAINT) {
ADVANCE_TOKEN;
cnstrt->cnstrt_name = (STR) ALLOC(NAME_SIZE + 1);
constraint->cnstrt_name = (STR) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<constraint name>",
(TEXT *) cnstrt->cnstrt_name);
(TEXT *) constraint->cnstrt_name);
if (token.tok_length > NAME_SIZE)
PAR_error("Constraint name too long");
ADVANCE_TOKEN;
@ -5931,22 +5927,22 @@ static CNSTRT par_table_constraint( GPRE_REQ request, GPRE_REL relation)
if (keyword == KW_PRIMARY) {
if (!MATCH(KW_KEY))
SYNTAX_ERROR("KEY");
cnstrt->cnstrt_type = CNSTRT_PRIMARY_KEY;
constraint->cnstrt_type = CNSTRT_PRIMARY_KEY;
}
else if (keyword == KW_FOREIGN) {
if (!MATCH(KW_KEY))
SYNTAX_ERROR("KEY");
cnstrt->cnstrt_type = CNSTRT_FOREIGN_KEY;
constraint->cnstrt_type = CNSTRT_FOREIGN_KEY;
}
else
cnstrt->cnstrt_type = CNSTRT_UNIQUE;
constraint->cnstrt_type = CNSTRT_UNIQUE;
EXP_left_paren(0);
/* Get list of fields for PRIMARY KEY or FOREIGN KEY or UNIQUE
constraint */
fields = &cnstrt->cnstrt_fields;
fields = &constraint->cnstrt_fields;
do {
field_name = (STR) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<column name>", (TEXT *) field_name);
@ -5966,19 +5962,19 @@ static CNSTRT par_table_constraint( GPRE_REQ request, GPRE_REL relation)
/* Relation name for foreign key */
cnstrt->cnstrt_referred_rel = (STR) ALLOC(NAME_SIZE + 1);
constraint->cnstrt_referred_rel = (STR) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("referred <table name>",
(TEXT *) cnstrt->cnstrt_referred_rel);
(TEXT *) constraint->cnstrt_referred_rel);
if (token.tok_length > NAME_SIZE)
PAR_error("Referred table name too long");
ADVANCE_TOKEN;
cnstrt->cnstrt_referred_fields = NULL;
constraint->cnstrt_referred_fields = NULL;
if (MATCH(KW_LEFT_PAREN)) {
/* Fields specified for referred relation */
fields = &cnstrt->cnstrt_referred_fields;
fields = &constraint->cnstrt_referred_fields;
do {
field_name = (STR) ALLOC(NAME_SIZE + 1);
SQL_resolve_identifier("<column name>",
@ -5995,15 +5991,15 @@ static CNSTRT par_table_constraint( GPRE_REQ request, GPRE_REL relation)
/* Don't print error message in case if <referenced column list>
is not specified. Try to catch them in cmd.c[create_constraint]
later on */
if (cnstrt->cnstrt_referred_fields != NULL &&
if (constraint->cnstrt_referred_fields != NULL &&
num_prim_key_flds != num_for_key_flds)
PAR_error
("FOREIGN KEY column count does not match PRIMARY KEY");
if (token.tok_keyword == KW_ON) {
par_fkey_extension(cnstrt);
par_fkey_extension(constraint);
ADVANCE_TOKEN;
if (token.tok_keyword == KW_ON) {
par_fkey_extension(cnstrt);
par_fkey_extension(constraint);
ADVANCE_TOKEN;
}
}
@ -6012,17 +6008,17 @@ static CNSTRT par_table_constraint( GPRE_REQ request, GPRE_REL relation)
case KW_CHECK:
ADVANCE_TOKEN;
cnstrt->cnstrt_type = CNSTRT_CHECK;
cnstrt->cnstrt_text = CPR_start_text();
cnstrt->cnstrt_boolean = SQE_boolean(request, 0);
CPR_end_text(cnstrt->cnstrt_text);
constraint->cnstrt_type = CNSTRT_CHECK;
constraint->cnstrt_text = CPR_start_text();
constraint->cnstrt_boolean = SQE_boolean(request, 0);
CPR_end_text(constraint->cnstrt_text);
break;
default:
PAR_error("Invalid constraint type");
}
return cnstrt;
return constraint;
}