From: janw Date: Tue, 15 Apr 2008 14:17:24 +0000 (+0000) Subject: Implemented function move_table. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=f258c8dc2b355a4d820c422b0ef08db42c195789;p=gosa.git Implemented function move_table. Drop table if exists for create_table git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10481 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/modules/DBsqlite.pm b/gosa-si/modules/DBsqlite.pm index cf53043a0..09ef7404a 100644 --- a/gosa-si/modules/DBsqlite.pm +++ b/gosa-si/modules/DBsqlite.pm @@ -44,7 +44,8 @@ sub create_table { $col_names->{ $table_name } = $col_names_ref; my $col_names_string = join("', '", @col_names); - my $sql_statement = "CREATE TABLE IF NOT EXISTS $table_name ( '$col_names_string' )"; + my $sql_statement = "CREATE TABLE $table_name ( '$col_names_string' )"; + $self->{dbh}->do("DROP TABLE IF EXISTS $table_name"); $self->{dbh}->do($sql_statement); return 0; } @@ -267,6 +268,8 @@ sub move_table { my $sql_statement_drop = "DROP TABLE IF EXISTS $to"; my $sql_statement_alter = "ALTER TABLE $from RENAME TO $to"; + $self->{dbh}->do($sql_statement_drop); + $self->{dbh}->do($sql_statement_alter); return; }