use a stored prepared sth instead of re-preparing it
This commit is contained in:
parent
e831c1563d
commit
2eb3c8ef6d
|
@ -544,8 +544,9 @@ sub logPrint {
|
|||
if ( $level <= $this->{databaseLevel} ) {
|
||||
if ( ( $this->{dbh} and $this->{dbh}->ping() ) or ( $this->{dbh} = ZoneMinder::Database::zmDbConnect() ) ) {
|
||||
|
||||
|
||||
my $sql = 'INSERT INTO Logs ( TimeKey, Component, Pid, Level, Code, Message, File, Line ) VALUES ( ?, ?, ?, ?, ?, ?, ?, NULL )';
|
||||
$this->{sth} = $this->{dbh}->prepare_cached($sql);
|
||||
$this->{sth} = $this->{dbh}->prepare_cached($sql) if ! $this->{sth};
|
||||
if ( !$this->{sth} ) {
|
||||
$this->{databaseLevel} = NOLOG;
|
||||
Error("Can't prepare log entry '$sql': ".$this->{dbh}->errstr());
|
||||
|
|
Loading…
Reference in New Issue