Example #1
0
 private void ClearStructures()
 {
     if (this.schemaManager != null)
     {
         this.schemaManager.ClearStructures();
     }
     this.granteeManager = null;
     this.userManager    = null;
     this.NameManager    = null;
     this.schemaManager  = null;
     this.DbInfo         = null;
 }
Example #2
0
 private void Reopen()
 {
     this.SetState(4);
     try
     {
         this.NameManager               = new QNameManager(this);
         this.granteeManager            = new GranteeManager(this);
         this.userManager               = new UserManager(this);
         this.schemaManager             = new SchemaManager(this);
         this.persistentStoreCollection = new PersistentStoreCollectionDatabase();
         this._isReferentialIntegrity   = true;
         this.sessionManager            = new SessionManager(this);
         this.collation = Collation.GetDefaultInstance();
         this.DbInfo    = DatabaseInformation.NewDatabaseInformation(this);
         this.TxManager = new TransactionManagerMvcc(this);
         this.lobManager.CreateSchema();
         this.sessionManager.GetSysLobSession().SetSchema("SYSTEM_LOBS");
         this.schemaManager.SetSchemaChangeTimestamp();
         this.logger.OpenPersistence();
         if (this.logger.IsNewDatabase)
         {
             string property = this.UrlProperties.GetProperty("user", "SA");
             string password = this.UrlProperties.GetProperty("password", "");
             this.userManager.CreateFirstUser(property, password);
             this.schemaManager.CreatePublicSchema();
             this.lobManager.InitialiseLobSpace();
             this.logger.Checkpoint(false);
         }
         this.lobManager.Open();
         this.DbInfo.SetWithContent(true);
     }
     catch (Exception error)
     {
         this.logger.ClosePersistence(-1);
         this.logger.ReleaseLock();
         this.SetState(0x10);
         this.ClearStructures();
         DatabaseManager.RemoveDatabase(this);
         if (!(error is CoreException))
         {
             error = Error.GetError(0x1ca, error);
         }
         this.logger.LogSevereEvent(FwNs.Core.LC.cResources.SR.Database_Reopen_could_not_reopen_database, error);
         throw;
     }
     this.SetState(1);
 }
Example #3
0
        private void ProcessGrantRevokeRole(Session session)
        {
            bool grant = base.type == 0x31;
            OrderedHashSet <string> granteeList = (OrderedHashSet <string>) this.Arguments[0];
            OrderedHashSet <string> roleList    = (OrderedHashSet <string>) this.Arguments[1];
            Grantee        grantor        = (Grantee)this.Arguments[2];
            GranteeManager granteeManager = session.database.granteeManager;

            granteeManager.CheckGranteeList(granteeList);
            for (int i = 0; i < granteeList.Size(); i++)
            {
                string granteeName = granteeList.Get(i);
                granteeManager.CheckRoleList(granteeName, roleList, grantor, grant);
            }
            if (grant)
            {
                for (int j = 0; j < granteeList.Size(); j++)
                {
                    string granteeName = granteeList.Get(j);
                    for (int k = 0; k < roleList.Size(); k++)
                    {
                        string roleName = roleList.Get(k);
                        granteeManager.Grant(granteeName, roleName, grantor);
                    }
                }
            }
            else
            {
                for (int j = 0; j < granteeList.Size(); j++)
                {
                    string granteeName = granteeList.Get(j);
                    for (int k = 0; k < roleList.Size(); k++)
                    {
                        granteeManager.Revoke(granteeName, roleList.Get(k), grantor);
                    }
                }
            }
        }