コード例 #1
0
ファイル: Index.cs プロジェクト: sulerzh/DbExporter
 private IEnumerable<ParadoxRecord> Enumerate(ParadoxCondition condition, ushort blockId, int indexLevel)
 {
     if (indexLevel == 0)
     {
         var block = this.table.GetBlock(blockId);
         for (int i=0; i<block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsDataOk(rec))
             {
                 yield return rec;
             }
         }
     }
     else
     {
         var block = this.GetBlock(blockId);
         var blockIdFldIndex = this.FieldCount - 3;
         for (int i = 0; i < block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsIndexPossible(rec, i < block.RecordCount-1 ? block[i + 1] : null))
             {
                 var qry = Enumerate(condition, (ushort)((short) rec.DataValues[blockIdFldIndex]-1), indexLevel - 1);
                 foreach (var dataRec in qry)
                 {
                     yield return dataRec;
                 }
             }
         }
     }
 }
コード例 #2
0
 private IEnumerable <ParadoxRecord> Enumerate(ParadoxCondition condition, ushort blockId, int indexLevel)
 {
     if (indexLevel == 0)
     {
         var block = this.table.GetBlock(blockId);
         for (int i = 0; i < block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsDataOk(rec))
             {
                 yield return(rec);
             }
         }
     }
     else
     {
         var block           = this.GetBlock(blockId);
         var blockIdFldIndex = this.FieldCount - 3;
         for (int i = 0; i < block.RecordCount; i++)
         {
             var rec = block[i];
             if (condition.IsIndexPossible(rec, i < block.RecordCount - 1 ? block[i + 1] : null))
             {
                 var qry = Enumerate(condition, (ushort)((short)rec.DataValues[blockIdFldIndex] - 1), indexLevel - 1);
                 foreach (var dataRec in qry)
                 {
                     yield return(dataRec);
                 }
             }
         }
     }
 }
コード例 #3
0
 /// <summary>
 /// 获取数据库游标
 /// </summary>
 /// <param name="tableName">要查询的数据库表名称</param>
 /// <param name="where">数据库查询条件</param>
 /// <param name="useIndex">是否使用数据库索引</param>
 /// <returns></returns>
 public ParadoxDataReader ExecuteQuery(string tableName, ParadoxCondition where, bool useIndex)
 {
     var table = GetParadoxTable(tableName);
     IEnumerable<ParadoxRecord> qry = null;
     if (useIndex)
     {
         var index = table.PrimaryKeyIndex; // index
         qry = index.Enumerate(where); // query
     }
     else
     {
         qry = table.Enumerate(where); // query
     }
     return new ParadoxDataReader(table, qry); // reader
 }
コード例 #4
0
 // modified by zsl: use Query Condition instead of 'Predicate<ParadoxRecord> where'
 //public IEnumerable<ParadoxRecord> Enumerate(Predicate<ParadoxRecord> where)
 public IEnumerable <ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     for (int blockId = 0; blockId < this.fileBlocks; blockId++)
     {
         var block = this.GetBlock(blockId);
         for (var recId = 0; recId < block.RecordCount; recId++)
         {
             var rec = block[recId];
             //if (where == null || where(rec))
             if (condition == null || condition.IsDataOk(rec))
             {
                 yield return(rec);
             }
         }
     }
 }
コード例 #5
0
ファイル: Db.cs プロジェクト: sulerzh/DbExporter
 // modified by zsl: use Query Condition instead of 'Predicate<ParadoxRecord> where'
 //public IEnumerable<ParadoxRecord> Enumerate(Predicate<ParadoxRecord> where)
 public IEnumerable<ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     for (int blockId = 0; blockId < this.fileBlocks; blockId++)
     {
         var block = this.GetBlock(blockId);
         for (var recId = 0; recId < block.RecordCount; recId++)
         {
             var rec = block[recId];
             //if (where == null || where(rec))
             if (condition == null || condition.IsDataOk(rec))
             {
                 yield return rec;
             }
         }
     }
 }
コード例 #6
0
ファイル: RecordQuery.cs プロジェクト: sulerzh/DbExporter
 public QueryArgs(string table, ParadoxCondition condition, string tag, string id)
 {
     this.TableName = table;
     this.Condition = condition;
     this.TagName = tag;
     this.IDName = id;
 }
コード例 #7
0
ファイル: RecordQuery.cs プロジェクト: sulerzh/DbExporter
 public QueryArgs(string table, string tag, string id)
 {
     this.TableName = table;
     this.Condition = new NullCondtion();
     this.TagName = tag;
     this.IDName = id;
 }
コード例 #8
0
ファイル: RecordQuery.cs プロジェクト: sulerzh/DbExporter
 public QueryArgs(string table)
 {
     this.TableName = table;
     this.Condition = new NullCondtion();
     this.TagName = "";
     this.IDName = "";
 }
コード例 #9
0
ファイル: Index.cs プロジェクト: sulerzh/DbExporter
 public IEnumerable<ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     return Enumerate(condition, (ushort)(this.pxRootBlockId-1), this.pxLevelCount);
 }
コード例 #10
0
ファイル: Index.cs プロジェクト: sulerzh/DbExporter
 protected Multiple(ParadoxCondition[] subConditions)
 {
     SubConditions = subConditions;
 }
コード例 #11
0
 public IEnumerable <ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     return(Enumerate(condition, (ushort)(this.pxRootBlockId - 1), this.pxLevelCount));
 }
コード例 #12
0
 /// <summary>
 /// 获取数据库游标
 /// </summary>
 /// <param name="tableName">要查询的数据库表名称</param>
 /// <param name="where">数据库查询条件</param>
 /// <returns></returns>
 public ParadoxDataReader ExecuteQuery(string tableName, ParadoxCondition where)
 {
     return ExecuteQuery(tableName, where, true);
 }