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

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.
This commit is contained in:
robocop 2014-04-09 07:17:34 +00:00
parent 2d1c89c134
commit de7ed79414
27 changed files with 97 additions and 55 deletions

View File

@ -1848,8 +1848,8 @@ C --
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

View File

@ -931,7 +931,7 @@ const
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;

View File

@ -3171,7 +3171,7 @@ void write_generators()
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));

View File

@ -10337,7 +10337,7 @@ void store_blr_gen_id(BurpGlobals* tdgbl, const TEXT* gen_name, SINT64 value, SI
}
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 ();

View File

@ -4911,7 +4911,7 @@ void CreateAlterSequenceNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch
{
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 @@ bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
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 @@ bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
{
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 @@ bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
{
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 @@ SSHORT CreateAlterSequenceNode::store(thread_db* tdbb, jrd_tra* transaction, con
X.RDB$INITIAL_VALUE.NULL = FALSE;
X.RDB$INITIAL_VALUE = val;
X.RDB$GENERATOR_STEP = step;
X.RDB$GENERATOR_INCREMENT = step;
}
END_STORE

View File

@ -5674,7 +5674,7 @@ ValueExprNode* GenIdNode::dsqlPass(DsqlCompilerScratch* dsqlScratch)
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 @@ dsc* GenIdNode::execute(thread_db* tdbb, jrd_req* request) const
change = MOV_get_int64(value, 0);
}
if (sysGen && change != 0 && generator.id != 9)
if (sysGen && change != 0)
{
if (!request->hasInternalStatement() && !tdbb->getAttachment()->isRWGbak())
{

View File

@ -568,7 +568,7 @@ using namespace Firebird;
%token <metaNamePtr> TAGS
%token <metaNamePtr> PLUGIN
%token <metaNamePtr> SERVERWIDE
%token <metaNamePtr> STEP
%token <metaNamePtr> INCREMENT
// precedence declarations for expression evaluation
@ -1496,7 +1496,11 @@ start_with
%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
@ -7362,7 +7366,7 @@ non_reserved_word
| TAGS
| PLUGIN
| SERVERWIDE
| STEP
| INCREMENT
;
%%

View File

@ -920,7 +920,7 @@ static const struct {
{"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},

View File

@ -954,7 +954,7 @@ const ISC_STATUS isc_dyn_domain_used_function = 336068890L;
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 @@ const ISC_STATUS isc_err_max = 1219;
#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

View File

@ -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)

View File

@ -923,7 +923,7 @@ Data source : @4"}, /* eds_statement */
{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 */

View File

@ -919,7 +919,7 @@ static const struct {
{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 */

View File

@ -919,7 +919,7 @@ static const struct {
{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

View File

@ -2823,8 +2823,8 @@ static void list_generators()
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

View File

@ -4076,8 +4076,8 @@ static processing_state show_generators(const SCHAR* object)
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

View File

@ -231,6 +231,7 @@ enum drq_type_t
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
};

View File

@ -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)

View File

@ -398,9 +398,8 @@ void INI_format(const MetaName& owner, const MetaName& charset)
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 @@ static void store_generator(thread_db* tdbb, const gen* generator, AutoRequest&
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
}

View File

@ -2306,7 +2306,7 @@ bool MET_load_generator(thread_db* tdbb, GeneratorItem& item, bool* sysGen, SLON
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 @@ SLONG MET_lookup_generator(thread_db* tdbb, const MetaName& name, bool* sysGen,
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 @@ bool MET_lookup_generator_id(thread_db* tdbb, SLONG gen_id, MetaName& name, bool
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 @@ void MET_update_generator_step(thread_db* tdbb, SLONG gen_id, SLONG step)
return;
MODIFY X
X.RDB$GENERATOR_STEP = step;
X.RDB$GENERATOR_INCREMENT = step;
END_MODIFY
END_FOR
}

View File

@ -104,7 +104,7 @@ Jrd::BlobFilter* MET_lookup_filter(Jrd::thread_db*, SSHORT, SSHORT);
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*);

View File

@ -115,7 +115,7 @@ NAME("RDB$GENERATORS", nam_gens)
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)

View File

@ -314,7 +314,7 @@ RELATION(nam_gens, rel_gens, ODS_8_0, rel_persistent)
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)

View File

@ -3180,6 +3180,11 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
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;
}

View File

@ -1924,7 +1924,7 @@ COMMIT WORK;
(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);

View File

@ -908,7 +908,7 @@ set bulk_insert INSERT INTO SYSTEM_ERRORS (SQL_CODE, SQL_CLASS, SQL_SUBCLASS, FA
(-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)

View File

@ -270,7 +270,7 @@ public:
: 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 @@ public:
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 @@ private:
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 @@ private:
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_database_size()
}
}
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 @@ void NBackup::backup_database(int level, const PathName& fname)
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 @@ void NBackup::backup_database(int level, const PathName& fname)
// 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,11 +1124,25 @@ void NBackup::backup_database(int level, const PathName& fname)
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");
}

View File

@ -218,6 +218,7 @@ static const TOK tokens[] =
{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 @@ static const TOK tokens[] =
{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},