11 |
use Getopt::Long; |
use Getopt::Long; |
12 |
use DBI; |
use DBI; |
13 |
use Data::Dumper; |
use Data::Dumper; |
14 |
|
use Pg::Scheme; |
15 |
|
|
16 |
$| = 1; |
$| = 1; |
17 |
|
|
63 |
print "Master connection is $minfo\n" if ($debug); |
print "Master connection is $minfo\n" if ($debug); |
64 |
print "Slave connection is $sinfo\n" if ($debug); |
print "Slave connection is $sinfo\n" if ($debug); |
65 |
|
|
66 |
my $mdbh = DBI->connect("DBI:Pg:$minfo", $masteruser, $masterpassword, { PrintError => 1 }); |
my $mdbh = DBI->connect("DBI:Pg:$minfo", $masteruser, $masterpassword, { PrintError => 0 } ); |
67 |
my $sdbh = DBI->connect("DBI:Pg:$sinfo", $slaveuser, $slavepassword, { PrintError => 1 }); |
if (! $mdbh) { |
68 |
|
print "Can't connect to master database $master"; |
69 |
|
print "on $masterhost" if ($masterhost); |
70 |
|
print "\n"; |
71 |
|
exit 1; |
72 |
|
} |
73 |
|
my $sdbh = DBI->connect("DBI:Pg:$sinfo", $slaveuser, $slavepassword, { PrintError => 0 }); |
74 |
|
if (! $sdbh) { |
75 |
|
print "Can't connect to slave database $slave"; |
76 |
|
print "on $slavehost" if ($slavehost); |
77 |
|
print "\n"; |
78 |
|
exit 1; |
79 |
|
} |
80 |
|
|
81 |
my ($diff_shema,$diff_data) = (0,0); |
my ($diff_shema,$diff_data) = (0,0); |
82 |
|
|
87 |
my $sql = shift; |
my $sql = shift; |
88 |
$sql =~ s/[\n\r]/ /gs; |
$sql =~ s/[\n\r]/ /gs; |
89 |
$sql =~ s/\s\s+/ /g; |
$sql =~ s/\s\s+/ /g; |
90 |
print STDERR "SQL: $sql\n"; |
print STDERR "DEBUG: SQL: $sql\n"; |
91 |
} |
} |
92 |
|
|
93 |
sub debug_row { |
sub debug_row { |
95 |
my $row = shift; |
my $row = shift; |
96 |
my @cols = @_; |
my @cols = @_; |
97 |
if (! $row) { |
if (! $row) { |
98 |
print STDERR "ROW data is undef!\n"; |
print STDERR "DEBUG: ROW data is undef!\n"; |
99 |
return; |
return; |
100 |
} |
} |
101 |
print STDERR "ROW: [",$#cols+1,"] "; |
print STDERR "DEBUG: ROW: [",$#cols+1,"] "; |
102 |
foreach my $col (@cols) { |
foreach my $col (@cols) { |
103 |
print STDERR "$col:"; |
print STDERR "$col:"; |
104 |
if ($row->{$col}) { |
if ($row->{$col}) { |
111 |
print STDERR "\n"; |
print STDERR "\n"; |
112 |
} |
} |
113 |
|
|
114 |
|
sub debug { |
115 |
|
return if (!$debug); |
116 |
|
print STDERR "DEBUG: ",@_; |
117 |
|
} |
118 |
|
|
119 |
$verbose = 1 if ($debug); |
$verbose = 1 if ($debug); |
120 |
|
|
121 |
|
# init object for scheme in master database |
122 |
|
my $mscheme = new Pg::Scheme( 'dbh' => $mdbh, 'DEBUG' => 0 ) || die "can't query master schema"; |
123 |
|
my $sscheme = new Pg::Scheme( 'dbh' => $sdbh, 'DEBUG' => 0 ) || die "can't query slave schema"; |
124 |
|
|
125 |
# which tables to compare? |
# which tables to compare? |
126 |
|
|
127 |
my @tables; |
my @tables = $mscheme->list_tables($tables); |
|
if ($tables) { |
|
|
@tables = split(/,/,$tables); |
|
|
} else { |
|
|
# take all tables |
|
|
#$sql="select tablename from pg_tables where tablename not like 'pg_%' and tablename not like '_rserv_%'"; |
|
|
# show tables (based on psql \dt) |
|
|
$sql = " |
|
|
SELECT c.relname as table |
|
|
FROM pg_catalog.pg_class c |
|
|
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace |
|
|
WHERE c.relkind = 'r' |
|
|
AND n.nspname NOT IN ('pg_catalog', 'pg_toast') |
|
|
AND pg_catalog.pg_table_is_visible(c.oid) |
|
|
and c.relname not like '_rserv_%' |
|
|
"; |
|
|
my $sth = $mdbh->prepare($sql); |
|
|
$sth->execute() || die; |
|
|
while(my $row = $sth->fetchrow_hashref()) { |
|
|
push @tables,$row->{table}; |
|
|
} |
|
|
} |
|
128 |
|
|
129 |
print "Comparing tables: ",join(", ",@tables),"\n" if ($debug); |
debug "Comparing tables: ".join(", ",@tables)."\n"; |
130 |
|
|
131 |
|
# start transaction |
132 |
|
print "begin work;\n"; |
133 |
|
|
134 |
|
# disable active triggers on slave database |
135 |
|
my @triggers = $sscheme->get_triggers(); |
136 |
|
|
137 |
|
foreach my $tr (@triggers) { |
138 |
|
print "update pg_trigger set tgenabled = false where tgname='$tr';\n"; |
139 |
|
} |
140 |
|
|
141 |
my $cols; |
my $cols; |
142 |
my $diff_total = 0; |
my $diff_total = 0; |
143 |
|
|
144 |
foreach my $table (@tables) { |
foreach my $table (@tables) { |
145 |
|
|
146 |
my ($sth); |
my $sth; |
147 |
|
|
148 |
# find table oid |
# diff schema |
|
$sql = " |
|
|
SELECT c.oid, n.nspname, c.relname |
|
|
FROM pg_catalog.pg_class c |
|
|
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace |
|
|
WHERE pg_catalog.pg_table_is_visible(c.oid) |
|
|
AND c.relname = '$table' |
|
|
ORDER BY 2, 3 |
|
|
"; |
|
|
|
|
|
$sth = $mdbh->prepare($sql); |
|
|
$sth->execute() || die; |
|
|
my $row = $sth->fetchrow_hashref(); |
|
|
if (! $row) { |
|
|
print STDERR "Can't find OID of table '$table'\n"; |
|
|
exit 1; |
|
|
} |
|
149 |
|
|
150 |
my $oid = $row->{oid}; |
# all colums (for insert) |
151 |
|
my @cols = @{$mscheme->cols($table)}; |
152 |
|
|
153 |
# diff schema |
# colums compared by a=b |
154 |
|
my @cols_notnull = @{$mscheme->cols_notnull($table)}; |
155 |
|
|
156 |
|
# colums compared by a=b or a is null and b is null |
157 |
|
my @cols_null = @{$mscheme->cols_null($table)}; |
158 |
|
|
159 |
|
# primary key columns |
160 |
|
my @cols_pk = @{$mscheme->cols_pk($table)}; |
161 |
|
|
162 |
|
# columns to compare (not in primary key) |
163 |
|
my @cols_cmp = @{$mscheme->cols_notpk($table)}; |
164 |
|
|
|
my @cols_notnull;# colums compared by a=b |
|
|
my @cols_null; # colums compared by a=b or a is null and b is null |
|
165 |
my @cols_skip; # skipped columns |
my @cols_skip; # skipped columns |
166 |
my @cols_test; # all colums to test (without skipped) |
my @cols_test; # all colums to test (without skipped) |
|
my @cols; # all colums (for insert) |
|
|
|
|
|
my $sql=" |
|
|
SELECT a.attname, |
|
|
pg_catalog.format_type(a.atttypid, a.atttypmod), |
|
|
a.attnotnull, a.atthasdef, a.attnum |
|
|
FROM pg_catalog.pg_attribute a |
|
|
WHERE a.attrelid = $oid AND a.attnum > 0 AND NOT a.attisdropped |
|
|
ORDER BY a.attnum |
|
|
"; |
|
167 |
|
|
168 |
$sth = $mdbh->prepare($sql); |
foreach my $row (@{$mscheme->pg_attribute($table)}) { |
|
$sth->execute() || die; |
|
|
while(my $row = $sth->fetchrow_hashref()) { |
|
169 |
# attname | format_type | attnotnull | atthasdef | attnum |
# attname | format_type | attnotnull | atthasdef | attnum |
170 |
|
|
|
push @cols,$row->{attname}; |
|
|
|
|
171 |
# FIXME: do something with attributes which shouldn't be compared |
# FIXME: do something with attributes which shouldn't be compared |
172 |
# (date, time, datetime, timestamp) |
# (date, time, datetime, timestamp) |
173 |
if ($row->{format_type} =~ /(date)|(time)/i) { |
if ($row->{format_type} =~ /(date)|(time)/i) { |
174 |
push @cols_skip,$row->{attname}; |
push @cols_skip,$row->{attname}; |
|
next; |
|
|
} |
|
|
|
|
|
push @cols_test,$row->{attname}; |
|
|
|
|
|
if ($row->{attnotnull}) { |
|
|
push @cols_notnull,$row->{attname}; |
|
175 |
} else { |
} else { |
176 |
push @cols_null,$row->{attname}; |
push @cols_test,$row->{attname}; |
177 |
} |
} |
178 |
|
|
179 |
} |
} |
|
$sth->finish(); |
|
180 |
|
|
181 |
if ($debug) { |
if ($debug) { |
182 |
print STDERR "table $table [$oid] not null: (",join(", ",@cols_notnull),")"; |
print STDERR "DEBUG: table $table not null cols: (",join(", ",@cols_notnull),")"; |
183 |
print STDERR " - null: (",join(", ",@cols_null),")" if (@cols_null); |
print STDERR " - null cols: (",join(", ",@cols_null),")" if (@cols_null); |
184 |
print STDERR " - skip: (",join(", ",@cols_skip),")" if (@cols_skip); |
print STDERR " - skip cols: (",join(", ",@cols_skip),")" if (@cols_skip); |
185 |
print STDERR "\n"; |
print STDERR "\n"; |
186 |
} |
} |
187 |
|
|
188 |
# diff data |
# diff data |
189 |
|
|
|
my @cols_pk; # columns which are primary key |
|
|
my %in_pk; |
|
|
|
|
|
$sql=" |
|
|
SELECT |
|
|
i.indexrelid as indexrelid, i.indrelid as indrelid, |
|
|
count(a.attname) as cols_in_pk |
|
|
FROM |
|
|
pg_catalog.pg_class c, |
|
|
pg_catalog.pg_index i, |
|
|
pg_catalog.pg_attribute a |
|
|
WHERE |
|
|
c.oid = i.indrelid |
|
|
and i.indisunique |
|
|
and c.relname = '$table' |
|
|
and a.attrelid = i.indexrelid |
|
|
GROUP BY |
|
|
i.indexrelid, i.indrelid, c.relname, i.indisprimary, i.indisunique |
|
|
ORDER BY |
|
|
cols_in_pk ASC, i.indisprimary DESC, i.indisunique DESC, c.relname DESC |
|
|
"; |
|
|
debug_sql($sql); |
|
|
$sth = $mdbh->prepare($sql); |
|
|
$sth->execute() || die; |
|
|
$row = $sth->fetchrow_hashref(); |
|
|
if ($row) { |
|
|
$sql=" |
|
|
select a1.attname as attname from pg_attribute a1, pg_attribute a2 where a1.attrelid = ".$row->{indexrelid}." and a2.attrelid=".$row->{indrelid}." and a1.attname = a2.attname and a2.attnotnull"; |
|
|
|
|
|
debug_sql($sql); |
|
|
my $sth2 = $mdbh->prepare($sql); |
|
|
$sth2->execute() || die; |
|
|
@cols_pk = (); |
|
|
while (my $row2 = $sth2->fetchrow_hashref()) { |
|
|
push @cols_pk,$row2->{attname}; |
|
|
$in_pk{$row2->{attname}}++; |
|
|
} |
|
|
|
|
|
} |
|
190 |
if (! @cols_pk) { |
if (! @cols_pk) { |
191 |
print STDERR "can't find PK rows for table '$table' using all\n"; |
print STDERR "can't find PK rows for table '$table' using all\n"; |
192 |
@cols_pk = @cols; |
@cols_pk = @cols; |
193 |
} |
} |
194 |
|
|
|
my @cols_cmp; # columns to compare |
|
|
|
|
|
foreach my $col (@cols_test) { |
|
|
push @cols_cmp,$col if (! $in_pk{$col}); |
|
|
} |
|
195 |
|
|
196 |
if ($verbose) { |
if ($verbose) { |
197 |
print "table '$table' using for key: (",join(", ",@cols_pk),") to compare cols: (",join(", ",@cols_cmp),")\n"; |
print "table '$table' using for key: (",join(", ",@cols_pk),") to compare cols: (",join(", ",@cols_cmp),")\n"; |
226 |
|
|
227 |
my $order = sql_order(@cols_pk); |
my $order = sql_order(@cols_pk); |
228 |
$msql .= $order; |
$msql .= $order; |
229 |
$ssql .= sql_where(@cols_pk) . $order; |
$ssql .= $order; |
230 |
|
|
231 |
debug_sql($msql); |
debug_sql($msql); |
|
debug_sql($ssql); |
|
232 |
|
|
233 |
my $msth = $mdbh->prepare($msql) || die; |
my $msth = $mdbh->prepare($msql) || die $mdbh->errstr; |
234 |
$msth->execute() || die; |
$msth->execute() || die $msth->errstr; |
235 |
|
|
236 |
my $ssth = $sdbh->prepare($ssql) || die; |
my $ssth = $sdbh->prepare($ssql) || die $sdbh->errstr; |
237 |
|
$ssth->execute() || die $ssth->errstr; |
238 |
|
|
239 |
my $diff_row = 0; |
my $diff_row = 0; |
240 |
|
|
241 |
my ($mrow,$srow); |
my ($mrow,$srow); |
242 |
my ($have_mrow,$have_srow) = (0,0); |
# have_* |
243 |
my @pk_val; |
use constant NO_ROW => 0; |
244 |
|
use constant FETCH_ROW => 1; |
245 |
|
use constant HAVE_ROW => 2; |
246 |
|
my ($have_mrow,$have_srow) = (FETCH_ROW,FETCH_ROW); |
247 |
|
|
248 |
|
while ($have_mrow != NO_ROW || $have_srow != NO_ROW) { |
249 |
|
|
250 |
|
debug "have mrow: $have_mrow srow: $have_srow\n"; |
251 |
|
|
252 |
|
sub pk_val { |
253 |
|
my $row = shift || die "need row"; |
254 |
|
my @cols = shift || die "need cols"; |
255 |
|
my @val; |
256 |
|
foreach my $col (@cols) { |
257 |
|
push @val,$row->{$col}; |
258 |
|
} |
259 |
|
return @val; |
260 |
|
} |
261 |
|
|
|
my $more_rows = 1; |
|
|
while (!$have_mrow || !$have_srow) { |
|
262 |
# fetch row from master |
# fetch row from master |
263 |
if (!$have_mrow) { |
if ($have_mrow == FETCH_ROW) { |
264 |
print "fetch row from master [$more_rows]: $msql\n" if ($debug); |
debug "fetch row from master: $msql\n"; |
265 |
$mrow = $msth->fetchrow_hashref(); |
$mrow = $msth->fetchrow_hashref(); |
266 |
debug_row($mrow,@cols); |
debug_row($mrow,@cols); |
267 |
|
|
268 |
if ($mrow) { |
if ($mrow) { |
269 |
# fill-in primary key values |
# fill-in primary key values |
270 |
@pk_val = (); |
$have_mrow = HAVE_ROW; |
|
foreach my $col (@cols_pk) { |
|
|
push @pk_val,$mrow->{$col}; |
|
|
} |
|
|
$have_mrow = 1; |
|
271 |
} else { |
} else { |
272 |
$have_mrow = 0; |
$have_mrow = NO_ROW; |
273 |
} |
} |
274 |
} |
} |
275 |
|
|
276 |
# fetch row from slave |
# fetch row from slave |
277 |
if (!$have_srow) { |
if ($have_srow == FETCH_ROW) { |
278 |
print "fetch row from slave [$more_rows]: $ssql\n" if ($debug); |
debug "fetch row from slave: $ssql\n"; |
|
$ssth->execute(@pk_val) || die; |
|
279 |
$srow = $ssth->fetchrow_hashref(); |
$srow = $ssth->fetchrow_hashref(); |
280 |
debug_row($srow,@cols); |
debug_row($srow,@cols); |
281 |
if ($srow) { |
if ($srow) { |
282 |
$have_srow = 1; |
$have_srow = HAVE_ROW; |
283 |
} else { |
} else { |
284 |
$have_srow = 0; |
$have_srow = NO_ROW; |
285 |
} |
} |
286 |
} |
} |
287 |
|
|
288 |
# end of this table? |
debug "have mrow: $have_mrow srow: $have_srow\n"; |
|
if (!$have_mrow && !$have_srow) { |
|
|
last; |
|
|
} |
|
289 |
|
|
290 |
# insert into slave database |
# insert into slave database |
291 |
sub sql_insert { |
sub sql_insert { |
292 |
|
my $dbh = shift @_ || die "need dbh"; |
293 |
my $table = shift @_ || die "need table as argument"; |
my $table = shift @_ || die "need table as argument"; |
294 |
my $row = shift @_ || die "need row data"; |
my $row = shift @_ || die "need row data"; |
295 |
my @cols = @_; |
my @cols = @_; |
297 |
my $sql = "insert into $table (".join(",",@cols).") values ("; |
my $sql = "insert into $table (".join(",",@cols).") values ("; |
298 |
my $comma = ""; |
my $comma = ""; |
299 |
foreach my $col (@cols) { |
foreach my $col (@cols) { |
300 |
$sql .= $comma.$mdbh->quote($row->{$col}); |
$sql .= $comma.$dbh->quote($row->{$col}); |
301 |
$comma = ","; |
$comma = ","; |
302 |
} |
} |
303 |
$sql.=")"; |
$sql.=")"; |
307 |
|
|
308 |
# delete from slave database |
# delete from slave database |
309 |
sub sql_delete { |
sub sql_delete { |
310 |
|
my $dbh = shift @_ || die "need dbh"; |
311 |
my $table = shift @_ || die "need table as argument"; |
my $table = shift @_ || die "need table as argument"; |
312 |
my $row = shift @_ || die "need row as argument"; |
my $row = shift @_ || die "need row as argument"; |
313 |
my @cols_pk = @_; |
my @cols_pk = @_; |
314 |
|
|
315 |
my $where = sql_where(@cols_pk); |
my $where = sql_where(@cols_pk); |
316 |
|
|
317 |
my $sql = "delete from $table "; |
my $sql = "delete from $table"; |
318 |
foreach my $col (@cols_pk) { |
foreach my $col (@cols_pk) { |
319 |
my $val = $sdbh->quote($row->{$col}) || die "can't find value in row for col $col"; |
my $val = $dbh->quote($row->{$col}) || die "can't find value in row for col $col"; |
320 |
$where =~ s/\?/$val/; |
$where =~ s/\?/$val/; |
321 |
} |
} |
322 |
$sql .= $where; |
$sql .= $where; |
324 |
return $sql; |
return $sql; |
325 |
} |
} |
326 |
|
|
327 |
|
# update row in slave database |
328 |
|
sub sql_update { |
329 |
|
my $dbh = shift @_ || die "need dbh"; |
330 |
|
my $table = shift @_ || die "need table as argument"; |
331 |
|
my $col = shift @_ || die "need col to update"; |
332 |
|
my $row = shift @_ || die "need row"; |
333 |
|
my @cols_pk = @_; |
334 |
|
|
335 |
|
my $sql = "update $table set $col=".$dbh->quote($row->{$col}); |
336 |
|
my $where = sql_where(@cols_pk); |
337 |
|
foreach my $col (@cols_pk) { |
338 |
|
my $val = $dbh->quote($row->{$col}) || die "can't find value in row for col $col"; |
339 |
|
$where =~ s/\?/$val/; |
340 |
|
} |
341 |
|
$sql .= $where; |
342 |
|
debug_sql($sql); |
343 |
|
return $sql; |
344 |
|
} |
345 |
# master slave |
# master slave |
346 |
# 1 = 1 test |
# 1 = 1 test |
347 |
# 1 < 2 insert mrow |
# 1 < 2 insert mrow |
353 |
|
|
354 |
# check key cols for row |
# check key cols for row |
355 |
foreach my $col (@cols_pk) { |
foreach my $col (@cols_pk) { |
356 |
if ( (!$mrow && $srow) || ($mrow && $srow && ($mrow->{$col} gt $srow->{$col})) ) { |
if ( ($have_mrow == NO_ROW && $have_srow == HAVE_ROW) || |
357 |
|
($have_mrow == HAVE_ROW && $have_srow == HAVE_ROW && $mrow->{$col} gt $srow->{$col}) ) { |
358 |
$diff_row++; |
$diff_row++; |
359 |
$pk_same = 0; |
$pk_same = 0; |
360 |
print sql_delete($table,$srow,@cols_pk),"\n"; |
print STDERR "EXTRA row in table '$table' pk: [".join(",",@cols_pk)."] value (".join(",",pk_val($srow,@cols_pk)).")\n" if ($verbose); |
361 |
$have_srow = 0; # fetch new slave row |
print sql_delete($sdbh,$table,$srow,@cols_pk),";\n"; |
362 |
|
$have_srow = FETCH_ROW; |
363 |
last; |
last; |
364 |
} elsif ( ($mrow && !$srow) || ($mrow && $srow && ($mrow->{$col} lt $srow->{$col})) ) { |
} elsif ( ($have_mrow == HAVE_ROW && $have_srow == NO_ROW) || |
365 |
|
($have_mrow == HAVE_ROW && $have_srow == HAVE_ROW && $mrow->{$col} lt $srow->{$col}) ) { |
366 |
$diff_row++; |
$diff_row++; |
367 |
$pk_same = 0; |
$pk_same = 0; |
368 |
print sql_insert($table,$mrow,@cols),"\n"; |
print STDERR "MISSING row in table '$table' pk: [".join(",",@cols_pk)."] value (".join(",",pk_val($mrow,@cols_pk)).")\n" if ($verbose); |
369 |
$have_mrow = 0; |
print sql_insert($mdbh,$table,$mrow,@cols),";\n"; |
370 |
|
$have_mrow = FETCH_ROW; |
371 |
last; |
last; |
372 |
} |
} |
373 |
} |
} |
374 |
|
|
375 |
if ($pk_same) { |
if ($pk_same && $have_mrow == HAVE_ROW && $have_srow == HAVE_ROW) { |
376 |
# check non-key cols for row |
# check non-key cols for row |
377 |
foreach my $col (@cols_cmp) { |
foreach my $col (@cols_cmp) { |
378 |
if ($mrow->{$col} ne $srow->{$col}) { |
if ($mrow->{$col} ne $srow->{$col}) { |
379 |
$diff_row++; |
$diff_row++; |
380 |
print STDERR "DIFF in table '$table' row ($col): [".join(",",@pk_val)."] '$mrow->{$col}' != '$srow->{$col}'\n" if ($verbose); |
print STDERR "DIFF in table '$table' row ($col): [".join(",",@cols_pk)."] '$mrow->{$col}' != '$srow->{$col}'\n" if ($verbose); |
381 |
print sql_delete($table,$srow,@cols_pk),"\n"; |
print sql_update($mdbh,$table,$col,$mrow,@cols_pk),";\n"; |
|
print sql_insert($table,$mrow,@cols),"\n"; |
|
382 |
} |
} |
383 |
} |
} |
384 |
|
$have_mrow = FETCH_ROW; |
385 |
|
$have_srow = FETCH_ROW; |
386 |
} |
} |
387 |
} |
} |
388 |
|
|
390 |
$diff_total += $diff_row; |
$diff_total += $diff_row; |
391 |
} |
} |
392 |
|
|
393 |
print STDERR "$diff_total differences in all tables\n" if ($verbose && $diff_total > 0); |
if ($verbose) { |
394 |
|
if ($diff_total == 0) { |
395 |
|
print STDERR "databases are same"; |
396 |
|
} elsif ($diff_total > 0) { |
397 |
|
print STDERR "$diff_total differences in all tables\n"; |
398 |
|
} else { |
399 |
|
die "this shouldn't happend. please report a bug!"; |
400 |
|
} |
401 |
|
} |
402 |
|
|
403 |
|
# enable triggers again on slave |
404 |
|
foreach my $tr (@triggers) { |
405 |
|
print "update pg_trigger set tgenabled = true where tgname='$tr';\n"; |
406 |
|
} |
407 |
|
# end transaction |
408 |
|
print "commit;\n"; |
409 |
|
|
410 |
$mdbh->disconnect(); |
$mdbh->disconnect(); |
411 |
$sdbh->disconnect(); |
$sdbh->disconnect(); |