/// <summary>
        /// Adds all of the extended properties from an ISchemaObject's ExtendedProperties collection.
        /// </summary>
        /// <param name="dictionary"></param>
        /// <param name="schemaObject"></param>
        public static void AddRange(this Dictionary <string, object> dictionary, ISchemaObject schemaObject)
        {
            if (dictionary == null)
            {
                return;
            }
            try {
                foreach (IExtendedProperty extendedProperty in schemaObject.ExtendedProperties)
                {
                    dictionary[extendedProperty.Name] = extendedProperty.Value;
                }
            } catch (NotSupportedException) {} catch (Exception ex) {
                string message = String.Format("Unable to Add Extended Properties for '{0}'. Exception: {1}", schemaObject.Name, ex.Message);
                Trace.WriteLine(message);
                Debug.WriteLine(message);
            }

            var dataObject = schemaObject as IDataObject;

            if (dataObject != null)
            {
                dictionary["DataType"]   = (dataObject).DataType;
                dictionary["NativeType"] = (dataObject).NativeType;
            }
        }
Exemple #2
0
        public QNameManager.QName GetName(string name)
        {
            switch (this._type)
            {
            case 3:
            case 4:
            case 6:
            case 7:
            case 8:
            case 12:
            case 13:
            case 14:
            case 15:
            case 0x10:
            case 0x11:
            case 0x18:
            case 0x1b:
            {
                ISchemaObject obj2 = (ISchemaObject)this.Map.Get(name);
                if (obj2 == null)
                {
                    return(null);
                }
                return(obj2.GetName());
            }

            case 5:
            case 9:
            case 20:
                return((QNameManager.QName) this.Map.Get(name));
            }
            return((QNameManager.QName) this.Map.Get(name));
        }
Exemple #3
0
 public void Compile(Session session, ISchemaObject parentObject)
 {
     using (Scanner scanner = new Scanner(this.statement.GetSql()))
     {
         ParserRoutine routine = new ParserRoutine(session, scanner)
         {
             compileContext = { InRoutine = true }
         };
         try
         {
             routine.Read();
             routine.StartRecording();
             Statement statement = routine.CompileSQLProcedureStatementOrNull(this, null);
             string    sql       = Token.GetSql(routine.GetRecordedStatement());
             statement.SetSql(sql);
             this.SetProcedure(statement);
             statement.Resolve(session);
             this.SetReferences();
         }
         finally
         {
             routine.compileContext.InRoutine = false;
         }
     }
 }
Exemple #4
0
        public static string ToDDL(this ISchemaObject @object, DdlRules rules)
        {
            var writer = new StringWriter();

            @object.Write(rules, writer);

            return(writer.ToString());
        }
Exemple #5
0
        public static Task Create(this ISchemaObject schemaObject, NpgsqlConnection conn)
        {
            var writer = new StringWriter();

            schemaObject.WriteCreateStatement(new DdlRules(), writer);

            return(conn.CreateCommand(writer.ToString()).ExecuteNonQueryAsync());
        }
Exemple #6
0
        /// <summary>
        /// Write the creation SQL for this ISchemaObject
        /// </summary>
        /// <param name="object"></param>
        /// <param name="rules"></param>
        /// <returns></returns>
        public static string ToCreateSql(this ISchemaObject @object, DdlRules rules)
        {
            var writer = new StringWriter();

            @object.WriteCreateStatement(rules, writer);

            return(writer.ToString());
        }
        private static bool ExtendedPropertiesContainsKey(this ISchemaObject schemaObject, string key)
        {
            try {
                return(schemaObject.ExtendedProperties.Contains(key));
            } catch {}

            return(false);
        }
Exemple #8
0
 public virtual void Compile(Session session, ISchemaObject parentObject)
 {
     if (this.userTypeModifier == null)
     {
         throw Error.RuntimeError(0xc9, "Type");
     }
     this.userTypeModifier.Compile(session);
 }
        protected Task DropSchemaObjectInDatabase(ISchemaObject schemaObject)
        {
            var rules  = new DdlRules();
            var writer = new StringWriter();

            schemaObject.WriteDropStatement(rules, writer);

            return(theConnection.CreateCommand(writer.ToString())
                   .ExecuteNonQueryAsync());
        }
