Skip to content
Snippets Groups Projects
Commit 4793df77 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- add SQL statements to handle purged AIPs

parent 1ca35ce6
No related branches found
No related tags found
No related merge requests found
......@@ -154,11 +154,24 @@ CREATE TABLE deleted (
aip_id INTEGER NOT NULL REFERENCES aip (id),
state TEXT NOT NULL,
reason TEXT NOT NULL,
note TEXT,
date DATE,
authorized_by TEXT NOT NULL,
PRIMARY KEY(id AUTOINCREMENT)
);
SQL_CREATE6
my $sql8=<<"SQL_CREATE8";
CREATE TABLE purged (
id INTEGER,
aip_id INTEGER NOT NULL REFERENCES aip (id),
state TEXT NOT NULL,
reason TEXT,
note TEXT,
date DATE,
authorized_by TEXT NOT NULL,
PRIMARY KEY(id AUTOINCREMENT)
);
SQL_CREATE8
my $sql7=<<"SQL_CREATE7";
CREATE TABLE transferaip (
id INTEGER,
......@@ -176,6 +189,7 @@ SQL_CREATE7
my $sth5 = $dbh->prepare($sql5); $sth5->execute() or die "sql problem detected", $dbh->errstr;
my $sth6 = $dbh->prepare($sql6); $sth6->execute() or die "sql problem detected", $dbh->errstr;
my $sth7 = $dbh->prepare($sql7); $sth7->execute() or die "sql problem detected", $dbh->errstr;
my $sth8 = $dbh->prepare($sql8); $sth8->execute() or die "sql problem detected", $dbh->errstr;
return 1;
}
......@@ -213,10 +227,16 @@ SQL_LOCAT_PLAN
);
SQL_DC_PLAN
my $sql_deleted_plan=<<"SQL_DELETE_PLAN";
INSERT INTO deleted (aip_id, state, reason, date, authorized_by) VALUES (
(SELECT id FROM aip WHERE aip.ie_id=\$1 AND aip.version=\$2), \$3, \$4, \$5, \$6
INSERT INTO deleted (aip_id, state, reason, note, date, authorized_by) VALUES (
(SELECT id FROM aip WHERE aip.ie_id=\$1 AND aip.version=\$2), \$3, \$4, \$5, \$6, \$7
);
SQL_DELETE_PLAN
my $sql_purged_plan=<<"SQL_PURGED_PLAN";
INSERT INTO purged (aip_id, state, reason, note, date, authorized_by) VALUES (
(SELECT id FROM aip WHERE aip.ie_id=\$1 AND aip.version=\$2), \$3, \$4, \$5, \$6, \$7
);
SQL_PURGED_PLAN
my $sth_aip_plan = $dbh->prepare($sql_aip_plan);
my $sth_ie_plan = $dbh->prepare($sql_ie_plan);
......@@ -224,6 +244,7 @@ SQL_DELETE_PLAN
my $sth_locat_plan = $dbh->prepare($sql_locat_plan);
my $sth_dc_plan = $dbh->prepare($sql_dc_plan);
my $sth_deleted_plan = $dbh->prepare($sql_deleted_plan);
my $sth_purged_plan = $dbh->prepare($sql_purged_plan);
my $plans;
$plans->{aip} = $sth_aip_plan;
$plans->{ie} = $sth_ie_plan;
......@@ -231,6 +252,7 @@ SQL_DELETE_PLAN
$plans->{locat} = $sth_locat_plan;
$plans->{dc} = $sth_dc_plan;
$plans->{deleted} = $sth_deleted_plan;
$plans->{purged} = $sth_purged_plan;
return $plans;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment