Exemplo n.º 1
0
 public void CheckAdd(QNameManager.QName name)
 {
     if (this.Map.ContainsKey(name.Name))
     {
         throw Error.GetError(GetAddErrorCode(name.type), name.Name);
     }
 }
Exemplo n.º 2
0
        public static string GetSetSchemaSql(QNameManager.QName schemaName)
        {
            StringBuilder builder1 = new StringBuilder();

            builder1.Append("SET").Append(' ');
            builder1.Append("SCHEMA").Append(' ');
            builder1.Append(schemaName.StatementName);
            return(builder1.ToString());
        }
Exemplo n.º 3
0
        public void Rename(QNameManager.QName name, QNameManager.QName newName)
        {
            if (this.Map.ContainsKey(newName.Name))
            {
                throw Error.GetError(GetAddErrorCode(name.type), newName.Name);
            }
            switch (newName.type)
            {
            case 3:
            case 4:
            case 6:
            case 7:
            case 8:
            case 12:
            case 13:
            case 14:
            case 15:
            case 0x10:
            case 0x11:
            case 0x1b:
            {
                int index = ((HashMappedList <string, object>) this.Map).GetIndex(name.Name);
                if (index == -1)
                {
                    throw Error.GetError(GetGetErrorCode(name.type), name.Name);
                }
                ((ISchemaObject)((HashMappedList <string, object>) this.Map).Get(index)).GetName().Rename(newName);
                ((HashMappedList <string, object>) this.Map).SetKey(index, name.Name);
                return;
            }

            case 5:
            case 9:
            case 20:
                this.Map.Remove(name.Name);
                name.Rename(newName);
                this.Map.Put(name.Name, name);
                break;

            case 10:
            case 11:
            case 0x12:
            case 0x13:
            case 0x15:
            case 0x16:
            case 0x17:
            case 0x18:
            case 0x19:
            case 0x1a:
                break;

            default:
                return;
            }
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 public void Reset(NumberSequence other)
 {
     lock (this)
     {
         this._name       = other._name;
         this._startValue = other._startValue;
         this._currValue  = other._currValue;
         this._lastValue  = other._lastValue;
         this._increment  = other._increment;
         this._dataType   = other._dataType;
         this._minValue   = other._minValue;
         this._maxValue   = other._maxValue;
         this._isCycle    = other._isCycle;
         this._isAlways   = other._isAlways;
     }
 }
Exemplo n.º 6
0
 public void AddSpecificRoutine(Database database, Routine routine)
 {
     SqlType[] parameterTypes = routine.GetParameterTypes();
     for (int i = 0; i < this.Routines.Length; i++)
     {
         if (this.Routines[i].ParameterTypes.Length != parameterTypes.Length)
         {
             continue;
         }
         if (this._routineType == 0x11)
         {
             throw Error.GetError(0x15e5);
         }
         if (this.Routines[i].IsAggregate() != routine.IsAggregate())
         {
             throw Error.GetError(0x15e5);
         }
         bool flag = true;
         for (int j = 0; j < parameterTypes.Length; j++)
         {
             if (!this.Routines[i].ParameterTypes[j].Equals(parameterTypes[j]))
             {
                 flag = false;
                 break;
             }
         }
         if (flag)
         {
             throw Error.GetError(0x15e5);
         }
     }
     if (routine.GetSpecificName() == null)
     {
         QNameManager.QName name = database.NameManager.NewSpecificRoutineName(this._name);
         routine.SetSpecificName(name);
     }
     else
     {
         routine.GetSpecificName().Parent = this._name;
         routine.GetSpecificName().schema = this._name.schema;
     }
     routine.SetName(this._name);
     routine.routineSchema = this;
     this.Routines         = ArrayUtil.ResizeArray <Routine>(this.Routines, this.Routines.Length + 1);
     this.Routines[this.Routines.Length - 1] = routine;
 }
Exemplo n.º 7
0
        public void SetDefaults(QNameManager.QName name, SqlType type)
        {
            long num2;
            long num3;

            this._name     = name;
            this._dataType = type;
            switch (this._dataType.TypeCode)
            {
            case 2:
            case 3:
                if (type.Scale != 0)
                {
                    break;
                }
                num2 = 0x7fffffffffffffffL;
                num3 = -9223372036854775808L;
                goto Label_00A7;

            case 4:
                num2 = 0x7fffffffL;
                num3 = -2147483648L;
                goto Label_00A7;

            case 5:
                num2 = 0x7fffL;
                num3 = -32768L;
                goto Label_00A7;

            case -6:
                num2 = 0xffL;
                num3 = 0L;
                goto Label_00A7;

            case 0x19:
                num2 = 0x7fffffffffffffffL;
                num3 = -9223372036854775808L;
                goto Label_00A7;
            }
            throw Error.GetError(0x15bb);
Label_00A7:
            this._minValue  = num3;
            this._maxValue  = num2;
            this._increment = 1L;
        }
Exemplo n.º 8
0
        public void RemoveParent(QNameManager.QName parent)
        {
            Iterator <object> iterator = this.Map.GetValues().GetIterator();

            while (iterator.HasNext())
            {
                if ((this._type == 8) || (this._type == 0x18))
                {
                    if (((ISchemaObject)iterator.Next()).GetName().Parent == parent)
                    {
                        iterator.Remove();
                    }
                }
                else if (((QNameManager.QName)iterator.Next()).Parent == parent)
                {
                    iterator.Remove();
                }
            }
        }
Exemplo n.º 9
0
 public Schema(QNameManager.QName name, Grantee owner)
 {
     this.Name                  = name;
     this.TriggerLookup         = new SchemaObjectSet(8);
     this.IndexLookup           = new SchemaObjectSet(20);
     this.ConstraintLookup      = new SchemaObjectSet(5);
     this.TableLookup           = new SchemaObjectSet(3);
     this.SequenceLookup        = new SchemaObjectSet(7);
     this.TypeLookup            = new SchemaObjectSet(12);
     this.CharsetLookup         = new SchemaObjectSet(14);
     this.CollationLookup       = new SchemaObjectSet(15);
     this.ProcedureLookup       = new SchemaObjectSet(0x11);
     this.FunctionLookup        = new SchemaObjectSet(0x10);
     this.AggregateLookup       = new SchemaObjectSet(0x1b);
     this.SpecificRoutineLookup = new SchemaObjectSet(0x18);
     this.AssertionLookup       = new SchemaObjectSet(6);
     this.TableList             = (HashMappedList <string, object>) this.TableLookup.Map;
     this.SequenceList          = (HashMappedList <string, object>) this.SequenceLookup.Map;
     this.Owner                 = owner;
     name.Owner                 = owner;
 }
Exemplo n.º 10
0
        public void Add(ISchemaObject obj)
        {
            QNameManager.QName specificName = obj.GetName();
            if (this._type == 0x18)
            {
                specificName = ((Routine)obj).GetSpecificName();
            }
            if (this.Map.ContainsKey(specificName.Name))
            {
                throw Error.GetError(GetAddErrorCode(specificName.type), specificName.Name);
            }
            object obj2 = obj;

            switch (specificName.type)
            {
            case 5:
            case 9:
            case 20:
                obj2 = specificName;
                break;
            }
            this.Map.Put(specificName.Name, obj2);
        }
Exemplo n.º 11
0
        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());
                    }
                }
            }
        }
Exemplo n.º 12
0
 public RoutineSchema(int type, QNameManager.QName name)
 {
     this._routineType = type;
     this._name        = name;
 }
Exemplo n.º 13
0
 public NumberSequence(QNameManager.QName name, long value, long increment, SqlType type) : this(name, type)
 {
     this.SetStartValue(value);
     this.SetIncrement(increment);
 }
Exemplo n.º 14
0
 public NumberSequence(QNameManager.QName name, SqlType type)
 {
     this.SetDefaults(name, type);
 }