8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 18:03:04 +01:00
This commit is contained in:
asfernandes 2009-07-05 02:15:43 +00:00
parent dd1b14802d
commit 82efebc4c8

View File

@ -101,11 +101,11 @@ namespace Jrd {
class dsql_str : public pool_alloc_rpt<char, dsql_type_str>
{
public:
const char* str_charset; //!< ASCIIZ Character set identifier for string
const char* str_charset; // ASCIIZ Character set identifier for string
//USHORT str_flags;
bool delimited_id;
ULONG str_length; //!< length of string in BYTES
char str_data[2]; //!< one for ALLOC and one for the NULL
ULONG str_length; // length of string in BYTES
char str_data[2]; // one for ALLOC and one for the NULL
};
// values used in str_flags
@ -127,14 +127,14 @@ typedef Firebird::SortedArray
class dsql_dbb : public pool_alloc<dsql_type_dbb>
{
public:
class dsql_rel* dbb_relations; //!< known relations in database
class dsql_prc* dbb_procedures; //!< known procedures in database
class dsql_udf* dbb_functions; //!< known functions in database
MemoryPool& dbb_pool; //!< The current pool for the dbb
class dsql_rel* dbb_relations; // known relations in database
class dsql_prc* dbb_procedures; // known procedures in database
class dsql_udf* dbb_functions; // known functions in database
MemoryPool& dbb_pool; // The current pool for the dbb
Database* dbb_database;
Attachment* dbb_attachment;
dsql_str* dbb_dfl_charset;
USHORT dbb_base_level; //!< indicates the version of the engine code itself
USHORT dbb_base_level; // indicates the version of the engine code itself
bool dbb_no_charset;
bool dbb_read_only;
USHORT dbb_db_SQL_dialect;
@ -170,24 +170,24 @@ public:
{
}
dsql_rel* rel_next; //!< Next relation in database
dsql_sym* rel_symbol; //!< Hash symbol for relation
class dsql_fld* rel_fields; //!< Field block
//dsql_rel* rel_base_relation; //!< base relation for an updatable view
Firebird::MetaName rel_name; //!< Name of relation
Firebird::MetaName rel_owner; //!< Owner of relation
USHORT rel_id; //!< Relation id
dsql_rel* rel_next; // Next relation in database
dsql_sym* rel_symbol; // Hash symbol for relation
class dsql_fld* rel_fields; // Field block
//dsql_rel* rel_base_relation; // base relation for an updatable view
Firebird::MetaName rel_name; // Name of relation
Firebird::MetaName rel_owner; // Owner of relation
USHORT rel_id; // Relation id
USHORT rel_dbkey_length;
USHORT rel_flags;
};
// rel_flags bits
enum rel_flags_vals {
REL_new_relation = 1, //!< relation exists in sys tables, not committed yet
REL_dropped = 2, //!< relation has been dropped
REL_view = 4, //!< relation is a view
REL_external = 8, //!< relation is an external table
REL_creating = 16 //!< we are creating the bare relation in memory
REL_new_relation = 1, // relation exists in sys tables, not committed yet
REL_dropped = 2, // relation has been dropped
REL_view = 4, // relation is a view
REL_external = 8, // relation is an external table
REL_creating = 16 // we are creating the bare relation in memory
};
class dsql_fld : public pool_alloc<dsql_type_fld>
@ -200,32 +200,32 @@ public:
{
}
dsql_fld* fld_next; //!< Next field in relation
dsql_rel* fld_relation; //!< Parent relation
class dsql_prc* fld_procedure; //!< Parent procedure
dsql_nod* fld_ranges; //!< ranges for multi dimension array
dsql_nod* fld_character_set; //!< null means not specified
dsql_nod* fld_sub_type_name; //!< Subtype name for later resolution
dsql_fld* fld_next; // Next field in relation
dsql_rel* fld_relation; // Parent relation
class dsql_prc* fld_procedure; // Parent procedure
dsql_nod* fld_ranges; // ranges for multi dimension array
dsql_nod* fld_character_set; // null means not specified
dsql_nod* fld_sub_type_name; // Subtype name for later resolution
USHORT fld_flags;
USHORT fld_id; //!< Field in in database
USHORT fld_dtype; //!< Data type of field
FLD_LENGTH fld_length; //!< Length of field
USHORT fld_element_dtype; //!< Data type of array element
USHORT fld_element_length; //!< Length of array element
SSHORT fld_scale; //!< Scale factor of field
SSHORT fld_sub_type; //!< Subtype for text & blob fields
USHORT fld_precision; //!< Precision for exact numeric types
USHORT fld_character_length; //!< length of field in characters
USHORT fld_seg_length; //!< Segment length for blobs
SSHORT fld_dimensions; //!< Non-zero means array
SSHORT fld_character_set_id; //!< ID of field's character set
SSHORT fld_collation_id; //!< ID of field's collation
SSHORT fld_ttype; //!< ID of field's language_driver
Firebird::string fld_type_of_name; //!< TYPE OF
dsql_str* fld_type_of_table; //!< TYPE OF table name
bool fld_explicit_collation; //!< COLLATE was explicit specified
bool fld_not_nullable; //!< NOT NULL was explicit specified
bool fld_full_domain; //!< Domain name without TYPE OF prefix
USHORT fld_id; // Field in in database
USHORT fld_dtype; // Data type of field
FLD_LENGTH fld_length; // Length of field
USHORT fld_element_dtype; // Data type of array element
USHORT fld_element_length; // Length of array element
SSHORT fld_scale; // Scale factor of field
SSHORT fld_sub_type; // Subtype for text & blob fields
USHORT fld_precision; // Precision for exact numeric types
USHORT fld_character_length; // length of field in characters
USHORT fld_seg_length; // Segment length for blobs
SSHORT fld_dimensions; // Non-zero means array
SSHORT fld_character_set_id; // ID of field's character set
SSHORT fld_collation_id; // ID of field's collation
SSHORT fld_ttype; // ID of field's language_driver
Firebird::string fld_type_of_name; // TYPE OF
dsql_str* fld_type_of_table; // TYPE OF table name
bool fld_explicit_collation; // COLLATE was explicit specified
bool fld_not_nullable; // NOT NULL was explicit specified
bool fld_full_domain; // Domain name without TYPE OF prefix
Firebird::string fld_name;
Firebird::MetaName fld_source;
};
@ -234,7 +234,7 @@ public:
enum fld_flags_vals {
FLD_computed = 1,
FLD_national = 2, //!< field uses NATIONAL character set
FLD_national = 2, // field uses NATIONAL character set
FLD_nullable = 4,
FLD_system = 8
};
@ -243,13 +243,13 @@ enum fld_flags_vals {
class dsql_fil : public pool_alloc<dsql_type_fil>
{
public:
SLONG fil_length; //!< File length in pages
SLONG fil_start; //!< Starting page
dsql_str* fil_name; //!< File name
//dsql_fil* fil_next; //!< next file
//SSHORT fil_shadow_number; //!< shadow number if part of shadow
//SSHORT fil_manual; //!< flag to indicate manual shadow
//SSHORT fil_partitions; //!< number of log file partitions
SLONG fil_length; // File length in pages
SLONG fil_start; // Starting page
dsql_str* fil_name; // File name
//dsql_fil* fil_next; // next file
//SSHORT fil_shadow_number; // shadow number if part of shadow
//SSHORT fil_manual; // flag to indicate manual shadow
//SSHORT fil_partitions; // number of log file partitions
//USHORT fil_flags;
};
@ -263,24 +263,24 @@ public:
{
}
dsql_prc* prc_next; //!< Next relation in database
dsql_sym* prc_symbol; //!< Hash symbol for procedure
dsql_fld* prc_inputs; //!< Input parameters
dsql_fld* prc_outputs; //!< Output parameters
Firebird::MetaName prc_name; //!< Name of procedure
Firebird::MetaName prc_owner; //!< Owner of procedure
dsql_prc* prc_next; // Next relation in database
dsql_sym* prc_symbol; // Hash symbol for procedure
dsql_fld* prc_inputs; // Input parameters
dsql_fld* prc_outputs; // Output parameters
Firebird::MetaName prc_name; // Name of procedure
Firebird::MetaName prc_owner; // Owner of procedure
SSHORT prc_in_count;
SSHORT prc_def_count; //!< number of inputs with default values
SSHORT prc_def_count; // number of inputs with default values
SSHORT prc_out_count;
USHORT prc_id; //!< Procedure id
USHORT prc_id; // Procedure id
USHORT prc_flags;
};
// prc_flags bits
enum prc_flags_vals {
PRC_new_procedure = 1, //!< procedure is newly defined, not committed yet
PRC_dropped = 2 //!< procedure has been dropped
PRC_new_procedure = 1, // procedure is newly defined, not committed yet
PRC_dropped = 2 // procedure has been dropped
};
//! User defined function block
@ -293,7 +293,7 @@ public:
}
dsql_udf* udf_next;
dsql_sym* udf_symbol; //!< Hash symbol for udf
dsql_sym* udf_symbol; // Hash symbol for udf
USHORT udf_dtype;
SSHORT udf_scale;
SSHORT udf_sub_type;
@ -308,8 +308,8 @@ public:
// udf_flags bits
enum udf_flags_vals {
UDF_new_udf = 1, //!< udf is newly declared, not committed yet
UDF_dropped = 2 //!< udf has been dropped
UDF_new_udf = 1, // udf is newly declared, not committed yet
UDF_dropped = 2 // udf has been dropped
};
// Variables - input, output & local
@ -318,13 +318,13 @@ enum udf_flags_vals {
class dsql_var : public pool_alloc_rpt<SCHAR, dsql_type_var>
{
public:
dsql_fld* var_field; //!< Field on which variable is based
dsql_fld* var_field; // Field on which variable is based
//USHORT var_flags; // Reserved
//dsql_var_type var_type; // Too cumbersome to compile the right data type.
int var_type; // Input, output or local var.
USHORT var_msg_number; //!< Message number containing variable
USHORT var_msg_item; //!< Item number in message
USHORT var_variable_number; //!< Local variable number
USHORT var_msg_number; // Message number containing variable
USHORT var_msg_item; // Item number in message
USHORT var_variable_number; // Local variable number
TEXT var_name[2];
};
@ -336,10 +336,10 @@ public:
class dsql_intlsym : public pool_alloc_rpt<SCHAR, dsql_type_intlsym>
{
public:
dsql_sym* intlsym_symbol; //!< Hash symbol for intlsym
USHORT intlsym_type; //!< what type of name
dsql_sym* intlsym_symbol; // Hash symbol for intlsym
USHORT intlsym_type; // what type of name
USHORT intlsym_flags;
SSHORT intlsym_ttype; //!< id of implementation
SSHORT intlsym_ttype; // id of implementation
SSHORT intlsym_charset_id;
SSHORT intlsym_collate_id;
USHORT intlsym_bytes_per_char;
@ -354,7 +354,7 @@ public:
// values used in intlsym_flags
enum intlsym_flags_vals {
INTLSYM_dropped = 1 //!< intlsym has been dropped
INTLSYM_dropped = 1 // intlsym has been dropped
};
@ -382,43 +382,43 @@ public:
{
}
dsql_req* req_parent; //!< Source request, if cursor update
dsql_req* req_sibling; //!< Next sibling request, if cursor update
dsql_req* req_offspring; //!< Cursor update requests
dsql_req* req_parent; // Source request, if cursor update
dsql_req* req_sibling; // Next sibling request, if cursor update
dsql_req* req_offspring; // Cursor update requests
MemoryPool& req_pool;
dsql_sym* req_name; //!< Name of request
dsql_sym* req_cursor; //!< Cursor symbol, if any
dsql_dbb* req_dbb; //!< DSQL attachment
jrd_tra* req_transaction; //!< JRD transaction
dsql_nod* req_ddl_node; //!< Store metadata request
class dsql_blb* req_blob; //!< Blob info for blob requests
jrd_req* req_request; //!< JRD request
//dsql_str* req_blr_string; //!< String block during BLR generation
dsql_sym* req_name; // Name of request
dsql_sym* req_cursor; // Cursor symbol, if any
dsql_dbb* req_dbb; // DSQL attachment
jrd_tra* req_transaction; // JRD transaction
dsql_nod* req_ddl_node; // Store metadata request
class dsql_blb* req_blob; // Blob info for blob requests
jrd_req* req_request; // JRD request
//dsql_str* req_blr_string; // String block during BLR generation
Firebird::HalfStaticArray<BLOB_PTR, 1024> req_blr_data;
class dsql_msg* req_send; //!< Message to be sent to start request
class dsql_msg* req_receive; //!< Per record message to be received
class dsql_msg* req_async; //!< Message for sending scrolling information
dsql_par* req_eof; //!< End of file parameter
dsql_par* req_dbkey; //!< Database key for current of
dsql_par* req_rec_version; //!< Record Version for current of
dsql_par* req_parent_rec_version; //!< parent record version
dsql_par* req_parent_dbkey; //!< Parent database key for current of
//BLOB_PTR* req_blr; //!< Running blr address
//BLOB_PTR* req_blr_yellow; //!< Threshold for upping blr buffer size
ULONG req_inserts; //!< records processed in request
class dsql_msg* req_send; // Message to be sent to start request
class dsql_msg* req_receive; // Per record message to be received
class dsql_msg* req_async; // Message for sending scrolling information
dsql_par* req_eof; // End of file parameter
dsql_par* req_dbkey; // Database key for current of
dsql_par* req_rec_version; // Record Version for current of
dsql_par* req_parent_rec_version; // parent record version
dsql_par* req_parent_dbkey; // Parent database key for current of
//BLOB_PTR* req_blr; // Running blr address
//BLOB_PTR* req_blr_yellow; // Threshold for upping blr buffer size
ULONG req_inserts; // records processed in request
ULONG req_deletes;
ULONG req_updates;
ULONG req_selects;
REQ_TYPE req_type; //!< Type of request
ULONG req_flags; //!< generic flag
REQ_TYPE req_type; // Type of request
ULONG req_flags; // generic flag
Firebird::RefStrPtr req_sql_text;
Firebird::AutoPtr<Jrd::RuntimeStatistics> req_fetch_baseline; //!< State of request performance counters when we reported it last time
SINT64 req_fetch_elapsed; //!< Number of clock ticks spent while fetching rows for this request since we reported it last time
SINT64 req_fetch_rowcount; //!< Total number of rows returned by this request
bool req_traced; //!< request is traced via TraceAPI
Firebird::AutoPtr<Jrd::RuntimeStatistics> req_fetch_baseline; // State of request performance counters when we reported it last time
SINT64 req_fetch_elapsed; // Number of clock ticks spent while fetching rows for this request since we reported it last time
SINT64 req_fetch_rowcount; // Total number of rows returned by this request
bool req_traced; // request is traced via TraceAPI
protected:
// Request should never be destroyed using delete.
@ -454,7 +454,7 @@ public:
protected:
// Request should never be destroyed using delete.
// It dies together with it's pool in release_request().
// It dies together with its pool in release_request().
~CompiledStatement();
public:
@ -539,33 +539,33 @@ public:
psql = value;
}
dsql_nod* req_blk_node; //!< exec_block node
dsql_rel* req_relation; //!< relation created by this request (for DDL)
dsql_prc* req_procedure; //!< procedure created by this request (for DDL)
dsql_nod* req_blk_node; // exec_block node
dsql_rel* req_relation; // relation created by this request (for DDL)
dsql_prc* req_procedure; // procedure created by this request (for DDL)
Firebird::HalfStaticArray<BLOB_PTR, 128> req_debug_data;
DsqlContextStack req_main_context;
DsqlContextStack* req_context;
DsqlContextStack req_union_context; //!< Save contexts for views of unions
DsqlContextStack req_dt_context; //!< Save contexts for views of derived tables
class dsql_ctx* req_outer_agg_context; //!< agg context for outer ref
ULONG req_base_offset; //!< place to go back and stuff in blr length
USHORT req_context_number; //!< Next available context number
USHORT req_derived_context_number; //!< Next available context number for derived tables
USHORT req_scope_level; //!< Scope level for parsing aliases in subqueries
//USHORT req_message_number; //!< Next available message number
USHORT req_loop_level; //!< Loop level
DsqlStrStack req_labels; //!< Loop labels
USHORT req_cursor_number; //!< Cursor number
DsqlNodStack req_cursors; //!< Cursors
USHORT req_in_select_list; //!< now processing "select list"
USHORT req_in_where_clause; //!< processing "where clause"
USHORT req_in_group_by_clause; //!< processing "group by clause"
USHORT req_in_having_clause; //!< processing "having clause"
USHORT req_in_order_by_clause; //!< processing "order by clause"
USHORT req_error_handlers; //!< count of active error handlers
USHORT req_client_dialect; //!< dialect passed into the API call
USHORT req_in_outer_join; //!< processing inside outer-join part
dsql_str* req_alias_relation_prefix; //!< prefix for every relation-alias.
DsqlContextStack req_union_context; // Save contexts for views of unions
DsqlContextStack req_dt_context; // Save contexts for views of derived tables
class dsql_ctx* req_outer_agg_context; // agg context for outer ref
ULONG req_base_offset; // place to go back and stuff in blr length
USHORT req_context_number; // Next available context number
USHORT req_derived_context_number; // Next available context number for derived tables
USHORT req_scope_level; // Scope level for parsing aliases in subqueries
//USHORT req_message_number; // Next available message number
USHORT req_loop_level; // Loop level
DsqlStrStack req_labels; // Loop labels
USHORT req_cursor_number; // Cursor number
DsqlNodStack req_cursors; // Cursors
USHORT req_in_select_list; // now processing "select list"
USHORT req_in_where_clause; // processing "where clause"
USHORT req_in_group_by_clause; // processing "group by clause"
USHORT req_in_having_clause; // processing "having clause"
USHORT req_in_order_by_clause; // processing "order by clause"
USHORT req_error_handlers; // count of active error handlers
USHORT req_client_dialect; // dialect passed into the API call
USHORT req_in_outer_join; // processing inside outer-join part
dsql_str* req_alias_relation_prefix; // prefix for every relation-alias.
DsqlNodStack req_hidden_vars; // hidden variables
USHORT req_hidden_vars_number; // next hidden variable number
@ -635,15 +635,15 @@ class dsql_blb : public pool_alloc<dsql_type_blb>
{
public:
// blb_field is currently assigned in one place and never used
//dsql_nod* blb_field; //!< Related blob field
dsql_par* blb_blob_id; //!< Parameter to hold blob id
dsql_par* blb_segment; //!< Parameter for segments
//dsql_nod* blb_field; // Related blob field
dsql_par* blb_blob_id; // Parameter to hold blob id
dsql_par* blb_segment; // Parameter for segments
dsql_nod* blb_from;
dsql_nod* blb_to;
dsql_msg* blb_open_in_msg; //!< Input message to open cursor
dsql_msg* blb_open_out_msg; //!< Output message from open cursor
dsql_msg* blb_segment_msg; //!< Segment message
blb* blb_blob; //!< JRD blob
dsql_msg* blb_open_in_msg; // Input message to open cursor
dsql_msg* blb_open_out_msg; // Output message from open cursor
dsql_msg* blb_segment_msg; // Segment message
blb* blb_blob; // JRD blob
};
//! Transaction block
@ -651,7 +651,7 @@ public:
class dsql_tra : public pool_alloc<dsql_type_tra>
{
public:
dsql_tra* tra_next; //!< Next open transaction
dsql_tra* tra_next; // Next open transaction
};
*/
@ -674,22 +674,22 @@ public:
{
}
dsql_req* ctx_request; //!< Parent request
dsql_rel* ctx_relation; //!< Relation for context
dsql_prc* ctx_procedure; //!< Procedure for context
dsql_nod* ctx_proc_inputs; //!< Procedure input parameters
class dsql_map* ctx_map; //!< Map for aggregates
dsql_nod* ctx_rse; //!< Sub-rse for aggregates
dsql_ctx* ctx_parent; //!< Parent context for aggregates
const TEXT* ctx_alias; //!< Context alias (can include concatenated derived table alias)
const TEXT* ctx_internal_alias; //!< Alias as specified in query
USHORT ctx_context; //!< Context id
USHORT ctx_recursive; //!< Secondary context id for recursive UNION (nobody referred to this context)
USHORT ctx_scope_level; //!< Subquery level within this request
USHORT ctx_flags; //!< Various flag values
dsql_req* ctx_request; // Parent request
dsql_rel* ctx_relation; // Relation for context
dsql_prc* ctx_procedure; // Procedure for context
dsql_nod* ctx_proc_inputs; // Procedure input parameters
class dsql_map* ctx_map; // Map for aggregates
dsql_nod* ctx_rse; // Sub-rse for aggregates
dsql_ctx* ctx_parent; // Parent context for aggregates
const TEXT* ctx_alias; // Context alias (can include concatenated derived table alias)
const TEXT* ctx_internal_alias; // Alias as specified in query
USHORT ctx_context; // Context id
USHORT ctx_recursive; // Secondary context id for recursive UNION (nobody referred to this context)
USHORT ctx_scope_level; // Subquery level within this request
USHORT ctx_flags; // Various flag values
USHORT ctx_in_outer_join; // req_in_outer_join when context was created
DsqlContextStack ctx_main_derived_contexts; // contexts used for blr_derived_expr
DsqlContextStack ctx_childs_derived_table; //!< Childs derived table context
DsqlContextStack ctx_childs_derived_table; // Childs derived table context
Firebird::GenericMap<Firebird::Pair<Firebird::Left<
Firebird::MetaName, ImplicitJoin*> > > ctx_imp_join; // Map of USING fieldname to ImplicitJoin
@ -731,42 +731,42 @@ const USHORT CTX_recursive = 0x10; // Context has secondary number (ctx_recursiv
class dsql_map : public pool_alloc<dsql_type_map>
{
public:
dsql_map* map_next; //!< Next map in item
dsql_nod* map_node; //!< Value for map item
USHORT map_position; //!< Position in map
dsql_map* map_next; // Next map in item
dsql_nod* map_node; // Value for map item
USHORT map_position; // Position in map
};
//! Message block used in communicating with a running request
class dsql_msg : public pool_alloc<dsql_type_msg>
{
public:
dsql_par* msg_parameters; //!< Parameter list
UCHAR* msg_buffer; //!< Message buffer
USHORT msg_number; //!< Message number
USHORT msg_length; //!< Message length
USHORT msg_parameter; //!< Next parameter number
USHORT msg_index; //!< Next index into SQLDA
dsql_par* msg_parameters; // Parameter list
UCHAR* msg_buffer; // Message buffer
USHORT msg_number; // Message number
USHORT msg_length; // Message length
USHORT msg_parameter; // Next parameter number
USHORT msg_index; // Next index into SQLDA
};
//! Parameter block used to describe a parameter of a message
class dsql_par : public pool_alloc<dsql_type_par>
{
public:
dsql_msg* par_message; //!< Parent message
dsql_par* par_next; //!< Next parameter in linked list
dsql_par* par_null; //!< Null parameter, if used
dsql_nod* par_node; //!< Associated value node, if any
dsql_ctx* par_dbkey_ctx; //!< Context of internally requested dbkey
dsql_ctx* par_rec_version_ctx; //!< Context of internally requested record version
const TEXT* par_name; //!< Parameter name, if any
const TEXT* par_rel_name; //!< Relation name, if any
const TEXT* par_owner_name; //!< Owner name, if any
const TEXT* par_rel_alias; //!< Relation alias, if any
const TEXT* par_alias; //!< Alias, if any
DSC par_desc; //!< Field data type
DSC par_user_desc; //!< SQLDA data type
USHORT par_parameter; //!< BLR parameter number
USHORT par_index; //!< Index into SQLDA, if appropriate
dsql_msg* par_message; // Parent message
dsql_par* par_next; // Next parameter in linked list
dsql_par* par_null; // Null parameter, if used
dsql_nod* par_node; // Associated value node, if any
dsql_ctx* par_dbkey_ctx; // Context of internally requested dbkey
dsql_ctx* par_rec_version_ctx; // Context of internally requested record version
const TEXT* par_name; // Parameter name, if any
const TEXT* par_rel_name; // Relation name, if any
const TEXT* par_owner_name; // Owner name, if any
const TEXT* par_rel_alias; // Relation alias, if any
const TEXT* par_alias; // Alias, if any
DSC par_desc; // Field data type
DSC par_user_desc; // SQLDA data type
USHORT par_parameter; // BLR parameter number
USHORT par_index; // Index into SQLDA, if appropriate
};
/*! \var unsigned DSQL_debug