예제 #1
0
        private static IDbfValue CreateDbfValue(DbfColumn dbfColumn, DbfMemo memo, DbfDataReaderOptions options)
        {
            IDbfValue value;

            switch (dbfColumn.ColumnType)
            {
            case DbfColumnType.Number:
                if (dbfColumn.DecimalCount == 0)
                {
                    value = new DbfValueInt(dbfColumn.Length);
                }
                else
                {
                    value = new DbfValueDecimal(dbfColumn.Length, dbfColumn.DecimalCount);
                }
                break;

            case DbfColumnType.Signedlong:
                value = new DbfValueLong(dbfColumn.Length, options);
                break;

            case DbfColumnType.Float:
                value = new DbfValueFloat(dbfColumn.Length);
                break;

            case DbfColumnType.Currency:
                value = new DbfValueCurrency(dbfColumn.Length, dbfColumn.DecimalCount, options);
                break;

            case DbfColumnType.Date:
                value = new DbfValueDate(dbfColumn.Length);
                break;

            case DbfColumnType.DateTime:
                value = new DbfValueDateTime(dbfColumn.Length);
                break;

            case DbfColumnType.Boolean:
                value = new DbfValueBoolean(dbfColumn.Length);
                break;

            case DbfColumnType.Memo:
                value = new DbfValueMemo(dbfColumn.Length, memo);
                break;

            case DbfColumnType.Double:
                value = new DbfValueDouble(dbfColumn.Length);
                break;

            case DbfColumnType.General:
            case DbfColumnType.Character:
                value = new DbfValueString(dbfColumn.Length);
                break;

            default:
                value = new DbfValueNull(dbfColumn.Length);
                break;
            }

            return(value);
        }
예제 #2
0
        private IDbfValue CreateDbfValue(DbfColumn dbfColumn, DbfMemo memo)
        {
            IDbfValue value;

            switch (dbfColumn.ColumnType)
            {
            case DbfColumnType.Number:
                if (dbfColumn.DecimalCount == 0)
                {
                    if (dbfColumn.Length < 10)
                    {
                        value = new DbfValueInt(dbfColumn.Start, dbfColumn.Length);
                    }
                    else
                    {
                        value = new DbfValueInt64(dbfColumn.Start, dbfColumn.Length);
                    }
                }
                else
                {
                    value = new DbfValueDecimal(dbfColumn.Start, dbfColumn.Length, dbfColumn.DecimalCount);
                }
                break;

            case DbfColumnType.SignedLong:
                value = new DbfValueLong(dbfColumn.Start, dbfColumn.Length);
                break;

            case DbfColumnType.Float:
                value = new DbfValueFloat(dbfColumn.Start, dbfColumn.Length, dbfColumn.DecimalCount);
                break;

            case DbfColumnType.Currency:
                value = new DbfValueCurrency(dbfColumn.Start, dbfColumn.Length, dbfColumn.DecimalCount);
                break;

            case DbfColumnType.Date:
                value = new DbfValueDate(dbfColumn.Start, dbfColumn.Length);
                break;

            case DbfColumnType.DateTime:
                value = new DbfValueDateTime(dbfColumn.Start, dbfColumn.Length);
                break;

            case DbfColumnType.Boolean:
                value = new DbfValueBoolean(dbfColumn.Start, dbfColumn.Length);
                break;

            case DbfColumnType.Memo:
                value = new DbfValueMemo(dbfColumn.Start, dbfColumn.Length, memo, _encoding);
                break;

            case DbfColumnType.Double:
                value = new DbfValueDouble(dbfColumn.Start, dbfColumn.Length, dbfColumn.DecimalCount);
                break;

            case DbfColumnType.General:
            case DbfColumnType.Character:
                value = new DbfValueString(dbfColumn.Start, dbfColumn.Length, _encoding);
                break;

            default:
                value = new DbfValueNull(dbfColumn.Start, dbfColumn.Length);
                break;
            }

            return(value);
        }