mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 22:03:03 +01:00
The architect created ODS12 and saw it was good, then he said "thy shall be the only one among your race", dropped the older ones and sent the developers to the four corners of the cyberspace to convert the masses to ODS12.
This commit is contained in:
parent
0bca011699
commit
f955568fc9
@ -447,7 +447,7 @@ void CommentOnNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const
|
|||||||
void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
||||||
{
|
{
|
||||||
Attachment* attachment = transaction->tra_attachment;
|
Attachment* attachment = transaction->tra_attachment;
|
||||||
Database* dbb = attachment->att_database;
|
//Database* dbb = attachment->att_database;
|
||||||
|
|
||||||
string table;
|
string table;
|
||||||
string column;
|
string column;
|
||||||
@ -505,9 +505,7 @@ void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
status << Arg::Gds(isc_dyn_proc_not_found) << Arg::Str(objName);
|
status << Arg::Gds(isc_dyn_proc_not_found) << Arg::Str(objName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_12_0)
|
addWhere = "rdb$package_name is null";
|
||||||
addWhere = "rdb$package_name is null";
|
|
||||||
|
|
||||||
column = "rdb$procedure_name";
|
column = "rdb$procedure_name";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -520,10 +518,7 @@ void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
case ddl_udf:
|
case ddl_udf:
|
||||||
table = "rdb$functions";
|
table = "rdb$functions";
|
||||||
column = "rdb$function_name";
|
column = "rdb$function_name";
|
||||||
|
addWhere = "rdb$package_name is null";
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_12_0)
|
|
||||||
addWhere = "rdb$package_name is null";
|
|
||||||
|
|
||||||
status << Arg::Gds(isc_dyn_func_not_found) << Arg::Str(objName);
|
status << Arg::Gds(isc_dyn_func_not_found) << Arg::Str(objName);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -570,7 +565,7 @@ void CommentOnNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case ddl_package:
|
case ddl_package:
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
table = "rdb$packages";
|
table = "rdb$packages";
|
||||||
column = "rdb$package_name";
|
column = "rdb$package_name";
|
||||||
@ -698,13 +693,13 @@ void CreateAlterFunctionNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
|
|
||||||
void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, jrd_tra* transaction)
|
void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, jrd_tra* transaction)
|
||||||
{
|
{
|
||||||
Database* dbb = tdbb->getDatabase();
|
//Database* dbb = tdbb->getDatabase();
|
||||||
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
|
|
||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_FUNCTION, metaName);
|
executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_FUNCTION, metaName);
|
||||||
|
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
AutoCacheRequest requestHandle(tdbb, drq_s_funcs2, DYN_REQUESTS);
|
AutoCacheRequest requestHandle(tdbb, drq_s_funcs2, DYN_REQUESTS);
|
||||||
|
|
||||||
@ -779,7 +774,7 @@ void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, jrd_tra* transactio
|
|||||||
|
|
||||||
bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction)
|
bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction)
|
||||||
{
|
{
|
||||||
Database* dbb = tdbb->getDatabase();
|
//Database* dbb = tdbb->getDatabase();
|
||||||
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
@ -793,7 +788,7 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, jrd_tra* transaction
|
|||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_FUNCTION, metaName);
|
executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_FUNCTION, metaName);
|
||||||
|
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
MODIFY FUN
|
MODIFY FUN
|
||||||
FUN.RDB$MODULE_NAME.NULL = TRUE;
|
FUN.RDB$MODULE_NAME.NULL = TRUE;
|
||||||
@ -1341,7 +1336,7 @@ void CreateAlterProcedureNode::executeCreate(thread_db* tdbb, jrd_tra* transacti
|
|||||||
bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, jrd_tra* transaction,
|
bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, jrd_tra* transaction,
|
||||||
bool secondPass, bool runTriggers)
|
bool secondPass, bool runTriggers)
|
||||||
{
|
{
|
||||||
Database* dbb = tdbb->getDatabase();
|
//Database* dbb = tdbb->getDatabase();
|
||||||
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
|
|
||||||
AutoCacheRequest requestHandle(tdbb, drq_m_prcs2, DYN_REQUESTS);
|
AutoCacheRequest requestHandle(tdbb, drq_m_prcs2, DYN_REQUESTS);
|
||||||
@ -1388,7 +1383,7 @@ bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, jrd_tra* transactio
|
|||||||
|
|
||||||
if (external)
|
if (external)
|
||||||
{
|
{
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
if (secondPass)
|
if (secondPass)
|
||||||
{
|
{
|
||||||
@ -1469,7 +1464,7 @@ void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, jrd_tra* transact
|
|||||||
{
|
{
|
||||||
checkEmptyName(parameter.name);
|
checkEmptyName(parameter.name);
|
||||||
|
|
||||||
Database* dbb = tdbb->getDatabase();
|
//Database* dbb = tdbb->getDatabase();
|
||||||
AutoCacheRequest requestHandle(tdbb, drq_s_prms4, DYN_REQUESTS);
|
AutoCacheRequest requestHandle(tdbb, drq_s_prms4, DYN_REQUESTS);
|
||||||
|
|
||||||
STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
STORE (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
||||||
@ -1503,14 +1498,14 @@ void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, jrd_tra* transact
|
|||||||
PRM.RDB$PARAMETER_MECHANISM =
|
PRM.RDB$PARAMETER_MECHANISM =
|
||||||
(USHORT) (parameter.fullDomain ? prm_mech_normal : prm_mech_type_of);
|
(USHORT) (parameter.fullDomain ? prm_mech_normal : prm_mech_type_of);
|
||||||
|
|
||||||
if (parameter.notNull)
|
//if (parameter.notNull)
|
||||||
dbb->checkOdsForDsql(ODS_11_1);
|
// dbb->checkOdsForDsql(ODS_11_1);
|
||||||
|
|
||||||
PRM.RDB$NULL_FLAG.NULL = !parameter.notNull;
|
PRM.RDB$NULL_FLAG.NULL = !parameter.notNull;
|
||||||
PRM.RDB$NULL_FLAG = parameter.notNull;
|
PRM.RDB$NULL_FLAG = parameter.notNull;
|
||||||
|
|
||||||
if (parameter.typeOfTable.hasData())
|
//if (parameter.typeOfTable.hasData())
|
||||||
dbb->checkOdsForDsql(ODS_11_2);
|
// dbb->checkOdsForDsql(ODS_11_2);
|
||||||
|
|
||||||
PRM.RDB$RELATION_NAME.NULL = parameter.typeOfTable.isEmpty();
|
PRM.RDB$RELATION_NAME.NULL = parameter.typeOfTable.isEmpty();
|
||||||
PRM.RDB$FIELD_NAME.NULL = PRM.RDB$RELATION_NAME.NULL || parameter.typeOfName.isEmpty();
|
PRM.RDB$FIELD_NAME.NULL = PRM.RDB$RELATION_NAME.NULL || parameter.typeOfName.isEmpty();
|
||||||
@ -1809,7 +1804,7 @@ void CreateAlterProcedureNode::compile(thread_db* tdbb, jrd_tra* /*transaction*/
|
|||||||
void DropProcedureNode::dropParameters(thread_db* tdbb, jrd_tra* transaction,
|
void DropProcedureNode::dropParameters(thread_db* tdbb, jrd_tra* transaction,
|
||||||
const Firebird::MetaName& procedureName, const Firebird::MetaName& packageName)
|
const Firebird::MetaName& procedureName, const Firebird::MetaName& packageName)
|
||||||
{
|
{
|
||||||
Database* dbb = tdbb->getDatabase();
|
//Database* dbb = tdbb->getDatabase();
|
||||||
AutoCacheRequest requestHandle(tdbb, drq_e_prms2, DYN_REQUESTS);
|
AutoCacheRequest requestHandle(tdbb, drq_e_prms2, DYN_REQUESTS);
|
||||||
|
|
||||||
FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
FOR (REQUEST_HANDLE requestHandle TRANSACTION_HANDLE transaction)
|
||||||
@ -1830,8 +1825,8 @@ void DropProcedureNode::dropParameters(thread_db* tdbb, jrd_tra* transaction,
|
|||||||
{
|
{
|
||||||
bool erase = true;
|
bool erase = true;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_2)
|
// Can this loop be merged with the previous?
|
||||||
{
|
{ // scope
|
||||||
AutoCacheRequest requestHandle3(tdbb, drq_d_gfields4, DYN_REQUESTS);
|
AutoCacheRequest requestHandle3(tdbb, drq_d_gfields4, DYN_REQUESTS);
|
||||||
|
|
||||||
FOR (REQUEST_HANDLE requestHandle3 TRANSACTION_HANDLE transaction)
|
FOR (REQUEST_HANDLE requestHandle3 TRANSACTION_HANDLE transaction)
|
||||||
@ -1845,7 +1840,7 @@ void DropProcedureNode::dropParameters(thread_db* tdbb, jrd_tra* transaction,
|
|||||||
erase = false;
|
erase = false;
|
||||||
}
|
}
|
||||||
END_FOR
|
END_FOR
|
||||||
}
|
} // end scope
|
||||||
|
|
||||||
if (erase)
|
if (erase)
|
||||||
ERASE FLD;
|
ERASE FLD;
|
||||||
@ -2111,13 +2106,13 @@ void CreateAlterTriggerNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
|
|
||||||
void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, jrd_tra* transaction)
|
void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, jrd_tra* transaction)
|
||||||
{
|
{
|
||||||
Database* dbb = tdbb->getDatabase();
|
//Database* dbb = tdbb->getDatabase();
|
||||||
const MetaName metaName(nameInMetaCharSet(tdbb, name));
|
const MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TRIGGER, metaName);
|
executeDdlTrigger(tdbb, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TRIGGER, metaName);
|
||||||
|
|
||||||
if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL))
|
//if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL))
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
// dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
AutoCacheRequest requestHandle(tdbb, drq_s_triggers2, DYN_REQUESTS);
|
AutoCacheRequest requestHandle(tdbb, drq_s_triggers2, DYN_REQUESTS);
|
||||||
|
|
||||||
@ -2147,7 +2142,7 @@ void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, jrd_tra* transaction
|
|||||||
|
|
||||||
bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, bool runTriggers)
|
bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction, bool runTriggers)
|
||||||
{
|
{
|
||||||
Database* dbb = tdbb->getDatabase();
|
//Database* dbb = tdbb->getDatabase();
|
||||||
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
bool modified = false;
|
bool modified = false;
|
||||||
|
|
||||||
@ -2168,8 +2163,8 @@ bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction,
|
|||||||
Arg::Gds(isc_dsql_db_trigger_type_cant_change));
|
Arg::Gds(isc_dsql_db_trigger_type_cant_change));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL))
|
//if (type.specified && (type.value & unsigned(TRIGGER_TYPE_MASK)) == unsigned(TRIGGER_TYPE_DDL))
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
// dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
if (!TRG.RDB$SYSTEM_FLAG.NULL)
|
if (!TRG.RDB$SYSTEM_FLAG.NULL)
|
||||||
{
|
{
|
||||||
@ -2218,7 +2213,7 @@ bool CreateAlterTriggerNode::executeAlter(thread_db* tdbb, jrd_tra* transaction,
|
|||||||
|
|
||||||
if (external)
|
if (external)
|
||||||
{
|
{
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
// ODS_12_0
|
// ODS_12_0
|
||||||
TRG.RDB$ENGINE_NAME.NULL = FALSE;
|
TRG.RDB$ENGINE_NAME.NULL = FALSE;
|
||||||
|
@ -427,7 +427,7 @@ void CreateAlterPackageNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
|
|
||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
|
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
@ -600,7 +600,7 @@ void DropPackageNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
|
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
@ -836,7 +836,7 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
const MetaName metaName(nameInMetaCharSet(tdbb, name));
|
const MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
|
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
@ -1017,7 +1017,7 @@ void DropPackageBodyNode::execute(thread_db* tdbb, jrd_tra* transaction)
|
|||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
const MetaName metaName(nameInMetaCharSet(tdbb, name));
|
const MetaName metaName(nameInMetaCharSet(tdbb, name));
|
||||||
|
|
||||||
dbb->checkOdsForDsql(ODS_12_0);
|
//dbb->checkOdsForDsql(ODS_12_0);
|
||||||
|
|
||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
@ -462,7 +462,7 @@ void DDL_resolve_intl_type2(CompiledStatement* statement,
|
|||||||
|
|
||||||
if (field->fld_type_of_name.hasData())
|
if (field->fld_type_of_name.hasData())
|
||||||
{
|
{
|
||||||
statement->req_dbb->dbb_database->checkOdsForDsql(ODS_11_1);
|
//statement->req_dbb->dbb_database->checkOdsForDsql(ODS_11_1);
|
||||||
|
|
||||||
if (field->fld_type_of_table)
|
if (field->fld_type_of_table)
|
||||||
{
|
{
|
||||||
|
@ -1995,10 +1995,10 @@ static dsql_dbb* init(Jrd::Attachment* attachment)
|
|||||||
|
|
||||||
case isc_info_ods_version:
|
case isc_info_ods_version:
|
||||||
database->dbb_ods_version = gds__vax_integer(data, l);
|
database->dbb_ods_version = gds__vax_integer(data, l);
|
||||||
if (database->dbb_ods_version < 8)
|
if (database->dbb_ods_version < 12)
|
||||||
{
|
{
|
||||||
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
|
ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-804) <<
|
||||||
Arg::Gds(isc_dsql_too_old_ods) << Arg::Num(8));
|
Arg::Gds(isc_dsql_too_old_ods) << Arg::Num(12));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2006,22 +2006,6 @@ static dsql_dbb* init(Jrd::Attachment* attachment)
|
|||||||
database->dbb_minor_version = gds__vax_integer(data, l);
|
database->dbb_minor_version = gds__vax_integer(data, l);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// This flag indicates the version level of the engine
|
|
||||||
// itself, so we can tell what capabilities the engine
|
|
||||||
// code itself (as opposed to the on-disk structure).
|
|
||||||
// Apparently the base level up to now indicated the major
|
|
||||||
// version number, but for 4.1 the base level is being
|
|
||||||
// incremented, so the base level indicates an engine version
|
|
||||||
// as follows:
|
|
||||||
// 1 == v1.x
|
|
||||||
// 2 == v2.x
|
|
||||||
// 3 == v3.x
|
|
||||||
// 4 == v4.0 only
|
|
||||||
// 5 == v4.1. (v5, too?)
|
|
||||||
// 6 == v6, FB1
|
|
||||||
// Note: this info item is so old it apparently uses an
|
|
||||||
// archaic format, not a standard vax integer format.
|
|
||||||
|
|
||||||
case isc_info_db_read_only:
|
case isc_info_db_read_only:
|
||||||
fb_assert(l == 1);
|
fb_assert(l == 1);
|
||||||
database->dbb_read_only = (USHORT) data[0] ? true : false;
|
database->dbb_read_only = (USHORT) data[0] ? true : false;
|
||||||
|
@ -716,9 +716,7 @@ void GEN_port(CompiledStatement* statement, dsql_msg* message)
|
|||||||
|
|
||||||
parameter->par_desc.dsc_length += adjust;
|
parameter->par_desc.dsc_length += adjust;
|
||||||
}
|
}
|
||||||
else if (ENCODE_ODS(statement->req_dbb->dbb_ods_version,
|
else if (parameter->par_desc.dsc_dtype == dtype_blob &&
|
||||||
statement->req_dbb->dbb_minor_version) >= ODS_11_1 &&
|
|
||||||
parameter->par_desc.dsc_dtype == dtype_blob &&
|
|
||||||
parameter->par_desc.dsc_sub_type == isc_blob_text &&
|
parameter->par_desc.dsc_sub_type == isc_blob_text &&
|
||||||
tdbb->getCharSet() != CS_NONE && tdbb->getCharSet() != CS_BINARY)
|
tdbb->getCharSet() != CS_NONE && tdbb->getCharSet() != CS_BINARY)
|
||||||
{
|
{
|
||||||
|
@ -1237,11 +1237,7 @@ dsql_prc* METD_get_procedure(CompiledStatement* statement, const dsql_str* name,
|
|||||||
|
|
||||||
for (int type = 0; type < 2; type++)
|
for (int type = 0; type < 2; type++)
|
||||||
{
|
{
|
||||||
dsql_fld** ptr;
|
dsql_fld** const ptr = type ? &procedure->prc_outputs : &procedure->prc_inputs;
|
||||||
if (type)
|
|
||||||
ptr = &procedure->prc_outputs;
|
|
||||||
else
|
|
||||||
ptr = &procedure->prc_inputs;
|
|
||||||
|
|
||||||
SSHORT count = 0, defaults = 0;
|
SSHORT count = 0, defaults = 0;
|
||||||
|
|
||||||
@ -1266,37 +1262,34 @@ dsql_prc* METD_get_procedure(CompiledStatement* statement, const dsql_str* name,
|
|||||||
SSHORT pr_null_flag;
|
SSHORT pr_null_flag;
|
||||||
bool pr_type_of = false;
|
bool pr_type_of = false;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
jrd_req* handle3 = CMP_find_request(tdbb, irq_parameters2, IRQ_REQUESTS);
|
||||||
{
|
|
||||||
jrd_req* handle3 = CMP_find_request(tdbb, irq_parameters2, IRQ_REQUESTS);
|
|
||||||
|
|
||||||
const MetaName packageName(PR.RDB$PACKAGE_NAME.NULL ? NULL : PR.RDB$PACKAGE_NAME);
|
const MetaName packageName(PR.RDB$PACKAGE_NAME.NULL ? NULL : PR.RDB$PACKAGE_NAME);
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE handle3 TRANSACTION_HANDLE statement->req_transaction)
|
FOR(REQUEST_HANDLE handle3 TRANSACTION_HANDLE statement->req_transaction)
|
||||||
PR2 IN RDB$PROCEDURE_PARAMETERS
|
PR2 IN RDB$PROCEDURE_PARAMETERS
|
||||||
WITH PR2.RDB$PROCEDURE_NAME EQ PR.RDB$PROCEDURE_NAME AND
|
WITH PR2.RDB$PROCEDURE_NAME EQ PR.RDB$PROCEDURE_NAME AND
|
||||||
PR2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '') AND
|
PR2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '') AND
|
||||||
PR2.RDB$PARAMETER_NAME EQ PR.RDB$PARAMETER_NAME
|
PR2.RDB$PARAMETER_NAME EQ PR.RDB$PARAMETER_NAME
|
||||||
|
|
||||||
if (!DSQL_REQUEST(irq_parameters2))
|
|
||||||
DSQL_REQUEST(irq_parameters2) = handle3;
|
|
||||||
|
|
||||||
pr_collation_id_null = PR2.RDB$COLLATION_ID.NULL;
|
|
||||||
pr_collation_id = PR2.RDB$COLLATION_ID;
|
|
||||||
|
|
||||||
pr_default_value_null = PR2.RDB$DEFAULT_VALUE.NULL;
|
|
||||||
|
|
||||||
pr_null_flag_null = PR2.RDB$NULL_FLAG.NULL;
|
|
||||||
pr_null_flag = PR2.RDB$NULL_FLAG;
|
|
||||||
|
|
||||||
if (!PR2.RDB$PARAMETER_MECHANISM.NULL && PR2.RDB$PARAMETER_MECHANISM == prm_mech_type_of)
|
|
||||||
pr_type_of = true;
|
|
||||||
|
|
||||||
END_FOR
|
|
||||||
|
|
||||||
if (!DSQL_REQUEST(irq_parameters2))
|
if (!DSQL_REQUEST(irq_parameters2))
|
||||||
DSQL_REQUEST(irq_parameters2) = handle3;
|
DSQL_REQUEST(irq_parameters2) = handle3;
|
||||||
}
|
|
||||||
|
pr_collation_id_null = PR2.RDB$COLLATION_ID.NULL;
|
||||||
|
pr_collation_id = PR2.RDB$COLLATION_ID;
|
||||||
|
|
||||||
|
pr_default_value_null = PR2.RDB$DEFAULT_VALUE.NULL;
|
||||||
|
|
||||||
|
pr_null_flag_null = PR2.RDB$NULL_FLAG.NULL;
|
||||||
|
pr_null_flag = PR2.RDB$NULL_FLAG;
|
||||||
|
|
||||||
|
if (!PR2.RDB$PARAMETER_MECHANISM.NULL && PR2.RDB$PARAMETER_MECHANISM == prm_mech_type_of)
|
||||||
|
pr_type_of = true;
|
||||||
|
|
||||||
|
END_FOR
|
||||||
|
|
||||||
|
if (!DSQL_REQUEST(irq_parameters2))
|
||||||
|
DSQL_REQUEST(irq_parameters2) = handle3;
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
// allocate the field block
|
// allocate the field block
|
||||||
|
@ -409,27 +409,16 @@ DatabaseSnapshot::DatabaseSnapshot(thread_db* tdbb, MemoryPool& pool)
|
|||||||
Database* const dbb = tdbb->getDatabase();
|
Database* const dbb = tdbb->getDatabase();
|
||||||
fb_assert(dbb);
|
fb_assert(dbb);
|
||||||
|
|
||||||
const USHORT ods_version = ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version);
|
|
||||||
|
|
||||||
// Initialize record buffers
|
// Initialize record buffers
|
||||||
RecordBuffer* const dbb_buffer =
|
RecordBuffer* const dbb_buffer = allocBuffer(tdbb, pool, rel_mon_database);
|
||||||
ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_database) : NULL;
|
RecordBuffer* const att_buffer = allocBuffer(tdbb, pool, rel_mon_attachments);
|
||||||
RecordBuffer* const att_buffer =
|
RecordBuffer* const tra_buffer = allocBuffer(tdbb, pool, rel_mon_transactions);
|
||||||
ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_attachments) : NULL;
|
RecordBuffer* const stmt_buffer = allocBuffer(tdbb, pool, rel_mon_statements);
|
||||||
RecordBuffer* const tra_buffer =
|
RecordBuffer* const call_buffer = allocBuffer(tdbb, pool, rel_mon_calls);
|
||||||
ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_transactions) : NULL;
|
RecordBuffer* const io_stat_buffer = allocBuffer(tdbb, pool, rel_mon_io_stats);
|
||||||
RecordBuffer* const stmt_buffer =
|
RecordBuffer* const rec_stat_buffer = allocBuffer(tdbb, pool, rel_mon_rec_stats);
|
||||||
ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_statements) : NULL;
|
RecordBuffer* const ctx_var_buffer = allocBuffer(tdbb, pool, rel_mon_ctx_vars);
|
||||||
RecordBuffer* const call_buffer =
|
RecordBuffer* const mem_usage_buffer = allocBuffer(tdbb, pool, rel_mon_mem_usage);
|
||||||
ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_calls) : NULL;
|
|
||||||
RecordBuffer* const io_stat_buffer =
|
|
||||||
ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_io_stats) : NULL;
|
|
||||||
RecordBuffer* const rec_stat_buffer =
|
|
||||||
ods_version >= ODS_11_1 ? allocBuffer(tdbb, pool, rel_mon_rec_stats) : NULL;
|
|
||||||
RecordBuffer* const ctx_var_buffer =
|
|
||||||
ods_version >= ODS_11_2 ? allocBuffer(tdbb, pool, rel_mon_ctx_vars) : NULL;
|
|
||||||
RecordBuffer* const mem_usage_buffer =
|
|
||||||
ods_version >= ODS_11_2 ? allocBuffer(tdbb, pool, rel_mon_mem_usage) : NULL;
|
|
||||||
|
|
||||||
// Release our own lock
|
// Release our own lock
|
||||||
LCK_release(tdbb, dbb->dbb_monitor_lock);
|
LCK_release(tdbb, dbb->dbb_monitor_lock);
|
||||||
|
@ -1389,7 +1389,7 @@ blb* BLB_open2(thread_db* tdbb,
|
|||||||
|
|
||||||
UCharBuffer new_bpb;
|
UCharBuffer new_bpb;
|
||||||
|
|
||||||
if (external_call && ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
if (external_call)
|
||||||
{
|
{
|
||||||
if (!from_type_specified)
|
if (!from_type_specified)
|
||||||
from = blob->blb_sub_type;
|
from = blob->blb_sub_type;
|
||||||
|
@ -1534,7 +1534,7 @@ void BTR_make_null_key(thread_db* tdbb, index_desc* idx, temporary_key* key)
|
|||||||
|
|
||||||
fb_assert(idx != NULL);
|
fb_assert(idx != NULL);
|
||||||
fb_assert(key != NULL);
|
fb_assert(key != NULL);
|
||||||
fb_assert(tdbb->getDatabase()->dbb_ods_version >= ODS_VERSION11)
|
fb_assert(tdbb->getDatabase()->dbb_ods_version >= ODS_VERSION12)
|
||||||
|
|
||||||
key->key_flags = key_all_nulls;
|
key->key_flags = key_all_nulls;
|
||||||
|
|
||||||
@ -2304,8 +2304,8 @@ static void compress(thread_db* tdbb,
|
|||||||
|
|
||||||
if (isNull)
|
if (isNull)
|
||||||
{
|
{
|
||||||
// dbb->dbb_ods_version < ODS_VERSION11 cannot happen, see PAG_header_init()
|
// dbb->dbb_ods_version < ODS_VERSION12 cannot happen, see PAG_header_init()
|
||||||
fb_assert(dbb->dbb_ods_version >= ODS_VERSION11);
|
fb_assert(dbb->dbb_ods_version >= ODS_VERSION12);
|
||||||
|
|
||||||
UCHAR pad = 0;
|
UCHAR pad = 0;
|
||||||
key->key_flags &= ~key_empty;
|
key->key_flags &= ~key_empty;
|
||||||
|
125
src/jrd/dfw.epp
125
src/jrd/dfw.epp
@ -2142,8 +2142,6 @@ static bool modify_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
|
|||||||
SET_TDBB(tdbb);
|
SET_TDBB(tdbb);
|
||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
|
|
||||||
const bool have_gtt = (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1);
|
|
||||||
|
|
||||||
bool is_create = true;
|
bool is_create = true;
|
||||||
dfw_task_routine task_routine = NULL;
|
dfw_task_routine task_routine = NULL;
|
||||||
|
|
||||||
@ -2171,45 +2169,42 @@ static bool modify_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
|
|||||||
more = (*task_routine)(tdbb, phase, work, transaction);
|
more = (*task_routine)(tdbb, phase, work, transaction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (have_gtt)
|
bool gtt_preserve = false;
|
||||||
|
jrd_rel* relation = NULL;
|
||||||
|
|
||||||
|
if (is_create)
|
||||||
{
|
{
|
||||||
bool gtt_preserve = false;
|
jrd_req* request = NULL;
|
||||||
jrd_rel* relation = NULL;
|
|
||||||
|
|
||||||
if (is_create)
|
FOR(REQUEST_HANDLE request)
|
||||||
{
|
IDX IN RDB$INDICES CROSS
|
||||||
jrd_req* request = NULL;
|
REL IN RDB$RELATIONS OVER RDB$RELATION_NAME WITH
|
||||||
|
IDX.RDB$INDEX_NAME EQ work->dfw_name.c_str()
|
||||||
|
gtt_preserve = (REL.RDB$RELATION_TYPE == rel_global_temp_preserve);
|
||||||
|
relation = MET_lookup_relation(tdbb, REL.RDB$RELATION_NAME);
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request)
|
CMP_release(tdbb, request);
|
||||||
IDX IN RDB$INDICES CROSS
|
}
|
||||||
REL IN RDB$RELATIONS OVER RDB$RELATION_NAME WITH
|
else
|
||||||
IDX.RDB$INDEX_NAME EQ work->dfw_name.c_str()
|
{
|
||||||
gtt_preserve = (REL.RDB$RELATION_TYPE == rel_global_temp_preserve);
|
relation = MET_lookup_relation_id(tdbb, work->dfw_id, false);
|
||||||
relation = MET_lookup_relation(tdbb, REL.RDB$RELATION_NAME);
|
gtt_preserve = (relation) && (relation->rel_flags & REL_temp_conn);
|
||||||
END_FOR;
|
}
|
||||||
|
|
||||||
CMP_release(tdbb, request);
|
if (gtt_preserve && relation)
|
||||||
}
|
{
|
||||||
else
|
tdbb->tdbb_flags &= ~TDBB_use_db_page_space;
|
||||||
{
|
try {
|
||||||
relation = MET_lookup_relation_id(tdbb, work->dfw_id, false);
|
if (relation->getPages(tdbb, -1, false)) {
|
||||||
gtt_preserve = (relation) && (relation->rel_flags & REL_temp_conn);
|
more2 = (*task_routine) (tdbb, phase, work, transaction);
|
||||||
}
|
|
||||||
|
|
||||||
if (gtt_preserve && relation)
|
|
||||||
{
|
|
||||||
tdbb->tdbb_flags &= ~TDBB_use_db_page_space;
|
|
||||||
try {
|
|
||||||
if (relation->getPages(tdbb, -1, false)) {
|
|
||||||
more2 = (*task_routine) (tdbb, phase, work, transaction);
|
|
||||||
}
|
|
||||||
tdbb->tdbb_flags |= TDBB_use_db_page_space;
|
|
||||||
}
|
|
||||||
catch (...)
|
|
||||||
{
|
|
||||||
tdbb->tdbb_flags |= TDBB_use_db_page_space;
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
|
tdbb->tdbb_flags |= TDBB_use_db_page_space;
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
tdbb->tdbb_flags |= TDBB_use_db_page_space;
|
||||||
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4789,44 +4784,38 @@ static Format* make_format(thread_db* tdbb, jrd_rel* relation, USHORT* version,
|
|||||||
|
|
||||||
HalfStaticArray<UCHAR, BUFFER_MEDIUM> buffer;
|
HalfStaticArray<UCHAR, BUFFER_MEDIUM> buffer;
|
||||||
|
|
||||||
if (dbb->dbb_ods_version >= ODS_VERSION12)
|
buffer.add(UCHAR(format->fmt_count));
|
||||||
{
|
buffer.add(UCHAR(format->fmt_count >> 8));
|
||||||
buffer.add(UCHAR(format->fmt_count));
|
|
||||||
buffer.add(UCHAR(format->fmt_count >> 8));
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer.add((UCHAR*) odsDescs.begin(), odsDescs.getCount() * sizeof(Ods::Descriptor));
|
buffer.add((UCHAR*) odsDescs.begin(), odsDescs.getCount() * sizeof(Ods::Descriptor));
|
||||||
|
|
||||||
if (dbb->dbb_ods_version >= ODS_VERSION12)
|
const size_t pos = buffer.getCount();
|
||||||
|
buffer.add(0);
|
||||||
|
buffer.add(0);
|
||||||
|
|
||||||
|
USHORT i = 0, dflCount = 0;
|
||||||
|
for (Format::fmt_defaults_iterator impure = format->fmt_defaults.begin();
|
||||||
|
impure != format->fmt_defaults.end(); ++impure, ++i)
|
||||||
{
|
{
|
||||||
size_t pos = buffer.getCount();
|
if (!impure->vlu_desc.isUnknown())
|
||||||
buffer.add(0);
|
|
||||||
buffer.add(0);
|
|
||||||
|
|
||||||
USHORT i = 0, dflCount = 0;
|
|
||||||
for (Format::fmt_defaults_iterator impure = format->fmt_defaults.begin();
|
|
||||||
impure != format->fmt_defaults.end(); ++impure, ++i)
|
|
||||||
{
|
{
|
||||||
if (!impure->vlu_desc.isUnknown())
|
dsc desc = impure->vlu_desc;
|
||||||
{
|
desc.dsc_address = NULL;
|
||||||
dsc desc = impure->vlu_desc;
|
|
||||||
desc.dsc_address = NULL;
|
|
||||||
|
|
||||||
Ods::Descriptor odsDflDesc = desc;
|
Ods::Descriptor odsDflDesc = desc;
|
||||||
|
|
||||||
buffer.add(UCHAR(i));
|
buffer.add(UCHAR(i));
|
||||||
buffer.add(UCHAR(i >> 8));
|
buffer.add(UCHAR(i >> 8));
|
||||||
buffer.add((UCHAR*) &odsDflDesc, sizeof(odsDflDesc));
|
buffer.add((UCHAR*) &odsDflDesc, sizeof(odsDflDesc));
|
||||||
buffer.add(impure->vlu_desc.dsc_address, impure->vlu_desc.dsc_length);
|
buffer.add(impure->vlu_desc.dsc_address, impure->vlu_desc.dsc_length);
|
||||||
|
|
||||||
++dflCount;
|
++dflCount;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
buffer[pos] = UCHAR(dflCount);
|
|
||||||
buffer[pos + 1] = UCHAR(dflCount >> 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
buffer[pos] = UCHAR(dflCount);
|
||||||
|
buffer[pos + 1] = UCHAR(dflCount >> 8);
|
||||||
|
|
||||||
BLB_put_segment(tdbb, blob, buffer.begin(), buffer.getCount());
|
BLB_put_segment(tdbb, blob, buffer.begin(), buffer.getCount());
|
||||||
BLB_close(tdbb, blob);
|
BLB_close(tdbb, blob);
|
||||||
END_STORE;
|
END_STORE;
|
||||||
@ -5419,8 +5408,7 @@ static bool modify_procedure(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
{ // scope
|
||||||
{
|
|
||||||
const DeferredWork* arg = work->findArg(dfw_arg_check_blr);
|
const DeferredWork* arg = work->findArg(dfw_arg_check_blr);
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
@ -5460,7 +5448,7 @@ static bool modify_procedure(thread_db* tdbb, SSHORT phase, DeferredWork* work,
|
|||||||
if (!REQUEST(irq_prc_validate))
|
if (!REQUEST(irq_prc_validate))
|
||||||
REQUEST(irq_prc_validate) = request;
|
REQUEST(irq_prc_validate) = request;
|
||||||
}
|
}
|
||||||
}
|
} // scope
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5521,8 +5509,7 @@ static bool modify_trigger(thread_db* tdbb, SSHORT phase, DeferredWork* work, jr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
{ // scope
|
||||||
{
|
|
||||||
const DeferredWork* arg = work->findArg(dfw_arg_check_blr);
|
const DeferredWork* arg = work->findArg(dfw_arg_check_blr);
|
||||||
if (arg)
|
if (arg)
|
||||||
{
|
{
|
||||||
@ -5595,7 +5582,7 @@ static bool modify_trigger(thread_db* tdbb, SSHORT phase, DeferredWork* work, jr
|
|||||||
if (!REQUEST(irq_trg_validate))
|
if (!REQUEST(irq_trg_validate))
|
||||||
REQUEST(irq_trg_validate) = request;
|
REQUEST(irq_trg_validate) = request;
|
||||||
}
|
}
|
||||||
}
|
} // scope
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,15 +1227,7 @@ SINT64 DPM_gen_id(thread_db* tdbb, SLONG generator, bool initialize, SINT64 val)
|
|||||||
* decided that the V6 engine would only access an ODS-10 database.
|
* decided that the V6 engine would only access an ODS-10 database.
|
||||||
* (and uncommented 2000-05-05, also by ChrisJ, when minds changed.)
|
* (and uncommented 2000-05-05, also by ChrisJ, when minds changed.)
|
||||||
*/
|
*/
|
||||||
SINT64* ptr = NULL;
|
SINT64* const ptr = ((SINT64*) (page->gpg_values)) + offset;
|
||||||
|
|
||||||
if (dbb->dbb_ods_version >= ODS_VERSION12)
|
|
||||||
ptr = ((SINT64*) (page->gpg_values)) + offset;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fb_assert(dbb->dbb_ods_version == ODS_VERSION11);
|
|
||||||
ptr = ((SINT64*) (((old_gen_page*) page)->gpg_values)) + offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (val || initialize)
|
if (val || initialize)
|
||||||
{
|
{
|
||||||
@ -1426,8 +1418,7 @@ ULONG DPM_get_blob(thread_db* tdbb,
|
|||||||
blob->blb_max_segment = header->blh_max_segment;
|
blob->blb_max_segment = header->blh_max_segment;
|
||||||
blob->blb_level = header->blh_level;
|
blob->blb_level = header->blh_level;
|
||||||
blob->blb_sub_type = header->blh_sub_type;
|
blob->blb_sub_type = header->blh_sub_type;
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
blob->blb_charset = header->blh_charset;
|
||||||
blob->blb_charset = header->blh_charset;
|
|
||||||
|
|
||||||
// Unless this is the only attachment, don't allow the sequential scan
|
// Unless this is the only attachment, don't allow the sequential scan
|
||||||
// of very large blobs to flush pages used by other attachments.
|
// of very large blobs to flush pages used by other attachments.
|
||||||
@ -2018,8 +2009,7 @@ RecordNumber DPM_store_blob(thread_db* tdbb, blb* blob, Record* record)
|
|||||||
header->blh_length = blob->blb_length;
|
header->blh_length = blob->blb_length;
|
||||||
header->blh_level = blob->blb_level;
|
header->blh_level = blob->blb_level;
|
||||||
header->blh_sub_type = blob->blb_sub_type;
|
header->blh_sub_type = blob->blb_sub_type;
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
header->blh_charset = blob->blb_charset;
|
||||||
header->blh_charset = blob->blb_charset;
|
|
||||||
|
|
||||||
if (length)
|
if (length)
|
||||||
memcpy(header->blh_page, q, length);
|
memcpy(header->blh_page, q, length);
|
||||||
|
@ -889,45 +889,41 @@ USHORT DYN_put_text_blob(Global* gbl, const UCHAR** ptr, bid* blob_id)
|
|||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
// make the code die at some place if DYN_error_punt doesn't jump far away.
|
const UCHAR* const end = p + length;
|
||||||
const UCHAR* end = NULL;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
UCharBuffer bpb;
|
|
||||||
|
|
||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
|
||||||
{
|
|
||||||
const size_t convSize = 15;
|
|
||||||
bpb.resize(convSize);
|
|
||||||
|
|
||||||
UCHAR* p = bpb.begin();
|
UCharBuffer bpb;
|
||||||
*p++ = isc_bpb_version1;
|
const size_t convSize = 15;
|
||||||
|
bpb.resize(convSize);
|
||||||
|
|
||||||
*p++ = isc_bpb_source_type;
|
UCHAR* bpbPtr = bpb.begin();
|
||||||
*p++ = 2;
|
*bpbPtr++ = isc_bpb_version1;
|
||||||
put_vax_short(p, isc_blob_text);
|
|
||||||
p += 2;
|
|
||||||
*p++ = isc_bpb_source_interp;
|
|
||||||
*p++ = 1;
|
|
||||||
*p++ = tdbb->getCharSet();
|
|
||||||
|
|
||||||
*p++ = isc_bpb_target_type;
|
*bpbPtr++ = isc_bpb_source_type;
|
||||||
*p++ = 2;
|
*bpbPtr++ = 2;
|
||||||
put_vax_short(p, isc_blob_text);
|
put_vax_short(bpbPtr, isc_blob_text);
|
||||||
p += 2;
|
bpbPtr += 2;
|
||||||
*p++ = isc_bpb_target_interp;
|
*bpbPtr++ = isc_bpb_source_interp;
|
||||||
*p++ = 1;
|
*bpbPtr++ = 1;
|
||||||
*p++ = CS_METADATA;
|
*bpbPtr++ = tdbb->getCharSet();
|
||||||
fb_assert(size_t(p - bpb.begin()) <= convSize);
|
|
||||||
|
|
||||||
// set the array count to the number of bytes we used
|
*bpbPtr++ = isc_bpb_target_type;
|
||||||
bpb.shrink(p - bpb.begin());
|
*bpbPtr++ = 2;
|
||||||
}
|
put_vax_short(bpbPtr, isc_blob_text);
|
||||||
|
bpbPtr += 2;
|
||||||
|
*bpbPtr++ = isc_bpb_target_interp;
|
||||||
|
*bpbPtr++ = 1;
|
||||||
|
*bpbPtr++ = CS_METADATA;
|
||||||
|
fb_assert(size_t(bpbPtr - bpb.begin()) <= convSize);
|
||||||
|
|
||||||
|
// set the array count to the number of bytes we used
|
||||||
|
bpb.shrink(bpbPtr - bpb.begin());
|
||||||
|
|
||||||
blb* blob = BLB_create2(tdbb, gbl->gbl_transaction, blob_id, bpb.getCount(), bpb.begin());
|
blb* blob = BLB_create2(tdbb, gbl->gbl_transaction, blob_id, bpb.getCount(), bpb.begin());
|
||||||
|
|
||||||
for (end = p + length; p < end; p += TEXT_BLOB_LENGTH)
|
for (; p < end; p += TEXT_BLOB_LENGTH)
|
||||||
{
|
{
|
||||||
length = (p + TEXT_BLOB_LENGTH <= end) ? TEXT_BLOB_LENGTH : end - p;
|
length = (p + TEXT_BLOB_LENGTH <= end) ? TEXT_BLOB_LENGTH : end - p;
|
||||||
BLB_put_segment(tdbb, blob, p, length);
|
BLB_put_segment(tdbb, blob, p, length);
|
||||||
|
@ -3002,12 +3002,6 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case isc_dyn_rel_temporary:
|
case isc_dyn_rel_temporary:
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) < ODS_11_1)
|
|
||||||
{
|
|
||||||
// msg 248: "Feature ''@1'' is not supported in ODS @2.@3"
|
|
||||||
DYN_error_punt(false, 248, SafeArg() << "GLOBAL TEMPORARY TABLE" <<
|
|
||||||
dbb->dbb_ods_version << dbb->dbb_minor_version);
|
|
||||||
}
|
|
||||||
switch (DYN_get_number(ptr))
|
switch (DYN_get_number(ptr))
|
||||||
{
|
{
|
||||||
case isc_dyn_rel_temp_global_preserve:
|
case isc_dyn_rel_temp_global_preserve:
|
||||||
@ -3028,7 +3022,8 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view)
|
|||||||
MetaTmp(REL.RDB$RELATION_NAME)
|
MetaTmp(REL.RDB$RELATION_NAME)
|
||||||
DYN_execute(gbl, ptr, &tmp, &field_name, NULL, NULL, NULL);
|
DYN_execute(gbl, ptr, &tmp, &field_name, NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
} // while
|
||||||
|
|
||||||
|
|
||||||
SSHORT old_id = id;
|
SSHORT old_id = id;
|
||||||
id = drq_l_rel_info2;
|
id = drq_l_rel_info2;
|
||||||
@ -3092,21 +3087,18 @@ void DYN_define_relation(Global* gbl, const UCHAR** ptr, bool view)
|
|||||||
if (!DYN_REQUEST(drq_s_rels))
|
if (!DYN_REQUEST(drq_s_rels))
|
||||||
DYN_REQUEST(drq_s_rels) = request;
|
DYN_REQUEST(drq_s_rels) = request;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
jrd_req* sub_request = NULL;
|
||||||
{
|
|
||||||
jrd_req* sub_request = NULL;
|
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction)
|
FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||||
REL IN RDB$RELATIONS WITH REL.RDB$RELATION_NAME EQ relation_name.c_str()
|
REL IN RDB$RELATIONS WITH REL.RDB$RELATION_NAME EQ relation_name.c_str()
|
||||||
|
|
||||||
MODIFY REL USING
|
MODIFY REL USING
|
||||||
REL.RDB$RELATION_TYPE = rel_type;
|
REL.RDB$RELATION_TYPE = rel_type;
|
||||||
REL.RDB$RELATION_TYPE.NULL = FALSE;
|
REL.RDB$RELATION_TYPE.NULL = FALSE;
|
||||||
END_MODIFY;
|
END_MODIFY;
|
||||||
END_FOR;
|
END_FOR;
|
||||||
|
|
||||||
CMP_release(tdbb, sub_request);
|
CMP_release(tdbb, sub_request);
|
||||||
}
|
|
||||||
|
|
||||||
if (sql_prot)
|
if (sql_prot)
|
||||||
{
|
{
|
||||||
@ -3914,25 +3906,22 @@ void DYN_define_trigger(Global* gbl,
|
|||||||
DYN_REQUEST(drq_s_triggers) = request;
|
DYN_REQUEST(drq_s_triggers) = request;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
jrd_req* sub_request = NULL;
|
||||||
{
|
|
||||||
jrd_req* sub_request = NULL;
|
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction)
|
FOR(REQUEST_HANDLE sub_request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||||
TRG IN RDB$TRIGGERS WITH TRG.RDB$TRIGGER_NAME EQ t.c_str()
|
TRG IN RDB$TRIGGERS WITH TRG.RDB$TRIGGER_NAME EQ t.c_str()
|
||||||
|
|
||||||
MODIFY TRG USING
|
MODIFY TRG USING
|
||||||
TRG.RDB$VALID_BLR = TRUE;
|
TRG.RDB$VALID_BLR = TRUE;
|
||||||
TRG.RDB$VALID_BLR.NULL = FALSE;
|
TRG.RDB$VALID_BLR.NULL = FALSE;
|
||||||
|
|
||||||
TRG.RDB$DEBUG_INFO.NULL = (debug_info_ptr == NULL) ? TRUE : FALSE;
|
TRG.RDB$DEBUG_INFO.NULL = (debug_info_ptr == NULL) ? TRUE : FALSE;
|
||||||
if (debug_info_ptr)
|
if (debug_info_ptr)
|
||||||
DYN_put_blr_blob(gbl, &debug_info_ptr, &TRG.RDB$DEBUG_INFO);
|
DYN_put_blr_blob(gbl, &debug_info_ptr, &TRG.RDB$DEBUG_INFO);
|
||||||
END_MODIFY;
|
END_MODIFY;
|
||||||
END_FOR;
|
END_FOR;
|
||||||
|
|
||||||
CMP_release(tdbb, sub_request);
|
CMP_release(tdbb, sub_request);
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (const Firebird::Exception& ex)
|
catch (const Firebird::Exception& ex)
|
||||||
@ -4102,10 +4091,6 @@ void DYN_define_view_relation( Global* gbl, const UCHAR** ptr, const Firebird::M
|
|||||||
case isc_dyn_view_context_name:
|
case isc_dyn_view_context_name:
|
||||||
GET_STRING(ptr, VRL.RDB$CONTEXT_NAME);
|
GET_STRING(ptr, VRL.RDB$CONTEXT_NAME);
|
||||||
VRL.RDB$CONTEXT_NAME.NULL = FALSE;
|
VRL.RDB$CONTEXT_NAME.NULL = FALSE;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) < ODS_11_2) {
|
|
||||||
VRL.RDB$CONTEXT_NAME[31] = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -4263,30 +4248,24 @@ static rel_t get_relation_type(thread_db* tdbb, Global* gbl, const Firebird::Met
|
|||||||
{
|
{
|
||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
|
|
||||||
const USHORT major_version = dbb->dbb_ods_version;
|
|
||||||
const USHORT minor_version = dbb->dbb_minor_version;
|
|
||||||
|
|
||||||
rel_t rel_type = rel_persistent;
|
rel_t rel_type = rel_persistent;
|
||||||
|
|
||||||
if (ENCODE_ODS(major_version, minor_version) >= ODS_11_1)
|
jrd_req* request = CMP_find_request(tdbb, drq_l_rel_type, DYN_REQUESTS);
|
||||||
{
|
|
||||||
jrd_req* request = CMP_find_request(tdbb, drq_l_rel_type, DYN_REQUESTS);
|
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||||
REL IN RDB$RELATIONS
|
REL IN RDB$RELATIONS
|
||||||
WITH REL.RDB$RELATION_NAME EQ rel_name.c_str()
|
WITH REL.RDB$RELATION_NAME EQ rel_name.c_str()
|
||||||
AND REL.RDB$RELATION_TYPE NOT MISSING
|
AND REL.RDB$RELATION_TYPE NOT MISSING
|
||||||
|
|
||||||
if (!DYN_REQUEST(drq_l_rel_type))
|
|
||||||
DYN_REQUEST(drq_l_rel_type) = request;
|
|
||||||
|
|
||||||
rel_type = (rel_t) REL.RDB$RELATION_TYPE;
|
|
||||||
|
|
||||||
END_FOR;
|
|
||||||
|
|
||||||
if (!DYN_REQUEST(drq_l_rel_type))
|
if (!DYN_REQUEST(drq_l_rel_type))
|
||||||
DYN_REQUEST(drq_l_rel_type) = request;
|
DYN_REQUEST(drq_l_rel_type) = request;
|
||||||
}
|
|
||||||
|
rel_type = (rel_t) REL.RDB$RELATION_TYPE;
|
||||||
|
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
|
if (!DYN_REQUEST(drq_l_rel_type))
|
||||||
|
DYN_REQUEST(drq_l_rel_type) = request;
|
||||||
|
|
||||||
return rel_type;
|
return rel_type;
|
||||||
}
|
}
|
||||||
|
@ -2796,21 +2796,18 @@ void DYN_modify_sql_field(Global* gbl, const UCHAR** ptr, const MetaName* relati
|
|||||||
first_request = request;
|
first_request = request;
|
||||||
request = NULL;
|
request = NULL;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_2)
|
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||||
{
|
PRM IN RDB$PROCEDURE_PARAMETERS
|
||||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND
|
||||||
PRM IN RDB$PROCEDURE_PARAMETERS
|
PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str()
|
||||||
WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND
|
|
||||||
PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str()
|
|
||||||
|
|
||||||
MODIFY PRM USING
|
MODIFY PRM USING
|
||||||
strcpy(PRM.RDB$FIELD_SOURCE, dom_fld.dyn_fld_source.c_str());
|
strcpy(PRM.RDB$FIELD_SOURCE, dom_fld.dyn_fld_source.c_str());
|
||||||
END_MODIFY;
|
END_MODIFY;
|
||||||
END_FOR;
|
END_FOR;
|
||||||
|
|
||||||
CMP_release(tdbb, request);
|
CMP_release(tdbb, request);
|
||||||
request = NULL;
|
request = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2959,21 +2956,18 @@ void DYN_modify_sql_field(Global* gbl, const UCHAR** ptr, const MetaName* relati
|
|||||||
CMP_release(tdbb, request);
|
CMP_release(tdbb, request);
|
||||||
request = NULL;
|
request = NULL;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_2)
|
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
||||||
{
|
PRM IN RDB$PROCEDURE_PARAMETERS
|
||||||
FOR(REQUEST_HANDLE request TRANSACTION_HANDLE gbl->gbl_transaction)
|
WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND
|
||||||
PRM IN RDB$PROCEDURE_PARAMETERS
|
PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str()
|
||||||
WITH PRM.RDB$RELATION_NAME = relation_name->c_str() AND
|
|
||||||
PRM.RDB$FIELD_NAME = orig_fld.dyn_fld_name.c_str()
|
|
||||||
|
|
||||||
MODIFY PRM USING
|
MODIFY PRM USING
|
||||||
strcpy(PRM.RDB$FIELD_SOURCE, new_fld.dyn_fld_source.c_str());
|
strcpy(PRM.RDB$FIELD_SOURCE, new_fld.dyn_fld_source.c_str());
|
||||||
END_MODIFY;
|
END_MODIFY;
|
||||||
END_FOR;
|
END_FOR;
|
||||||
|
|
||||||
CMP_release(tdbb, request);
|
CMP_release(tdbb, request);
|
||||||
request = NULL;
|
request = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (changeDefault)
|
else if (changeDefault)
|
||||||
{
|
{
|
||||||
|
131
src/jrd/evl.cpp
131
src/jrd/evl.cpp
@ -1252,134 +1252,21 @@ bool EVL_field(jrd_rel* relation, Record* record, USHORT id, dsc* desc)
|
|||||||
thread_db* tdbb = JRD_get_thread_data();
|
thread_db* tdbb = JRD_get_thread_data();
|
||||||
Database* dbb = tdbb->getDatabase();
|
Database* dbb = tdbb->getDatabase();
|
||||||
|
|
||||||
if (dbb->dbb_ods_version >= ODS_VERSION12)
|
while (format &&
|
||||||
|
(id >= format->fmt_defaults.getCount() ||
|
||||||
|
format->fmt_defaults[id].vlu_desc.isUnknown()))
|
||||||
{
|
{
|
||||||
while (format &&
|
if (format->fmt_version >= relation->rel_current_format->fmt_version)
|
||||||
(id >= format->fmt_defaults.getCount() ||
|
|
||||||
format->fmt_defaults[id].vlu_desc.isUnknown()))
|
|
||||||
{
|
{
|
||||||
if (format->fmt_version >= relation->rel_current_format->fmt_version)
|
format = NULL;
|
||||||
{
|
break;
|
||||||
format = NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
format = MET_format(tdbb, relation, format->fmt_version + 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return format && !(*desc = format->fmt_defaults[id].vlu_desc).isUnknown();
|
format = MET_format(tdbb, relation, format->fmt_version + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Legacy ODS logic
|
return format && !(*desc = format->fmt_defaults[id].vlu_desc).isUnknown();
|
||||||
|
|
||||||
// A database sweep does not scan a relation's metadata. However
|
|
||||||
// the change to substitute a default value for a missing "not null"
|
|
||||||
// field makes it necessary to reference the field block.
|
|
||||||
if (!relation->rel_fields)
|
|
||||||
{
|
|
||||||
thread_db* tdbb = NULL;
|
|
||||||
|
|
||||||
SET_TDBB(tdbb);
|
|
||||||
MET_scan_relation(tdbb, relation);
|
|
||||||
}
|
|
||||||
|
|
||||||
// CVC: With a corrupt db, the engine crashed doing backup.
|
|
||||||
jrd_fld* temp_field = NULL;
|
|
||||||
if (id < relation->rel_fields->count())
|
|
||||||
temp_field = (*relation->rel_fields)[id];
|
|
||||||
|
|
||||||
if (temp_field && temp_field->fld_default_value && temp_field->fld_not_null)
|
|
||||||
{
|
|
||||||
const nod_t temp_nod_type = temp_field->fld_default_value->nod_type;
|
|
||||||
|
|
||||||
switch (temp_nod_type)
|
|
||||||
{
|
|
||||||
case nod_user_name:
|
|
||||||
{
|
|
||||||
desc->dsc_dtype = dtype_text;
|
|
||||||
desc->dsc_sub_type = 0;
|
|
||||||
desc->dsc_scale = 0;
|
|
||||||
INTL_ASSIGN_TTYPE(desc, ttype_metadata);
|
|
||||||
Firebird::MetaName& owner_name = relation->rel_owner_name;
|
|
||||||
desc->dsc_address = (UCHAR*) owner_name.c_str(); // throwing away const.
|
|
||||||
desc->dsc_length = owner_name.length();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case nod_current_role:
|
|
||||||
{
|
|
||||||
// CVC: Revisiting the current_role to fill default values:
|
|
||||||
// If the current user is the same as the table creator,
|
|
||||||
// return the current role for that user, otherwise return NONE.
|
|
||||||
desc->dsc_dtype = dtype_text;
|
|
||||||
desc->dsc_sub_type = 0;
|
|
||||||
desc->dsc_scale = 0;
|
|
||||||
INTL_ASSIGN_TTYPE(desc, ttype_metadata);
|
|
||||||
thread_db* tdbb = NULL;
|
|
||||||
SET_TDBB(tdbb);
|
|
||||||
const char* rc_role = 0;
|
|
||||||
const UserId* att_user = tdbb->getAttachment()->att_user;
|
|
||||||
const char* cur_user = att_user ? att_user->usr_user_name.c_str() : 0;
|
|
||||||
if (cur_user && relation->rel_owner_name == cur_user)
|
|
||||||
rc_role = att_user->usr_sql_role_name.c_str();
|
|
||||||
else
|
|
||||||
rc_role = NULL_ROLE;
|
|
||||||
|
|
||||||
desc->dsc_address = reinterpret_cast<UCHAR*>(const_cast<char*>(rc_role));
|
|
||||||
desc->dsc_length = strlen(rc_role);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case nod_current_date:
|
|
||||||
case nod_current_time:
|
|
||||||
case nod_current_timestamp:
|
|
||||||
{
|
|
||||||
static const GDS_TIMESTAMP temp_timestamp = { 0, 0 };
|
|
||||||
desc->dsc_dtype = dtype_timestamp;
|
|
||||||
desc->dsc_scale = 0;
|
|
||||||
desc->dsc_flags = 0;
|
|
||||||
desc->dsc_address =
|
|
||||||
reinterpret_cast<UCHAR*>(const_cast<ISC_TIMESTAMP*>(&temp_timestamp));
|
|
||||||
desc->dsc_length = sizeof(temp_timestamp);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case nod_internal_info:
|
|
||||||
{
|
|
||||||
static const SLONG temp_long = 0;
|
|
||||||
desc->dsc_dtype = dtype_long;
|
|
||||||
desc->dsc_scale = 0;
|
|
||||||
desc->dsc_flags = 0;
|
|
||||||
desc->dsc_address = (UCHAR*) const_cast<SLONG*>(&temp_long);
|
|
||||||
desc->dsc_length = sizeof(temp_long);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
const Literal* default_literal =
|
|
||||||
reinterpret_cast<Literal*>(temp_field->fld_default_value);
|
|
||||||
|
|
||||||
if (default_literal->nod_type == nod_null)
|
|
||||||
{
|
|
||||||
ERR_post(Arg::Gds(isc_not_valid) << Arg::Str(temp_field->fld_name) <<
|
|
||||||
Arg::Str(NULL_STRING_MARK));
|
|
||||||
}
|
|
||||||
|
|
||||||
fb_assert(default_literal->nod_type == nod_literal);
|
|
||||||
|
|
||||||
const dsc* default_desc = &default_literal->lit_desc;
|
|
||||||
// CVC: This could be a bitwise copy in one line
|
|
||||||
/*
|
|
||||||
desc->dsc_dtype = default_desc->dsc_dtype;
|
|
||||||
desc->dsc_scale = default_desc->dsc_scale;
|
|
||||||
desc->dsc_length = default_desc->dsc_length;
|
|
||||||
desc->dsc_sub_type = default_desc->dsc_sub_type;
|
|
||||||
desc->dsc_flags = default_desc->dsc_flags;
|
|
||||||
desc->dsc_address = default_desc->dsc_address;
|
|
||||||
*/
|
|
||||||
*desc = *default_desc;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
desc->dsc_dtype = dtype_text;
|
desc->dsc_dtype = dtype_text;
|
||||||
@ -1387,7 +1274,7 @@ bool EVL_field(jrd_rel* relation, Record* record, USHORT id, dsc* desc)
|
|||||||
desc->dsc_sub_type = 0;
|
desc->dsc_sub_type = 0;
|
||||||
desc->dsc_scale = 0;
|
desc->dsc_scale = 0;
|
||||||
desc->dsc_ttype() = ttype_ascii;
|
desc->dsc_ttype() = ttype_ascii;
|
||||||
desc->dsc_address = (UCHAR *) " ";
|
desc->dsc_address = (UCHAR*) " ";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -652,38 +652,8 @@ void INI_init2(thread_db* tdbb)
|
|||||||
{
|
{
|
||||||
if (n-- > 0)
|
if (n-- > 0)
|
||||||
{
|
{
|
||||||
// In ODS 12.0, RDB$TRIGGER_TYPE was changed from SHORTINT to BIGINT
|
format->fmt_length = (USHORT) MET_align(dbb, &(*desc), format->fmt_length);
|
||||||
if (fld[RFLD_F_NAME] == nam_trg_type && major_version < ODS_12_0)
|
|
||||||
{
|
|
||||||
desc->dsc_dtype = dtype_short;
|
|
||||||
desc->dsc_length = sizeof(SSHORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
format->fmt_length = (USHORT)MET_align(dbb, &(*desc), format->fmt_length);
|
|
||||||
desc->dsc_address = (UCHAR*) (IPTR) format->fmt_length;
|
desc->dsc_address = (UCHAR*) (IPTR) format->fmt_length;
|
||||||
|
|
||||||
// In ODS prior to 11.2 all varchar columns were actually
|
|
||||||
// two bytes shorter than defined in fields.h
|
|
||||||
if (desc->dsc_dtype == dtype_varying &&
|
|
||||||
ENCODE_ODS(major_version, minor_version) < ODS_11_2)
|
|
||||||
{
|
|
||||||
desc->dsc_length -= sizeof(USHORT);
|
|
||||||
}
|
|
||||||
|
|
||||||
// In ODS11.2 length of RDB$CONTEXT_NAME was enlarged from 31 to 255 bytes
|
|
||||||
if ((fld[RFLD_F_NAME] == nam_context) &&
|
|
||||||
ENCODE_ODS(major_version, minor_version) < ODS_11_2)
|
|
||||||
{
|
|
||||||
desc->dsc_length = 31;
|
|
||||||
}
|
|
||||||
else if (fld[RFLD_F_NAME] == nam_entry &&
|
|
||||||
ENCODE_ODS(major_version, minor_version) < ODS_12_0)
|
|
||||||
{
|
|
||||||
// In ODS12.0 length of RDB$EXTERNAL_NAME are enlarged from
|
|
||||||
// 31 to 255 bytes
|
|
||||||
desc->dsc_length = 31;
|
|
||||||
}
|
|
||||||
|
|
||||||
format->fmt_length += desc->dsc_length;
|
format->fmt_length += desc->dsc_length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
452
src/jrd/met.epp
452
src/jrd/met.epp
@ -829,170 +829,167 @@ DeferredWork* MET_change_fields(thread_db* tdbb, jrd_tra* transaction, const dsc
|
|||||||
if (!REQUEST(irq_m_fields))
|
if (!REQUEST(irq_m_fields))
|
||||||
REQUEST(irq_m_fields) = request;
|
REQUEST(irq_m_fields) = request;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
request = CMP_find_request(tdbb, irq_m_fields2, IRQ_REQUESTS);
|
||||||
{
|
|
||||||
request = CMP_find_request(tdbb, irq_m_fields2, IRQ_REQUESTS);
|
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request)
|
FOR(REQUEST_HANDLE request)
|
||||||
DEP IN RDB$DEPENDENCIES CROSS
|
DEP IN RDB$DEPENDENCIES CROSS
|
||||||
PRC IN RDB$PROCEDURES
|
PRC IN RDB$PROCEDURES
|
||||||
WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND
|
WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND
|
||||||
DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND
|
DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND
|
||||||
DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND
|
DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND
|
||||||
DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND
|
DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND
|
||||||
PRC.RDB$PACKAGE_NAME MISSING
|
PRC.RDB$PACKAGE_NAME MISSING
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields2))
|
|
||||||
REQUEST(irq_m_fields2) = request;
|
|
||||||
|
|
||||||
Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME);
|
|
||||||
|
|
||||||
dsc desc;
|
|
||||||
desc.dsc_dtype = dtype_text;
|
|
||||||
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
|
||||||
desc.dsc_length = proc_name.length();
|
|
||||||
desc.dsc_address = (UCHAR*) proc_name.c_str();
|
|
||||||
|
|
||||||
DeferredWork* dw2 =
|
|
||||||
DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID);
|
|
||||||
DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr);
|
|
||||||
END_FOR;
|
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields2))
|
if (!REQUEST(irq_m_fields2))
|
||||||
REQUEST(irq_m_fields2) = request;
|
REQUEST(irq_m_fields2) = request;
|
||||||
|
|
||||||
request = CMP_find_request(tdbb, irq_m_fields6, IRQ_REQUESTS);
|
Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME);
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request)
|
dsc desc;
|
||||||
DEP IN RDB$DEPENDENCIES CROSS
|
desc.dsc_dtype = dtype_text;
|
||||||
PRC IN RDB$PROCEDURES
|
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
||||||
WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND
|
desc.dsc_length = proc_name.length();
|
||||||
DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND
|
desc.dsc_address = (UCHAR*) proc_name.c_str();
|
||||||
(DEP.RDB$DEPENDENT_TYPE EQ obj_package_header OR
|
|
||||||
DEP.RDB$DEPENDENT_TYPE EQ obj_package_body) AND
|
|
||||||
DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PACKAGE_NAME
|
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields6))
|
DeferredWork* dw2 =
|
||||||
REQUEST(irq_m_fields6) = request;
|
DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID);
|
||||||
|
DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr);
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME);
|
if (!REQUEST(irq_m_fields2))
|
||||||
|
REQUEST(irq_m_fields2) = request;
|
||||||
|
|
||||||
dsc desc;
|
request = CMP_find_request(tdbb, irq_m_fields6, IRQ_REQUESTS);
|
||||||
desc.dsc_dtype = dtype_text;
|
|
||||||
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
|
||||||
desc.dsc_length = proc_name.length();
|
|
||||||
desc.dsc_address = (UCHAR*) proc_name.c_str();
|
|
||||||
|
|
||||||
DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_procedure, &desc,
|
FOR(REQUEST_HANDLE request)
|
||||||
PRC.RDB$PROCEDURE_ID, PRC.RDB$PACKAGE_NAME);
|
DEP IN RDB$DEPENDENCIES CROSS
|
||||||
DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr);
|
PRC IN RDB$PROCEDURES
|
||||||
END_FOR;
|
WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND
|
||||||
|
DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND
|
||||||
|
(DEP.RDB$DEPENDENT_TYPE EQ obj_package_header OR
|
||||||
|
DEP.RDB$DEPENDENT_TYPE EQ obj_package_body) AND
|
||||||
|
DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PACKAGE_NAME
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields6))
|
if (!REQUEST(irq_m_fields6))
|
||||||
REQUEST(irq_m_fields6) = request;
|
REQUEST(irq_m_fields6) = request;
|
||||||
|
|
||||||
request = CMP_find_request(tdbb, irq_m_fields3, IRQ_REQUESTS);
|
Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME);
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request)
|
dsc desc;
|
||||||
DEP IN RDB$DEPENDENCIES CROSS
|
desc.dsc_dtype = dtype_text;
|
||||||
TRG IN RDB$TRIGGERS
|
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
||||||
WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND
|
desc.dsc_length = proc_name.length();
|
||||||
DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND
|
desc.dsc_address = (UCHAR*) proc_name.c_str();
|
||||||
DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND
|
|
||||||
DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME
|
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields3))
|
DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_procedure, &desc,
|
||||||
REQUEST(irq_m_fields3) = request;
|
PRC.RDB$PROCEDURE_ID, PRC.RDB$PACKAGE_NAME);
|
||||||
|
DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr);
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME);
|
if (!REQUEST(irq_m_fields6))
|
||||||
Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME);
|
REQUEST(irq_m_fields6) = request;
|
||||||
|
|
||||||
dsc desc;
|
request = CMP_find_request(tdbb, irq_m_fields3, IRQ_REQUESTS);
|
||||||
desc.dsc_dtype = dtype_text;
|
|
||||||
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
|
||||||
desc.dsc_length = trigger_name.length();
|
|
||||||
desc.dsc_address = (UCHAR*) trigger_name.c_str();
|
|
||||||
|
|
||||||
DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0);
|
FOR(REQUEST_HANDLE request)
|
||||||
DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type);
|
DEP IN RDB$DEPENDENCIES CROSS
|
||||||
|
TRG IN RDB$TRIGGERS
|
||||||
desc.dsc_length = trigger_relation_name.length();
|
WITH DEP.RDB$DEPENDED_ON_NAME EQ field_source->dsc_address AND
|
||||||
desc.dsc_address = (UCHAR*) trigger_relation_name.c_str();
|
DEP.RDB$DEPENDED_ON_TYPE EQ obj_field AND
|
||||||
DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr);
|
DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND
|
||||||
END_FOR;
|
DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields3))
|
if (!REQUEST(irq_m_fields3))
|
||||||
REQUEST(irq_m_fields3) = request;
|
REQUEST(irq_m_fields3) = request;
|
||||||
|
|
||||||
request = CMP_find_request(tdbb, irq_m_fields4, IRQ_REQUESTS);
|
Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME);
|
||||||
|
Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME);
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request)
|
dsc desc;
|
||||||
RFL IN RDB$RELATION_FIELDS CROSS
|
desc.dsc_dtype = dtype_text;
|
||||||
DEP IN RDB$DEPENDENCIES CROSS
|
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
||||||
PRC IN RDB$PROCEDURES
|
desc.dsc_length = trigger_name.length();
|
||||||
WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND
|
desc.dsc_address = (UCHAR*) trigger_name.c_str();
|
||||||
DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND
|
|
||||||
DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND
|
|
||||||
DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND
|
|
||||||
DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND
|
|
||||||
DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND
|
|
||||||
PRC.RDB$PACKAGE_NAME MISSING
|
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields4))
|
DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0);
|
||||||
REQUEST(irq_m_fields4) = request;
|
DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type);
|
||||||
|
|
||||||
Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME);
|
desc.dsc_length = trigger_relation_name.length();
|
||||||
|
desc.dsc_address = (UCHAR*) trigger_relation_name.c_str();
|
||||||
|
DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr);
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
dsc desc;
|
if (!REQUEST(irq_m_fields3))
|
||||||
desc.dsc_dtype = dtype_text;
|
REQUEST(irq_m_fields3) = request;
|
||||||
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
|
||||||
desc.dsc_length = proc_name.length();
|
|
||||||
desc.dsc_address = (UCHAR*) proc_name.c_str();
|
|
||||||
|
|
||||||
DeferredWork* dw2 =
|
request = CMP_find_request(tdbb, irq_m_fields4, IRQ_REQUESTS);
|
||||||
DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID);
|
|
||||||
DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr);
|
FOR(REQUEST_HANDLE request)
|
||||||
END_FOR;
|
RFL IN RDB$RELATION_FIELDS CROSS
|
||||||
|
DEP IN RDB$DEPENDENCIES CROSS
|
||||||
|
PRC IN RDB$PROCEDURES
|
||||||
|
WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND
|
||||||
|
DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND
|
||||||
|
DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND
|
||||||
|
DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND
|
||||||
|
DEP.RDB$DEPENDENT_TYPE EQ obj_procedure AND
|
||||||
|
DEP.RDB$DEPENDENT_NAME EQ PRC.RDB$PROCEDURE_NAME AND
|
||||||
|
PRC.RDB$PACKAGE_NAME MISSING
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields4))
|
if (!REQUEST(irq_m_fields4))
|
||||||
REQUEST(irq_m_fields4) = request;
|
REQUEST(irq_m_fields4) = request;
|
||||||
|
|
||||||
request = CMP_find_request(tdbb, irq_m_fields5, IRQ_REQUESTS);
|
Firebird::MetaName proc_name(PRC.RDB$PROCEDURE_NAME);
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request)
|
dsc desc;
|
||||||
RFL IN RDB$RELATION_FIELDS CROSS
|
desc.dsc_dtype = dtype_text;
|
||||||
DEP IN RDB$DEPENDENCIES CROSS
|
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
||||||
TRG IN RDB$TRIGGERS
|
desc.dsc_length = proc_name.length();
|
||||||
WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND
|
desc.dsc_address = (UCHAR*) proc_name.c_str();
|
||||||
DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND
|
|
||||||
DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND
|
|
||||||
DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND
|
|
||||||
DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND
|
|
||||||
DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME
|
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields5))
|
DeferredWork* dw2 =
|
||||||
REQUEST(irq_m_fields5) = request;
|
DFW_post_work(transaction, dfw_modify_procedure, &desc, PRC.RDB$PROCEDURE_ID);
|
||||||
|
DFW_post_work_arg(transaction, dw2, NULL, 0, dfw_arg_check_blr);
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME);
|
if (!REQUEST(irq_m_fields4))
|
||||||
Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME);
|
REQUEST(irq_m_fields4) = request;
|
||||||
|
|
||||||
dsc desc;
|
request = CMP_find_request(tdbb, irq_m_fields5, IRQ_REQUESTS);
|
||||||
desc.dsc_dtype = dtype_text;
|
|
||||||
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
|
||||||
desc.dsc_length = trigger_name.length();
|
|
||||||
desc.dsc_address = (UCHAR*) trigger_name.c_str();
|
|
||||||
|
|
||||||
DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0);
|
FOR(REQUEST_HANDLE request)
|
||||||
DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type);
|
RFL IN RDB$RELATION_FIELDS CROSS
|
||||||
|
DEP IN RDB$DEPENDENCIES CROSS
|
||||||
desc.dsc_length = trigger_relation_name.length();
|
TRG IN RDB$TRIGGERS
|
||||||
desc.dsc_address = (UCHAR*) trigger_relation_name.c_str();
|
WITH RFL.RDB$FIELD_SOURCE EQ field_source->dsc_address AND
|
||||||
DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr);
|
DEP.RDB$DEPENDED_ON_NAME EQ RFL.RDB$RELATION_NAME AND
|
||||||
END_FOR;
|
DEP.RDB$FIELD_NAME EQ RFL.RDB$FIELD_NAME AND
|
||||||
|
DEP.RDB$DEPENDED_ON_TYPE EQ obj_relation AND
|
||||||
|
DEP.RDB$DEPENDENT_TYPE EQ obj_trigger AND
|
||||||
|
DEP.RDB$DEPENDENT_NAME EQ TRG.RDB$TRIGGER_NAME
|
||||||
|
|
||||||
if (!REQUEST(irq_m_fields5))
|
if (!REQUEST(irq_m_fields5))
|
||||||
REQUEST(irq_m_fields5) = request;
|
REQUEST(irq_m_fields5) = request;
|
||||||
}
|
|
||||||
|
Firebird::MetaName trigger_name(TRG.RDB$TRIGGER_NAME);
|
||||||
|
Firebird::MetaName trigger_relation_name(TRG.RDB$RELATION_NAME);
|
||||||
|
|
||||||
|
dsc desc;
|
||||||
|
desc.dsc_dtype = dtype_text;
|
||||||
|
INTL_ASSIGN_DSC(&desc, CS_METADATA, COLLATE_NONE);
|
||||||
|
desc.dsc_length = trigger_name.length();
|
||||||
|
desc.dsc_address = (UCHAR*) trigger_name.c_str();
|
||||||
|
|
||||||
|
DeferredWork* dw2 = DFW_post_work(transaction, dfw_modify_trigger, &desc, 0);
|
||||||
|
DFW_post_work_arg(transaction, dw2, NULL, TRG.RDB$TRIGGER_TYPE, dfw_arg_trg_type);
|
||||||
|
|
||||||
|
desc.dsc_length = trigger_relation_name.length();
|
||||||
|
desc.dsc_address = (UCHAR*) trigger_relation_name.c_str();
|
||||||
|
DFW_post_work_arg(transaction, dw2, &desc, 0, dfw_arg_check_blr);
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
|
if (!REQUEST(irq_m_fields5))
|
||||||
|
REQUEST(irq_m_fields5) = request;
|
||||||
|
|
||||||
return dw;
|
return dw;
|
||||||
}
|
}
|
||||||
@ -1209,16 +1206,8 @@ Format* MET_format(thread_db* tdbb, jrd_rel* relation, USHORT number)
|
|||||||
|
|
||||||
HalfStaticArray<UCHAR, BUFFER_MEDIUM> buffer;
|
HalfStaticArray<UCHAR, BUFFER_MEDIUM> buffer;
|
||||||
BLB_get_data(tdbb, blob, buffer.getBuffer(blob->blb_length), blob->blb_length);
|
BLB_get_data(tdbb, blob, buffer.getBuffer(blob->blb_length), blob->blb_length);
|
||||||
unsigned bufferPos = 0;
|
unsigned bufferPos = 2;
|
||||||
USHORT count;
|
USHORT count = buffer[0] | (buffer[1] << 8);
|
||||||
|
|
||||||
if (dbb->dbb_ods_version >= ODS_VERSION12)
|
|
||||||
{
|
|
||||||
count = buffer[0] | (buffer[1] << 8);
|
|
||||||
bufferPos = 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
count = buffer.getCount() / sizeof(Ods::Descriptor);
|
|
||||||
|
|
||||||
format = Format::newFormat(*dbb->dbb_permanent, count);
|
format = Format::newFormat(*dbb->dbb_permanent, count);
|
||||||
|
|
||||||
@ -1234,38 +1223,35 @@ Format* MET_format(thread_db* tdbb, jrd_rel* relation, USHORT number)
|
|||||||
format->fmt_length = odsDesc->dsc_offset + desc->dsc_length;
|
format->fmt_length = odsDesc->dsc_offset + desc->dsc_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dbb->dbb_ods_version >= ODS_VERSION12)
|
const UCHAR* p = buffer.begin() + bufferPos + count * sizeof(Ods::Descriptor);
|
||||||
|
count = p[0] | (p[1] << 8);
|
||||||
|
p += 2;
|
||||||
|
|
||||||
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
const UCHAR* p = buffer.begin() + bufferPos + count * sizeof(Ods::Descriptor);
|
USHORT offset = p[0] | (p[1] << 8);
|
||||||
count = p[0] | (p[1] << 8);
|
|
||||||
p += 2;
|
p += 2;
|
||||||
|
|
||||||
while (count-- > 0)
|
const Ods::Descriptor* odsDflDesc = (Ods::Descriptor*) p;
|
||||||
|
p = (UCHAR*) (odsDflDesc + 1);
|
||||||
|
|
||||||
|
dsc& desc = format->fmt_defaults[offset].vlu_desc;
|
||||||
|
desc = *odsDflDesc;
|
||||||
|
|
||||||
|
if (desc.dsc_dtype == dtype_text)
|
||||||
{
|
{
|
||||||
USHORT offset = p[0] | (p[1] << 8);
|
VaryingString* vluString = FB_NEW_RPT(*dbb->dbb_permanent,
|
||||||
p += 2;
|
desc.dsc_length) VaryingString();
|
||||||
|
vluString->str_length = desc.dsc_length;
|
||||||
const Ods::Descriptor* odsDflDesc = (Ods::Descriptor*) p;
|
format->fmt_defaults[offset].vlu_string = vluString;
|
||||||
p = (UCHAR*) (odsDflDesc + 1);
|
desc.dsc_address = format->fmt_defaults[offset].vlu_string->str_data;
|
||||||
|
|
||||||
dsc& desc = format->fmt_defaults[offset].vlu_desc;
|
|
||||||
desc = *odsDflDesc;
|
|
||||||
|
|
||||||
if (desc.dsc_dtype == dtype_text)
|
|
||||||
{
|
|
||||||
VaryingString* vluString = FB_NEW_RPT(*dbb->dbb_permanent,
|
|
||||||
desc.dsc_length) VaryingString();
|
|
||||||
vluString->str_length = desc.dsc_length;
|
|
||||||
format->fmt_defaults[offset].vlu_string = vluString;
|
|
||||||
desc.dsc_address = format->fmt_defaults[offset].vlu_string->str_data;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
desc.dsc_address = (UCHAR*) &format->fmt_defaults[offset].vlu_misc;
|
|
||||||
|
|
||||||
memcpy(desc.dsc_address, p, desc.dsc_length);
|
|
||||||
|
|
||||||
p += desc.dsc_length;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
desc.dsc_address = (UCHAR*) &format->fmt_defaults[offset].vlu_misc;
|
||||||
|
|
||||||
|
memcpy(desc.dsc_address, p, desc.dsc_length);
|
||||||
|
|
||||||
|
p += desc.dsc_length;
|
||||||
}
|
}
|
||||||
END_FOR;
|
END_FOR;
|
||||||
|
|
||||||
@ -3226,28 +3212,25 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
|||||||
SSHORT pa_default_value_null = true;
|
SSHORT pa_default_value_null = true;
|
||||||
bid pa_default_value;
|
bid pa_default_value;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
jrd_req* request3 = CMP_find_request(tdbb, irq_r_params2, IRQ_REQUESTS);
|
||||||
{
|
|
||||||
jrd_req* request3 = CMP_find_request(tdbb, irq_r_params2, IRQ_REQUESTS);
|
|
||||||
|
|
||||||
FOR (REQUEST_HANDLE request3)
|
FOR (REQUEST_HANDLE request3)
|
||||||
PA2 IN RDB$PROCEDURE_PARAMETERS
|
PA2 IN RDB$PROCEDURE_PARAMETERS
|
||||||
WITH PA2.RDB$PROCEDURE_NAME EQ PA.RDB$PROCEDURE_NAME AND
|
WITH PA2.RDB$PROCEDURE_NAME EQ PA.RDB$PROCEDURE_NAME AND
|
||||||
PA2.RDB$PARAMETER_NAME EQ PA.RDB$PARAMETER_NAME AND
|
PA2.RDB$PARAMETER_NAME EQ PA.RDB$PARAMETER_NAME AND
|
||||||
PA2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '')
|
PA2.RDB$PACKAGE_NAME EQUIV NULLIF(packageName.c_str(), '')
|
||||||
|
|
||||||
if (!REQUEST(irq_r_params2))
|
|
||||||
REQUEST(irq_r_params2) = request3;
|
|
||||||
|
|
||||||
pa_collation_id_null = PA2.RDB$COLLATION_ID.NULL;
|
|
||||||
pa_collation_id = PA2.RDB$COLLATION_ID;
|
|
||||||
pa_default_value_null = PA2.RDB$DEFAULT_VALUE.NULL;
|
|
||||||
pa_default_value = PA2.RDB$DEFAULT_VALUE;
|
|
||||||
END_FOR
|
|
||||||
|
|
||||||
if (!REQUEST(irq_r_params2))
|
if (!REQUEST(irq_r_params2))
|
||||||
REQUEST(irq_r_params2) = request3;
|
REQUEST(irq_r_params2) = request3;
|
||||||
}
|
|
||||||
|
pa_collation_id_null = PA2.RDB$COLLATION_ID.NULL;
|
||||||
|
pa_collation_id = PA2.RDB$COLLATION_ID;
|
||||||
|
pa_default_value_null = PA2.RDB$DEFAULT_VALUE.NULL;
|
||||||
|
pa_default_value = PA2.RDB$DEFAULT_VALUE;
|
||||||
|
END_FOR
|
||||||
|
|
||||||
|
if (!REQUEST(irq_r_params2))
|
||||||
|
REQUEST(irq_r_params2) = request3;
|
||||||
|
|
||||||
if (PA.RDB$PARAMETER_TYPE) {
|
if (PA.RDB$PARAMETER_TYPE) {
|
||||||
paramVector = procedure->prc_output_fields;
|
paramVector = procedure->prc_output_fields;
|
||||||
@ -3334,30 +3317,27 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
|||||||
Jrd::ContextPoolHolder context(tdbb, csb_pool);
|
Jrd::ContextPoolHolder context(tdbb, csb_pool);
|
||||||
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
|
CompilerScratch* csb = CompilerScratch::newCsb(*tdbb->getDefaultPool(), 5);
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
jrd_req* request4 = CMP_find_request(tdbb, irq_p_type, IRQ_REQUESTS);
|
||||||
{
|
|
||||||
jrd_req* request4 = CMP_find_request(tdbb, irq_p_type, IRQ_REQUESTS);
|
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE request4)
|
FOR(REQUEST_HANDLE request4)
|
||||||
PT IN RDB$PROCEDURES
|
PT IN RDB$PROCEDURES
|
||||||
WITH PT.RDB$PROCEDURE_ID EQ procedure->prc_id
|
WITH PT.RDB$PROCEDURE_ID EQ procedure->prc_id
|
||||||
|
|
||||||
if (!REQUEST(irq_p_type))
|
if (!REQUEST(irq_p_type))
|
||||||
{
|
{
|
||||||
REQUEST(irq_p_type) = request4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!PT.RDB$PROCEDURE_TYPE.NULL)
|
|
||||||
prc_type = (prc_t) PT.RDB$PROCEDURE_TYPE;
|
|
||||||
|
|
||||||
if (!PT.RDB$DEBUG_INFO.NULL)
|
|
||||||
DBG_parse_debug_info(tdbb, &PT.RDB$DEBUG_INFO, csb->csb_dbg_info);
|
|
||||||
|
|
||||||
END_FOR;
|
|
||||||
|
|
||||||
if (!REQUEST(irq_p_type)) {
|
|
||||||
REQUEST(irq_p_type) = request4;
|
REQUEST(irq_p_type) = request4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!PT.RDB$PROCEDURE_TYPE.NULL)
|
||||||
|
prc_type = (prc_t) PT.RDB$PROCEDURE_TYPE;
|
||||||
|
|
||||||
|
if (!PT.RDB$DEBUG_INFO.NULL)
|
||||||
|
DBG_parse_debug_info(tdbb, &PT.RDB$DEBUG_INFO, csb->csb_dbg_info);
|
||||||
|
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
|
if (!REQUEST(irq_p_type)) {
|
||||||
|
REQUEST(irq_p_type) = request4;
|
||||||
}
|
}
|
||||||
|
|
||||||
procedure->prc_type = prc_type;
|
procedure->prc_type = prc_type;
|
||||||
@ -3434,8 +3414,7 @@ jrd_prc* MET_procedure(thread_db* tdbb, int id, bool noscan, USHORT flags)
|
|||||||
procedure->prc_flags |= PRC_scanned;
|
procedure->prc_flags |= PRC_scanned;
|
||||||
|
|
||||||
// CVC: This condition is always false because valid_blr is always true.
|
// CVC: This condition is always false because valid_blr is always true.
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1 &&
|
if (!(dbb->dbb_flags & DBB_read_only) && !valid_blr)
|
||||||
!(dbb->dbb_flags & DBB_read_only) && !valid_blr)
|
|
||||||
{
|
{
|
||||||
// if the BLR was marked as invalid but the procedure was compiled,
|
// if the BLR was marked as invalid but the procedure was compiled,
|
||||||
// mark the BLR as valid
|
// mark the BLR as valid
|
||||||
@ -4070,47 +4049,44 @@ void MET_scan_relation(thread_db* tdbb, jrd_rel* relation)
|
|||||||
|
|
||||||
delete csb;
|
delete csb;
|
||||||
|
|
||||||
if (ENCODE_ODS(dbb->dbb_ods_version, dbb->dbb_minor_version) >= ODS_11_1)
|
jrd_req* sub_request = CMP_find_request(tdbb, irq_r_type, IRQ_REQUESTS);
|
||||||
{
|
|
||||||
jrd_req* sub_request = CMP_find_request(tdbb, irq_r_type, IRQ_REQUESTS);
|
|
||||||
|
|
||||||
FOR(REQUEST_HANDLE sub_request)
|
FOR(REQUEST_HANDLE sub_request)
|
||||||
REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id
|
REL IN RDB$RELATIONS WITH REL.RDB$RELATION_ID EQ relation->rel_id
|
||||||
|
|
||||||
if (!REQUEST(irq_r_type))
|
|
||||||
REQUEST(irq_r_type) = sub_request;
|
|
||||||
|
|
||||||
if (!REL.RDB$RELATION_TYPE.NULL)
|
|
||||||
{
|
|
||||||
switch (REL.RDB$RELATION_TYPE)
|
|
||||||
{
|
|
||||||
case rel_persistent:
|
|
||||||
break;
|
|
||||||
case rel_external:
|
|
||||||
fb_assert(relation->rel_file);
|
|
||||||
break;
|
|
||||||
case rel_view:
|
|
||||||
fb_assert(relation->rel_view_rse);
|
|
||||||
break;
|
|
||||||
case rel_virtual:
|
|
||||||
relation->rel_flags |= REL_virtual;
|
|
||||||
break;
|
|
||||||
case rel_global_temp_preserve:
|
|
||||||
relation->rel_flags |= REL_temp_conn;
|
|
||||||
break;
|
|
||||||
case rel_global_temp_delete:
|
|
||||||
relation->rel_flags |= REL_temp_tran;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fb_assert(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
END_FOR;
|
|
||||||
|
|
||||||
if (!REQUEST(irq_r_type))
|
if (!REQUEST(irq_r_type))
|
||||||
REQUEST(irq_r_type) = sub_request;
|
REQUEST(irq_r_type) = sub_request;
|
||||||
}
|
|
||||||
|
if (!REL.RDB$RELATION_TYPE.NULL)
|
||||||
|
{
|
||||||
|
switch (REL.RDB$RELATION_TYPE)
|
||||||
|
{
|
||||||
|
case rel_persistent:
|
||||||
|
break;
|
||||||
|
case rel_external:
|
||||||
|
fb_assert(relation->rel_file);
|
||||||
|
break;
|
||||||
|
case rel_view:
|
||||||
|
fb_assert(relation->rel_view_rse);
|
||||||
|
break;
|
||||||
|
case rel_virtual:
|
||||||
|
relation->rel_flags |= REL_virtual;
|
||||||
|
break;
|
||||||
|
case rel_global_temp_preserve:
|
||||||
|
relation->rel_flags |= REL_temp_conn;
|
||||||
|
break;
|
||||||
|
case rel_global_temp_delete:
|
||||||
|
relation->rel_flags |= REL_temp_tran;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fb_assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
END_FOR;
|
||||||
|
|
||||||
|
if (!REQUEST(irq_r_type))
|
||||||
|
REQUEST(irq_r_type) = sub_request;
|
||||||
|
|
||||||
// release any triggers in case of a rescan, but not if the rescan
|
// release any triggers in case of a rescan, but not if the rescan
|
||||||
// hapenned while system triggers were being loaded.
|
// hapenned while system triggers were being loaded.
|
||||||
|
@ -552,8 +552,6 @@ PAG PAG_allocate(thread_db* tdbb, WIN* window)
|
|||||||
// Starting from ODS 11.1 we store in pip_header.reserved number of pages
|
// Starting from ODS 11.1 we store in pip_header.reserved number of pages
|
||||||
// allocated from this pointer page. There is intention to create dedicated
|
// allocated from this pointer page. There is intention to create dedicated
|
||||||
// field at page_inv_page for this purpose in ODS 12.
|
// field at page_inv_page for this purpose in ODS 12.
|
||||||
const bool isODS11_x = (dbb->dbb_ods_version == ODS_VERSION11 && dbb->dbb_minor_version >= 1) ||
|
|
||||||
dbb->dbb_ods_version > ODS_VERSION11;
|
|
||||||
|
|
||||||
// Find an allocation page with something on it
|
// Find an allocation page with something on it
|
||||||
|
|
||||||
@ -586,9 +584,6 @@ PAG PAG_allocate(thread_db* tdbb, WIN* window)
|
|||||||
new_page = CCH_fake(tdbb, window, 0); // don't wait on latch
|
new_page = CCH_fake(tdbb, window, 0); // don't wait on latch
|
||||||
if (new_page)
|
if (new_page)
|
||||||
{
|
{
|
||||||
if (!isODS11_x)
|
|
||||||
break;
|
|
||||||
|
|
||||||
BackupManager::StateReadGuard stateGuard(tdbb);
|
BackupManager::StateReadGuard stateGuard(tdbb);
|
||||||
const bool nbak_stalled =
|
const bool nbak_stalled =
|
||||||
dbb->dbb_backup_manager->getState() == nbak_state_stalled;
|
dbb->dbb_backup_manager->getState() == nbak_state_stalled;
|
||||||
@ -1247,19 +1242,10 @@ void PAG_init(thread_db* tdbb)
|
|||||||
pageMgr.transPerTIP = (dbb->dbb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4;
|
pageMgr.transPerTIP = (dbb->dbb_page_size - OFFSETA(tx_inv_page*, tip_transactions)) * 4;
|
||||||
pageSpace->ppFirst = 1;
|
pageSpace->ppFirst = 1;
|
||||||
// dbb_ods_version can be 0 when a new database is being created
|
// dbb_ods_version can be 0 when a new database is being created
|
||||||
if ((dbb->dbb_ods_version == 0) || (dbb->dbb_ods_version >= ODS_VERSION12))
|
fb_assert((dbb->dbb_ods_version == 0) || (dbb->dbb_ods_version >= ODS_VERSION12));
|
||||||
{
|
pageMgr.gensPerPage =
|
||||||
pageMgr.gensPerPage =
|
(dbb->dbb_page_size -
|
||||||
(dbb->dbb_page_size -
|
OFFSETA(generator_page*, gpg_values)) / sizeof(((generator_page*) NULL)->gpg_values);
|
||||||
OFFSETA(generator_page*, gpg_values)) / sizeof(((generator_page*) NULL)->gpg_values);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fb_assert(dbb->dbb_ods_version == ODS_VERSION11);
|
|
||||||
pageMgr.gensPerPage =
|
|
||||||
(dbb->dbb_page_size -
|
|
||||||
OFFSETA(old_gen_page*, gpg_values)) / sizeof(((old_gen_page*) NULL)->gpg_values);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compute the number of data pages per pointer page. Each data page
|
// Compute the number of data pages per pointer page. Each data page
|
||||||
// requires a 32 bit pointer and a 2 bit control field.
|
// requires a 32 bit pointer and a 2 bit control field.
|
||||||
@ -2260,12 +2246,6 @@ ULONG PAG_page_count(Database* database, PageCountCallback* cb)
|
|||||||
*
|
*
|
||||||
*********************************************/
|
*********************************************/
|
||||||
fb_assert(cb);
|
fb_assert(cb);
|
||||||
const bool isODS11_x =
|
|
||||||
(database->dbb_ods_version == ODS_VERSION11 && database->dbb_minor_version >= 1) ||
|
|
||||||
database->dbb_ods_version > ODS_VERSION11;
|
|
||||||
if (!isODS11_x) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
Firebird::Array<BYTE> temp;
|
Firebird::Array<BYTE> temp;
|
||||||
page_inv_page* pip = (Ods::page_inv_page*) // can't reinterpret_cast<> here
|
page_inv_page* pip = (Ods::page_inv_page*) // can't reinterpret_cast<> here
|
||||||
|
@ -2714,13 +2714,8 @@ void VIO_store(thread_db* tdbb, record_param* rpb, jrd_tra* transaction)
|
|||||||
work = DFW_post_work(transaction, dfw_create_procedure, &desc, id, package_name);
|
work = DFW_post_work(transaction, dfw_create_procedure, &desc, id, package_name);
|
||||||
|
|
||||||
bool check_blr = true;
|
bool check_blr = true;
|
||||||
|
if (EVL_field(0, rpb->rpb_record, f_prc_valid_blr, &desc2))
|
||||||
if (ENCODE_ODS(tdbb->getDatabase()->dbb_ods_version,
|
check_blr = MOV_get_long(&desc2, 0) != 0;
|
||||||
tdbb->getDatabase()->dbb_minor_version) >= ODS_11_1)
|
|
||||||
{
|
|
||||||
if (EVL_field(0, rpb->rpb_record, f_prc_valid_blr, &desc2))
|
|
||||||
check_blr = MOV_get_long(&desc2, 0) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check_blr)
|
if (check_blr)
|
||||||
DFW_post_work_arg(transaction, work, NULL, 0, dfw_arg_check_blr);
|
DFW_post_work_arg(transaction, work, NULL, 0, dfw_arg_check_blr);
|
||||||
|
Loading…
Reference in New Issue
Block a user