protected void ExecuteRow <T>(SelectQuery <T> query, RowExecutor <T> executor) where T : DataRecord { var item = query.CreateWork(executor); Client.EnqueueWork(item); }
public override void ExecuteRow <ActiveRecord>(DataTable <ActiveRecord> table, SelectQuery <ActiveRecord> query, RowExecutor <ActiveRecord> executor) { enqueueWork((w) => { w.ExecuteRow(table, query, executor); }); }
public override void ExecuteRow <ActiveRecord>(DataTable <ActiveRecord> table, SelectQuery <ActiveRecord> query, RowExecutor <ActiveRecord> executor) { var items = query.Condition.ToArray(); ActiveRecord result; switch (items.Length) { case 0: result = table.MemoryRecords.Values.First(); break; case 1: result = findItem(table, items[0]); break; default: result = applyCondition(table, query.Condition).FirstOrDefault(); break; } executor(result); }
public override void ExecuteRow <ActiveRecord>(DataTable <ActiveRecord> table, SelectQuery <ActiveRecord> query, RowExecutor <ActiveRecord> executor) { var queryCmd = createSelect <ActiveRecord>(table, query.Condition); queryCmd.Append(" LIMIT 1"); ActiveRecord result = default(ActiveRecord); using (var reader = queryCmd.ExecuteReader()) { if (reader.Read()) { var columns = new ColumnsReader(reader); result = table.CreateRecord(columns); } reader.Close(); } executor(result); }
internal RowQueryWorkItem(SelectQuery <ActiveRecord> query, RowExecutor <ActiveRecord> executor) { _query = query; _executor = executor; }
public abstract void ExecuteRow <ActiveRecord>(DataTable <ActiveRecord> table, SelectQuery <ActiveRecord> query, RowExecutor <ActiveRecord> executor) where ActiveRecord : DataRecord;