8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 23:23:02 +01:00

Basic implementation of the ODS upgrade

This commit is contained in:
Dmitry Yemanov 2021-02-05 16:32:23 +03:00
parent db6e98fce3
commit f7f98b661d
12 changed files with 523 additions and 311 deletions

View File

@ -73,7 +73,6 @@ enum alice_repl_mode {
struct user_action struct user_action
{ {
ULONG ua_switches;
const char* ua_user; const char* ua_user;
const char* ua_role; const char* ua_role;
const char* ua_password; const char* ua_password;

View File

@ -66,6 +66,7 @@ const SINT64 sw_nolinger = QUADCONST(0x0000001000000000);
const SINT64 sw_icu = QUADCONST(0x0000002000000000); const SINT64 sw_icu = QUADCONST(0x0000002000000000);
const SINT64 sw_role = QUADCONST(0x0000004000000000); const SINT64 sw_role = QUADCONST(0x0000004000000000);
const SINT64 sw_replica = QUADCONST(0x0000008000000000); const SINT64 sw_replica = QUADCONST(0x0000008000000000);
const SINT64 sw_upgrade = QUADCONST(0x0000010000000000);
// Popular combination of compatible switches // Popular combination of compatible switches
const SINT64 sw_auth_set = sw_user | sw_password | sw_role | sw_fetch_password | sw_trusted_auth; const SINT64 sw_auth_set = sw_user | sw_password | sw_role | sw_fetch_password | sw_trusted_auth;
@ -126,7 +127,8 @@ enum alice_switches
IN_SW_ALICE_ICU = 48, IN_SW_ALICE_ICU = 48,
IN_SW_ALICE_ROLE = 49, IN_SW_ALICE_ROLE = 49,
IN_SW_ALICE_REPLICA = 50, IN_SW_ALICE_REPLICA = 50,
IN_SW_ALICE_PARALLEL_WORKERS = 51 IN_SW_ALICE_PARALLEL_WORKERS = 51,
IN_SW_ALICE_UPGRADE = 52
}; };
static const char* const ALICE_SW_ASYNC = "ASYNC"; static const char* const ALICE_SW_ASYNC = "ASYNC";
@ -259,6 +261,9 @@ static const Switches::in_sw_tab_t alice_in_sw_table[] =
0, (sw_user | sw_password | sw_fetch_password), false, false, 115, 3, NULL}, 0, (sw_user | sw_password | sw_fetch_password), false, false, 115, 3, NULL},
// msg 115: -trusted use trusted authentication // msg 115: -trusted use trusted authentication
#endif #endif
{IN_SW_ALICE_UPGRADE, isc_spb_rpr_upgrade_db, "UPGRADE", sw_upgrade,
0, ~(sw_upgrade | sw_user | sw_password | sw_nolinger | sw_role), false, true, 136, 2, NULL},
// msg 136: \t-upgrade\t\tupgrade database ODS
{IN_SW_ALICE_NO_RESERVE, 0, "USE", sw_no_reserve, {IN_SW_ALICE_NO_RESERVE, 0, "USE", sw_no_reserve,
0, ~(sw_no_reserve | sw_auth_set | sw_nolinger), false, false, 49, 1, NULL}, 0, ~(sw_no_reserve | sw_auth_set | sw_nolinger), false, false, 49, 1, NULL},
// msg 49: \t-use\t\tuse full or reserve space for versions // msg 49: \t-use\t\tuse full or reserve space for versions

View File

@ -335,6 +335,9 @@ static void buildDpb(Firebird::ClumpletWriter& dpb, const SINT64 switches)
if (switches & sw_icu) if (switches & sw_icu)
dpb.insertTag(isc_dpb_reset_icu); dpb.insertTag(isc_dpb_reset_icu);
if (switches & sw_upgrade)
dpb.insertTag(isc_dpb_upgrade_db);
const unsigned char* authBlock; const unsigned char* authBlock;
unsigned int authBlockSize = tdgbl->uSvc->getAuthBlock(&authBlock); unsigned int authBlockSize = tdgbl->uSvc->getAuthBlock(&authBlock);

View File

@ -129,6 +129,7 @@
#define isc_dpb_decfloat_round 94 #define isc_dpb_decfloat_round 94
#define isc_dpb_decfloat_traps 95 #define isc_dpb_decfloat_traps 95
#define isc_dpb_clear_map 96 #define isc_dpb_clear_map 96
#define isc_dpb_upgrade_db 97
#define isc_dpb_parallel_workers 100 #define isc_dpb_parallel_workers 100
#define isc_dpb_worker_attach 101 #define isc_dpb_worker_attach 101
@ -536,6 +537,7 @@
#define isc_spb_rpr_kill_shadows 0x40 #define isc_spb_rpr_kill_shadows 0x40
#define isc_spb_rpr_full 0x80 #define isc_spb_rpr_full 0x80
#define isc_spb_rpr_icu 0x0800 #define isc_spb_rpr_icu 0x0800
#define isc_spb_rpr_upgrade_db 0x1000
/***************************************** /*****************************************
* Parameters for isc_action_svc_restore * * Parameters for isc_action_svc_restore *

View File

@ -3986,6 +3986,7 @@ const
isc_dpb_decfloat_round = byte(94); isc_dpb_decfloat_round = byte(94);
isc_dpb_decfloat_traps = byte(95); isc_dpb_decfloat_traps = byte(95);
isc_dpb_clear_map = byte(96); isc_dpb_clear_map = byte(96);
isc_dpb_upgrade_db = byte(97);
isc_dpb_parallel_workers = byte(100); isc_dpb_parallel_workers = byte(100);
isc_dpb_worker_attach = byte(101); isc_dpb_worker_attach = byte(101);
isc_dpb_address = byte(1); isc_dpb_address = byte(1);
@ -4222,6 +4223,7 @@ const
isc_spb_rpr_kill_shadows = $40; isc_spb_rpr_kill_shadows = $40;
isc_spb_rpr_full = $80; isc_spb_rpr_full = $80;
isc_spb_rpr_icu = $0800; isc_spb_rpr_icu = $0800;
isc_spb_rpr_upgrade_db = $1000;
isc_spb_res_buffers = byte(9); isc_spb_res_buffers = byte(9);
isc_spb_res_page_size = byte(10); isc_spb_res_page_size = byte(10);
isc_spb_res_length = byte(11); isc_spb_res_length = byte(11);

View File

@ -22,208 +22,208 @@
*/ */
// type , name , dtype , length , sub_type , dflt_blr , nullable) // type , name , dtype , length , sub_type , dflt_blr , nullable , ods)
FIELD(fld_context , nam_v_context , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_context , nam_v_context , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_ctx_name , nam_context , dtype_text , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_ctx_name , nam_context , dtype_text , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_description , nam_description , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true) FIELD(fld_description , nam_description , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true , ODS_13_0)
FIELD(fld_edit_string , nam_edit_string , dtype_varying , 127 , 0 , NULL , true) FIELD(fld_edit_string , nam_edit_string , dtype_varying , 127 , 0 , NULL , true , ODS_13_0)
FIELD(fld_f_id , nam_f_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_f_id , nam_f_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_f_name , nam_f_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_f_name , nam_f_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_flag , nam_sys_flag , dtype_short , sizeof(SSHORT) , 0 , NULL , false) FIELD(fld_flag , nam_sys_flag , dtype_short , sizeof(SSHORT) , 0 , NULL , false , ODS_13_0)
FIELD(fld_flag_nullable , nam_sys_nullflag , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_flag_nullable , nam_sys_nullflag , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_i_id , nam_i_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_i_id , nam_i_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_i_name , nam_i_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_i_name , nam_i_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_f_length , nam_f_length , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_f_length , nam_f_length , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_f_position , nam_f_position , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_f_position , nam_f_position , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_f_scale , nam_f_scale , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_f_scale , nam_f_scale , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_f_type , nam_f_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_f_type , nam_f_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_format , nam_fmt , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_format , nam_fmt , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_key_length , nam_key_length , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_key_length , nam_key_length , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_p_number , nam_p_number , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_p_number , nam_p_number , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_p_sequence , nam_p_sequence , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_p_sequence , nam_p_sequence , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_p_type , nam_p_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_p_type , nam_p_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_q_header , nam_q_header , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true) FIELD(fld_q_header , nam_q_header , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true , ODS_13_0)
FIELD(fld_r_id , nam_r_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_r_id , nam_r_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_r_name , nam_r_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_r_name , nam_r_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_s_count , nam_s_count , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_s_count , nam_s_count , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_s_length , nam_s_length , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_s_length , nam_s_length , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_source , nam_source , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true) FIELD(fld_source , nam_source , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true , ODS_13_0)
FIELD(fld_sub_type , nam_f_sub_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_sub_type , nam_f_sub_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_v_blr , nam_v_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true) FIELD(fld_v_blr , nam_v_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true , ODS_13_0)
FIELD(fld_validation , nam_vl_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true) FIELD(fld_validation , nam_vl_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true , ODS_13_0)
FIELD(fld_value , nam_value , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true) FIELD(fld_value , nam_value , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true , ODS_13_0)
FIELD(fld_class , nam_class , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_class , nam_class , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_acl , nam_acl , dtype_blob , BLOB_SIZE , isc_blob_acl , NULL , true) FIELD(fld_acl , nam_acl , dtype_blob , BLOB_SIZE , isc_blob_acl , NULL , true , ODS_13_0)
FIELD(fld_file_name , nam_file_name , dtype_varying , 255 , 0 , NULL , true) FIELD(fld_file_name , nam_file_name , dtype_varying , 255 , 0 , NULL , true , ODS_13_0)
FIELD(fld_file_name2 , nam_file_name2 , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_file_name2 , nam_file_name2 , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_file_seq , nam_file_seq , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_file_seq , nam_file_seq , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_file_start , nam_file_start , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_file_start , nam_file_start , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_file_length , nam_file_length , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_file_length , nam_file_length , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_file_flags , nam_file_flags , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_file_flags , nam_file_flags , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_trigger , nam_trigger , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true) FIELD(fld_trigger , nam_trigger , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true , ODS_13_0)
FIELD(fld_trg_name , nam_trg_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_trg_name , nam_trg_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_gnr_name , nam_gnr_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_gnr_name , nam_gnr_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_fun_name , nam_fun_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_fun_name , nam_fun_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_ext_name , nam_ext_name , dtype_text , 255 , 0 , NULL , true) FIELD(fld_ext_name , nam_ext_name , dtype_text , 255 , 0 , NULL , true , ODS_13_0)
FIELD(fld_typ_name , nam_typ_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_typ_name , nam_typ_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_dimensions , nam_dimensions , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_dimensions , nam_dimensions , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_runtime , nam_runtime , dtype_blob , BLOB_SIZE , isc_blob_summary , NULL , true) FIELD(fld_runtime , nam_runtime , dtype_blob , BLOB_SIZE , isc_blob_summary , NULL , true , ODS_13_0)
FIELD(fld_trg_seq , nam_trg_seq , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_trg_seq , nam_trg_seq , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_gnr_type , nam_gnr_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_gnr_type , nam_gnr_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_trg_type , nam_trg_type , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_trg_type , nam_trg_type , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_0)
FIELD(fld_obj_type , nam_obj_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_obj_type , nam_obj_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_mechanism , nam_mechanism , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_mechanism , nam_mechanism , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_f_descr , nam_desc , dtype_blob , BLOB_SIZE , isc_blob_format , NULL , true) FIELD(fld_f_descr , nam_desc , dtype_blob , BLOB_SIZE , isc_blob_format , NULL , true , ODS_13_0)
FIELD(fld_fun_type , nam_fun_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_fun_type , nam_fun_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_trans_id , nam_trans_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_trans_id , nam_trans_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_0)
FIELD(fld_trans_state , nam_trans_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_trans_state , nam_trans_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_time , nam_time , dtype_timestamp, TIMESTAMP_SIZE , 0 , NULL , true) FIELD(fld_time , nam_time , dtype_timestamp, TIMESTAMP_SIZE , 0 , NULL , true , ODS_13_0)
FIELD(fld_trans_desc , nam_trans_desc , dtype_blob , BLOB_SIZE , isc_blob_tra , NULL , true) FIELD(fld_trans_desc , nam_trans_desc , dtype_blob , BLOB_SIZE , isc_blob_tra , NULL , true , ODS_13_0)
FIELD(fld_msg , nam_msg , dtype_varying , 1023 , 0 , NULL , true) FIELD(fld_msg , nam_msg , dtype_varying , 1023 , 0 , NULL , true , ODS_13_0)
FIELD(fld_msg_num , nam_msg_num , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_msg_num , nam_msg_num , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_user , nam_user , dtype_text , USERNAME_LENGTH , dsc_text_type_metadata , NULL , true) FIELD(fld_user , nam_user , dtype_text , USERNAME_LENGTH , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_privilege , nam_privilege , dtype_text , 6 , 0 , NULL , true) FIELD(fld_privilege , nam_privilege , dtype_text , 6 , 0 , NULL , true , ODS_13_0)
FIELD(fld_ext_desc , nam_ext_desc , dtype_blob , BLOB_SIZE , isc_blob_extfile , NULL , true) FIELD(fld_ext_desc , nam_ext_desc , dtype_blob , BLOB_SIZE , isc_blob_extfile , NULL , true , ODS_13_0)
FIELD(fld_shad_num , nam_shad_num , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_shad_num , nam_shad_num , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_gen_name , nam_gen_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_gen_name , nam_gen_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_gen_id , nam_gen_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_gen_id , nam_gen_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_bound , nam_bound , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_bound , nam_bound , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_dim , nam_dim , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_dim , nam_dim , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_statistics , nam_statistics , dtype_double , sizeof(double) , 0 , NULL , true) FIELD(fld_statistics , nam_statistics , dtype_double , sizeof(double) , 0 , NULL , true , ODS_13_0)
FIELD(fld_null_flag , nam_null_flag , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_null_flag , nam_null_flag , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_con_name , nam_con_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_con_name , nam_con_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_con_type , nam_con_type , dtype_text , 11 , 0 , NULL , true) FIELD(fld_con_type , nam_con_type , dtype_text , 11 , 0 , NULL , true , ODS_13_0)
FIELD(fld_defer , nam_defer , dtype_text , 3 , 0 , dflt_no , true) FIELD(fld_defer , nam_defer , dtype_text , 3 , 0 , dflt_no , true , ODS_13_0)
FIELD(fld_match , nam_match , dtype_text , 7 , 0 , dflt_full , true) FIELD(fld_match , nam_match , dtype_text , 7 , 0 , dflt_full , true , ODS_13_0)
FIELD(fld_rule , nam_rule , dtype_text , 11 , 0 , dflt_restrict, true) FIELD(fld_rule , nam_rule , dtype_text , 11 , 0 , dflt_restrict, true , ODS_13_0)
FIELD(fld_file_partitions, nam_file_partitions, dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_file_partitions, nam_file_partitions, dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_prc_blr , nam_prc_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true) FIELD(fld_prc_blr , nam_prc_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true , ODS_13_0)
FIELD(fld_prc_id , nam_prc_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_prc_id , nam_prc_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_prc_prm , nam_prc_prm , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_prc_prm , nam_prc_prm , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_prc_name , nam_prc_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_prc_name , nam_prc_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_prm_name , nam_prm_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_prm_name , nam_prm_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_prm_number , nam_prm_number , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_prm_number , nam_prm_number , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_prm_type , nam_prm_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_prm_type , nam_prm_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_charset_name , nam_charset_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_charset_name , nam_charset_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_charset_id , nam_charset_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_charset_id , nam_charset_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_collate_name , nam_collate_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_collate_name , nam_collate_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_collate_id , nam_collate_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_collate_id , nam_collate_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_num_chars , nam_num_chars , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_num_chars , nam_num_chars , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_xcp_name , nam_xcp_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_xcp_name , nam_xcp_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_xcp_number , nam_xcp_number , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_xcp_number , nam_xcp_number , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_file_p_offset , nam_file_p_offset , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_file_p_offset , nam_file_p_offset , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_f_precision , nam_f_precision , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_f_precision , nam_f_precision , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_backup_id , nam_backup_id , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_backup_id , nam_backup_id , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_backup_level , nam_backup_level , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_backup_level , nam_backup_level , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_guid , nam_guid , dtype_text , 38 , 0 , NULL , true) FIELD(fld_guid , nam_guid , dtype_text , 38 , 0 , NULL , true , ODS_13_0)
FIELD(fld_scn , nam_scn , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_scn , nam_scn , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_specific_attr , nam_specific_attr , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true) FIELD(fld_specific_attr , nam_specific_attr , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true , ODS_13_0)
FIELD(fld_plugin_name , nam_plugin , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_plugin_name , nam_plugin , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_r_type , nam_r_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_r_type , nam_r_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_prc_type , nam_prc_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_prc_type , nam_prc_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_att_id , nam_att_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_att_id , nam_att_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_0)
FIELD(fld_stmt_id , nam_stmt_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_stmt_id , nam_stmt_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_0)
FIELD(fld_call_id , nam_call_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_call_id , nam_call_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_0)
FIELD(fld_stat_id , nam_stat_id , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_stat_id , nam_stat_id , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_pid , nam_pid , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_pid , nam_pid , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_state , nam_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_state , nam_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_ods_number , nam_ods_number , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_ods_number , nam_ods_number , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_page_size , nam_page_size , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_page_size , nam_page_size , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_page_bufs , nam_page_bufs , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_page_bufs , nam_page_bufs , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_shut_mode , nam_shut_mode , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_shut_mode , nam_shut_mode , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_sql_dialect , nam_sql_dialect , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_sql_dialect , nam_sql_dialect , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_sweep_int , nam_sweep_int , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_sweep_int , nam_sweep_int , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_counter , nam_counter , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_counter , nam_counter , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_0)
FIELD(fld_remote_proto , nam_remote_proto , dtype_varying , 10 , dsc_text_type_ascii , NULL , true) FIELD(fld_remote_proto , nam_remote_proto , dtype_varying , 10 , dsc_text_type_ascii , NULL , true , ODS_13_0)
FIELD(fld_remote_addr , nam_remote_addr , dtype_varying , 255 , dsc_text_type_ascii , NULL , true) FIELD(fld_remote_addr , nam_remote_addr , dtype_varying , 255 , dsc_text_type_ascii , NULL , true , ODS_13_0)
FIELD(fld_iso_mode , nam_iso_mode , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_iso_mode , nam_iso_mode , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_lock_timeout , nam_lock_timeout , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_lock_timeout , nam_lock_timeout , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_backup_state , nam_backup_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_backup_state , nam_backup_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_stat_group , nam_stat_group , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_stat_group , nam_stat_group , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_debug_info , nam_debug_info , dtype_blob , BLOB_SIZE , isc_blob_debug_info , NULL , true) FIELD(fld_debug_info , nam_debug_info , dtype_blob , BLOB_SIZE , isc_blob_debug_info , NULL , true , ODS_13_0)
FIELD(fld_prm_mechanism , nam_prm_mechanism , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_prm_mechanism , nam_prm_mechanism , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_src_info , nam_src_info , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_src_info , nam_src_info , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_ctx_var_name , nam_ctx_var_name , dtype_varying , 80 , 0 , NULL , true) FIELD(fld_ctx_var_name , nam_ctx_var_name , dtype_varying , 80 , 0 , NULL , true , ODS_13_0)
FIELD(fld_ctx_var_value , nam_ctx_var_value , dtype_varying , MAX_VARY_COLUMN_SIZE , 0 , NULL , true) FIELD(fld_ctx_var_value , nam_ctx_var_value , dtype_varying , MAX_VARY_COLUMN_SIZE , 0 , NULL , true , ODS_13_0)
FIELD(fld_engine_name , nam_engine_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_engine_name , nam_engine_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_pkg_name , nam_pkg_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_pkg_name , nam_pkg_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_fun_id , nam_fun_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_fun_id , nam_fun_id , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_fun_blr , nam_fun_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true) FIELD(fld_fun_blr , nam_fun_blr , dtype_blob , BLOB_SIZE , isc_blob_blr , NULL , true , ODS_13_0)
FIELD(fld_arg_name , nam_arg_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_arg_name , nam_arg_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_arg_mechanism , nam_arg_mechanism , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_arg_mechanism , nam_arg_mechanism , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_identity_type , nam_identity_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_identity_type , nam_identity_type , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_bool , nam_bool , dtype_boolean , 1 , 0 , NULL , true) FIELD(fld_bool , nam_bool , dtype_boolean , 1 , 0 , NULL , true , ODS_13_0)
FIELD(fld_user_name , nam_user_name , dtype_varying , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_user_name , nam_user_name , dtype_varying , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_attr_key , nam_sec_attr_key , dtype_varying , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_attr_key , nam_sec_attr_key , dtype_varying , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_attr_value , nam_sec_attr_value, dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_attr_value , nam_sec_attr_value, dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_name_part , nam_name_part , dtype_varying , 32 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_name_part , nam_name_part , dtype_varying , 32 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_client_ver , nam_client_ver , dtype_varying , 255 , dsc_text_type_ascii , NULL , true) FIELD(fld_client_ver , nam_client_ver , dtype_varying , 255 , dsc_text_type_ascii , NULL , true , ODS_13_0)
FIELD(fld_remote_ver , nam_remote_ver , dtype_varying , 255 , dsc_text_type_ascii , NULL , true) FIELD(fld_remote_ver , nam_remote_ver , dtype_varying , 255 , dsc_text_type_ascii , NULL , true , ODS_13_0)
FIELD(fld_host_name , nam_host_name , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_host_name , nam_host_name , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_os_user , nam_os_user , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_os_user , nam_os_user , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_gen_val , nam_gen_val , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_gen_val , nam_gen_val , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_0)
FIELD(fld_auth_method , nam_auth_method , dtype_varying , 255 , dsc_text_type_ascii , NULL , true) FIELD(fld_auth_method , nam_auth_method , dtype_varying , 255 , dsc_text_type_ascii , NULL , true , ODS_13_0)
FIELD(fld_linger , nam_linger , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_linger , nam_linger , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_sec_db , nam_mon_secdb , dtype_text , 7 , dsc_text_type_ascii , NULL , false) FIELD(fld_sec_db , nam_mon_secdb , dtype_text , 7 , dsc_text_type_ascii , NULL , false , ODS_13_0)
FIELD(fld_map_name , nam_map_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , false) FIELD(fld_map_name , nam_map_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , false , ODS_13_0)
FIELD(fld_map_using , nam_map_using , dtype_text , 1 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , false) FIELD(fld_map_using , nam_map_using , dtype_text , 1 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , false , ODS_13_0)
FIELD(fld_map_db , nam_map_db , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_map_db , nam_map_db , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_map_from_type , nam_map_from_type , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , false) FIELD(fld_map_from_type , nam_map_from_type , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , false , ODS_13_0)
FIELD(fld_map_from , nam_map_from , dtype_text , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_map_from , nam_map_from , dtype_text , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_map_to , nam_map_to , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_map_to , nam_map_to , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_gen_increment , nam_gen_increment , dtype_long , sizeof(SLONG) , 0 , NULL , false) FIELD(fld_gen_increment , nam_gen_increment , dtype_long , sizeof(SLONG) , 0 , NULL , false , ODS_13_0)
FIELD(fld_plan , nam_plan , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true) FIELD(fld_plan , nam_plan , dtype_blob , BLOB_SIZE , isc_blob_text , NULL , true , ODS_13_0)
FIELD(fld_system_privileges, nam_system_privileges, dtype_text, 8 , dsc_text_type_fixed , dflt_no_privs, true) FIELD(fld_system_privileges, nam_system_privileges, dtype_text, 8 , dsc_text_type_fixed , dflt_no_privs, true , ODS_13_0)
FIELD(fld_b_sql_security, nam_sql_security , dtype_boolean , 1 , 0 , NULL , true) FIELD(fld_b_sql_security, nam_sql_security , dtype_boolean , 1 , 0 , NULL , true , ODS_13_0)
FIELD(fld_idle_timeout , nam_idle_timeout , dtype_long , sizeof(SLONG) , 0 , NULL , false) FIELD(fld_idle_timeout , nam_idle_timeout , dtype_long , sizeof(SLONG) , 0 , NULL , false , ODS_13_0)
FIELD(fld_idle_timer , nam_idle_timer , dtype_timestamp_tz, TIMESTAMP_TZ_SIZE , 0 , NULL , true) FIELD(fld_idle_timer , nam_idle_timer , dtype_timestamp_tz, TIMESTAMP_TZ_SIZE , 0 , NULL , true , ODS_13_0)
FIELD(fld_stmt_timeout , nam_stmt_timeout , dtype_long , sizeof(SLONG) , 0 , NULL , false) FIELD(fld_stmt_timeout , nam_stmt_timeout , dtype_long , sizeof(SLONG) , 0 , NULL , false , ODS_13_0)
FIELD(fld_stmt_timer , nam_stmt_timer , dtype_timestamp_tz, TIMESTAMP_TZ_SIZE , 0 , NULL , true) FIELD(fld_stmt_timer , nam_stmt_timer , dtype_timestamp_tz, TIMESTAMP_TZ_SIZE , 0 , NULL , true , ODS_13_0)
FIELD(fld_tz_id , nam_tz_id , dtype_long , sizeof(SLONG) , 0 , NULL , true) FIELD(fld_tz_id , nam_tz_id , dtype_long , sizeof(SLONG) , 0 , NULL , true , ODS_13_0)
FIELD(fld_tz_name , nam_tz_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_tz_name , nam_tz_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_tz_offset , nam_tz_offset , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_tz_offset , nam_tz_offset , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_timestamp_tz , nam_timestamp_tz , dtype_timestamp_tz, TIMESTAMP_TZ_SIZE , 0 , NULL , true) FIELD(fld_timestamp_tz , nam_timestamp_tz , dtype_timestamp_tz, TIMESTAMP_TZ_SIZE , 0 , NULL , true , ODS_13_0)
FIELD(fld_tz_db_version , nam_tz_db_version , dtype_varying , 10 , dsc_text_type_ascii , NULL , true) FIELD(fld_tz_db_version , nam_tz_db_version , dtype_varying , 10 , dsc_text_type_ascii , NULL , true , ODS_13_0)
FIELD(fld_crypt_state , nam_crypt_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_crypt_state , nam_crypt_state , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_remote_crypt , nam_wire_crypt_plugin, dtype_varying, MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true) FIELD(fld_remote_crypt , nam_wire_crypt_plugin, dtype_varying, MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_pub_name , nam_pub_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , false) FIELD(fld_pub_name , nam_pub_name , dtype_text , MAX_SQL_IDENTIFIER_LEN , dsc_text_type_metadata , NULL , false , ODS_13_0)
FIELD(fld_file_id , nam_file_id , dtype_varying , 255 , dsc_text_type_ascii , NULL , false) FIELD(fld_file_id , nam_file_id , dtype_varying , 255 , dsc_text_type_ascii , NULL , false , ODS_13_0)
FIELD(fld_cfg_id , nam_cfg_id , dtype_long , sizeof(SLONG) , 0 , NULL , false) FIELD(fld_cfg_id , nam_cfg_id , dtype_long , sizeof(SLONG) , 0 , NULL , false , ODS_13_0)
FIELD(fld_cfg_name , nam_cfg_name , dtype_varying , MAX_CONFIG_NAME_LEN , dsc_text_type_ascii , NULL , false) FIELD(fld_cfg_name , nam_cfg_name , dtype_varying , MAX_CONFIG_NAME_LEN , dsc_text_type_ascii , NULL , false , ODS_13_0)
FIELD(fld_cfg_value , nam_cfg_value , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true) FIELD(fld_cfg_value , nam_cfg_value , dtype_varying , 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata , NULL , true , ODS_13_0)
FIELD(fld_cfg_is_set , nam_cfg_is_set , dtype_boolean , 1 , 0 , NULL , false) FIELD(fld_cfg_is_set , nam_cfg_is_set , dtype_boolean , 1 , 0 , NULL , false , ODS_13_0)
FIELD(fld_repl_mode , nam_repl_mode , dtype_short , sizeof(SSHORT) , 0 , NULL , true) FIELD(fld_repl_mode , nam_repl_mode , dtype_short , sizeof(SSHORT) , 0 , NULL , true , ODS_13_0)
FIELD(fld_keyword_name , nam_keyword_name , dtype_varying , METADATA_IDENTIFIER_CHAR_LEN, dsc_text_type_ascii , NULL , false) FIELD(fld_keyword_name , nam_keyword_name , dtype_varying , METADATA_IDENTIFIER_CHAR_LEN, dsc_text_type_ascii , NULL , false , ODS_13_1)
FIELD(fld_keyword_reserved, nam_keyword_reserved, dtype_boolean, 1 , 0 , NULL , false) FIELD(fld_keyword_reserved, nam_keyword_reserved, dtype_boolean, 1 , 0 , NULL , false , ODS_13_1)
FIELD(fld_short_description, nam_short_description, dtype_varying, 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata, NULL , true) FIELD(fld_short_description, nam_short_description, dtype_varying, 255 * METADATA_BYTES_PER_CHAR, dsc_text_type_metadata, NULL , true , ODS_13_1)
FIELD(fld_seconds_interval, nam_seconds_interval, dtype_long, sizeof(SLONG) , 0 , NULL , true) FIELD(fld_seconds_interval, nam_seconds_interval, dtype_long, sizeof(SLONG) , 0 , NULL , true , ODS_13_1)
FIELD(fld_prof_ses_id , nam_prof_ses_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true) FIELD(fld_prof_ses_id , nam_prof_ses_id , dtype_int64 , sizeof(SINT64) , 0 , NULL , true , ODS_13_1)

View File

@ -38,6 +38,7 @@ struct ini_idx_t
UCHAR ini_idx_relid; UCHAR ini_idx_relid;
UCHAR ini_idx_flags; UCHAR ini_idx_flags;
UCHAR ini_idx_segment_count; UCHAR ini_idx_segment_count;
USHORT ini_idx_ods;
struct ini_idx_segment_t struct ini_idx_segment_t
{ {
UCHAR ini_idx_rfld_id; UCHAR ini_idx_rfld_id;
@ -54,254 +55,254 @@ using Jrd::idx_string;
using Jrd::idx_descending; using Jrd::idx_descending;
using Jrd::idx_timestamp_tz; using Jrd::idx_timestamp_tz;
#define INDEX(id, rel, unique, count) {(id), (UCHAR) (rel), (unique), (count), { #define INDEX(id, rel, unique, count, ods) {(id), (UCHAR) (rel), (unique), (count), (ods), {
#define SEGMENT(fld, type) {(fld), (type)} #define SEGMENT(fld, type) {(fld), (type)}
static const struct ini_idx_t indices[] = static const struct ini_idx_t indices[] =
{ {
// define index RDB$INDEX_0 for RDB$RELATIONS unique RDB$RELATION_NAME; // define index RDB$INDEX_0 for RDB$RELATIONS unique RDB$RELATION_NAME;
INDEX(0, rel_relations, idx_unique, 1) INDEX(0, rel_relations, idx_unique, 1, ODS_13_0)
SEGMENT(f_rel_name, idx_metadata) // relation name SEGMENT(f_rel_name, idx_metadata) // relation name
}}, }},
// define index RDB$INDEX_1 for RDB$RELATIONS RDB$RELATION_ID; // define index RDB$INDEX_1 for RDB$RELATIONS RDB$RELATION_ID;
INDEX(1, rel_relations, 0, 1) INDEX(1, rel_relations, 0, 1, ODS_13_0)
SEGMENT(f_rel_id, idx_numeric) // relation id SEGMENT(f_rel_id, idx_numeric) // relation id
}}, }},
// define index RDB$INDEX_2 for RDB$FIELDS unique RDB$FIELD_NAME; // define index RDB$INDEX_2 for RDB$FIELDS unique RDB$FIELD_NAME;
INDEX(2, rel_fields, idx_unique, 1) INDEX(2, rel_fields, idx_unique, 1, ODS_13_0)
SEGMENT(f_fld_name, idx_metadata) // field name SEGMENT(f_fld_name, idx_metadata) // field name
}}, }},
// define index RDB$INDEX_3 for RDB$RELATION_FIELDS RDB$FIELD_SOURCE; // define index RDB$INDEX_3 for RDB$RELATION_FIELDS RDB$FIELD_SOURCE;
INDEX(3, rel_rfr, 0, 1) INDEX(3, rel_rfr, 0, 1, ODS_13_0)
SEGMENT(f_rfr_sname, idx_metadata) // field source name SEGMENT(f_rfr_sname, idx_metadata) // field source name
}}, }},
// define index RDB$INDEX_4 for RDB$RELATION_FIELDS RDB$RELATION_NAME; // define index RDB$INDEX_4 for RDB$RELATION_FIELDS RDB$RELATION_NAME;
INDEX(4, rel_rfr, 0, 1) INDEX(4, rel_rfr, 0, 1, ODS_13_0)
SEGMENT(f_rfr_rname, idx_metadata) // relation name in RFR SEGMENT(f_rfr_rname, idx_metadata) // relation name in RFR
}}, }},
// define index RDB$INDEX_5 for RDB$INDICES unique RDB$INDEX_NAME; // define index RDB$INDEX_5 for RDB$INDICES unique RDB$INDEX_NAME;
INDEX(5, rel_indices, idx_unique, 1) INDEX(5, rel_indices, idx_unique, 1, ODS_13_0)
SEGMENT(f_idx_name, idx_metadata) // index name SEGMENT(f_idx_name, idx_metadata) // index name
}}, }},
// define index RDB$INDEX_6 for RDB$INDEX_SEGMENTS RDB$INDEX_NAME; // define index RDB$INDEX_6 for RDB$INDEX_SEGMENTS RDB$INDEX_NAME;
INDEX(6, rel_segments, 0, 1) INDEX(6, rel_segments, 0, 1, ODS_13_0)
SEGMENT(f_seg_name, idx_metadata) // index name in seg SEGMENT(f_seg_name, idx_metadata) // index name in seg
}}, }},
// define index RDB$INDEX_7 for RDB$SECURITY_CLASSES unique RDB$SECURITY_CLASS; // define index RDB$INDEX_7 for RDB$SECURITY_CLASSES unique RDB$SECURITY_CLASS;
INDEX(7, rel_classes, idx_unique, 1) INDEX(7, rel_classes, idx_unique, 1, ODS_13_0)
SEGMENT(f_cls_class, idx_metadata) // security class SEGMENT(f_cls_class, idx_metadata) // security class
}}, }},
// define index RDB$INDEX_8 for RDB$TRIGGERS unique RDB$TRIGGER_NAME; // define index RDB$INDEX_8 for RDB$TRIGGERS unique RDB$TRIGGER_NAME;
INDEX(8, rel_triggers, idx_unique, 1) INDEX(8, rel_triggers, idx_unique, 1, ODS_13_0)
SEGMENT(f_trg_name, idx_metadata) // trigger name SEGMENT(f_trg_name, idx_metadata) // trigger name
}}, }},
// define index RDB$INDEX_9 for RDB$FUNCTIONS unique RDB$PACKAGE_NAME, RDB$FUNCTION_NAME; // define index RDB$INDEX_9 for RDB$FUNCTIONS unique RDB$PACKAGE_NAME, RDB$FUNCTION_NAME;
INDEX(9, rel_funs, idx_unique, 2) INDEX(9, rel_funs, idx_unique, 2, ODS_13_0)
SEGMENT(f_fun_pkg_name, idx_metadata), // package name SEGMENT(f_fun_pkg_name, idx_metadata), // package name
SEGMENT(f_fun_name, idx_metadata) // function name SEGMENT(f_fun_name, idx_metadata) // function name
}}, }},
// define index RDB$INDEX_10 for RDB$FUNCTION_ARGUMENTS RDB$PACKAGE_NAME, RDB$FUNCTION_NAME; // define index RDB$INDEX_10 for RDB$FUNCTION_ARGUMENTS RDB$PACKAGE_NAME, RDB$FUNCTION_NAME;
INDEX(10, rel_args, 0, 2) INDEX(10, rel_args, 0, 2, ODS_13_0)
SEGMENT(f_arg_pkg_name, idx_metadata), // package name SEGMENT(f_arg_pkg_name, idx_metadata), // package name
SEGMENT(f_arg_fun_name, idx_metadata) // function name SEGMENT(f_arg_fun_name, idx_metadata) // function name
}}, }},
// define index RDB$INDEX_11 for RDB$GENERATORS unique RDB$GENERATOR_NAME; // define index RDB$INDEX_11 for RDB$GENERATORS unique RDB$GENERATOR_NAME;
INDEX(11, rel_gens, idx_unique, 1) INDEX(11, rel_gens, idx_unique, 1, ODS_13_0)
SEGMENT(f_gen_name, idx_metadata) // Generator name SEGMENT(f_gen_name, idx_metadata) // Generator name
}}, }},
// define index RDB$INDEX_12 for RDB$RELATION_CONSTRAINTS unique RDB$CONSTRAINT_NAME; // define index RDB$INDEX_12 for RDB$RELATION_CONSTRAINTS unique RDB$CONSTRAINT_NAME;
INDEX(12, rel_rcon, idx_unique, 1) INDEX(12, rel_rcon, idx_unique, 1, ODS_13_0)
SEGMENT(f_rcon_cname, idx_metadata) // constraint name SEGMENT(f_rcon_cname, idx_metadata) // constraint name
}}, }},
// define index RDB$INDEX_13 for RDB$REF_CONSTRAINTS unique RDB$CONSTRAINT_NAME; // define index RDB$INDEX_13 for RDB$REF_CONSTRAINTS unique RDB$CONSTRAINT_NAME;
INDEX(13, rel_refc, idx_unique, 1) INDEX(13, rel_refc, idx_unique, 1, ODS_13_0)
SEGMENT(f_refc_cname, idx_metadata) // constraint name SEGMENT(f_refc_cname, idx_metadata) // constraint name
}}, }},
// define index RDB$INDEX_14 for RDB$CHECK_CONSTRAINTS RDB$CONSTRAINT_NAME; // define index RDB$INDEX_14 for RDB$CHECK_CONSTRAINTS RDB$CONSTRAINT_NAME;
INDEX(14, rel_ccon, 0, 1) INDEX(14, rel_ccon, 0, 1, ODS_13_0)
SEGMENT(f_ccon_cname, idx_metadata) // constraint name SEGMENT(f_ccon_cname, idx_metadata) // constraint name
}}, }},
// define index RDB$INDEX_15 for RDB$RELATION_FIELDS unique RDB$FIELD_NAME, RDB$RELATION_NAME; // define index RDB$INDEX_15 for RDB$RELATION_FIELDS unique RDB$FIELD_NAME, RDB$RELATION_NAME;
INDEX(15, rel_rfr, idx_unique, 2) INDEX(15, rel_rfr, idx_unique, 2, ODS_13_0)
SEGMENT(f_rfr_fname, idx_metadata), // field name SEGMENT(f_rfr_fname, idx_metadata), // field name
SEGMENT(f_rfr_rname, idx_metadata) // relation name SEGMENT(f_rfr_rname, idx_metadata) // relation name
}}, }},
// define index RDB$INDEX_16 for RDB$FORMATS RDB$RELATION_ID, RDB$FORMAT; // define index RDB$INDEX_16 for RDB$FORMATS RDB$RELATION_ID, RDB$FORMAT;
INDEX(16, rel_formats, 0, 2) INDEX(16, rel_formats, 0, 2, ODS_13_0)
SEGMENT(f_fmt_rid, idx_numeric), // relation id SEGMENT(f_fmt_rid, idx_numeric), // relation id
SEGMENT(f_fmt_format, idx_numeric) // format id SEGMENT(f_fmt_format, idx_numeric) // format id
}}, }},
// define index RDB$INDEX_17 for RDB$FILTERS RDB$INPUT_SUB_TYPE, RDB$OUTPUT_SUB_TYPE; // define index RDB$INDEX_17 for RDB$FILTERS RDB$INPUT_SUB_TYPE, RDB$OUTPUT_SUB_TYPE;
INDEX(17, rel_filters, idx_unique, 2) INDEX(17, rel_filters, idx_unique, 2, ODS_13_0)
SEGMENT(f_flt_input, idx_numeric), // input subtype SEGMENT(f_flt_input, idx_numeric), // input subtype
SEGMENT(f_flt_output, idx_numeric) // output subtype SEGMENT(f_flt_output, idx_numeric) // output subtype
}}, }},
// define index RDB$INDEX_18 for RDB$PROCEDURE_PARAMETERS unique RDB$PACKAGE_NAME, // define index RDB$INDEX_18 for RDB$PROCEDURE_PARAMETERS unique RDB$PACKAGE_NAME,
// RDB$PROCEDURE_NAME, RDB$PARAMETER_NAME; // RDB$PROCEDURE_NAME, RDB$PARAMETER_NAME;
INDEX(18, rel_prc_prms, idx_unique, 3) INDEX(18, rel_prc_prms, idx_unique, 3, ODS_13_0)
SEGMENT(f_prm_pkg_name, idx_metadata), // package name SEGMENT(f_prm_pkg_name, idx_metadata), // package name
SEGMENT(f_prm_procedure, idx_metadata), // procedure name SEGMENT(f_prm_procedure, idx_metadata), // procedure name
SEGMENT(f_prm_name, idx_metadata) // parameter name SEGMENT(f_prm_name, idx_metadata) // parameter name
}}, }},
// define index RDB$INDEX_19 for RDB$CHARACTER_SETS unique RDB$CHARACTER_SET_NAME; // define index RDB$INDEX_19 for RDB$CHARACTER_SETS unique RDB$CHARACTER_SET_NAME;
INDEX(19, rel_charsets, idx_unique, 1) INDEX(19, rel_charsets, idx_unique, 1, ODS_13_0)
SEGMENT(f_cs_cs_name, idx_metadata) // character set name SEGMENT(f_cs_cs_name, idx_metadata) // character set name
}}, }},
// define index RDB$INDEX_20 for RDB$COLLATIONS unique RDB$COLLATION_NAME; // define index RDB$INDEX_20 for RDB$COLLATIONS unique RDB$COLLATION_NAME;
INDEX(20, rel_collations, idx_unique, 1) INDEX(20, rel_collations, idx_unique, 1, ODS_13_0)
SEGMENT(f_coll_name, idx_metadata) // collation name SEGMENT(f_coll_name, idx_metadata) // collation name
}}, }},
// define index RDB$INDEX_21 for RDB$PROCEDURES unique RDB$PACKAGE_NAME, RDB$PROCEDURE_NAME; // define index RDB$INDEX_21 for RDB$PROCEDURES unique RDB$PACKAGE_NAME, RDB$PROCEDURE_NAME;
INDEX(21, rel_procedures, idx_unique, 2) INDEX(21, rel_procedures, idx_unique, 2, ODS_13_0)
SEGMENT(f_prc_pkg_name, idx_metadata), // package name SEGMENT(f_prc_pkg_name, idx_metadata), // package name
SEGMENT(f_prc_name, idx_metadata) // procedure name SEGMENT(f_prc_name, idx_metadata) // procedure name
}}, }},
// define index RDB$INDEX_22 for RDB$PROCEDURES unique RDB$PROCEDURE_ID; // define index RDB$INDEX_22 for RDB$PROCEDURES unique RDB$PROCEDURE_ID;
INDEX(22, rel_procedures, idx_unique, 1) INDEX(22, rel_procedures, idx_unique, 1, ODS_13_0)
SEGMENT(f_prc_id, idx_numeric) // procedure id SEGMENT(f_prc_id, idx_numeric) // procedure id
}}, }},
// define index RDB$INDEX_23 for RDB$EXCEPTIONS unique RDB$EXCEPTION_NAME; // define index RDB$INDEX_23 for RDB$EXCEPTIONS unique RDB$EXCEPTION_NAME;
INDEX(23, rel_exceptions, idx_unique, 1) INDEX(23, rel_exceptions, idx_unique, 1, ODS_13_0)
SEGMENT(f_xcp_name, idx_metadata) // exception name SEGMENT(f_xcp_name, idx_metadata) // exception name
}}, }},
// define index RDB$INDEX_24 for RDB$EXCEPTIONS unique RDB$EXCEPTION_NUMBER; // define index RDB$INDEX_24 for RDB$EXCEPTIONS unique RDB$EXCEPTION_NUMBER;
INDEX(24, rel_exceptions, idx_unique, 1) INDEX(24, rel_exceptions, idx_unique, 1, ODS_13_0)
SEGMENT(f_xcp_number, idx_numeric) // exception number SEGMENT(f_xcp_number, idx_numeric) // exception number
}}, }},
// define index RDB$INDEX_25 for RDB$CHARACTER_SETS unique RDB$CHARACTER_SET_ID; // define index RDB$INDEX_25 for RDB$CHARACTER_SETS unique RDB$CHARACTER_SET_ID;
INDEX(25, rel_charsets, idx_unique, 1) INDEX(25, rel_charsets, idx_unique, 1, ODS_13_0)
SEGMENT(f_cs_id, idx_numeric) // character set id SEGMENT(f_cs_id, idx_numeric) // character set id
}}, }},
// define index RDB$INDEX_26 for RDB$COLLATIONS unique RDB$COLLATION_ID, RDB$CHARACTER_SET_ID; // define index RDB$INDEX_26 for RDB$COLLATIONS unique RDB$COLLATION_ID, RDB$CHARACTER_SET_ID;
INDEX(26, rel_collations, idx_unique, 2) INDEX(26, rel_collations, idx_unique, 2, ODS_13_0)
SEGMENT(f_coll_id, idx_numeric), // collation id SEGMENT(f_coll_id, idx_numeric), // collation id
SEGMENT(f_coll_cs_id, idx_numeric) // character set id SEGMENT(f_coll_cs_id, idx_numeric) // character set id
}}, }},
// define index RDB$INDEX_27 for RDB$DEPENDENCIES RDB$DEPENDENT_NAME, RDB$DEPENDENT_TYPE; // define index RDB$INDEX_27 for RDB$DEPENDENCIES RDB$DEPENDENT_NAME, RDB$DEPENDENT_TYPE;
INDEX(27, rel_dpds, 0, 2) INDEX(27, rel_dpds, 0, 2, ODS_13_0)
SEGMENT(f_dpd_name, idx_metadata), // dependent name SEGMENT(f_dpd_name, idx_metadata), // dependent name
SEGMENT(f_dpd_type, idx_numeric) // dependent type SEGMENT(f_dpd_type, idx_numeric) // dependent type
}}, }},
// define index RDB$INDEX_28 for RDB$DEPENDENCIES RDB$DEPENDED_ON_NAME, RDB$DEPENDED_ON_TYPE, RDB$FIELD_NAME; // define index RDB$INDEX_28 for RDB$DEPENDENCIES RDB$DEPENDED_ON_NAME, RDB$DEPENDED_ON_TYPE, RDB$FIELD_NAME;
INDEX(28, rel_dpds, 0, 3) INDEX(28, rel_dpds, 0, 3, ODS_13_0)
SEGMENT(f_dpd_o_name, idx_metadata), // dependent on name SEGMENT(f_dpd_o_name, idx_metadata), // dependent on name
SEGMENT(f_dpd_o_type, idx_numeric), // dependent on type SEGMENT(f_dpd_o_type, idx_numeric), // dependent on type
SEGMENT(f_dpd_f_name, idx_metadata) // field name SEGMENT(f_dpd_f_name, idx_metadata) // field name
}}, }},
// define index RDB$INDEX_29 for RDB$USER_PRIVILEGES RDB$RELATION_NAME; // define index RDB$INDEX_29 for RDB$USER_PRIVILEGES RDB$RELATION_NAME;
INDEX(29, rel_priv, 0, 1) INDEX(29, rel_priv, 0, 1, ODS_13_0)
SEGMENT(f_prv_rname, idx_metadata) // relation name SEGMENT(f_prv_rname, idx_metadata) // relation name
}}, }},
// define index RDB$INDEX_30 for RDB$USER_PRIVILEGES RDB$USER; // define index RDB$INDEX_30 for RDB$USER_PRIVILEGES RDB$USER;
INDEX(30, rel_priv, 0, 1) INDEX(30, rel_priv, 0, 1, ODS_13_0)
SEGMENT(f_prv_user, idx_metadata) // granted user SEGMENT(f_prv_user, idx_metadata) // granted user
}}, }},
// define index RDB$INDEX_31 for RDB$INDICES RDB$RELATION_NAME; // define index RDB$INDEX_31 for RDB$INDICES RDB$RELATION_NAME;
INDEX(31, rel_indices, 0, 1) INDEX(31, rel_indices, 0, 1, ODS_13_0)
SEGMENT(f_idx_relation, idx_metadata) // indexed relation SEGMENT(f_idx_relation, idx_metadata) // indexed relation
}}, }},
// define index RDB$INDEX_32 for RDB$TRANSACTIONS unique RDB$TRANSACTION_ID; // define index RDB$INDEX_32 for RDB$TRANSACTIONS unique RDB$TRANSACTION_ID;
INDEX(32, rel_trans, idx_unique, 1) INDEX(32, rel_trans, idx_unique, 1, ODS_13_0)
SEGMENT(f_trn_id, idx_numeric) // transaction id SEGMENT(f_trn_id, idx_numeric) // transaction id
}}, }},
// define index RDB$INDEX_33 for RDB$VIEW_RELATIONS RDB$VIEW_NAME; // define index RDB$INDEX_33 for RDB$VIEW_RELATIONS RDB$VIEW_NAME;
INDEX(33, rel_vrel, 0, 1) INDEX(33, rel_vrel, 0, 1, ODS_13_0)
SEGMENT(f_vrl_vname, idx_metadata) // view name SEGMENT(f_vrl_vname, idx_metadata) // view name
}}, }},
// define index RDB$INDEX_34 for RDB$VIEW_RELATIONS RDB$RELATION_NAME; // define index RDB$INDEX_34 for RDB$VIEW_RELATIONS RDB$RELATION_NAME;
INDEX(34, rel_vrel, 0, 1) INDEX(34, rel_vrel, 0, 1, ODS_13_0)
SEGMENT(f_vrl_rname, idx_metadata) // base relation name SEGMENT(f_vrl_rname, idx_metadata) // base relation name
}}, }},
// define index RDB$INDEX_35 for RDB$TRIGGER_MESSAGES RDB$TRIGGER_NAME; // define index RDB$INDEX_35 for RDB$TRIGGER_MESSAGES RDB$TRIGGER_NAME;
INDEX(35, rel_msgs, 0, 1) INDEX(35, rel_msgs, 0, 1, ODS_13_0)
SEGMENT(f_msg_trigger, idx_metadata) // trigger name SEGMENT(f_msg_trigger, idx_metadata) // trigger name
}}, }},
// define index RDB$INDEX_36 for RDB$FIELD_DIMENSIONS RDB$FIELD_NAME; // define index RDB$INDEX_36 for RDB$FIELD_DIMENSIONS RDB$FIELD_NAME;
INDEX(36, rel_dims, 0, 1) INDEX(36, rel_dims, 0, 1, ODS_13_0)
SEGMENT(f_dims_fname, idx_metadata) // array name SEGMENT(f_dims_fname, idx_metadata) // array name
}}, }},
// define index RDB$INDEX_37 for RDB$TYPES RDB$TYPE_NAME; // define index RDB$INDEX_37 for RDB$TYPES RDB$TYPE_NAME;
INDEX(37, rel_types, 0, 1) INDEX(37, rel_types, 0, 1, ODS_13_0)
SEGMENT(f_typ_name, idx_metadata) // type name SEGMENT(f_typ_name, idx_metadata) // type name
}}, }},
// define index RDB$INDEX_38 for RDB$TRIGGERS RDB$RELATION_NAME; // define index RDB$INDEX_38 for RDB$TRIGGERS RDB$RELATION_NAME;
INDEX(38, rel_triggers, 0, 1) INDEX(38, rel_triggers, 0, 1, ODS_13_0)
SEGMENT(f_trg_rname, idx_metadata) // triggered relation SEGMENT(f_trg_rname, idx_metadata) // triggered relation
}}, }},
// define index RDB$INDEX_39 for RDB$ROLES unique RDB$ROLE_NAME; // define index RDB$INDEX_39 for RDB$ROLES unique RDB$ROLE_NAME;
INDEX(39, rel_roles, idx_unique, 1) INDEX(39, rel_roles, idx_unique, 1, ODS_13_0)
SEGMENT(f_rol_name, idx_metadata) // role name SEGMENT(f_rol_name, idx_metadata) // role name
}}, }},
// define index RDB$INDEX_40 for RDB$CHECK_CONSTRAINTS RDB$TRIGGER_NAME; // define index RDB$INDEX_40 for RDB$CHECK_CONSTRAINTS RDB$TRIGGER_NAME;
INDEX(40, rel_ccon, 0, 1) INDEX(40, rel_ccon, 0, 1, ODS_13_0)
SEGMENT(f_ccon_tname, idx_metadata) // trigger name SEGMENT(f_ccon_tname, idx_metadata) // trigger name
}}, }},
// define index RDB$INDEX_41 for RDB$INDICES RDB$FOREIGN_KEY; // define index RDB$INDEX_41 for RDB$INDICES RDB$FOREIGN_KEY;
INDEX(41, rel_indices, 0, 1) INDEX(41, rel_indices, 0, 1, ODS_13_0)
SEGMENT(f_idx_foreign, idx_metadata) // foreign key name SEGMENT(f_idx_foreign, idx_metadata) // foreign key name
}}, }},
// define index RDB$INDEX_42 for RDB$RELATION_CONSTRAINTS RDB$RELATION_NAME, RDB$CONSTRAINT_TYPE; // define index RDB$INDEX_42 for RDB$RELATION_CONSTRAINTS RDB$RELATION_NAME, RDB$CONSTRAINT_TYPE;
INDEX(42, rel_rcon, 0, 2) INDEX(42, rel_rcon, 0, 2, ODS_13_0)
SEGMENT(f_rcon_rname, idx_metadata), // relation name SEGMENT(f_rcon_rname, idx_metadata), // relation name
SEGMENT(f_rcon_ctype, idx_metadata) // constraint type SEGMENT(f_rcon_ctype, idx_metadata) // constraint type
}}, }},
// define index RDB$INDEX_43 for RDB$RELATION_CONSTRAINTS RDB$INDEX_NAME; // define index RDB$INDEX_43 for RDB$RELATION_CONSTRAINTS RDB$INDEX_NAME;
INDEX(43, rel_rcon, 0, 1) INDEX(43, rel_rcon, 0, 1, ODS_13_0)
SEGMENT(f_rcon_iname, idx_metadata), // index name SEGMENT(f_rcon_iname, idx_metadata), // index name
}}, }},
// define index RDB$INDEX_44 for RDB$BACKUP_HISTORY RDB$LEVEL, RDB$BACKUP_ID; // define index RDB$INDEX_44 for RDB$BACKUP_HISTORY RDB$LEVEL, RDB$BACKUP_ID;
INDEX(44, rel_backup_history, idx_unique | idx_descending, 2) INDEX(44, rel_backup_history, idx_unique | idx_descending, 2, ODS_13_0)
SEGMENT(f_backup_level, idx_numeric), // backup level SEGMENT(f_backup_level, idx_numeric), // backup level
SEGMENT(f_backup_id, idx_numeric) // backup id SEGMENT(f_backup_id, idx_numeric) // backup id
}}, }},
// define index RDB$INDEX_45 for RDB$FILTERS RDB$FUNCTION_NAME; // define index RDB$INDEX_45 for RDB$FILTERS RDB$FUNCTION_NAME;
INDEX(45, rel_filters, idx_unique, 1) INDEX(45, rel_filters, idx_unique, 1, ODS_13_0)
SEGMENT(f_flt_name, idx_metadata) // function name SEGMENT(f_flt_name, idx_metadata) // function name
}}, }},
// define index RDB$INDEX_46 for RDB$GENERATORS unique RDB$GENERATOR_ID; // define index RDB$INDEX_46 for RDB$GENERATORS unique RDB$GENERATOR_ID;
INDEX(46, rel_gens, idx_unique, 1) INDEX(46, rel_gens, idx_unique, 1, ODS_13_0)
SEGMENT(f_gen_id, idx_numeric) // generator id SEGMENT(f_gen_id, idx_numeric) // generator id
}}, }},
// define index RDB$INDEX_47 for RDB$PACKAGES unique RDB$PACKAGE_NAME; // define index RDB$INDEX_47 for RDB$PACKAGES unique RDB$PACKAGE_NAME;
INDEX(47, rel_packages, idx_unique, 1) INDEX(47, rel_packages, idx_unique, 1, ODS_13_0)
SEGMENT(f_pkg_name, idx_metadata) // package name SEGMENT(f_pkg_name, idx_metadata) // package name
}}, }},
// define index RDB$INDEX_48 for RDB$PROCEDURE_PARAMETERS RDB$FIELD_SOURCE; // define index RDB$INDEX_48 for RDB$PROCEDURE_PARAMETERS RDB$FIELD_SOURCE;
INDEX(48, rel_prc_prms, 0, 1) INDEX(48, rel_prc_prms, 0, 1, ODS_13_0)
SEGMENT(f_prm_sname, idx_metadata) // field source name SEGMENT(f_prm_sname, idx_metadata) // field source name
}}, }},
// define index RDB$INDEX_49 for RDB$FUNCTION_ARGUMENTS RDB$FIELD_SOURCE; // define index RDB$INDEX_49 for RDB$FUNCTION_ARGUMENTS RDB$FIELD_SOURCE;
INDEX(49, rel_args, 0, 1) INDEX(49, rel_args, 0, 1, ODS_13_0)
SEGMENT(f_arg_sname, idx_metadata) // field source name SEGMENT(f_arg_sname, idx_metadata) // field source name
}}, }},
// define index RDB$INDEX_50 for RDB$PROCEDURE_PARAMETERS RDB$RELATION_NAME, RDB$FIELD_NAME; // define index RDB$INDEX_50 for RDB$PROCEDURE_PARAMETERS RDB$RELATION_NAME, RDB$FIELD_NAME;
INDEX(50, rel_prc_prms, 0, 2) INDEX(50, rel_prc_prms, 0, 2, ODS_13_0)
SEGMENT(f_prm_rname, idx_metadata), // relation name SEGMENT(f_prm_rname, idx_metadata), // relation name
SEGMENT(f_prm_fname, idx_metadata) // field name SEGMENT(f_prm_fname, idx_metadata) // field name
}}, }},
// define index RDB$INDEX_51 for RDB$FUNCTION_ARGUMENTS RDB$RELATION_NAME, RDB$FIELD_NAME; // define index RDB$INDEX_51 for RDB$FUNCTION_ARGUMENTS RDB$RELATION_NAME, RDB$FIELD_NAME;
INDEX(51, rel_args, 0, 2) INDEX(51, rel_args, 0, 2, ODS_13_0)
SEGMENT(f_arg_rname, idx_metadata), // relation name SEGMENT(f_arg_rname, idx_metadata), // relation name
SEGMENT(f_arg_fname, idx_metadata) // field name SEGMENT(f_arg_fname, idx_metadata) // field name
}}, }},
// define index RDB$INDEX_52 for RDB$AUTH_MAPPING RDB$MAP_NAME; // define index RDB$INDEX_52 for RDB$AUTH_MAPPING RDB$MAP_NAME;
INDEX(52, rel_auth_mapping, 0, 1) INDEX(52, rel_auth_mapping, 0, 1, ODS_13_0)
SEGMENT(f_map_name, idx_metadata) // mapping name SEGMENT(f_map_name, idx_metadata) // mapping name
}}, }},
// define index RDB$INDEX_53 for RDB$FUNCTIONS unique RDB$FUNCTION_ID; // define index RDB$INDEX_53 for RDB$FUNCTIONS unique RDB$FUNCTION_ID;
INDEX(53, rel_funs, idx_unique, 1) INDEX(53, rel_funs, idx_unique, 1, ODS_13_0)
SEGMENT(f_fun_id, idx_numeric) // function id SEGMENT(f_fun_id, idx_numeric) // function id
}}, }},
// define index RDB$INDEX_54 for RDB$BACKUP_HISTORY RDB$GUID; // define index RDB$INDEX_54 for RDB$BACKUP_HISTORY RDB$GUID;
INDEX(54, rel_backup_history, idx_unique, 1) INDEX(54, rel_backup_history, idx_unique, 1, ODS_13_0)
SEGMENT(f_backup_guid, idx_string) // backup guid SEGMENT(f_backup_guid, idx_string) // backup guid
}}, }},
// define index RDB$INDEX_55 for RDB$PUBLICATIONS unique RDB$PUBLICATION_NAME; // define index RDB$INDEX_55 for RDB$PUBLICATIONS unique RDB$PUBLICATION_NAME;
INDEX(55, rel_pubs, idx_unique, 1) INDEX(55, rel_pubs, idx_unique, 1, ODS_13_0)
SEGMENT(f_pub_name, idx_string) // publication name SEGMENT(f_pub_name, idx_string) // publication name
}}, }},
// define index RDB$INDEX_56 for RDB$PUBLICATION_TABLES unique RDB$TABLE_NAME, RDB$PUBLICATION_NAME; // define index RDB$INDEX_56 for RDB$PUBLICATION_TABLES unique RDB$TABLE_NAME, RDB$PUBLICATION_NAME;
INDEX(56, rel_pub_tables, idx_unique, 2) INDEX(56, rel_pub_tables, idx_unique, 2, ODS_13_0)
SEGMENT(f_pubtab_tab_name, idx_string), // table name SEGMENT(f_pubtab_tab_name, idx_string), // table name
SEGMENT(f_pubtab_pub_name, idx_string) // publication name SEGMENT(f_pubtab_pub_name, idx_string) // publication name
}}, }},

View File

@ -70,7 +70,7 @@ DATABASE DB = FILENAME "ODS.RDB";
const int FB_MAX_ACL_SIZE = 4096; const int FB_MAX_ACL_SIZE = 4096;
static void add_index_set(thread_db*); static void add_index_set(thread_db*, USHORT = 0);
static void add_security_to_sys_obj(thread_db*, AutoRequest&, AutoRequest&, AutoRequest&, static void add_security_to_sys_obj(thread_db*, AutoRequest&, AutoRequest&, AutoRequest&,
const MetaName&, USHORT, const MetaName&, USHORT = 0, const UCHAR* = NULL); const MetaName&, USHORT, const MetaName&, USHORT = 0, const UCHAR* = NULL);
static void add_security_class(thread_db* tdbb, AutoRequest&, const MetaName& class_name, static void add_security_class(thread_db* tdbb, AutoRequest&, const MetaName& class_name,
@ -82,8 +82,9 @@ static void store_generator(thread_db*, const gen*, AutoRequest&, const MetaName
static void store_global_field(thread_db*, const gfld*, AutoRequest&, const MetaName&); static void store_global_field(thread_db*, const gfld*, AutoRequest&, const MetaName&);
static void store_intlnames(thread_db*, const MetaName&); static void store_intlnames(thread_db*, const MetaName&);
static void store_message(thread_db*, const trigger_msg*, AutoRequest&); static void store_message(thread_db*, const trigger_msg*, AutoRequest&);
static void store_relation_field(thread_db*, const int*, const int*, int, AutoRequest&); static void store_relation(thread_db*, int, const char*, const char*, int, int, AutoRequest&);
static void store_packages(thread_db* tdbb, const MetaName& owner); static void store_relation_field(thread_db*, int, const char*, const char*, const char*, int, AutoRequest&);
static void store_packages(thread_db* tdbb, const MetaName& owner, USHORT = 0);
static void store_trigger(thread_db*, const jrd_trg*, AutoRequest&); static void store_trigger(thread_db*, const jrd_trg*, AutoRequest&);
static void store_admin_grant(thread_db*, const char* grantee, USHORT grantee_type, static void store_admin_grant(thread_db*, const char* grantee, USHORT grantee_type,
const char* object, USHORT object_type, const char* prvl, USHORT option = 0, bool dflt = false); const char* object, USHORT object_type, const char* prvl, USHORT option = 0, bool dflt = false);
@ -246,7 +247,7 @@ void INI_format(const char* owner, const char* charset)
MetaName ownerName(owner); MetaName ownerName(owner);
// Uppercase charset name // Uppercase charset name
MetaName rdbCharSetName(charset && charset[0] ? charset : DEFAULT_DB_CHARACTER_SET_NAME); MetaName charSetName(charset && charset[0] ? charset : DEFAULT_DB_CHARACTER_SET_NAME);
const int* fld; const int* fld;
@ -267,35 +268,32 @@ void INI_format(const char* owner, const char* charset)
// Store RELATIONS and RELATION_FIELDS // Store RELATIONS and RELATION_FIELDS
SLONG rdbRelationId; AutoRequest handle1, handle2;
MetaName rdbRelationName;
SLONG rdbFieldId;
SLONG rdbSystemFlag = RDB_system;
SLONG rdbRelationType;
PreparedStatement::Builder sql;
sql << "insert into rdb$relations (rdb$relation_id, rdb$relation_name, rdb$field_id,"
<< "rdb$format, rdb$system_flag, rdb$dbkey_length, rdb$owner_name, rdb$relation_type)"
<< "values (" << rdbRelationId << ", " << rdbRelationName << ", " << rdbFieldId << ", 0,"
<< rdbSystemFlag << ", 8, " << ownerName << ", " << rdbRelationType << ")";
AutoPreparedStatement ps(attachment->prepareStatement(tdbb, transaction, sql));
AutoRequest handle1;
for (const int* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1) for (const int* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1)
{ {
for (rdbFieldId = 0, fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; fld += RFLD_F_LENGTH) int fieldId = 0;
for (fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; fld += RFLD_F_LENGTH)
{ {
const int* pFld = fld; const gfld* gfield = &gfields[fld[RFLD_F_ID]];
const int* pRelFld = relfld; const auto relId = relfld[RFLD_R_ID];
store_relation_field(tdbb, pFld, pRelFld, rdbFieldId, handle1); const auto relName = names[relfld[RFLD_R_NAME]];
++rdbFieldId; const auto fieldName = names[fld[RFLD_F_NAME]];
const auto globalName = names[gfield->gfld_name];
const auto updateFlag = fld[RFLD_F_UPDATE];
store_relation_field(tdbb, fieldId, relName, fieldName, globalName,
updateFlag, handle1);
++fieldId;
} }
rdbRelationId = relfld[RFLD_R_ID]; const auto relId = relfld[RFLD_R_ID];
rdbRelationName = names[relfld[RFLD_R_NAME]]; const auto relName = names[relfld[RFLD_R_NAME]];
rdbRelationType = relfld[RFLD_R_TYPE]; const auto relType = relfld[RFLD_R_TYPE];
ps->execute(tdbb, transaction);
store_relation(tdbb, relId, relName, ownerName.c_str(),
fieldId, relType, handle2);
} }
handle1.reset(); handle1.reset();
@ -307,14 +305,13 @@ void INI_format(const char* owner, const char* charset)
// Store DATABASE record // Store DATABASE record
sql = PreparedStatement::Builder(); handle1.reset();
sql << "insert into rdb$database (rdb$relation_id, rdb$character_set_name) values ("
<< rdbRelationId << ", " << rdbCharSetName << ")";
ps.reset(attachment->prepareStatement(tdbb, transaction, sql)); STORE(REQUEST_HANDLE handle1) X IN RDB$DATABASE
X.RDB$RELATION_ID = (int) USER_DEF_REL_INIT_ID;
rdbRelationId = USER_DEF_REL_INIT_ID; PAD(charSetName.c_str(), X.RDB$CHARACTER_SET_NAME);
ps->execute(tdbb, transaction); X.RDB$CHARACTER_SET_NAME.NULL = FALSE;
END_STORE
// Store default publication // Store default publication
@ -536,6 +533,7 @@ void INI_format(const char* owner, const char* charset)
add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_database, add_security_to_sys_obj(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, obj_database,
"", length, buffer); "", length, buffer);
} }
// Add security on system tables // Add security on system tables
const UCHAR REL_OWNER_ACL[] = const UCHAR REL_OWNER_ACL[] =
@ -571,10 +569,13 @@ void INI_format(const char* owner, const char* charset)
AutoRequest reqModObjSC, reqInsUserPriv; AutoRequest reqModObjSC, reqInsUserPriv;
for (const int* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1) for (const int* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1)
{ {
for (rdbFieldId = 0, fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; fld += RFLD_F_LENGTH) int fieldId = 0;
++rdbFieldId; for (fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; fld += RFLD_F_LENGTH)
++fieldId;
add_security_to_sys_rel(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, names[relfld[RFLD_R_NAME]], length, buffer); const auto relName = names[relfld[RFLD_R_NAME]];
add_security_to_sys_rel(tdbb, reqAddSC, reqModObjSC, reqInsUserPriv, ownerName, relName, length, buffer);
} }
} }
@ -923,7 +924,168 @@ void INI_init_dsql(thread_db* tdbb, dsql_dbb* database)
} }
static void add_index_set(thread_db* tdbb) void INI_upgrade(thread_db* tdbb)
{
/**************************************
*
* I N I _ u p g r a d e
*
**************************************
*
* Functional description
* Upgrade minor ODS version.
*
**************************************/
const auto dbb = tdbb->getDatabase();
const auto attachment = tdbb->getAttachment();
// If database is read-only, punt
if (dbb->dbb_flags & DBB_read_only)
Arg::Gds(isc_read_only).raise();
// Check current ODS version to see if we have work to do
const auto majorVersion = dbb->dbb_ods_version;
fb_assert(majorVersion == ODS_VERSION);
const auto minorVersion = dbb->dbb_minor_version;
if (minorVersion == ODS_CURRENT)
return;
const auto odsVersion = ENCODE_ODS(majorVersion, minorVersion);
const int* fld;
// Make sure relations exist already
for (const int* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1)
{
if (relfld[RFLD_R_TYPE] == rel_persistent &&
relfld[RFLD_R_ODS] > odsVersion)
{
DPM_create_relation(tdbb, MET_relation(tdbb, relfld[RFLD_R_ID]));
}
for (fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; fld += RFLD_F_LENGTH)
;
}
AutoRequest handle1, handle2;
// Get the database owner
MetaName ownerName;
FOR(REQUEST_HANDLE handle1)
FIRST 1 REL IN RDB$RELATIONS
WITH REL.RDB$RELATION_NAME EQ "RDB$DATABASE"
{
fb_assert(!REL.RDB$OWNER_NAME.NULL);
ownerName = REL.RDB$OWNER_NAME;
}
END_FOR
// Create global fields added after the original minor ODS
handle1.reset();
for (const gfld* gfield = gfields; gfield->gfld_name; gfield++)
{
if (gfield->gfld_ods_version > odsVersion)
store_global_field(tdbb, gfield, handle1, ownerName);
}
// Create new system relations and new relation fields
handle1.reset();
for (const int* relfld = relfields; relfld[RFLD_R_NAME]; relfld = fld + 1)
{
int fieldId = 0;
for (fld = relfld + RFLD_RPT; fld[RFLD_F_NAME]; fld += RFLD_F_LENGTH)
{
if (fld[RFLD_F_ODS] > odsVersion)
{
const gfld* gfield = &gfields[fld[RFLD_F_ID]];
const auto relId = relfld[RFLD_R_ID];
const auto relName = names[relfld[RFLD_R_NAME]];
const auto fieldName = names[fld[RFLD_F_NAME]];
const auto globalName = names[gfield->gfld_name];
const auto updateFlag = fld[RFLD_F_UPDATE];
store_relation_field(tdbb, fieldId, relName, fieldName, globalName,
updateFlag, handle1);
}
++fieldId;
}
if (relfld[RFLD_R_ODS] > odsVersion)
{
const auto relId = relfld[RFLD_R_ID];
const auto relName = names[relfld[RFLD_R_NAME]];
const auto relType = relfld[RFLD_R_TYPE];
store_relation(tdbb, relId, relName, ownerName.c_str(),
fieldId, relType, handle2);
}
}
// Create new system indexes
add_index_set(tdbb, odsVersion);
// Create new system triggers and their trigger messages
handle1.reset();
for (const jrd_trg* trigger = triggers; trigger->trg_relation; ++trigger)
{
if (trigger->trg_ods_version > odsVersion)
store_trigger(tdbb, trigger, handle1);
}
handle1.reset();
for (const trigger_msg* message = trigger_messages; message->trigmsg_name; ++message)
{
if (message->trg_ods_version > odsVersion)
store_message(tdbb, message, handle1);
}
// Create new system generators
handle1.reset();
for (const gen* generator = generators; generator->gen_name; generator++)
{
if (generator->gen_ods_version > odsVersion)
store_generator(tdbb, generator, handle1, ownerName);
}
// Create new system packages
store_packages(tdbb, ownerName, odsVersion);
// Should we also add new types? They are collected from multiple sources and
// don't have their corresponding ODS defined.
// The same for new charsets/collations.
// If the database was successfully updated, mark it with the current minor ODS
win window(HEADER_PAGE_NUMBER);
auto header = (Ods::header_page*) CCH_FETCH(tdbb, &window, LCK_write, pag_header);
CCH_MARK(tdbb, &window);
dbb->dbb_minor_version = header->hdr_ods_minor = ODS_CURRENT;
CCH_RELEASE(tdbb, &window);
DFW_perform_system_work(tdbb);
}
static void add_index_set(thread_db* tdbb, USHORT odsVersion)
{ {
/************************************** /**************************************
* *
@ -932,9 +1094,8 @@ static void add_index_set(thread_db* tdbb)
************************************** **************************************
* *
* Functional description * Functional description
* Add system indices. If update_ods is true we are performing * Add system indices. If odsVersion is specified, then we are performing
* an ODS update, and only add the indices marked as newer than * an ODS update, so add only the indices marked as newer than odsVersion.
* ODS (major_version,minor_version).
* *
**************************************/ **************************************/
SET_TDBB(tdbb); SET_TDBB(tdbb);
@ -949,6 +1110,9 @@ static void add_index_set(thread_db* tdbb)
const ini_idx_t* index = &indices[n]; const ini_idx_t* index = &indices[n];
jrd_rel* relation = MET_relation(tdbb, index->ini_idx_relid); jrd_rel* relation = MET_relation(tdbb, index->ini_idx_relid);
if (odsVersion && index->ini_idx_ods <= odsVersion)
continue;
MetaName indexName; MetaName indexName;
indexName.printf("RDB$INDEX_%d", index->ini_idx_index_id); indexName.printf("RDB$INDEX_%d", index->ini_idx_index_id);
@ -1679,11 +1843,37 @@ static void store_message(thread_db* tdbb, const trigger_msg* message, AutoReque
} }
static void store_relation_field(thread_db* tdbb, static void store_relation(thread_db* tdbb,
const int* fld, int relId,
const int* relfld, const char* relName,
int field_id, const char* ownerName,
AutoRequest& handle) int fieldId,
int relType,
AutoRequest& handle)
{
SET_TDBB(tdbb);
const auto attachment = tdbb->getAttachment();
STORE(REQUEST_HANDLE handle) X IN RDB$RELATIONS
X.RDB$RELATION_ID = relId;
PAD(relName, X.RDB$RELATION_NAME);
PAD(ownerName, X.RDB$OWNER_NAME);
X.RDB$OWNER_NAME.NULL = FALSE;
X.RDB$FIELD_ID = fieldId;
X.RDB$FORMAT = 0;
X.RDB$SYSTEM_FLAG = RDB_system;
X.RDB$DBKEY_LENGTH = 8;
END_STORE;
}
static void store_relation_field(thread_db* tdbb,
int fieldId,
const char* relName,
const char* fieldName,
const char* globalName,
int updateFlag,
AutoRequest& handle)
{ {
/************************************** /**************************************
* *
@ -1701,28 +1891,25 @@ static void store_relation_field(thread_db* tdbb,
STORE(REQUEST_HANDLE handle) X IN RDB$RELATION_FIELDS STORE(REQUEST_HANDLE handle) X IN RDB$RELATION_FIELDS
{ {
const gfld* gfield = &gfields[fld[RFLD_F_ID]]; PAD(relName, X.RDB$RELATION_NAME);
PAD(names[relfld[RFLD_R_NAME]], X.RDB$RELATION_NAME); PAD(fieldName, X.RDB$FIELD_NAME);
PAD(names[fld[RFLD_F_NAME]], X.RDB$FIELD_NAME); PAD(globalName, X.RDB$FIELD_SOURCE);
PAD(names[gfield->gfld_name], X.RDB$FIELD_SOURCE); X.RDB$FIELD_POSITION = fieldId;
X.RDB$FIELD_POSITION = field_id; X.RDB$FIELD_ID = fieldId;
X.RDB$FIELD_ID = field_id;
X.RDB$SYSTEM_FLAG = RDB_system; X.RDB$SYSTEM_FLAG = RDB_system;
X.RDB$SYSTEM_FLAG.NULL = FALSE; X.RDB$SYSTEM_FLAG.NULL = FALSE;
X.RDB$UPDATE_FLAG = fld[RFLD_F_UPDATE]; X.RDB$UPDATE_FLAG = updateFlag;
} }
END_STORE END_STORE
} }
// Store system packages. // Store system packages.
static void store_packages(thread_db* tdbb, const MetaName& owner) static void store_packages(thread_db* tdbb, const MetaName& owner, USHORT odsVersion)
{ {
SET_TDBB(tdbb); SET_TDBB(tdbb);
Jrd::Attachment* attachment = tdbb->getAttachment(); Jrd::Attachment* attachment = tdbb->getAttachment();
Database* const dbb = tdbb->getDatabase(); Database* const dbb = tdbb->getDatabase();
const USHORT majorVersion = dbb->dbb_ods_version;
const USHORT minorVersion = dbb->dbb_minor_version;
AutoRequest packageHandle, procedureHandle, procedureParameterHandle; AutoRequest packageHandle, procedureHandle, procedureParameterHandle;
AutoRequest functionHandle, functionReturnHandle, functionArgumentHandle; AutoRequest functionHandle, functionReturnHandle, functionArgumentHandle;
@ -1731,7 +1918,7 @@ static void store_packages(thread_db* tdbb, const MetaName& owner)
for (auto& systemPackage : SystemPackage::get()) for (auto& systemPackage : SystemPackage::get())
{ {
if (systemPackage.odsVersion > ENCODE_ODS(majorVersion, minorVersion)) if (odsVersion && systemPackage.odsVersion < odsVersion)
continue; continue;
STORE (REQUEST_HANDLE packageHandle) PKG IN RDB$PACKAGES STORE (REQUEST_HANDLE packageHandle) PKG IN RDB$PACKAGES

View File

@ -75,7 +75,7 @@ const USHORT TIMESTAMP_TZ_SIZE = 12;
// Pick up global ids // Pick up global ids
#define FIELD(type, name, dtype, length, sub_type, dflt_blr, nullable) type, #define FIELD(type, name, dtype, length, sub_type, dflt_blr, nullable, ods) type,
enum gflds enum gflds
{ {
#include "../jrd/fields.h" #include "../jrd/fields.h"
@ -88,11 +88,11 @@ typedef gflds GFLDS;
// Pick up actual global fields // Pick up actual global fields
#ifndef GPRE #ifndef GPRE
#define FIELD(type, name, dtype, length, sub_type, dflt_blr, nullable) \ #define FIELD(type, name, dtype, length, sub_type, dflt_blr, nullable, ods) \
{ (int) type, (int) name, dtype, length, sub_type, dflt_blr, sizeof(dflt_blr), nullable }, { (int) type, (int) name, dtype, length, sub_type, dflt_blr, sizeof(dflt_blr), nullable, ods },
#else #else
#define FIELD(type, name, dtype, length, sub_type, dflt_blr, nullable) \ #define FIELD(type, name, dtype, length, sub_type, dflt_blr, nullable, ods) \
{ (int) type, (int) name, dtype, length, sub_type, NULL, 0, true }, { (int) type, (int) name, dtype, length, sub_type, NULL, 0, true, ods },
#endif #endif
struct gfld struct gfld
@ -105,12 +105,13 @@ struct gfld
const UCHAR* gfld_dflt_blr; const UCHAR* gfld_dflt_blr;
USHORT gfld_dflt_len; USHORT gfld_dflt_len;
bool gfld_nullable; bool gfld_nullable;
USHORT gfld_ods_version;
}; };
static const struct gfld gfields[] = static const struct gfld gfields[] =
{ {
#include "../jrd/fields.h" #include "../jrd/fields.h"
{ 0, 0, dtype_unknown, 0, 0, NULL, 0, false } { 0, 0, dtype_unknown, 0, 0, NULL, 0, false, 0 }
}; };
#undef FIELD #undef FIELD

View File

@ -35,5 +35,6 @@ void INI_init(Jrd::thread_db*);
void INI_init2(Jrd::thread_db*); void INI_init2(Jrd::thread_db*);
void INI_init_dsql(Jrd::thread_db*, Jrd::dsql_dbb* database); void INI_init_dsql(Jrd::thread_db*, Jrd::dsql_dbb* database);
Firebird::string INI_owner_privileges(); Firebird::string INI_owner_privileges();
void INI_upgrade(Jrd::thread_db*);
#endif // JRD_INI_PROTO_H #endif // JRD_INI_PROTO_H

View File

@ -1083,6 +1083,7 @@ namespace Jrd
ReplicaMode dpb_replica_mode; ReplicaMode dpb_replica_mode;
bool dpb_set_db_replica; bool dpb_set_db_replica;
bool dpb_clear_map; bool dpb_clear_map;
bool dpb_upgrade_db;
// here begin compound objects // here begin compound objects
// for constructor to work properly dpb_user_name // for constructor to work properly dpb_user_name
@ -1835,6 +1836,12 @@ JAttachment* JProvider::internalAttach(CheckStatusWrapper* user_status, const ch
dbb->dbb_tip_cache = FB_NEW_POOL(*dbb->dbb_permanent) TipCache(dbb); dbb->dbb_tip_cache = FB_NEW_POOL(*dbb->dbb_permanent) TipCache(dbb);
dbb->dbb_tip_cache->initializeTpc(tdbb); dbb->dbb_tip_cache->initializeTpc(tdbb);
if (options.dpb_upgrade_db)
{
validateAccess(tdbb, attachment, USE_GFIX_UTILITY);
INI_upgrade(tdbb);
}
// linger // linger
dbb->dbb_linger_seconds = MET_get_linger(tdbb); dbb->dbb_linger_seconds = MET_get_linger(tdbb);
@ -7248,6 +7255,9 @@ void DatabaseOptions::get(const UCHAR* dpb, USHORT dpb_length, bool& invalid_cli
case isc_dpb_worker_attach: case isc_dpb_worker_attach:
dpb_worker_attach = true; dpb_worker_attach = true;
case isc_dpb_upgrade_db:
dpb_upgrade_db = true;
break; break;
default: default:

View File

@ -62,6 +62,7 @@ struct gen
const char* gen_name; const char* gen_name;
USHORT gen_id; USHORT gen_id;
const char* gen_description; const char* gen_description;
USHORT gen_ods_version;
}; };
} //namespace Jrd } //namespace Jrd
@ -70,18 +71,18 @@ struct gen
// Keep in sync with constants.h // Keep in sync with constants.h
static const Jrd::gen generators[] = static const Jrd::gen generators[] =
{ {
{ "RDB$SECURITY_CLASS", 1, NULL }, { "RDB$SECURITY_CLASS", 1, NULL, ODS_13_0 },
{ "SQL$DEFAULT", 2, NULL }, { "SQL$DEFAULT", 2, NULL, ODS_13_0 },
{ PROCEDURES_GENERATOR, 3, "Procedure ID" }, { PROCEDURES_GENERATOR, 3, "Procedure ID", ODS_13_0 },
{ "RDB$EXCEPTIONS", 4, "Exception ID" }, { "RDB$EXCEPTIONS", 4, "Exception ID", ODS_13_0 },
{ "RDB$CONSTRAINT_NAME", 5, "Implicit constraint name" }, { "RDB$CONSTRAINT_NAME", 5, "Implicit constraint name", ODS_13_0 },
{ "RDB$FIELD_NAME", 6, "Implicit domain name" }, { "RDB$FIELD_NAME", 6, "Implicit domain name", ODS_13_0 },
{ "RDB$INDEX_NAME", 7, "Implicit index name" }, { "RDB$INDEX_NAME", 7, "Implicit index name", ODS_13_0 },
{ "RDB$TRIGGER_NAME", 8, "Implicit trigger name" }, { "RDB$TRIGGER_NAME", 8, "Implicit trigger name", ODS_13_0 },
{ "RDB$BACKUP_HISTORY", 9, "Nbackup technology" }, { "RDB$BACKUP_HISTORY", 9, "Nbackup technology", ODS_13_0 },
{ FUNCTIONS_GENERATOR, 10, "Function ID" }, { FUNCTIONS_GENERATOR, 10, "Function ID", ODS_13_0 },
{ "RDB$GENERATOR_NAME", 11, "Implicit generator name" }, { "RDB$GENERATOR_NAME", 11, "Implicit generator name", ODS_13_0 },
{ nullptr, 0, nullptr } { nullptr, 0, nullptr, 0 }
}; };