From: Anti V. <du...@us...> - 2004-11-08 22:06:08
|
Update of /cvsroot/tuxaator/tuxaator/Plugins/Dict In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12636 Modified Files: Plugin.pm Log Message: + check for errors and die if one occurs Index: Plugin.pm =================================================================== RCS file: /cvsroot/tuxaator/tuxaator/Plugins/Dict/Plugin.pm,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** Plugin.pm 30 Mar 2004 20:37:06 -0000 1.14 --- Plugin.pm 8 Nov 2004 22:05:49 -0000 1.15 *************** *** 123,126 **** --- 123,129 ---- my $sth = $self->{'core'}->{'dbh'}->prepare($query); $sth->execute(); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } my $rows = $sth->rows(); $self->{'core'}->queue($event,"Andmebaasis on $rows definitsiooni"); *************** *** 142,145 **** --- 145,152 ---- my $sth = $self->{'core'}->{'dbh'}->prepare("SELECT term FROM terms ORDER BY changed DESC LIMIT 30"); $sth->execute(); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } + # how many answers? my $rows = $sth->rows(); *************** *** 169,172 **** --- 176,182 ---- my $sth = $self->{'core'}->{'dbh'}->prepare("SELECT * FROM terms WHERE term = ?"); $sth->execute($argstring); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } my $rows = $sth->rows(); # mitu vastust leiti? if ($rows == 1) *************** *** 220,223 **** --- 230,236 ---- my $sth = $self->{'core'}->{'dbh'}->prepare("INSERT INTO history (term,story,counter,nick,userhost,changed) SELECT term,story,counter,nick,userhost,changed FROM terms WHERE term = ?"); $sth->execute($term); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } $sth = $self->{'core'}->{'dbh'}->prepare("UPDATE terms SET story='',nick=?,userhost=?,changed=now() WHERE term = ?"); if ($sth->execute($event->nick,$userhost,$term)) *************** *** 282,285 **** --- 295,301 ---- $sth = $self->{'core'}->{'dbh'}->prepare("INSERT INTO history (term,story,counter,nick,userhost,changed) SELECT term,story,counter,nick,userhost,changed FROM terms WHERE term = ?"); $sth->execute($term); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } $sth = $self->{'core'}->{'dbh'}->prepare("UPDATE terms SET story = ?,nick = ?,userhost = ?,changed = now() where term = ?"); if ($sth->execute($definition,$nick,$userhost,$term)) *************** *** 334,337 **** --- 350,356 ---- $sth = $self->{'core'}->{'dbh'}->prepare("INSERT INTO history (term,story,counter,nick,userhost,changed) SELECT term,story,counter,nick,userhost,changed FROM terms WHERE term = ?"); $sth->execute($term); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } $sth = $self->{'core'}->{'dbh'}->prepare("UPDATE terms SET story = ?,nick = ?,userhost = ?,changed = now() where term = ?"); *************** *** 516,519 **** --- 535,541 ---- my $sth = $self->{'core'}->{'dbh'}->prepare($query); $sth->execute($arg); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } $story = $def->{'story'}; $term = $def->{'term'}; *************** *** 595,598 **** --- 617,623 ---- my $sth = $self->{'core'}->{'dbh'}->prepare("SELECT id,nick, changed FROM history WHERE term = ? ORDER BY changed DESC"); $sth->execute($term); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } my $rows = $sth->rows(); *************** *** 645,648 **** --- 670,676 ---- $sth = $self->{'core'}->{'dbh'}->prepare($query); $sth->execute($term,$revision); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } } else *************** *** 651,654 **** --- 679,685 ---- $sth = $self->{'core'}->{'dbh'}->prepare($query); $sth->execute($term); + if (!$sth) { + die "Error:" . $self->{'core'}->{'dbh'}->errstr . "\n"; + } } |