예제 #1
0
 public DbfWriter(SocialExplorer.IO.FastDBF.DbfFile dbf, DataFormatSettings dataFormat)
 {
     _dbf = dbf;
     _orec = new DbfRecord(_dbf.Header);
     _dataFormat = dataFormat;
     _formatter = new CdlValueFormatter(_dataFormat ?? new DataFormatSettings());
 }
예제 #2
0
 public DbfReader(TableInfo structure, SocialExplorer.IO.FastDBF.DbfFile dbf)
     : base(structure)
 {
     _dbf = dbf;
     _array = new string[structure.ColumnCount];
     _irec = new DbfRecord(_dbf.Header);
 }
예제 #3
0
파일: DbfFile.cs 프로젝트: dbshell/dbshell
 TableInfo GetStructure(SocialExplorer.IO.FastDBF.DbfFile dbf)
 {
     var res = new TableInfo(null);
     //output column names
     for (int i = 0; i < dbf.Header.ColumnCount; i++)
     {
         DbTypeBase type;
         // convert DBF type to DA type
         switch (dbf.Header[i].ColumnType)
         {
             case DbfColumn.DbfColumnType.Binary:
                 type = new DbTypeBlob();
                 break;
             case DbfColumn.DbfColumnType.Boolean:
                 type = new DbTypeLogical();
                 break;
             case DbfColumn.DbfColumnType.Date:
                 type = new DbTypeDatetime {SubType = DbDatetimeSubType.Date};
                 break;
             case DbfColumn.DbfColumnType.Character:
                 type = new DbTypeString {Length = dbf.Header[i].Length};
                 break;
             case DbfColumn.DbfColumnType.Integer:
                 type = new DbTypeInt();
                 break;
             case DbfColumn.DbfColumnType.Memo:
                 type = new DbTypeText();
                 break;
             case DbfColumn.DbfColumnType.Number:
                 type = new DbTypeNumeric
                     {
                         Precision = dbf.Header[i].Length,
                         Scale = dbf.Header[i].DecimalCount,
                     };
                 break;
             default:
                 type = new DbTypeString();
                 break;
         }
         var col = new ColumnInfo(res);
         col.Name = dbf.Header[i].Name;
         col.CommonType = type;
         //col.FillTypeFromCommonType();
         res.Columns.Add(col);
     }
     return res;
 }