From: <ro...@us...> - 2014-04-09 07:17:38
|
Revision: 59404 http://sourceforge.net/p/firebird/code/59404 Author: robocop Date: 2014-04-09 07:17:34 +0000 (Wed, 09 Apr 2014) Log Message: ----------- Fixing several issues with my previous commit: Use increment [by], no step. Enable again code in ini.epp because it's needed when restoring (but not when creating gens directly in a new db). Gbak has code to fix system generators and we should allow it. Nbackup cannot update the history generator when doing a backup. Field name renamed to rdb$generator_increment. Modified Paths: -------------- firebird/trunk/lang_helpers/gds_codes.ftn firebird/trunk/lang_helpers/gds_codes.pas firebird/trunk/src/burp/backup.epp firebird/trunk/src/burp/restore.epp firebird/trunk/src/dsql/DdlNodes.epp firebird/trunk/src/dsql/ExprNodes.cpp firebird/trunk/src/dsql/parse.y firebird/trunk/src/include/gen/codetext.h firebird/trunk/src/include/gen/iberror.h firebird/trunk/src/include/gen/ids.h firebird/trunk/src/include/gen/msgs.h firebird/trunk/src/include/gen/sql_code.h firebird/trunk/src/include/gen/sql_state.h firebird/trunk/src/isql/extract.epp firebird/trunk/src/isql/show.epp firebird/trunk/src/jrd/drq.h firebird/trunk/src/jrd/fields.h firebird/trunk/src/jrd/ini.epp firebird/trunk/src/jrd/met.epp firebird/trunk/src/jrd/met_proto.h firebird/trunk/src/jrd/names.h firebird/trunk/src/jrd/relations.h firebird/trunk/src/jrd/vio.cpp firebird/trunk/src/msgs/messages2.sql firebird/trunk/src/msgs/system_errors2.sql firebird/trunk/src/utilities/nbackup/nbackup.cpp firebird/trunk/src/yvalve/keywords.cpp Modified: firebird/trunk/lang_helpers/gds_codes.ftn =================================================================== --- firebird/trunk/lang_helpers/gds_codes.ftn 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/lang_helpers/gds_codes.ftn 2014-04-09 07:17:34 UTC (rev 59404) @@ -1848,8 +1848,8 @@ PARAMETER (GDS__dyn_duplicate_package_item = 336068894) INTEGER*4 GDS__dyn_cant_modify_sysobj PARAMETER (GDS__dyn_cant_modify_sysobj = 336068895) - INTEGER*4 GDS__dyn_cant_use_zero_step - PARAMETER (GDS__dyn_cant_use_zero_step = 336068896) + INTEGER*4 GDS__dyn_cant_use_zero_increment + PARAMETER (GDS__dyn_cant_use_zero_increment = 336068896) INTEGER*4 GDS__gbak_unknown_switch PARAMETER (GDS__gbak_unknown_switch = 336330753) INTEGER*4 GDS__gbak_page_size_missing Modified: firebird/trunk/lang_helpers/gds_codes.pas =================================================================== --- firebird/trunk/lang_helpers/gds_codes.pas 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/lang_helpers/gds_codes.pas 2014-04-09 07:17:34 UTC (rev 59404) @@ -931,7 +931,7 @@ gds_dyn_alter_user_no_clause = 336068891; gds_dyn_duplicate_package_item = 336068894; gds_dyn_cant_modify_sysobj = 336068895; - gds_dyn_cant_use_zero_step = 336068896; + gds_dyn_cant_use_zero_increment = 336068896; gds_gbak_unknown_switch = 336330753; gds_gbak_page_size_missing = 336330754; gds_gbak_page_size_toobig = 336330755; Modified: firebird/trunk/src/burp/backup.epp =================================================================== --- firebird/trunk/src/burp/backup.epp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/burp/backup.epp 2014-04-09 07:17:34 UTC (rev 59404) @@ -3171,7 +3171,7 @@ if (!X.RDB$INITIAL_VALUE.NULL) put_int64(att_gen_init_val, X.RDB$INITIAL_VALUE); - put_int32(att_gen_id_step, X.RDB$GENERATOR_STEP); + put_int32(att_gen_id_step, X.RDB$GENERATOR_INCREMENT); put(tdgbl, att_end); MISC_terminate (X.RDB$GENERATOR_NAME, temp, l, sizeof(temp)); Modified: firebird/trunk/src/burp/restore.epp =================================================================== --- firebird/trunk/src/burp/restore.epp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/burp/restore.epp 2014-04-09 07:17:34 UTC (rev 59404) @@ -10337,7 +10337,7 @@ } X.RDB$INITIAL_VALUE.NULL = FALSE; X.RDB$INITIAL_VALUE = initial_value; - X.RDB$GENERATOR_STEP = step; + X.RDB$GENERATOR_INCREMENT = step; END_STORE; ON_ERROR general_on_error (); Modified: firebird/trunk/src/dsql/DdlNodes.epp =================================================================== --- firebird/trunk/src/dsql/DdlNodes.epp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/dsql/DdlNodes.epp 2014-04-09 07:17:34 UTC (rev 59404) @@ -4911,7 +4911,7 @@ { initialStep = step.value; if (initialStep == 0) - status_exception::raise(Arg::Gds(isc_dyn_cant_use_zero_step) << Arg::Str(name)); + status_exception::raise(Arg::Gds(isc_dyn_cant_use_zero_increment) << Arg::Str(name)); } store(tdbb, transaction, name, fb_sysflag_user, val, initialStep); @@ -4936,7 +4936,7 @@ if (id < 0) return false; - if (forbidden) + if (forbidden && !tdbb->getAttachment()->isRWGbak()) status_exception::raise(Arg::Gds(isc_dyn_cant_modify_sysobj) << "generator" << Arg::Str(name)); executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_SEQUENCE, name); @@ -4947,11 +4947,11 @@ { const SLONG newStep = step.value; if (newStep == 0) - status_exception::raise(Arg::Gds(isc_dyn_cant_use_zero_step) << Arg::Str(name)); + status_exception::raise(Arg::Gds(isc_dyn_cant_use_zero_increment) << Arg::Str(name)); // Perhaps it's better to move this to DFW? if (newStep != oldStep) - MET_update_generator_step(tdbb, id, newStep); + MET_update_generator_increment(tdbb, id, newStep); } transaction->getGenIdCache()->put(id, val); @@ -4987,12 +4987,12 @@ { const SLONG newStep = step.value; if (newStep == 0) - status_exception::raise(Arg::Gds(isc_dyn_cant_use_zero_step) << Arg::Str(name)); + status_exception::raise(Arg::Gds(isc_dyn_cant_use_zero_increment) << Arg::Str(name)); - if (newStep != X.RDB$GENERATOR_STEP) + if (newStep != X.RDB$GENERATOR_INCREMENT) { MODIFY X - X.RDB$GENERATOR_STEP = newStep; + X.RDB$GENERATOR_INCREMENT = newStep; END_MODIFY } } @@ -5049,7 +5049,7 @@ X.RDB$INITIAL_VALUE.NULL = FALSE; X.RDB$INITIAL_VALUE = val; - X.RDB$GENERATOR_STEP = step; + X.RDB$GENERATOR_INCREMENT = step; } END_STORE Modified: firebird/trunk/src/dsql/ExprNodes.cpp =================================================================== --- firebird/trunk/src/dsql/ExprNodes.cpp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/dsql/ExprNodes.cpp 2014-04-09 07:17:34 UTC (rev 59404) @@ -5674,7 +5674,7 @@ void GenIdNode::setParameterName(dsql_par* parameter) const { - parameter->par_name = parameter->par_alias = (implicit ? "GEN_ID2" : "GEN_ID"); + parameter->par_name = parameter->par_alias = (implicit ? "NEXT_VALUE" : "GEN_ID"); } bool GenIdNode::setParameterType(DsqlCompilerScratch* dsqlScratch, @@ -5796,7 +5796,7 @@ change = MOV_get_int64(value, 0); } - if (sysGen && change != 0 && generator.id != 9) + if (sysGen && change != 0) { if (!request->hasInternalStatement() && !tdbb->getAttachment()->isRWGbak()) { Modified: firebird/trunk/src/dsql/parse.y =================================================================== --- firebird/trunk/src/dsql/parse.y 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/dsql/parse.y 2014-04-09 07:17:34 UTC (rev 59404) @@ -568,7 +568,7 @@ %token <metaNamePtr> TAGS %token <metaNamePtr> PLUGIN %token <metaNamePtr> SERVERWIDE -%token <metaNamePtr> STEP +%token <metaNamePtr> INCREMENT // precedence declarations for expression evaluation @@ -1496,8 +1496,12 @@ %type <nullableInt32Val> step_option step_option : /* nothing */ { $$ = Nullable<SLONG>::empty(); } - | STEP signed_long_integer { $$ = Nullable<SLONG>::val($2); } + | INCREMENT by_noise signed_long_integer { $$ = Nullable<SLONG>::val($3); } +by_noise + : // nothing + | BY + %type <createAlterSequenceNode> replace_sequence_clause replace_sequence_clause : symbol_generator_name replace_sequence_options step_option @@ -7362,7 +7366,7 @@ | TAGS | PLUGIN | SERVERWIDE - | STEP + | INCREMENT ; %% Modified: firebird/trunk/src/include/gen/codetext.h =================================================================== --- firebird/trunk/src/include/gen/codetext.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/include/gen/codetext.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -920,7 +920,7 @@ {"dyn_alter_user_no_clause", 336068891}, {"dyn_duplicate_package_item", 336068894}, {"dyn_cant_modify_sysobj", 336068895}, - {"dyn_cant_use_zero_step", 336068896}, + {"dyn_cant_use_zero_increment", 336068896}, {"gbak_unknown_switch", 336330753}, {"gbak_page_size_missing", 336330754}, {"gbak_page_size_toobig", 336330755}, Modified: firebird/trunk/src/include/gen/iberror.h =================================================================== --- firebird/trunk/src/include/gen/iberror.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/include/gen/iberror.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -954,7 +954,7 @@ const ISC_STATUS isc_dyn_alter_user_no_clause = 336068891L; const ISC_STATUS isc_dyn_duplicate_package_item = 336068894L; const ISC_STATUS isc_dyn_cant_modify_sysobj = 336068895L; -const ISC_STATUS isc_dyn_cant_use_zero_step = 336068896L; +const ISC_STATUS isc_dyn_cant_use_zero_increment = 336068896L; const ISC_STATUS isc_gbak_unknown_switch = 336330753L; const ISC_STATUS isc_gbak_page_size_missing = 336330754L; const ISC_STATUS isc_gbak_page_size_toobig = 336330755L; @@ -2199,7 +2199,7 @@ #define isc_dyn_alter_user_no_clause 336068891L #define isc_dyn_duplicate_package_item 336068894L #define isc_dyn_cant_modify_sysobj 336068895L -#define isc_dyn_cant_use_zero_step 336068896L +#define isc_dyn_cant_use_zero_increment 336068896L #define isc_gbak_unknown_switch 336330753L #define isc_gbak_page_size_missing 336330754L #define isc_gbak_page_size_toobig 336330755L Modified: firebird/trunk/src/include/gen/ids.h =================================================================== --- firebird/trunk/src/include/gen/ids.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/include/gen/ids.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -315,7 +315,7 @@ const USHORT f_gen_class = 4; const USHORT f_gen_owner = 5; const USHORT f_gen_init_val = 6; - const USHORT f_gen_step = 7; + const USHORT f_gen_increment = 7; // Relation 21 (RDB$FIELD_DIMENSIONS) Modified: firebird/trunk/src/include/gen/msgs.h =================================================================== --- firebird/trunk/src/include/gen/msgs.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/include/gen/msgs.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -923,7 +923,7 @@ {336068891, "ALTER USER requires at least one clause to be specified"}, /* dyn_alter_user_no_clause */ {336068894, "Duplicate @1 @2"}, /* dyn_duplicate_package_item */ {336068895, "System @1 @2 cannot be modified"}, /* dyn_cant_modify_sysobj */ - {336068896, "STEP 0 is an illegal option for sequence @1"}, /* dyn_cant_use_zero_step */ + {336068896, "INCREMENT BY 0 is an illegal option for sequence @1"}, /* dyn_cant_use_zero_increment */ {336330753, "found unknown switch"}, /* gbak_unknown_switch */ {336330754, "page size parameter missing"}, /* gbak_page_size_missing */ {336330755, "Page size specified (@1) greater than limit (16384 bytes)"}, /* gbak_page_size_toobig */ Modified: firebird/trunk/src/include/gen/sql_code.h =================================================================== --- firebird/trunk/src/include/gen/sql_code.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/include/gen/sql_code.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -919,7 +919,7 @@ {336068891, -901}, /* 283 dyn_alter_user_no_clause */ {336068894, -901}, /* 286 dyn_duplicate_package_item */ {336068895, -901}, /* 287 dyn_cant_modify_sysobj */ - {336068896, -901}, /* 288 dyn_cant_use_zero_step */ + {336068896, -901}, /* 288 dyn_cant_use_zero_increment */ {336330753, -901}, /* 1 gbak_unknown_switch */ {336330754, -901}, /* 2 gbak_page_size_missing */ {336330755, -901}, /* 3 gbak_page_size_toobig */ Modified: firebird/trunk/src/include/gen/sql_state.h =================================================================== --- firebird/trunk/src/include/gen/sql_state.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/include/gen/sql_state.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -919,7 +919,7 @@ {336068891, "42000"}, // 283 dyn_alter_user_no_clause {336068894, "42000"}, // 286 dyn_duplicate_package_item {336068895, "42000"}, // 287 dyn_cant_modify_sysobj - {336068896, "42000"}, // 288 dyn_cant_use_zero_step + {336068896, "42000"}, // 288 dyn_cant_use_zero_increment {336330753, "00000"}, // 1 gbak_unknown_switch {336330754, "00000"}, // 2 gbak_page_size_missing {336330755, "00000"}, // 3 gbak_page_size_toobig Modified: firebird/trunk/src/isql/extract.epp =================================================================== --- firebird/trunk/src/isql/extract.epp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/isql/extract.epp 2014-04-09 07:17:34 UTC (rev 59404) @@ -2823,8 +2823,8 @@ if (!G2.RDB$INITIAL_VALUE.NULL && G2.RDB$INITIAL_VALUE != 0) isqlGlob.printf(" START WITH %" SQUADFORMAT, G2.RDB$INITIAL_VALUE); - if (G2.RDB$GENERATOR_STEP != 1) - isqlGlob.printf(" STEP %ld", G2.RDB$GENERATOR_STEP); + if (G2.RDB$GENERATOR_INCREMENT != 1) + isqlGlob.printf(" INCREMENT %ld", G2.RDB$GENERATOR_INCREMENT); END_FOR ON_ERROR Modified: firebird/trunk/src/isql/show.epp =================================================================== --- firebird/trunk/src/isql/show.epp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/isql/show.epp 2014-04-09 07:17:34 UTC (rev 59404) @@ -4076,8 +4076,8 @@ WITH G2.RDB$GENERATOR_NAME = GEN.RDB$GENERATOR_NAME ISC_INT64 initval = !G2.RDB$INITIAL_VALUE.NULL ? G2.RDB$INITIAL_VALUE : 0; - isqlGlob.printf(", initial value: %" QUADFORMAT "d%, step: %ld", - initval, G2.RDB$GENERATOR_STEP); + isqlGlob.printf(", initial value: %" QUADFORMAT "d%, increment: %ld", + initval, G2.RDB$GENERATOR_INCREMENT); END_FOR ON_ERROR Modified: firebird/trunk/src/jrd/drq.h =================================================================== --- firebird/trunk/src/jrd/drq.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/drq.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -231,6 +231,7 @@ drq_e_xcp_prvs, // erase exception privileges drq_e_gen_prvs, // erase generator privileges drq_e_gfld_prvs, // erase domain privileges + drq_g_nxt_nbakhist_id, // generate next history ID for nbackup drq_MAX }; Modified: firebird/trunk/src/jrd/fields.h =================================================================== --- firebird/trunk/src/jrd/fields.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/fields.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -189,5 +189,5 @@ FIELD(fld_map_from , nam_map_from , dtype_text , 255 , 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) - FIELD(fld_gen_step , nam_gen_step , dtype_long , sizeof(SLONG) , 0 , NULL , false) + FIELD(fld_gen_step , nam_gen_increment , dtype_long , sizeof(SLONG) , 0 , NULL , false) Modified: firebird/trunk/src/jrd/ini.epp =================================================================== --- firebird/trunk/src/jrd/ini.epp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/ini.epp 2014-04-09 07:17:34 UTC (rev 59404) @@ -398,9 +398,8 @@ for (const gen* generator = generators; generator->gen_name; generator++) store_generator(tdbb, generator, handle1, ownerName); - // Redundant, VIO_store does the job. // Adjust the value of the hidden generator RDB$GENERATORS - //DPM_gen_id(tdbb, 0, true, FB_NELEM(generators) - 1); + DPM_gen_id(tdbb, 0, true, FB_NELEM(generators) - 1); // store system-defined triggers @@ -1192,7 +1191,7 @@ else X.RDB$DESCRIPTION.NULL = TRUE; - X.RDB$GENERATOR_STEP = 0; // only sys gens have zero default increment + X.RDB$GENERATOR_INCREMENT = 0; // only sys gens have zero default increment } END_STORE } Modified: firebird/trunk/src/jrd/met.epp =================================================================== --- firebird/trunk/src/jrd/met.epp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/met.epp 2014-04-09 07:17:34 UTC (rev 59404) @@ -2306,7 +2306,7 @@ if (sysGen) *sysGen = (X.RDB$SYSTEM_FLAG == fb_sysflag_system); if (step) - *step = X.RDB$GENERATOR_STEP; + *step = X.RDB$GENERATOR_INCREMENT; return true; } @@ -2347,7 +2347,7 @@ if (sysGen) *sysGen = (X.RDB$SYSTEM_FLAG == fb_sysflag_system); if (step) - *step = X.RDB$GENERATOR_STEP; + *step = X.RDB$GENERATOR_INCREMENT; return X.RDB$GENERATOR_ID; } @@ -2391,11 +2391,11 @@ return name.length() != 0; } -void MET_update_generator_step(thread_db* tdbb, SLONG gen_id, SLONG step) +void MET_update_generator_increment(thread_db* tdbb, SLONG gen_id, SLONG step) { /************************************** * - * M E T _ u p d a t e _ g e n e r a t o r _ s t e p + * M E T _ u p d a t e _ g e n e r a t o r _ i n c r e m e n t * ************************************** * @@ -2417,7 +2417,7 @@ return; MODIFY X - X.RDB$GENERATOR_STEP = step; + X.RDB$GENERATOR_INCREMENT = step; END_MODIFY END_FOR } Modified: firebird/trunk/src/jrd/met_proto.h =================================================================== --- firebird/trunk/src/jrd/met_proto.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/met_proto.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -104,7 +104,7 @@ bool MET_load_generator(Jrd::thread_db*, Jrd::GeneratorItem&, bool* sysGen = 0, SLONG* step = 0); SLONG MET_lookup_generator(Jrd::thread_db*, const Firebird::MetaName&, bool* sysGen = 0, SLONG* step = 0); bool MET_lookup_generator_id(Jrd::thread_db*, SLONG, Firebird::MetaName&, bool* sysGen = 0); -void MET_update_generator_step(Jrd::thread_db* tdbb, SLONG gen_id, SLONG step); +void MET_update_generator_increment(Jrd::thread_db* tdbb, SLONG gen_id, SLONG step); void MET_lookup_index(Jrd::thread_db*, Firebird::MetaName&, const Firebird::MetaName&, USHORT); SLONG MET_lookup_index_name(Jrd::thread_db*, const Firebird::MetaName&, SLONG*, Jrd::IndexStatus* status); bool MET_lookup_partner(Jrd::thread_db*, Jrd::jrd_rel*, struct Jrd::index_desc*, const TEXT*); Modified: firebird/trunk/src/jrd/names.h =================================================================== --- firebird/trunk/src/jrd/names.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/names.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -115,7 +115,7 @@ NAME("RDB$GENERATOR_ID", nam_gen_id) NAME("RDB$GENERATOR_NAME", nam_gen_name) NAME("RDB$GENERATOR_VALUE", nam_gen_val) -NAME("RDB$GENERATOR_STEP", nam_gen_step) +NAME("RDB$GENERATOR_INCREMENT", nam_gen_increment) NAME("RDB$GENERIC_NAME", nam_gnr_name) NAME("RDB$GENERIC_TYPE", nam_gnr_type) NAME("RDB$GRANTOR", nam_grantor) Modified: firebird/trunk/src/jrd/relations.h =================================================================== --- firebird/trunk/src/jrd/relations.h 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/relations.h 2014-04-09 07:17:34 UTC (rev 59404) @@ -314,7 +314,7 @@ FIELD(f_gen_class, nam_class, fld_class, 1, ODS_12_0) FIELD(f_gen_owner, nam_owner, fld_user, 1, ODS_12_0) FIELD(f_gen_init_val, nam_init_val, fld_gen_val, 1, ODS_12_0) - FIELD(f_gen_step, nam_gen_step, fld_gen_step, 1, ODS_12_0) + FIELD(f_gen_increment, nam_gen_increment, fld_gen_step, 1, ODS_12_0) END_RELATION // Relation 21 (RDB$FIELD_DIMENSIONS) Modified: firebird/trunk/src/jrd/vio.cpp =================================================================== --- firebird/trunk/src/jrd/vio.cpp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/jrd/vio.cpp 2014-04-09 07:17:34 UTC (rev 59404) @@ -3180,6 +3180,11 @@ DFW_post_work(transaction, dfw_grant, &desc, obj_exception); break; + case rel_backup_history: + set_metadata_id(tdbb, rpb->rpb_record, + f_backup_id, drq_g_nxt_nbakhist_id, "RDB$BACKUP_HISTORY"); + break; + default: // Shut up compiler warnings break; } Modified: firebird/trunk/src/msgs/messages2.sql =================================================================== --- firebird/trunk/src/msgs/messages2.sql 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/msgs/messages2.sql 2014-04-09 07:17:34 UTC (rev 59404) @@ -1924,7 +1924,7 @@ (NULL, 'DdlNodes.epp', 'AlterRelationNode::modifyField', NULL, 8, 285, NULL, 'Column @1 is not an identity column', NULL, NULL); ('dyn_duplicate_package_item', NULL, 'PackageNodes.epp', NULL, 8, 286, NULL, 'Duplicate @1 @2', NULL, NULL); ('dyn_cant_modify_sysobj', NULL, 'DdlNodes.epp', NULL, 8, 287, NULL, 'System @1 @2 cannot be modified', NULL, 'Ex: System generator rdb$... cannot be modified'); -('dyn_cant_use_zero_step', NULL, 'DdlNodes.epp', NULL, 8, 288, NULL, 'STEP 0 is an illegal option for sequence @1', NULL, NULL); +('dyn_cant_use_zero_increment', NULL, 'DdlNodes.epp', NULL, 8, 288, NULL, 'INCREMENT BY 0 is an illegal option for sequence @1', NULL, NULL); COMMIT WORK; -- TEST (NULL, 'main', 'test.c', NULL, 11, 0, NULL, 'This is a modified text message', NULL, NULL); Modified: firebird/trunk/src/msgs/system_errors2.sql =================================================================== --- firebird/trunk/src/msgs/system_errors2.sql 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/msgs/system_errors2.sql 2014-04-09 07:17:34 UTC (rev 59404) @@ -908,7 +908,7 @@ (-901, '42', '000', 8, 283, 'dyn_alter_user_no_clause', NULL, NULL) (-901, '42', '000', 8, 286, 'dyn_duplicate_package_item', NULL, NULL) (-901, '42', '000', 8, 287, 'dyn_cant_modify_sysobj', NULL, NULL) -(-901, '42', '000', 8, 288, 'dyn_cant_use_zero_step', NULL, NULL) +(-901, '42', '000', 8, 288, 'dyn_cant_use_zero_increment', NULL, NULL) -- GBAK (-901, '00', '000', 12, 1, 'gbak_unknown_switch', NULL, NULL) (-901, '00', '000', 12, 2, 'gbak_page_size_missing', NULL, NULL) Modified: firebird/trunk/src/utilities/nbackup/nbackup.cpp =================================================================== --- firebird/trunk/src/utilities/nbackup/nbackup.cpp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/utilities/nbackup/nbackup.cpp 2014-04-09 07:17:34 UTC (rev 59404) @@ -270,7 +270,7 @@ : uSvc(_uSvc), newdb(0), trans(0), database(_database), username(_username), password(_password), /*trustedUser(_trustedUser),*/ run_db_triggers(_run_db_triggers), /*trustedRole(_trustedRole), */direct_io(_direct_io), - dbase(0), backup(0), db_size_pages(0), m_silent(false), m_printed(false) + dbase(0), backup(0), db_size_pages(0), m_odsNumber(0), m_silent(false), m_printed(false) { // Recognition of local prefix allows to work with // database using TCP/IP loopback while reading file locally. @@ -305,7 +305,7 @@ void backup_database(int level, const PathName& fname); void restore_database(const BackupFiles& files); - bool printed() + bool printed() const { return m_printed; } @@ -326,6 +326,7 @@ FILE_HANDLE dbase; FILE_HANDLE backup; ULONG db_size_pages; // In pages + USHORT m_odsNumber; bool m_silent; // are we already handling an exception? bool m_printed; // pr_error() was called to print status vector @@ -338,6 +339,7 @@ void internal_lock_database(); void get_database_size(); + void get_ods(); void internal_unlock_database(); void attach_database(); void detach_database(); @@ -716,6 +718,22 @@ } } +void NBackup::get_ods() +{ + m_odsNumber = 0; + const char db_version_info[] = { isc_info_ods_version }; + char res[128]; + if (isc_database_info(status, &newdb, sizeof(db_version_info), db_version_info, sizeof(res), res)) + { + pr_error(status, "ods info"); + } + else if (res[0] == isc_info_ods_version) + { + USHORT len = isc_vax_integer (&res[1], 2); + m_odsNumber = isc_vax_integer (&res[3], len); + } +} + void NBackup::internal_unlock_database() { if (m_silent) @@ -821,10 +839,10 @@ if (isc_dsql_allocate_statement(status, &newdb, &stmt)) pr_error(status, "allocate statement"); char str[200]; - sprintf(str, "select rdb$guid, rdb$scn from rdb$backup_history " - "where rdb$backup_id = " - "(select max(rdb$backup_id) from rdb$backup_history " - "where rdb$backup_level = %d)", level - 1); + sprintf(str, "SELECT RDB$GUID, RDB$SCN FROM RDB$BACKUP_HISTORY " + "WHERE RDB$BACKUP_ID = " + "(SELECT MAX(RDB$BACKUP_ID) FROM RDB$BACKUP_HISTORY " + "WHERE RDB$BACKUP_LEVEL = %d)", level - 1); if (isc_dsql_prepare(status, &trans, &stmt, 0, str, 1, NULL)) pr_error(status, "prepare history query"); if (isc_dsql_describe(status, &stmt, 1, out_sqlda)) @@ -1098,6 +1116,7 @@ // Write about successful backup to backup history table if (isc_start_transaction(status, &trans, 1, &newdb, 0, NULL)) pr_error(status, "start transaction"); + char in_sqlda_data[XSQLDA_LENGTH(4)]; XSQLDA *in_sqlda = (XSQLDA *)in_sqlda_data; in_sqlda->version = SQLDA_VERSION1; @@ -1105,12 +1124,26 @@ isc_stmt_handle stmt = 0; if (isc_dsql_allocate_statement(status, &newdb, &stmt)) pr_error(status, "allocate statement"); - if (isc_dsql_prepare(status, &trans, &stmt, 0, - "insert into rdb$backup_history(rdb$backup_id, rdb$timestamp, " - "rdb$backup_level, rdb$guid, rdb$scn, rdb$file_name) " - "values(gen_id(rdb$backup_history, 1), 'now', ?, ?, ?, ?)", - 1, NULL)) + + const char* insHistory; + get_ods(); + if (m_odsNumber >= ODS_VERSION12) { + insHistory = + "INSERT INTO RDB$BACKUP_HISTORY(RDB$BACKUP_ID, RDB$TIMESTAMP, " + "RDB$BACKUP_LEVEL, RDB$GUID, RDB$SCN, RDB$FILE_NAME) " + "VALUES(NULL, 'NOW', ?, ?, ?, ?)"; + } + else + { + insHistory = + "INSERT INTO RDB$BACKUP_HISTORY(RDB$BACKUP_ID, RDB$TIMESTAMP, " + "RDB$BACKUP_LEVEL, RDB$GUID, RDB$SCN, RDB$FILE_NAME) " + "VALUES(GEN_ID(RDB$BACKUP_HISTORY, 1), 'NOW', ?, ?, ?, ?)"; + } + + if (isc_dsql_prepare(status, &trans, &stmt, 0, insHistory, 1, NULL)) + { pr_error(status, "prepare history insert"); } if (isc_dsql_describe_bind(status, &stmt, 1, in_sqlda)) Modified: firebird/trunk/src/yvalve/keywords.cpp =================================================================== --- firebird/trunk/src/yvalve/keywords.cpp 2014-04-09 02:35:34 UTC (rev 59403) +++ firebird/trunk/src/yvalve/keywords.cpp 2014-04-09 07:17:34 UTC (rev 59404) @@ -218,6 +218,7 @@ {IIF, "IIF", 2, true}, {KW_IN, "IN", 1, false}, {INACTIVE, "INACTIVE", 1, false}, + {INCREMENT, "INCREMENT", 2, false}, {INDEX, "INDEX", 1, false}, {INNER, "INNER", 1, false}, {INPUT_TYPE, "INPUT_TYPE", 1, false}, @@ -386,7 +387,6 @@ {STARTING, "STARTS", 1, false}, // Alias of STARTING {STATEMENT, "STATEMENT", 2, true}, {STATISTICS, "STATISTICS", 1, false}, - {STEP, "STEP", 2, false}, {SUBSTRING, "SUBSTRING", 2, true}, {SUB_TYPE, "SUB_TYPE", 1, false}, {SUM, "SUM", 1, false}, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |