Exemple #1
0
 private void Assign(QueryResultInfo source)
 {
     foreach(var item in source.Columns)
     {
         Columns.Add(item.Clone());
     }
 }
 private void Assign(QueryResultInfo source)
 {
     foreach (var item in source.Columns)
     {
         Columns.Add(item.Clone());
     }
 }
        public static QueryResultInfo SchemaTableToInfo(DataTable schemaTable)
        {
            var res = new QueryResultInfo();
            foreach (DataRow row in schemaTable.Rows.SortedByKey<DataRow, int>(row => Int32.Parse(row["ColumnOrdinal"].ToString())))
            {
                var col = new QueryResultColumnInfo();
                int size = row.SafeString("ColumnSize").SafeIntParse();
                col.Name = row.SafeString("ColumnName");
                col.NotNull = !(bool)row["AllowDBNull"];
                col.DataType = row["DataTypeName"].SafeToString();
                col.Size = size;
                col.CommonType = ReaderDataType(row);

                col.BaseColumnName = row.SafeString("BaseColumnName");
                col.BaseSchemaName = row.SafeString("BaseSchemaName");
                col.BaseTableName = row .SafeString("BaseTableName");
                col.BaseServerName = row.SafeString("BaseServerName");
                col.BaseCatalogName = row.SafeString("BaseCatalogName");
                if (row.SafeBool("IsAutoIncrement", false))
                {
                    col.CommonType.SetAutoincrement(true);
                    col.AutoIncrement = true;
                }
                if (row.SafeBool("IsKey", false)) col.IsKey = true;
                if (row.SafeBool("IsHidden", false)) col.IsHidden = true;
                if (row.SafeBool("IsReadOnly", false)) col.IsReadOnly = true;
                if (row.SafeBool("IsAliased", false)) col.IsAliased = true;
                res.Columns.Add(col);
            }
            return res;
        }
        public QueryResultInfo Clone()
        {
            var res = new QueryResultInfo();

            res.Assign(this);
            return(res);
        }
Exemple #5
0
 public QueryResultInfo Clone()
 {
     var res = new QueryResultInfo();
     res.Assign(this);
     return res;
 }