コード例 #1
0
            public string GetSchemaQualifiedStatementName()
            {
                if (this.type == 9)
                {
                    if ((this.Parent == null) || "SYSTEM_SUBQUERY".Equals(this.Parent.Name))
                    {
                        return(this.StatementName);
                    }
                    StringBuilder builder = new StringBuilder();
                    if ((this.schema != null) && !SqlInvariants.IsSystemSchemaName(this.schema))
                    {
                        builder.Append(this.schema.GetStatementName());
                        builder.Append('.');
                    }
                    builder.Append(this.Parent.GetStatementName());
                    builder.Append('.');
                    builder.Append(this.StatementName);
                    return(builder.ToString());
                }
                if ((this.schema == null) || (this.schema == SqlInvariants.ModuleQname))
                {
                    return(this.StatementName);
                }
                StringBuilder builder1 = new StringBuilder();

                builder1.Append(this.schema.GetStatementName());
                builder1.Append('.');
                builder1.Append(this.StatementName);
                return(builder1.ToString());
            }
コード例 #2
0
ファイル: SchemaObjectSet.cs プロジェクト: cwdotson/FwNs
        private static bool IsChildObjectResolved(ISchemaObject obj, OrderedHashSet <object> resolved)
        {
            OrderedHashSet <QNameManager.QName> references = obj.GetReferences();

            for (int i = 0; i < references.Size(); i++)
            {
                QNameManager.QName name = references.Get(i);
                if (!SqlInvariants.IsSystemSchemaName(name) && !resolved.Contains(name))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #3
0
 public static void CheckSchemaUpdateAuthorisation(Session session, QNameManager.QName schema)
 {
     if (!session.IsProcessingLog())
     {
         if (SqlInvariants.IsSystemSchemaName(schema.Name))
         {
             throw Error.GetError(0x157f);
         }
         if (session.Parser.IsSchemaDefinition)
         {
             if (schema == session.GetCurrentSchemaQName())
             {
                 return;
             }
             Error.GetError(0x1581, schema.Name);
         }
         session.GetGrantee().CheckSchemaUpdateOrGrantRights(schema.Name);
         session.CheckDdlWrite();
     }
 }
コード例 #4
0
ファイル: SchemaObjectSet.cs プロジェクト: cwdotson/FwNs
        public static void AddAllSql(OrderedHashSet <object> resolved, OrderedHashSet <object> unresolved, List <string> list, Iterator <object> it, OrderedHashSet <object> newResolved)
        {
            while (it.HasNext())
            {
                ISchemaObject key = (ISchemaObject)it.Next();
                OrderedHashSet <QNameManager.QName> references = key.GetReferences();
                bool flag = true;
                for (int i = 0; i < references.Size(); i++)
                {
                    QNameManager.QName name = references.Get(i);
                    if (SqlInvariants.IsSystemSchemaName(name) || (name.schema == SqlInvariants.ModuleQname))
                    {
                        continue;
                    }
                    int type = name.type;
                    switch (type)
                    {
                    case 3:
                    {
                        if (!resolved.Contains(name))
                        {
                            flag = false;
                        }
                        continue;
                    }

                    case 4:
                    case 6:
                    case 7:
                    case 8:
                    case 10:
                    case 11:
                    case 15:
                    {
                        continue;
                    }

                    case 5:
                    {
                        if (name.Parent == key.GetName())
                        {
                            Constraint constraint = ((Table)key).GetConstraint(name.Name);
                            if ((constraint.GetConstraintType() == 3) && !IsChildObjectResolved(constraint, resolved))
                            {
                                flag = false;
                            }
                        }
                        continue;
                    }

                    case 9:
                    {
                        if (key.GetSchemaObjectType() != 3)
                        {
                            break;
                        }
                        Table table1 = (Table)key;
                        if (!IsChildObjectResolved(table1.GetColumn(table1.FindColumn(name.Name)), resolved))
                        {
                            flag = false;
                        }
                        continue;
                    }

                    case 12:
                    case 13:
                    case 0x10:
                    case 0x11:
                        goto Label_0147;

                    case 14:
                    {
                        if (name.schema != null)
                        {
                            goto Label_0147;
                        }
                        continue;
                    }

                    default:
                        goto Label_013B;
                    }
                    if (!resolved.Contains(name.Parent))
                    {
                        flag = false;
                    }
                    continue;
Label_013B:
                    if ((type != 0x18) && (type != 0x1b))
                    {
                        continue;
                    }
Label_0147:
                    if (!resolved.Contains(name))
                    {
                        flag = false;
                    }
                }
                if (!flag)
                {
                    unresolved.Add(key);
                }
                else
                {
                    QNameManager.QName specificName;
                    if (((key.GetSchemaObjectType() == 0x10) || (key.GetSchemaObjectType() == 0x1b)) || (key.GetSchemaObjectType() == 0x11))
                    {
                        specificName = ((Routine)key).GetSpecificName();
                    }
                    else
                    {
                        specificName = key.GetName();
                    }
                    resolved.Add(specificName);
                    if (newResolved != null)
                    {
                        newResolved.Add(key);
                    }
                    if (key.GetSchemaObjectType() == 3)
                    {
                        list.AddRange(((Table)key).GetSql(resolved, unresolved));
                    }
                    else
                    {
                        if (((key.GetSchemaObjectType() - 0x10) <= 1) && ((Routine)key).IsRecursive)
                        {
                            list.Add(((Routine)key).GetSqlDeclaration());
                            list.Add(((Routine)key).GetSqlAlter());
                            continue;
                        }
                        list.Add(key.GetSql());
                    }
                }
            }
        }