8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-31 11:23:02 +01:00
firebird-mirror/src/qli/compile.h

252 lines
6.4 KiB
C
Raw Normal View History

2001-05-23 15:26:42 +02:00
/*
* PROGRAM: JRD Command Oriented Query Language
* MODULE: compile.h
* DESCRIPTION: Parser/compiler definitions
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
#ifndef QLI_COMPILE_H
#define QLI_COMPILE_H
2001-05-23 15:26:42 +02:00
2008-12-05 01:56:15 +01:00
// Name nodes -- used to hold names between parse and compilation
2001-05-23 15:26:42 +02:00
typedef struct nam {
2004-02-02 12:02:12 +01:00
blk nam_header;
2008-12-05 01:56:15 +01:00
qli_symbol* nam_symbol; // Symbol pointer, if any
USHORT nam_length; // Length of name
TEXT nam_string[1]; // Actual name string
2001-05-23 15:26:42 +02:00
} *NAM;
2008-12-05 01:56:15 +01:00
// Qualified procedure node -- used to hold qualified procedure names
2001-05-23 15:26:42 +02:00
typedef struct qpr {
2003-09-19 12:26:46 +02:00
blk qpr_header;
2009-01-10 11:51:02 +01:00
qli_dbb* qpr_database; // database block
2008-12-05 01:56:15 +01:00
nam* qpr_name; // name block
2001-05-23 15:26:42 +02:00
} *QPR;
2008-12-05 01:56:15 +01:00
// Qualified function node -- used to hold qualified function names
2001-05-23 15:26:42 +02:00
typedef struct qfn {
2003-09-19 12:26:46 +02:00
blk qfn_header;
2009-01-10 11:51:02 +01:00
qli_dbb* qfn_database; // database block
2008-12-05 01:56:15 +01:00
nam* qfn_name; // name block
2001-05-23 15:26:42 +02:00
} *QFN;
2008-12-05 01:56:15 +01:00
// Qualified filter node -- used to hold qualified filter names
2001-05-23 15:26:42 +02:00
typedef struct qfl {
2003-09-19 12:26:46 +02:00
blk qfl_header;
2009-01-10 11:51:02 +01:00
qli_dbb* qfl_database; // database block
2008-12-05 01:56:15 +01:00
nam* qfl_name; // name block
2001-05-23 15:26:42 +02:00
} *QFL;
2008-12-05 01:56:15 +01:00
// SHOW options
2001-05-23 15:26:42 +02:00
2003-08-22 12:56:55 +02:00
enum show_t {
2001-05-23 15:26:42 +02:00
show_all,
show_relation,
show_relations,
show_system_relations,
show_database,
show_databases,
show_procedure,
show_procedures,
show_version,
show_variable,
show_variables,
show_indices,
2008-12-09 08:24:32 +01:00
//show_qualified_procedure,
2001-05-23 15:26:42 +02:00
show_field,
show_filter,
show_filters,
show_global_field,
show_global_fields,
show_trigger,
show_triggers,
show_security_class,
show_security_classes,
2008-12-09 08:24:32 +01:00
//show_forms,
2001-05-23 15:26:42 +02:00
show_function,
show_functions,
show_views,
show_system_triggers,
show_matching_language,
show_db_indices,
show_db_fields
};
2003-08-22 12:56:55 +02:00
enum set_t {
2001-05-23 15:26:42 +02:00
set_blr,
set_statistics,
2008-12-11 02:07:15 +01:00
//set_epilog, // Unused
2001-05-23 15:26:42 +02:00
set_columns,
set_lines,
set_semi,
set_echo,
2008-12-09 08:24:32 +01:00
//set_form,
2001-05-23 15:26:42 +02:00
set_matching_language,
set_prompt,
set_continuation,
set_user,
set_password,
2008-12-09 08:24:32 +01:00
//set_euc_justify, // JPN specific option
2001-05-23 15:26:42 +02:00
set_count,
2004-08-25 01:00:17 +02:00
set_charset
2001-05-23 15:26:42 +02:00
#ifdef DEV_BUILD
2004-08-25 01:00:17 +02:00
,set_hex_output,
2001-05-23 15:26:42 +02:00
set_explain
#endif
};
2008-12-05 01:56:15 +01:00
// Position assignments for syntax tree nodes
2001-05-23 15:26:42 +02:00
2008-12-05 01:56:15 +01:00
const int s_rel_relation = 0; // Actual relation block
const int s_rel_context = 1; // Symbol block for context, if any
2004-05-16 03:42:11 +02:00
const int s_rel_count = 2;
2008-12-05 01:56:15 +01:00
const int s_prt_list = 0; // Print list
const int s_prt_rse = 1; // Rse, if any
const int s_prt_output = 2; // Output file, if any
const int s_prt_distinct = 3; // Simple flag indicating distinct
const int s_prt_order = 4; // SQL order clause
2004-05-16 03:42:11 +02:00
const int s_prt_form = 5;
const int s_prt_count = 6;
2008-12-05 01:56:15 +01:00
const int s_rse_first = 0; // FIRST clause, if any
const int s_rse_boolean = 1; // Boolean clause, if any
const int s_rse_sort = 2; // Sort clause, if any
const int s_rse_reduced = 3; // Reduced clause, if any
2004-05-16 03:42:11 +02:00
const int s_rse_group_by = 4;
const int s_rse_having = 5;
2008-12-05 01:56:15 +01:00
const int s_rse_outer = 6; // Outer context value (implicit ANY)
const int s_rse_inner = 7; // Inner context value
const int s_rse_op = 8; // Comparison operator
const int s_rse_join_type = 9; // Join type
const int s_rse_all_flag = 10; // Explicit "ALL" flag
2004-05-16 03:42:11 +02:00
const int s_rse_list = 11;
const int s_rse_count = 12;
2001-05-23 15:26:42 +02:00
2004-05-16 03:42:11 +02:00
const int s_for_rse = 0;
const int s_for_statement = 1;
const int s_for_count = 2;
2008-12-05 01:56:15 +01:00
const int s_itm_value = 0; // Value of print item
const int s_itm_edit_string = 1; // Edit string, if any
const int s_itm_header = 2; // Query header, if any
2004-05-16 03:42:11 +02:00
const int s_itm_count = 3;
const int s_sto_relation = 0;
const int s_sto_statement = 1;
const int s_sto_rse = 2;
const int s_sto_fields = 3;
const int s_sto_values = 4;
const int s_sto_form = 5;
const int s_sto_count = 6;
const int s_asn_from = 0;
const int s_asn_to = 1;
const int s_asn_count = 2;
2008-12-05 01:56:15 +01:00
const int s_mod_list = 0; // Field list
const int s_mod_statement = 1; // Sub-statement
const int s_mod_rse = 2; // Record selection expression
2004-05-16 03:42:11 +02:00
const int s_mod_form = 3;
const int s_mod_count = 4;
const int s_era_rse = 0;
const int s_era_count = 1;
const int s_rpt_value = 0;
const int s_rpt_statement = 1;
const int s_rpt_count = 2;
const int s_if_boolean = 0;
const int s_if_true = 1;
const int s_if_false = 2;
const int s_if_count = 3;
const int s_stt_rse = 0;
const int s_stt_value = 1;
const int s_stt_default = 2;
const int s_stt_distinct = 3;
const int s_stt_count = 4;
const int s_out_file = 0;
const int s_out_pipe = 1;
const int s_out_count = 2;
const int s_fmt_value = 0;
const int s_fmt_edit = 1;
const int s_fmt_count = 2;
const int s_dfi_name = 0;
2008-12-05 01:56:15 +01:00
const int s_dfi_relation = 1; // Define index
2004-05-16 03:42:11 +02:00
const int s_dfi_fields = 2;
const int s_dfi_count = 3;
2008-12-05 01:56:15 +01:00
const int s_mfi_name = 0; // Modify an index
2004-05-16 03:42:11 +02:00
const int s_mfi_database = 1;
const int s_mfi_count = 2;
const int s_ffr_form = 0;
const int s_ffr_statement = 1;
const int s_ffr_count = 2;
const int s_frm_form = 0;
const int s_frm_context = 1;
const int s_frm_database = 2;
const int s_frm_count = 3;
const int s_men_string = 0;
const int s_men_labels = 1;
const int s_men_statements = 2;
const int s_men_count = 3;
const int s_fun_args = 0;
const int s_fun_function = 1;
const int s_fun_count = 2;
2008-12-05 01:56:15 +01:00
const int s_idx_field = 0; // array subscript
2004-05-16 03:42:11 +02:00
const int s_idx_subs = 1;
const int s_idx_count = 2;
const int s_crv_name = 0;
const int s_crv_rse = 1;
const int s_crv_count = 2;
const int s_grant_fields = 0;
const int s_grant_relation = 1;
const int s_grant_users = 2;
const int s_grant_privileges = 3;
const int s_grant_count = 4;
2001-05-23 15:26:42 +02:00
2008-12-05 01:56:15 +01:00
// some flags for index definitions
2001-05-23 15:26:42 +02:00
2004-05-16 03:42:11 +02:00
const USHORT s_dfi_flag_unique = 1;
const USHORT s_dfi_flag_inactive = 2;
const USHORT s_dfi_flag_activity = 4;
const USHORT s_dfi_flag_selectivity = 8;
const USHORT s_dfi_flag_descending = 16;
const USHORT s_dfi_flag_order = 32;
const USHORT s_dfi_flag_statistics = 64;
2001-05-23 15:26:42 +02:00
2004-02-02 12:02:12 +01:00
#endif // QLI_COMPILE_H