Use more modern techniques
authorJoey Schulze <joey@infodrom.org>
Sun, 11 Feb 2007 18:57:40 +0000 (18:57 +0000)
committerJoey Schulze <joey@infodrom.org>
Sun, 11 Feb 2007 18:57:40 +0000 (18:57 +0000)
src/InfoCon/buch/infocon

index a19cd22..f1fe103 100755 (executable)
@@ -242,6 +242,8 @@ sub buchung_input
     my ($date_sec,$date_min,$date_hour,$date_mday,$date_mon,$date_year,$date_wday,$date_isdst)
        = localtime();
 
     my ($date_sec,$date_min,$date_hour,$date_mday,$date_mon,$date_year,$date_wday,$date_isdst)
        = localtime();
 
+    $sth = $dbh->prepare ("INSERT INTO $table VALUES (?,?,?,?,?,?,?,?,?)");
+
     print "Buchungseingabe\n\n";
     while ($weiter =~ /[JjYy1]/) {
        $i=0;while ($i <= $#fieldname) {
     print "Buchungseingabe\n\n";
     while ($weiter =~ /[JjYy1]/) {
        $i=0;while ($i <= $#fieldname) {
@@ -288,10 +290,8 @@ sub buchung_input
            $input[6] *= -1 if ($input[6] > 0);
        }
 
            $input[6] *= -1 if ($input[6] > 0);
        }
 
-       $query = sprintf ("INSERT INTO $table VALUES (%d,'%s','%s','%s',%8.2f,%8.2f,%8.2f,%d,%d)",
-                         &get_next_nr(), &date_to_string($input[0]), $input[1], $input[2], $input[4],
+       $sth->execute (&get_next_nr(), &date_to_string($input[0]), $input[1], $input[2], $input[4],
                          $input[5], $input[6], 1, $input[7]);
                          $input[5], $input[6], 1, $input[7]);
-       $sth = $dbh->do($query);
        $weiter = &read_input("Weiter",'j');
        $input[5] = 0.0;
     }
        $weiter = &read_input("Weiter",'j');
        $input[5] = 0.0;
     }