Code

Add error handling to the create_table function of the DBsqlite module,
[gosa.git] / trunk / gosa-si / modules / DBsqlite.pm
index e6ec1048c289149ddeb576211a72b3b491c8b3a6..4b8f60a66762295dd3049c06bb570ccb4a20ee92 100644 (file)
@@ -133,11 +133,19 @@ sub create_table {
        my $col_names_string = join(", ", @col_names);
        my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( $col_names_string )"; 
        my $res = $self->exec_statement($sql_statement);
+       if ($@) {
+               &main::daemon_log("0 ERROR: CREATE TABLE IF NOT EXISTS $table_name failed", 1);
+               return 1;
+       }
        
        # Add indices
        if(defined($index_names_ref) and ref($index_names_ref) eq 'ARRAY') {
                foreach my $index_name (@$index_names_ref) {
                        $self->exec_statement("CREATE ".(($index_name eq 'id')?'UNIQUE':'')." INDEX IF NOT EXISTS $index_name on $table_name ($index_name);");
+                       if ($@) {
+                               &main::daemon_log("0 ERROR: CREATE $index_name on $table_name failed", 1);
+                               return 1;
+                       }
                }
        }