index 4c3dd589d5cf20f5c7ef4ef4b4a72ee90ebee786..7a7f67f7e36c5c7c9738fafeeef1cfb017809181 100644 (file)
if($recreate_table) {
$self->{dbh}->do("DROP TABLE $table_name");
}
- my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( $col_names_string )";
+ my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( $col_names_string ) ENGINE=INNODB";
# &main::daemon_log("DEBUG: $sql_statement");
eval {
$self->{dbh}->do($sql_statement);
my @db_answer;
# print STDERR Dumper($sql_statement);
- eval {
+# eval {
if($sql_statement =~ /^SELECT/i) {
- $sth = $self->{dbh}->prepare($sql_statement) or &main::daemon_log("ERROR: Preparation of statement '$sql_statement' failed!", 1);
- $sth->execute or &main::daemon_log("ERROR: Execution of statement '$sql_statement' failed!", 1);
+ $sth = $self->{dbh}->prepare($sql_statement) or &main::daemon_log("0 ERROR: Preparation of statement '$sql_statement' failed!", 1);
+ $sth->execute or &main::daemon_log("0 ERROR: Execution of statement '$sql_statement' failed!", 1);
if($sth->rows > 0) {
- @db_answer = @{ $sth->fetchall_arrayref() } or &main::daemon_log("ERROR: Fetch() failed!", 1);
+ @db_answer = @{ $sth->fetchall_arrayref() } or &main::daemon_log("0 ERROR: Fetch() failed!", 1);
# print STDERR Dumper(@db_answer);
}
- $sth->finish or &main::daemon_log("ERROR: Finishing the statement handle failed!", 1);
+ $sth->finish or &main::daemon_log("0 ERROR: Finishing the statement handle failed!", 1);
} else {
$self->{dbh}->do($sql_statement);
}
- };
- if($@) {
- &main::daemon_log("ERROR: $sql_statement failed with '$@'", 1);
- }
+# };
+# if($@) {
+# &main::daemon_log("0 ERROR: '$sql_statement' failed with '$@'", 1);
+# }
# TODO : maybe an error handling and an erro feedback to invoking function
my $error = $self->{dbh}->err;
if ($error) {
- &main::daemon_log("ERROR: ".@$self->{dbh}->errstr, 1);
+ &main::daemon_log("0 ERROR: ".@$self->{dbh}->errstr, 1);
}
return \@db_answer;