8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 01:23:03 +01:00
This commit is contained in:
Adriano dos Santos Fernandes 2016-05-26 14:59:03 -03:00
parent 721a168477
commit fbba8ad798
6 changed files with 129 additions and 126 deletions

View File

@ -642,7 +642,7 @@ void Jrd::ProtectRelations::relLock::releaseLock(thread_db* tdbb, jrd_tra* trans
if (*lock == m_lock)
{
LCK_release(tdbb, m_lock);
*lock = 0;
*lock = NULL;
break;
}
}
@ -2669,7 +2669,7 @@ static bool create_expression_index(thread_db* tdbb, SSHORT phase, DeferredWork*
if (IDX.RDB$INDEX_TYPE == 1)
idx.idx_flags |= idx_descending;
CompilerScratch* csb = 0;
CompilerScratch* csb = NULL;
// allocate a new pool to contain the expression tree for the expression index
new_pool = attachment->createPool();
{ // scope
@ -3454,7 +3454,7 @@ static bool create_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
Arg::Gds(isc_partner_idx_incompat_type) << Arg::Num(bad_segment + 1));
}
/* hvlad: this code was never called but i preserve it for Claudio review and decision
/*** hvlad: this code was never called but i preserve it for Claudio review and decision
// CVC: Currently, the server doesn't enforce FK creation more than at DYN level.
// If DYN is bypassed, then FK creation succeeds and operation will fail at run-time.
@ -3474,7 +3474,7 @@ static bool create_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
SCL_check_index(tdbb, partner_relation->rel_name,
idx.idx_id + 1, SCL_references);
}
*/
***/
}
protectRelations.lock();
@ -3494,7 +3494,8 @@ static bool create_index(thread_db* tdbb, SSHORT phase, DeferredWork* work, jrd_
LCK_lock(tdbb, relation->rel_partners_lock, LCK_EX, LCK_WAIT);
LCK_release(tdbb, relation->rel_partners_lock);
if (relation != partner_relation) {
if (relation != partner_relation)
{
partner_relation->rel_flags |= REL_check_partners;
LCK_lock(tdbb, partner_relation->rel_partners_lock, LCK_EX, LCK_WAIT);
LCK_release(tdbb, partner_relation->rel_partners_lock);

View File

@ -775,7 +775,7 @@ void Trigger::compile(thread_db* tdbb)
if (extTrigger)
return;
if (!statement /*&& !compile_in_progress*/)
if (!statement)
{
compile_in_progress = true;
// Allocate statement memory pool

View File

@ -1036,6 +1036,7 @@ bool SCL_role_granted(thread_db* tdbb, const UserId& usr, const TEXT* sql_role)
}
// TODO: Remove recursion. See dfw.epp/check_computed_dependencies as a model.
void SCL_find_granted_roles(thread_db* tdbb, const Firebird::MetaName& object, bool isRole,
Firebird::SortedArray<Firebird::MetaName>& grantedRoles, bool defaultOnly)
{
@ -1089,8 +1090,8 @@ bool SCL_admin_role(thread_db* tdbb, const Firebird::SortedArray<Firebird::MetaN
AutoCacheRequest request(tdbb, irq_is_admin_role, IRQ_REQUESTS);
FOR(REQUEST_HANDLE request) R IN RDB$ROLES
WITH R.RDB$ROLE_NAME EQ roles[i].c_str()
AND R.RDB$SYSTEM_FLAG != 0
WITH R.RDB$ROLE_NAME EQ roles[i].c_str() AND
R.RDB$SYSTEM_FLAG != 0
{
adminRole = true;
break;
@ -1171,6 +1172,7 @@ void SCL_init(thread_db* tdbb, bool create, const UserId& tempId)
user->usr_granted_roles.add(user->usr_sql_role_name);
SCL_find_granted_roles(tdbb, user->usr_sql_role_name, true, user->usr_granted_roles, false);
}
// Add all default roles granted to user
SCL_find_granted_roles(tdbb, user->usr_user_name, false, user->usr_granted_roles, true);