Changeset 389 for trunk/sources/HeuristicLab.CEDMA.DB/Database.cs
- Timestamp:
- 07/22/08 14:06:42 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.DB/Database.cs
r380 r389 432 432 } 433 433 434 public ICollection<RunEntry> GetRuns( ) {434 public ICollection<RunEntry> GetRuns(long agentId) { 435 435 List<RunEntry> runs = new List<RunEntry>(); 436 436 rwLock.EnterReadLock(); … … 439 439 cnn.Open(); 440 440 using(DbCommand c = cnn.CreateCommand()) { 441 c.CommandText = "Select Id, AgentId, CreationTime, StartTime, FinishedTime, Status, Rawdata from Run"; 441 c.CommandText = "Select Id, AgentId, CreationTime, Status, Rawdata from Run where AgentId=@AgentId"; 442 DbParameter agentParameter = c.CreateParameter(); 443 agentParameter.ParameterName = "@AgentId"; 444 agentParameter.Value = agentId; 445 c.Parameters.Add(agentParameter); 446 442 447 using(DbDataReader r = c.ExecuteReader()) { 443 448 while(r.Read()) { … … 446 451 run.AgentId = r.GetInt32(1); 447 452 run.CreationTime = r.GetDateTime(2); 448 run.StartTime = r.GetDateTime(3); 449 run.FinishedTime = r.GetDateTime(4); 450 run.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(5)); 451 run.RawData = (byte[])r.GetValue(6); 453 run.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(3)); 454 run.RawData = (byte[])r.GetValue(4); 452 455 runs.Add(run); 453 456 } … … 468 471 cnn.Open(); 469 472 using(DbCommand c = cnn.CreateCommand()) { 470 c.CommandText = "Select Id, AgentId, CreationTime, Sta rtTime, FinishedTime, Status, Rawdata from Run where Status=@Status";473 c.CommandText = "Select Id, AgentId, CreationTime, Status, Rawdata from Run where Status=@Status"; 471 474 DbParameter statusParameter = c.CreateParameter(); 472 475 statusParameter.ParameterName = "@Status"; … … 480 483 run.AgentId = r.GetInt32(1); 481 484 run.CreationTime = r.GetDateTime(2); 482 run.StartTime = r.IsDBNull(3) ? null : new Nullable<DateTime>(r.GetDateTime(3)); 483 run.FinishedTime = r.IsDBNull(4) ? null : new Nullable<DateTime>(r.GetDateTime(4)); 484 run.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(5)); 485 run.RawData = (byte[])r.GetValue(6); 485 run.Status = (ProcessStatus)Enum.Parse(typeof(ProcessStatus), r.GetString(3)); 486 run.RawData = (byte[])r.GetValue(4); 486 487 runs.Add(run); 487 488 }
Note: See TracChangeset
for help on using the changeset viewer.