- add parameters to query()
authorAndreas Scherbaum <[email protected]>
Mon, 27 Feb 2012 00:44:36 +0000 (01:44 +0100)
committerAndreas Scherbaum <[email protected]>
Mon, 27 Feb 2012 00:44:36 +0000 (01:44 +0100)
db.pm

diff --git a/db.pm b/db.pm
index 580d8384dae4588ce520abc070c58bbed6b7589a..e29f38f425805fec54829306d703cf1fa3200636 100644 (file)
--- a/db.pm
+++ b/db.pm
@@ -289,6 +289,10 @@ sub do {
 sub query {
     my $self = shift;
     my $query = shift;
+    my @param = ();
+    if (defined($_[0])) {
+        @param = @_;
+    }
 
     main::print_msg("Execute database query: $query", DEBUG2);
 
@@ -298,7 +302,7 @@ sub query {
     }
 
     my $st = $self->{db_connection}->prepare($query);
-    if (!$st->execute) {
+    if (!$st->execute(@param)) {
         main::print_msg("Could not execute database query", ERROR);
         return undef;
     }