Exemple #10
0
        public override void Compile(Session session, ISchemaObject parentObject)
        {
            using (Scanner scanner = new Scanner(this.statement))
            {
                ParserDQL rdql = new ParserDQL(session, scanner);
                rdql.Read();
                this.ViewSubQuery    = rdql.XreadViewSubquery(this);
                base.queryExpression = this.ViewSubQuery.queryExpression;
                if (base.GetColumnCount() == 0)
                {
                    if (this.ColumnNames == null)
                    {
                        this.ColumnNames = this.ViewSubQuery.queryExpression.GetResultColumnNames();
                    }
                    if (this.ColumnNames.Length != this.ViewSubQuery.queryExpression.GetColumnCount())
                    {
                        throw Error.GetError(0x15d9, this.GetName().StatementName);
                    }
                    TableUtil.SetColumnsInSchemaTable(this, this.ColumnNames, base.queryExpression.GetColumnTypes(), base.queryExpression.GetColumnNullability());
                }
                OrderedHashSet <SubQuery> set = OrderedHashSet <SubQuery> .AddAll(OrderedHashSet <SubQuery> .Add(base.queryExpression.GetSubqueries(), this.ViewSubQuery), this.ViewSubQuery.GetExtraSubqueries());

                this.ViewSubqueries = new SubQuery[set.Size()];
                set.ToArray(this.ViewSubqueries);
                ArraySort.Sort <SubQuery>(this.ViewSubqueries, 0, this.ViewSubqueries.Length, this.ViewSubqueries[0]);
                foreach (SubQuery query in this.ViewSubqueries)
                {
                    if (query.ParentView == null)
                    {
                        query.ParentView = this;
                    }
                    query.PrepareTable(session);
                }
                this.ViewSubQuery.GetTable().view       = this;
                this.ViewSubQuery.GetTable().ColumnList = base.ColumnList;
                this._schemaObjectNames = rdql.compileContext.GetSchemaObjectNames();
                this._baseTable         = base.queryExpression.GetBaseTable();
            }
            if (this._baseTable != null)
            {
                switch (this._check)
                {
                case 0:
                case 2:
                    return;

                case 1:
                    base.queryExpression.GetCheckCondition();
                    return;
                }
                throw Error.RuntimeError(0xc9, "View");
            }
        }
Exemple #11
0
 public void Compile(Session session, ISchemaObject table)
 {
     if (this._generatingExpression != null)
     {
         this._generatingExpression.ResetColumnReferences();
         this._generatingExpression.ResolveCheckOrGenExpression(session, ((Table)table).DefaultRanges, false);
         if (base.DataType.TypeComparisonGroup != this._generatingExpression.GetDataType().TypeComparisonGroup)
         {
             throw Error.GetError(0x15b9);
         }
         this.SetReferences();
     }
 }
Exemple #12
0
        /// <summary>
        /// 获取列的默认值
        /// </summary>
        /// <param name="col"></param>
        /// <returns></returns>
        public static string getDefaultValue(ISchemaObject col)
        {
            var ext = col.ExtendedProperties["CS_Default"];

            if (ext == null)
            {
                return("");
            }
            else
            {
                return(ext.Value.ToString());
            }
        }
Exemple #13
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);
        }
Exemple #14
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);
                    }
                }
            }
        }
Exemple #15
0
        public OrderedHashSet <Right> GetAllGrantedPrivileges(ISchemaObject obj)
        {
            Iterator <Right> iterator = this._grantedRightsMap.Get(obj.GetName());

            if (iterator.HasNext())
            {
                OrderedHashSet <Right> set2 = new OrderedHashSet <Right>();
                while (iterator.HasNext())
                {
                    set2.Add(iterator.Next());
                }
                return(set2);
            }
            return(Right.EmptySetRight);
        }
