Merge branch 'add-dbi-logs-2455' into 'v2.0'
give more logs when prepare() or execute() fail (helps debugging #2455) See merge request lemonldap-ng/lemonldap-ng!198
This commit is contained in:
commit
f91ede4020
|
@ -54,8 +54,9 @@ sub load {
|
|||
$fields = $fields ? join( ",", @$fields ) : '*';
|
||||
my $sth =
|
||||
$self->_dbh->prepare(
|
||||
"SELECT field,value from " . $self->{dbiTable} . " WHERE cfgNum=?" );
|
||||
$sth->execute($cfgNum);
|
||||
"SELECT field,value from " . $self->{dbiTable} . " WHERE cfgNum=?" )
|
||||
or $self->logError;
|
||||
$sth->execute($cfgNum) or $self->logError;
|
||||
my ( $res, @row );
|
||||
while ( @row = $sth->fetchrow_array ) {
|
||||
$res->{ $row[0] } = $row[1];
|
||||
|
|
|
@ -36,8 +36,8 @@ sub available {
|
|||
my $sth =
|
||||
$self->_dbh->prepare( "SELECT DISTINCT cfgNum from "
|
||||
. $self->{dbiTable}
|
||||
. " order by cfgNum" );
|
||||
$sth->execute();
|
||||
. " order by cfgNum" ) or $self->logError;
|
||||
$sth->execute() or $self->logError;
|
||||
my @conf;
|
||||
while ( my @row = $sth->fetchrow_array ) {
|
||||
push @conf, $row[0];
|
||||
|
@ -105,8 +105,9 @@ sub unlock {
|
|||
sub delete {
|
||||
my ( $self, $cfgNum ) = @_;
|
||||
my $req =
|
||||
$self->_dbh->prepare("DELETE FROM $self->{dbiTable} WHERE cfgNum=?");
|
||||
my $res = $req->execute($cfgNum);
|
||||
$self->_dbh->prepare("DELETE FROM $self->{dbiTable} WHERE cfgNum=?")
|
||||
or $self->logError;
|
||||
my $res = $req->execute($cfgNum) or $self->logError;
|
||||
$Lemonldap::NG::Common::Conf::msg .=
|
||||
"Unable to find conf $cfgNum (" . $self->_dbh->errstr . ")"
|
||||
unless ($res);
|
||||
|
|
Loading…
Reference in New Issue
Block a user