Esempio n. 1
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;
                 }
             }
         }
     }
 }
Esempio n. 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);
                 }
             }
         }
     }
 }
Esempio n. 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
 }
Esempio n. 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);
             }
         }
     }
 }
Esempio n. 5
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;
             }
         }
     }
 }
Esempio n. 6
0
 public QueryArgs(string table, ParadoxCondition condition, string tag, string id)
 {
     this.TableName = table;
     this.Condition = condition;
     this.TagName = tag;
     this.IDName = id;
 }
Esempio n. 7
0
 public QueryArgs(string table, string tag, string id)
 {
     this.TableName = table;
     this.Condition = new NullCondtion();
     this.TagName = tag;
     this.IDName = id;
 }
Esempio n. 8
0
 public QueryArgs(string table)
 {
     this.TableName = table;
     this.Condition = new NullCondtion();
     this.TagName = "";
     this.IDName = "";
 }
Esempio n. 9
0
 public IEnumerable<ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     return Enumerate(condition, (ushort)(this.pxRootBlockId-1), this.pxLevelCount);
 }
Esempio n. 10
0
 protected Multiple(ParadoxCondition[] subConditions)
 {
     SubConditions = subConditions;
 }
Esempio n. 11
0
 public IEnumerable <ParadoxRecord> Enumerate(ParadoxCondition condition)
 {
     return(Enumerate(condition, (ushort)(this.pxRootBlockId - 1), this.pxLevelCount));
 }
Esempio n. 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);
 }