From f258c8dc2b355a4d820c422b0ef08db42c195789 Mon Sep 17 00:00:00 2001 From: janw Date: Tue, 15 Apr 2008 14:17:24 +0000 Subject: [PATCH] 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 --- gosa-si/modules/DBsqlite.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; } -- 2.30.2