* Make the queries more readable.

[?]
Oct 7, 2009, 1:40 PM
SZYY2EQQK2JUAHMDPBASGWC2RON2GA5G6FHBLO4GAAX2XTM6QLSQC

Dependencies

  • [2] S6OISBQ3 * Mark the "current" builds in a jobset, i.e. those corresponding to
  • [3] RAKTHYAI * In the job status and error pages, show when the status of a job
  • [4] SJN2QPWH * Big speed-up of the job status page and the channel generation (such
  • [5] X5UVREJY * PostgreSQL compatibility.
  • [*] J5UVLXOK * Start of a basic Catalyst web interface.

Change contents

  • edit in src/lib/Hydra/Schema/Builds.pm at line 215
    [3.2536]
    [3.1005]
  • replacement in src/lib/Hydra/Schema/Builds.pm at line 217
    [3.1036][3.1036:1374](),[3.1374][3.87:169](),[3.169][2.1096:1579](),[2.1579][3.639:914](),[3.639][3.639:914]()
    "natural join BuildResultInfo r " .
    "left join Builds b on b.id = " .
    "(select max(id) from builds c natural join buildresultinfo r2 " .
    " where x.project = c.project and x.jobset = c.jobset and x.job = c.job and x.system = c.system and " .
    " x.id > c.id and r.buildstatus != r2.buildstatus)";
    # Urgh, can't use "*" in the "select" here because of the status change join.
    makeSource('JobStatus' . $name, "select x.id, x.finished, x.timestamp, x.project, x.jobset, x.job, x.nixname, x.description, x.drvpath, x.outpath, x.system, x.longdescription, x.license, x.homepage, x.maintainers, x.isCurrent, b.id as statusChangeId, b.timestamp as statusChangeTime from (select project, jobset, job, system, max(id) as id from Builds where finished = 1 $constraint group by project, jobset, job, system) as latest natural join Builds x $joinWithStatusChange");
    makeSource('LatestSucceeded' . $name, "select * from (select project, jobset, job, system, max(id) as id from Builds natural join BuildResultInfo where finished = 1 and buildStatus = 0 $constraint group by project, jobset, job, system) as latest natural join Builds x");
    [3.1036]
    [3.3029]
    <<QUERY;
    natural join BuildResultInfo r
    left join Builds b on
    b.id =
    (select max(id)
    from builds c natural join buildresultinfo r2
    where
    x.project = c.project and x.jobset = c.jobset and x.job = c.job and x.system = c.system and
    x.id > c.id and r.buildstatus != r2.buildstatus)
    QUERY
    makeSource(
    "JobStatus$name",
    # Urgh, can't use "*" in the "select" here because of the status change join.
    <<QUERY
    select
    x.id, x.finished, x.timestamp, x.project, x.jobset, x.job, x.nixname,
    x.description, x.drvpath, x.outpath, x.system, x.longdescription,
    x.license, x.homepage, x.maintainers, x.isCurrent,
    b.id as statusChangeId, b.timestamp as statusChangeTime
    from
    (select project, jobset, job, system, max(id) as id
    from Builds where finished = 1 $constraint group by project, jobset, job, system)
    as latest
    natural join Builds x
    $joinWithStatusChange
    QUERY
    );
    makeSource(
    "LatestSucceeded$name",
    <<QUERY
    select *
    from
    (select project, jobset, job, system, max(id) as id
    from Builds natural join BuildResultInfo
    where finished = 1 and buildStatus = 0 $constraint
    group by project, jobset, job, system
    ) as latest
    natural join Builds
    QUERY
    );