Ejemplo n.º 1
0
        protected FunctionMeta BuildFunction(SQLUserDefinedFunction udfDef, ref ArrayList grantList, ref ArrayList denyList)
        {
            if (ValidateVersion(udfDef) == DDLActionEnum.NONE)  // not in range!
            {
                return(null);
            }

            // Always treated as rebuild or create...
            //			FunctionMeta funcTmp = new FunctionMeta( udfDef.FunctionName, udfDef.ReturnValue.ToString() );
            FunctionMeta funcTmp = new FunctionMeta(udfDef.FunctionName, DataTypeEnum.NUMERIC, _context);

            //funcTmp.DDLBodyText = udfDef..ToString();
            foreach (SQLStoredProcedureParameter param in udfDef.Parameters)
            {
                ParameterMeta pramMeta = new ParameterMeta(param.Name, param.DataType, param.ParameterDirection, _dtMap);
                pramMeta.DataType.StringLength = param.StringLength;

                funcTmp.GetParameterList().Add(pramMeta);
            }

            SQLRoleAssignmentCollection roles = udfDef.Roles;

            foreach (SQLRoleAssignment roleAssign in roles)
            {
                GranteeMeta roleGrantee = new GranteeMeta(udfDef.FunctionName);
                roleGrantee.GranteeList.Add(roleAssign.RoleName);
                roleGrantee.ObjPermissions.Add(roleAssign.GrantAssignments);
                grantList.Add(roleGrantee);

                GranteeMeta roleDenied = new GranteeMeta(udfDef.FunctionName);
                roleDenied.GranteeList.Add(roleAssign.RoleName);
                roleDenied.ObjPermissions.Add(roleAssign.DenyAssignments);
                denyList.Add(roleDenied);
            }

            return(funcTmp);
        }
Ejemplo n.º 2
0
        protected StoredProcMeta BuildStoredProc(SQLStoredProcedure spDef, ref ArrayList grantList, ref ArrayList denyList)
        {
            if (ValidateVersion(spDef) == DDLActionEnum.NONE)   // not in range!
            {
                return(null);
            }

            // Always treated as rebuild or create...
            StoredProcMeta spTmp = new StoredProcMeta(spDef.ProcName, _context);

            spTmp.DDLBodyText = spDef.ProcedureText.ToString();
            foreach (SQLStoredProcedureParameter param in spDef.Parameters)
            {
                ParameterMeta pramMeta = new ParameterMeta(param.Name, param.DataType, param.ParameterDirection, _dtMap);
                pramMeta.DataType.StringLength = param.StringLength;

                spTmp.GetParameterList().Add(pramMeta);
            }

            SQLRoleAssignmentCollection roles = spDef.Roles;

            foreach (SQLRoleAssignment roleAssign in roles)
            {
                GranteeMeta roleGrantee = new GranteeMeta(spDef.ProcName);
                roleGrantee.GranteeList.Add(roleAssign.RoleName);
                roleGrantee.ObjPermissions.Add(roleAssign.GrantAssignments);
                grantList.Add(roleGrantee);

                GranteeMeta roleDenied = new GranteeMeta(spDef.ProcName);
                roleDenied.GranteeList.Add(roleAssign.RoleName);
                roleDenied.ObjPermissions.Add(roleAssign.DenyAssignments);
                denyList.Add(roleDenied);
            }

            return(spTmp);
        }