Exemple #16
0
        public void Revoke(ISchemaObject obj, Right right, Grantee grantor, bool grantOption)
        {
            QNameManager.QName key     = obj.GetName();
            Routine            routine = obj as Routine;

            if (routine != null)
            {
                key = routine.GetSpecificName();
            }
            Iterator <Right> iterator = this._directRightsMap.Get(key);
            Right            right2   = null;

            while (iterator.HasNext())
            {
                right2 = iterator.Next();
                if (right2.Grantor == grantor)
                {
                    break;
                }
            }
            if (right2 != null)
            {
                if (right2.GrantableRights != null)
                {
                    right2.GrantableRights.Remove(obj, right);
                }
                if (!grantOption)
                {
                    if (right.IsFull)
                    {
                        this._directRightsMap.Remove(key, right2);
                        grantor._grantedRightsMap.Remove(key, right2);
                        this.UpdateAllRights();
                    }
                    else
                    {
                        right2.Remove(obj, right);
                        if (right2.IsEmpty())
                        {
                            this._directRightsMap.Remove(key, right2);
                            grantor._grantedRightsMap.Remove(key, right2);
                        }
                        this.UpdateAllRights();
                    }
                }
            }
        }
Exemple #17
0
 public void CheckAccess(ISchemaObject obj)
 {
     if (!this.IsFullyAccessibleByRole(obj.GetName()))
     {
         QNameManager.QName key     = obj.GetName();
         Routine            routine = obj as Routine;
         if (routine != null)
         {
             key = routine.GetSpecificName();
         }
         Right right = this._fullRightsMap.Get(key);
         if ((right == null) || right.IsEmpty())
         {
             throw Error.GetError(0x157d, obj.GetName().Name);
         }
     }
 }
        protected async Task CreateSchemaObjectInDatabase(ISchemaObject schemaObject)
        {
            var rules  = new DdlRules();
            var writer = new StringWriter();

            schemaObject.WriteCreateStatement(rules, writer);

            try
            {
                await theConnection.CreateCommand(writer.ToString())
                .ExecuteNonQueryAsync();
            }
            catch (Exception e)
            {
                throw new Exception("DDL Execution Failure.\n" + writer.ToString(), e);
            }
        }
Exemple #19
0
        public OrderedHashSet <Right> GetAllDirectPrivileges(ISchemaObject obj)
        {
            if (obj.GetOwner() == this)
            {
                OrderedHashSet <Right> set1 = new OrderedHashSet <Right>();
                set1.Add(this.OwnerRights);
                return(set1);
            }
            Iterator <Right> iterator = this._directRightsMap.Get(obj.GetName());

            if (iterator.HasNext())
            {
                OrderedHashSet <Right> set2 = new OrderedHashSet <Right>();
                while (iterator.HasNext())
                {
                    set2.Add(iterator.Next());
                }
                return(set2);
            }
            return(Right.EmptySetRight);
        }
Exemple #20
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);
        }
Exemple #21
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);
                    }
                }
            }
        }
Exemple #22
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());
                    }
                }
            }
        }
 /// <summary>
 /// 是否为自增列
 /// </summary>
 /// <param name="col"></param>
 /// <returns></returns>
 public static bool isAutoIdentity(ISchemaObject col)
 {
     return Convert.ToBoolean(col.ExtendedProperties["CS_IsIdentity"].Value.ToString());
 }
Exemple #24
0
 /// <summary>
 /// 是否为自增列
 /// </summary>
 /// <param name="col"></param>
 /// <returns></returns>
 public static bool isAutoIdentity(ISchemaObject col)
 {
     return(Convert.ToBoolean(col.ExtendedProperties["CS_IsIdentity"].Value.ToString()));
 }
Exemple #25
0
 /// <summary>
 /// 获取注释说明
 /// </summary>
 /// <returns></returns>
 public static string GetComment(ISchemaObject col, string cut)
 {
     return(string.IsNullOrEmpty(col.Description) ? DbUtil.GetColumnName(col.Name, cut) : col.Description);
 }
Exemple #26
0
        public static async Task ApplyChanges(this ISchemaObject schemaObject, NpgsqlConnection conn)
        {
            var migration = await SchemaMigration.Determine(conn, new ISchemaObject[] { schemaObject });

            await migration.ApplyAll(conn, new DdlRules(), AutoCreate.CreateOrUpdate);
        }
Exemple #27
0
 public void Compile(Session session, ISchemaObject parentObject)
 {
 }
Exemple #28
0
 public bool IsGrantable(ISchemaObject obj, Right right)
 {
     return(this.IsFullyAccessibleByRole(obj.GetName()) || this.GetAllGrantableRights(obj.GetName()).Contains(right));
 }
Exemple #29
0
 public bool IsAccessible(ISchemaObject obj)
 {
     return(this.IsAccessible(obj.GetName()));
 }
Exemple #30
0
        public List <string> GetRightsSQL()
        {
            List <string> list = new List <string>();
            string        directRolesAsString = this.GetDirectRolesAsString();

            if (directRolesAsString.Length != 0)
            {
                StringBuilder builder = new StringBuilder(0x80);
                builder.Append("GRANT").Append(' ').Append(directRolesAsString);
                builder.Append(' ').Append("TO").Append(' ');
                builder.Append(this.GetStatementName());
                list.Add(builder.ToString());
            }
            MultiValueHashMap <QNameManager.QName, Right> rights = this.GetRights();
            Iterator <QNameManager.QName> iterator = rights.GetKeySet().GetIterator();

            while (iterator.HasNext())
            {
                QNameManager.QName key       = iterator.Next();
                Iterator <Right>   iterator2 = rights.Get(key);
                while (iterator2.HasNext())
                {
                    Right              right    = iterator2.Next();
                    StringBuilder      builder2 = new StringBuilder(0x80);
                    QNameManager.QName name2    = key;
                    switch (name2.type)
                    {
                    case 3:
                    case 4:
                    {
                        Table table = this.granteeManager.database.schemaManager.FindUserTable(null, name2.Name, name2.schema.Name);
                        if (table != null)
                        {
                            builder2.Append("GRANT").Append(' ');
                            builder2.Append(right.GetTableRightsSQL(table));
                            builder2.Append(' ').Append("ON").Append(' ');
                            builder2.Append("TABLE").Append(' ');
                            builder2.Append(name2.GetSchemaQualifiedStatementName());
                        }
                        break;
                    }

                    case 7:
                        if (((NumberSequence)this.granteeManager.database.schemaManager.FindSchemaObject(name2.Name, name2.schema.Name, 7)) != null)
                        {
                            builder2.Append("GRANT").Append(' ');
                            builder2.Append("USAGE");
                            builder2.Append(' ').Append("ON").Append(' ');
                            builder2.Append("SEQUENCE").Append(' ');
                            builder2.Append(name2.GetSchemaQualifiedStatementName());
                        }
                        break;

                    case 12:
                        if (((SqlType)this.granteeManager.database.schemaManager.FindSchemaObject(name2.Name, name2.schema.Name, 13)) != null)
                        {
                            builder2.Append("GRANT").Append(' ');
                            builder2.Append("USAGE");
                            builder2.Append(' ').Append("ON").Append(' ');
                            builder2.Append("TYPE").Append(' ');
                            builder2.Append(name2.GetSchemaQualifiedStatementName());
                        }
                        break;

                    case 13:
                        if (((SqlType)this.granteeManager.database.schemaManager.FindSchemaObject(name2.Name, name2.schema.Name, 13)) != null)
                        {
                            builder2.Append("GRANT").Append(' ');
                            builder2.Append("USAGE");
                            builder2.Append(' ').Append("ON").Append(' ');
                            builder2.Append("DOMAIN").Append(' ');
                            builder2.Append(name2.GetSchemaQualifiedStatementName());
                        }
                        break;

                    case 0x10:
                    case 0x11:
                    case 0x18:
                    case 0x1b:
                    {
                        ISchemaObject obj2 = this.granteeManager.database.schemaManager.FindSchemaObject(name2.Name, name2.schema.Name, name2.type);
                        if (obj2 != null)
                        {
                            builder2.Append("GRANT").Append(' ');
                            builder2.Append("EXECUTE").Append(' ');
                            builder2.Append("ON").Append(' ');
                            builder2.Append("SPECIFIC").Append(' ');
                            if (obj2.GetSchemaObjectType() == 0x11)
                            {
                                builder2.Append("PROCEDURE");
                            }
                            else if (obj2.GetSchemaObjectType() == 0x1b)
                            {
                                builder2.Append("AGGREGATE");
                            }
                            else
                            {
                                builder2.Append("FUNCTION");
                            }
                            builder2.Append(' ');
                            builder2.Append(name2.GetSchemaQualifiedStatementName());
                        }
                        break;
                    }
                    }
                    if (builder2.Length != 0)
                    {
                        builder2.Append(' ').Append("TO").Append(' ');
                        builder2.Append(this.GetStatementName());
                        list.Add(builder2.ToString());
                    }
                }
            }
            return(list);
        }
 /// <summary>
 /// 获取列的默认值
 /// </summary>
 /// <param name="col"></param>
 /// <returns></returns>
 public static string getDefaultValue(ISchemaObject col)
 {
     var ext = col.ExtendedProperties["CS_Default"];
     if(ext == null)
         return "";
     else
         return ext.Value.ToString();
 }
