Revision 1b960273
Von Moritz Bunkus vor mehr als 11 Jahren hinzugefügt
sql/Pg-upgrade2/tax_constraints.pl | ||
---|---|---|
193 | 193 |
$sth->finish; |
194 | 194 |
|
195 | 195 |
for my $i (0 .. $rowcount-1){ |
196 |
$query= qq|
|
|
196 |
$query= <<SQL;
|
|
197 | 197 |
DELETE FROM taxkeys tk1 |
198 |
WHERE (SELECT count(*) |
|
199 |
FROM taxkeys tk2 |
|
200 |
WHERE tk2.chart_id = tk1.chart_id |
|
201 |
AND tk2.startdate = tk1.startdate) > 1 |
|
202 |
AND NOT tk1.id = (SELECT id |
|
203 |
FROM taxkeys |
|
204 |
WHERE chart_id = | . $::form->{TAXKEYS}[$i]->{chart_id} . qq| |
|
205 |
AND startdate = '| . $::form->{TAXKEYS}[$i]->{startdate} . qq|' |
|
206 |
LIMIT 1) |
|
207 |
|; |
|
198 |
WHERE (tk1.chart_id = ?) |
|
199 |
AND (tk1.startdate = ?) |
|
200 |
AND (tk1.id <> ( |
|
201 |
SELECT id |
|
202 |
FROM taxkeys |
|
203 |
WHERE (chart_id = ?) |
|
204 |
AND (startdate = ?) |
|
205 |
LIMIT 1)) |
|
206 |
SQL |
|
208 | 207 |
|
209 |
$self->db_query($query); |
|
208 |
$self->db_query($query, bind => [ ($::form->{TAXKEYS}[$i]->{chart_id}, $::form->{TAXKEYS}[$i]->{startdate}) x 2 ]);
|
|
210 | 209 |
} |
211 | 210 |
|
212 | 211 |
#END CHECK OF taxkeys |
Auch abrufbar als: Unified diff
tax_constraints: Nicht zu viele Einträge aus taxkeys löschen