On Sat, May 11, 2002 at 09:27:17AM +0200, CVS User joey wrote:
> Update of /var/cvs/ltev/ltp/admin/supporter
> In directory luonnotar:/tmp/cvs-serv9100
>
> Modified Files:
> update.wml
> Log Message:
> Even though this looks like a large change, it's a very small change
> but with large impact. It only adds support for deleting a job with
> all fragments in place (first 6 lines). The remaining patch is only
> indention due to if () {} else {...}
>
> --- /var/cvs/ltev/ltp/admin/supporter/update.wml 2002/05/10 19:15:46 1.19
> +++ /var/cvs/ltev/ltp/admin/supporter/update.wml 2002/05/11 07:27:17 1.20
> @@ -177,68 +177,46 @@
> # Begin transaction
> pg_exec($dbh, "BEGIN TRANSACTION") or die ("Could not start transaction.");
>
> - if (!strlen ($section))
> - {
> + if ($id > 0 && $delete == 1) {
> + $query = sprintf ("DELETE FROM job WHERE id = %d", $id);
> + pg_exec($dbh, $query) or die ("Can't delete job.");
> + $query = sprintf ("DELETE FROM jobfragment WHERE jobid = %d", $id);
> + pg_exec($dbh, $query) or die ("Can't delete job fragments.");
> + } else {
Ich glaube die 2. Query kannst du weglassen, das sollte kaskadieren:
CREATE TABLE jobfragment (
id SERIAL NOT NULL,
jobid INT4 NOT NULL references job(id) on delete cascade,
^^^^^^^
min INT4,
max INT4,
starttime timestamp without time zone NOT NULL,
endtime timestamp without time zone,
comment TEXT,
PRIMARY KEY (id)
);
This archive was generated by hypermail 2.1.3 : Sat May 11 2002 - 15:12:58 CEST