Beispiel #1
0
        Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema)
        {
            var  dbType = (DbType)dataColumnSchema.ProviderType;
            Type type;

            switch (dbType)
            {
            case DbType.DateTime:
                type = typeof(DateTime);
                break;

            case DbType.String:
                type = typeof(string);
                break;

            case DbType.Int32:
                type = typeof(int);
                break;

            default:
                type = typeof(object);
                break;
            }

            return(type);
        }
        Type IProvider.GetColumnType(FoundationDbColumn column)
        {
            var  oracleDbType = (OracleDbType)column.ProviderType;
            Type type;

            switch (oracleDbType)
            {
            case OracleDbType.Int16:
                type = typeof(short);
                break;

            case OracleDbType.Int32:
                type = typeof(int);
                break;

            case OracleDbType.Decimal:
                type = typeof(object);
                break;

            case OracleDbType.Date:
                type = typeof(object);
                break;

            case OracleDbType.Char:
            case OracleDbType.Varchar2:
                type = typeof(string);
                break;

            default:
                type = typeof(object);
                break;
            }

            return(type);
        }
        Type IProvider.GetColumnType(FoundationDbColumn column)
        {
            var oracleType = (OracleType)column.ProviderType;
            var type       = column.DataType;

            return(type);
        }
Beispiel #4
0
 Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema)
 {
     // 11   INT     int
     // 12	BIGINT	long
     // 16	TEXT	string
     return(typeof(object));
 }
        Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema)
        {
            // TODO

            //var dbType = (MySqlDbType)dataColumnSchema.ProviderType;
            //int columnSize = dataColumnSchema.ColumnSize;
            //Type type;

            return(typeof(object));
        }
Beispiel #6
0
        Type IProvider.GetColumnType(FoundationDbColumn column)
        {
            var  dbType     = (SqlDbType)column.ProviderType;
            var  columnSize = column.ColumnSize;
            Type type;

            switch (dbType)
            {
            case SqlDbType.BigInt:
                type = typeof(long);
                break;

            case SqlDbType.Bit:
                type = typeof(bool);
                break;

            case SqlDbType.DateTime:
                //type = typeof(DateTimeField); DataTableView does not work in edit mode
                type = typeof(object);
                break;

            case SqlDbType.Int:
                type = typeof(int);
                break;

            case SqlDbType.Char:
            case SqlDbType.NChar:
            case SqlDbType.VarChar:
            case SqlDbType.NVarChar:
            case SqlDbType.Text:
            case SqlDbType.NText:
                if (columnSize <= 8000)
                {
                    type = typeof(string);
                }
                else
                {
                    //type = typeof(StringField);
                    type = typeof(object);
                }

                break;

            case SqlDbType.SmallInt:
                type = typeof(short);
                break;

            default:
                type = typeof(object);
                break;
            }

            return(type);
        }
        Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema)
        {
            var  dbType = (OleDbType)dataColumnSchema.ProviderType;
            Type type;

            switch (dbType)
            {
            default:
                type = typeof(object);
                break;
            }

            return(type);
        }
Beispiel #8
0
        Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema)
        {
            throw new NotImplementedException();
            // System.Data.SqlServerCe.SqlCeType
            // var sqlCeType = (SqlCeType)dataColumnSchema.ProviderType;
            //SqlDbType sqlDbType = sqlCeType.SqlDbType;
            //Type dataType;

            //switch (sqlDbType)
            //{
            //    case SqlDbType.Decimal:
            //        dataType = typeof (DecimalField);
            //        break;

            //    default:
            //        dataType = dataColumnSchema.DataType;
            //        break;
            //}

            //return dataType;
        }
        private static IDataFieldReader CreateDataFieldReader(IDataRecord dataRecord, FoundationDbColumn dataColumnSchema)
        {
            var columnOrdinal = dataColumnSchema.ColumnOrdinal;
            var providerType  = (SqlDbType)dataColumnSchema.ProviderType;
            IDataFieldReader dataFieldReader;

            switch (providerType)
            {
            case SqlDbType.BigInt:
            case SqlDbType.Bit:
            case SqlDbType.Udt:
            case SqlDbType.Int:
            case SqlDbType.SmallInt:
            case SqlDbType.TinyInt:
            case SqlDbType.UniqueIdentifier:
            case SqlDbType.Real:     //
                dataFieldReader = new DefaultDataFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.Float:     //
                dataFieldReader = new DoubleFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.Char:
            case SqlDbType.NChar:
            case SqlDbType.VarChar:
            case SqlDbType.NVarChar:
            case SqlDbType.Text:
            case SqlDbType.NText:
                var columnSize = dataColumnSchema.ColumnSize;

                if (columnSize <= SqlServerProvider.ShortStringSize)
                {
                    dataFieldReader = new ShortStringFieldReader(dataRecord, columnOrdinal, providerType);
                }
                else
                {
                    dataFieldReader = new LongStringFieldReader(dataRecord, columnOrdinal);
                }

                break;

            case SqlDbType.Binary:
            case SqlDbType.VarBinary:
            case SqlDbType.Image:
            case SqlDbType.Timestamp:
                dataFieldReader = new BinaryDataFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.Decimal:
                dataFieldReader = new DefaultDataFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.SmallDateTime:
                dataFieldReader = new SmallDateTimeDataFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.Date:
            case SqlDbType.DateTime:
            case SqlDbType.DateTime2:
                dataFieldReader = new DateTimeDataFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.DateTimeOffset:
                dataFieldReader = new DateTimeOffsetDataFieldReader(dataRecord, columnOrdinal);
                break;


            case SqlDbType.Time:
                dataFieldReader = new DefaultDataFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.Money:
                dataFieldReader = new MoneyDataFieldReader(dataRecord, columnOrdinal);
                break;

            case SqlDbType.Variant:
                dataFieldReader = new VariantDataFieldReader(dataRecord, columnOrdinal);
                break;

            //                case SqlDbType.Timestamp:
            //                    dataFieldReader = new TimeStampDataFieldReader(dataRecord,columnOrdinal);
            //                    break;

            case SqlDbType.Xml:
                dataFieldReader = new LongStringFieldReader(dataRecord, columnOrdinal);
                break;

            default:
                throw new Exception();
            }

            return(dataFieldReader);
        }
Beispiel #10
0
 public Type GetColumnType(FoundationDbColumn dataColumnSchema)
 {
     throw new NotImplementedException();
 }
Beispiel #11
0
 Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema)
 {
     return(typeof(object));
 }
 private static DbQueryResultField ToField(FoundationDbColumn column)
 {
     return(new DbQueryResultField(column.ColumnName, column.DataType, column.AllowDbNull == true));
 }
Beispiel #13
0
 Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema) => dataColumnSchema.DataType;
Beispiel #14
0
 Type IProvider.GetColumnType(FoundationDbColumn column)
 {
     throw new NotImplementedException();
 }
Beispiel #15
0
 Type IProvider.GetColumnType(FoundationDbColumn dataColumnSchema)
 {
     return(dataColumnSchema.DataType);
 }