Exemple #32
0
 public string GetSql()
 {
     ExpressionColumn column = this._expression as ExpressionColumn;
     if (column != null)
     {
         if (this.TokenType == 0x2a9)
         {
             StringBuilder builder = new StringBuilder();
             if (((column == null) || (column.OpType != 0x61)) || (column.nodes.Length == 0))
             {
                 return this.TokenString;
             }
             builder.Append(' ');
             for (int i = 0; i < column.nodes.Length; i++)
             {
                 Expression expression = column.nodes[i];
                 ColumnSchema schema = expression.GetColumn();
                 if (expression.OpType == 3)
                 {
                     if (i > 0)
                     {
                         builder.Append(',');
                     }
                     builder.Append(expression.GetColumnName());
                 }
                 else
                 {
                     string schemaQualifiedStatementName;
                     if (expression.GetRangeVariable().TableAlias == null)
                     {
                         schemaQualifiedStatementName = schema.GetName().GetSchemaQualifiedStatementName();
                     }
                     else
                     {
                         schemaQualifiedStatementName = expression.GetRangeVariable().TableAlias.GetStatementName() + "." + schema.GetName().StatementName;
                     }
                     if (i > 0)
                     {
                         builder.Append(',');
                     }
                     builder.Append(schemaQualifiedStatementName);
                 }
             }
             builder.Append(' ');
             return builder.ToString();
         }
     }
     else
     {
         SqlType type = this._expression as SqlType;
         if (type != null)
         {
             this.IsDelimiter = false;
             if (!type.IsDistinctType() && !type.IsDomainType())
             {
                 return type.GetNameString();
             }
             return type.GetName().GetSchemaQualifiedStatementName();
         }
         ISchemaObject obj2 = this._expression as ISchemaObject;
         if (obj2 != null)
         {
             this.IsDelimiter = false;
             return obj2.GetName().GetSchemaQualifiedStatementName();
         }
     }
     if ((this.NamePrefix == null) && this.IsUndelimitedIdentifier)
     {
         return this.TokenString;
     }
     if (this.TokenType == 0x2e9)
     {
         return this.DataType.ConvertToSQLString(this.TokenValue);
     }
     StringBuilder builder2 = new StringBuilder();
     if (this.NamePrePrefix != null)
     {
         if (this.IsDelimitedPrePrefix)
         {
             builder2.Append('"');
             builder2.Append(this.NamePrePrefix);
             builder2.Append('"');
         }
         else
         {
             builder2.Append(this.NamePrePrefix);
             this.IsDelimiter = false;
         }
         builder2.Append('.');
     }
     if (this.NamePrefix != null)
     {
         if (this.IsDelimitedPrefix)
         {
             builder2.Append('"');
             builder2.Append(this.NamePrefix);
             builder2.Append('"');
         }
         else
         {
             builder2.Append(this.NamePrefix);
             this.IsDelimiter = false;
         }
         builder2.Append('.');
     }
     if (this.IsDelimitedIdentifier)
     {
         builder2.Append('"');
         builder2.Append(this.TokenString);
         builder2.Append('"');
         builder2.Append(' ');
     }
     else
     {
         builder2.Append(this.TokenString);
     }
     return builder2.ToString();
 }
 /// <summary>
 /// 获取注释说明
 /// </summary>
 /// <returns></returns>
 public static string GetComment(ISchemaObject col, string cut)
 {
     return string.IsNullOrEmpty(col.Description) ? DbUtil.GetColumnName(col.Name, cut) : col.Description;
 }