Esempio n. 1
0
        private void ProcessComment(Session session, SchemaManager schemaManager)
        {
            QNameManager.QName name = (QNameManager.QName) this.Arguments[0];
            string             str  = (string)this.Arguments[1];
            int type = name.type;

            switch (type)
            {
            case 3:
            {
                Table table2 = (Table)schemaManager.GetSchemaObject(name.Name, name.schema.Name, 3);
                if (!session.GetGrantee().IsFullyAccessibleByRole(table2.GetName()))
                {
                    throw Error.GetError(0x157d);
                }
                table2.GetName().Comment = str;
                break;
            }

            case 9:
            {
                Table table = (Table)schemaManager.GetSchemaObject(name.Parent.Name, name.Parent.schema.Name, 3);
                if (!session.GetGrantee().IsFullyAccessibleByRole(table.GetName()))
                {
                    throw Error.GetError(0x157d);
                }
                int columnIndex = table.GetColumnIndex(name.Name);
                if (columnIndex < 0)
                {
                    throw Error.GetError(0x157d);
                }
                table.GetColumn(columnIndex).GetName().Comment = str;
                return;
            }

            default:
            {
                if (type != 0x12)
                {
                    break;
                }
                RoutineSchema schema = (RoutineSchema)schemaManager.GetSchemaObject(name.Name, name.schema.Name, 0x12);
                if (!session.GetGrantee().IsFullyAccessibleByRole(schema.GetName()))
                {
                    throw Error.GetError(0x157d);
                }
                schema.GetName().Comment = str;
                return;
            }
            }
        }
Esempio n. 2
0
        public void Revoke(OrderedHashSet <string> granteeList, ISchemaObject dbObject, Right rights, Grantee grantor, bool grantOption, bool cascade)
        {
            RoutineSchema schema = dbObject as RoutineSchema;

            if (schema != null)
            {
                ISchemaObject[] specificRoutines = schema.GetSpecificRoutines();
                this.Revoke(granteeList, specificRoutines, rights, grantor, grantOption, cascade);
            }
            else
            {
                QNameManager.QName specificName = dbObject.GetName();
                Routine            routine      = dbObject as Routine;
                if (routine != null)
                {
                    specificName = routine.GetSpecificName();
                }
                if (!grantor.IsFullyAccessibleByRole(specificName))
                {
                    throw Error.GetError(0x157d, dbObject.GetName().Name);
                }
                if (grantor.IsAdmin())
                {
                    grantor = dbObject.GetOwner();
                }
                for (int i = 0; i < granteeList.Size(); i++)
                {
                    string str = granteeList.Get(i);
                    if (this.Get(str) == null)
                    {
                        throw Error.GetError(0xfa1, str);
                    }
                    if (IsImmutable(str))
                    {
                        throw Error.GetError(0xfa2, str);
                    }
                }
                for (int j = 0; j < granteeList.Size(); j++)
                {
                    string  str2 = granteeList.Get(j);
                    Grantee role = this.Get(str2);
                    role.Revoke(dbObject, rights, grantor, grantOption);
                    role.UpdateAllRights();
                    if (role.IsRole)
                    {
                        this.UpdateAllRights(role);
                    }
                }
            }
        }
Esempio n. 3
0
        public void Grant(OrderedHashSet <string> granteeList, ISchemaObject dbObject, Right right, Grantee grantor, bool withGrantOption)
        {
            RoutineSchema schema = dbObject as RoutineSchema;

            if (schema != null)
            {
                ISchemaObject[] specificRoutines = schema.GetSpecificRoutines();
                this.Grant(granteeList, specificRoutines, right, grantor, withGrantOption);
            }
            else
            {
                QNameManager.QName specificName = dbObject.GetName();
                Routine            routine      = dbObject as Routine;
                if (routine != null)
                {
                    specificName = routine.GetSpecificName();
                }
                if (!grantor.IsGrantable(dbObject, right))
                {
                    throw Error.GetError(0x7d0, grantor.GetNameString());
                }
                if (grantor.IsAdmin())
                {
                    grantor = dbObject.GetOwner();
                }
                this.CheckGranteeList(granteeList);
                for (int i = 0; i < granteeList.Size(); i++)
                {
                    Grantee role = this.Get(granteeList.Get(i));
                    role.Grant(specificName, right, grantor, withGrantOption);
                    if (role.IsRole)
                    {
                        this.UpdateAllRights(role);
                    }
                }
            }
        }
