Example #1
0
        public DbfRecord(DbfTable dbfTable, DbfDataReaderOptions options)
        {
            Values = new List <IDbfValue>();

            foreach (var dbfColumn in dbfTable.Columns)
            {
                var dbfValue = CreateDbfValue(dbfColumn, dbfTable.Memo, options);
                Values.Add(dbfValue);
            }
        }
Example #2
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);
        }
Example #3
0
 public DbfValueLong(int length, DbfDataReaderOptions options) : base(length)
 {
     this.options = options;
 }
 public DbfDataReader(Stream stream, Stream memoStream, DbfDataReaderOptions options)
 {
     _options  = options;
     DbfTable  = new DbfTable(stream, memoStream, options.Encoding);
     DbfRecord = new DbfRecord(DbfTable);
 }
 public DbfDataReader(string path, DbfDataReaderOptions options)
 {
     _options  = options;
     DbfTable  = new DbfTable(path, options.Encoding);
     DbfRecord = new DbfRecord(DbfTable);
 }
Example #6
0
 public DbfValueCurrency(int length, int decimalCount, DbfDataReaderOptions options) : base(length)
 {
     DecimalCount = decimalCount;
     this.options = options;
 }
 public DbfDataReader(string path, Encoding encoding, DbfDataReaderOptions options)
 {
     DbfTable  = new DbfTable(path, encoding);
     DbfRecord = new DbfRecord(DbfTable, options);
 }