Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/22/08 14:06:42 (16 years ago)
Author:
gkronber
Message:

worked on #188

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.DB/Database.cs

    r380 r389  
    432432    }
    433433
    434     public ICollection<RunEntry> GetRuns() {
     434    public ICollection<RunEntry> GetRuns(long agentId) {
    435435      List<RunEntry> runs = new List<RunEntry>();
    436436      rwLock.EnterReadLock();
     
    439439          cnn.Open();
    440440          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
    442447            using(DbDataReader r = c.ExecuteReader()) {
    443448              while(r.Read()) {
     
    446451                run.AgentId = r.GetInt32(1);
    447452                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);
    452455                runs.Add(run);
    453456              }
     
    468471          cnn.Open();
    469472          using(DbCommand c = cnn.CreateCommand()) {
    470             c.CommandText = "Select Id, AgentId, CreationTime, StartTime, FinishedTime, Status, Rawdata from Run where Status=@Status";
     473            c.CommandText = "Select Id, AgentId, CreationTime, Status, Rawdata from Run where Status=@Status";
    471474            DbParameter statusParameter = c.CreateParameter();
    472475            statusParameter.ParameterName = "@Status";
     
    480483                run.AgentId = r.GetInt32(1);
    481484                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);
    486487                runs.Add(run);
    487488              }
Note: See TracChangeset for help on using the changeset viewer.