Esempio n. 4
0
        public StatementDMQL CompileCallStatement(RangeVariable[] outerRanges, bool isStrictlyProcedure)
        {
            Expression[] expressionArray;
            Expression   expression2;

            base.Read();
            if (!base.IsIdentifier())
            {
                goto Label_01E4;
            }
            base.CheckValidCatalogName(base.token.NamePrePrefix);
            RoutineSchema schema = (RoutineSchema)base.database.schemaManager.FindSchemaObject(base.token.TokenString, base.session.GetSchemaName(base.token.NamePrefix), 0x11);

            if (schema == null)
            {
                goto Label_01E4;
            }
            base.Read();
            List <Expression> list = new List <Expression>();

            base.ReadThis(0x2b7);
            if (base.token.TokenType == 0x2aa)
            {
                base.Read();
                goto Label_00C7;
            }
Label_0092:
            expression2 = base.XreadValueExpression();
            list.Add(expression2);
            if (base.token.TokenType == 0x2ac)
            {
                base.Read();
                goto Label_0092;
            }
            base.ReadThis(0x2aa);
Label_00C7:
            expressionArray = list.ToArray();
            Routine specificRoutine = schema.GetSpecificRoutine(expressionArray.Length);

            base.compileContext.AddProcedureCall(specificRoutine);
            List <Expression> unresolvedSet = null;

            for (int i = 0; i < expressionArray.Length; i++)
            {
                Expression expression3 = expressionArray[i];
                if (expression3.IsUnresolvedParam())
                {
                    expression3.SetAttributesAsColumn(specificRoutine.GetParameter(i), specificRoutine.GetParameter(i).IsWriteable());
                }
                else
                {
                    int parameterMode = specificRoutine.GetParameter(i).GetParameterMode();
                    unresolvedSet = expression3.ResolveColumnReferences(outerRanges, unresolvedSet);
                    if (parameterMode != 1)
                    {
                        if (expression3.GetExprType() == 7)
                        {
                            ExpressionColumn column = (ExpressionColumn)expression3;
                            if ((column.GetParameterMode() == parameterMode) || (column.GetParameterMode() == 2))
                            {
                                goto Label_017E;
                            }
                        }
                        if (expression3.GetExprType() != 6)
                        {
                            throw Error.GetError(0x15e3);
                        }
                    }
                    Label_017E :;
                }
            }
            ExpressionColumn.CheckColumnsResolved(unresolvedSet);
            for (int j = 0; j < expressionArray.Length; j++)
            {
                expressionArray[j].ResolveTypes(base.session, null);
            }
            StatementProcedure procedure1 = new StatementProcedure(base.session, specificRoutine, expressionArray);

            procedure1.SetDatabseObjects(base.session, base.compileContext);
            procedure1.CheckAccessRights(base.session);
            return(procedure1);

Label_01E4:
            if (isStrictlyProcedure)
            {
                throw Error.GetError(0x157d, base.token.TokenString);
            }
            Expression expression = base.XreadValueExpression();

            ExpressionColumn.CheckColumnsResolved(expression.ResolveColumnReferences(outerRanges, null));
            expression.ResolveTypes(base.session, null);
            StatementProcedure procedure2 = new StatementProcedure(base.session, expression);

            procedure2.SetDatabseObjects(base.session, base.compileContext);
            procedure2.CheckAccessRights(base.session);
            return(procedure2);
        }
Esempio n. 5
0
 public FunctionSQLInvoked(int type, RoutineSchema routineSchema) : base(type)
 {
     this.routineSchema = routineSchema;
 }
Esempio n. 6
0
 public FunctionSQLInvoked(RoutineSchema routineSchema) : base(routineSchema.IsAggregate() ? 0x68 : 0x1b)
 {
     this.routineSchema = routineSchema;
 }