summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec21fad)
raw | patch | inline | side by side (parent: ec21fad)
author | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Mar 2009 11:42:47 +0000 (11:42 +0000) | ||
committer | janw <janw@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 12 Mar 2009 11:42:47 +0000 (11:42 +0000) |
Repair logic of move_table.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13540 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13540 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-si/modules/DBsqlite.pm | patch | blob | history |
index c0406c95fc38ebf738853712381822b691096cf5..0a4f5d97c4808b2992e194ef2583880ef06569de 100644 (file)
}
}
-
return 0;
}
# 2nd chance
eval {
- DBI->trace(2) if($main::verbose >= 7);
+ DBI->trace(6) if($main::verbose >= 7);
my $sth = $self->{dbh}->prepare($sql_statement);
my $res = $sth->execute();
@db_answer = @{$sth->fetchall_arrayref()};
# 3rd chance
eval {
- DBI->trace(2) if($main::verbose >= 7);
+ DBI->trace(6) if($main::verbose >= 7);
my $sth = $self->{dbh}->prepare($sql_statement);
my $res = $sth->execute();
@db_answer = @{$sth->fetchall_arrayref()};
my $sql_statement_drop = "DROP TABLE IF EXISTS $to";
my $sql_statement_alter = "ALTER TABLE $from RENAME TO $to";
+ my $success = 0;
- &main::daemon_log("INFO move_table called successfully! Exiting!",1 );
-
$self->lock();
eval {
$self->{dbh}->begin_work();
$self->{dbh}->do($sql_statement_drop);
$self->{dbh}->do($sql_statement_alter);
$self->{dbh}->commit();
+ $success = 1;
};
if($@) {
$self->{dbh}->rollback();
}
}
- eval {
- $self->{dbh}->begin_work();
- $self->{dbh}->do($sql_statement_drop);
- $self->{dbh}->do($sql_statement_alter);
- $self->{dbh}->commit();
- };
- if($@) {
- $self->{dbh}->rollback();
+ if($success == 0) {
eval {
- $self->{dbh}->do("ANALYZE");
+ $self->{dbh}->begin_work();
+ $self->{dbh}->do($sql_statement_drop);
+ $self->{dbh}->do($sql_statement_alter);
+ $self->{dbh}->commit();
+ $success = 1;
};
if($@) {
- &main::daemon_log("ERROR: 'ANALYZE' on database '".$self->{db_name}."' failed with $@", 1);
+ $self->{dbh}->rollback();
+ eval {
+ $self->{dbh}->do("ANALYZE");
+ };
+ if($@) {
+ &main::daemon_log("ERROR: 'ANALYZE' on database '".$self->{db_name}."' failed with $@", 1);
+ }
+ eval {
+ $self->{dbh}->do("VACUUM");
+ };
+ if($@) {
+ &main::daemon_log("ERROR: 'VACUUM' on database '".$self->{db_name}."' failed with $@", 1);
+ }
}
+ }
+
+ if($success == 0) {
eval {
- $self->{dbh}->do("VACUUM");
+ $self->{dbh}->begin_work();
+ $self->{dbh}->do($sql_statement_drop);
+ $self->{dbh}->do($sql_statement_alter);
+ $self->{dbh}->commit();
+ $success = 1;
};
if($@) {
- &main::daemon_log("ERROR: 'VACUUM' on database '".$self->{db_name}."' failed with $@", 1);
+ $self->{dbh}->rollback();
+ &main::daemon_log("0 ERROR: GOSA::DBsqlite::move_table crashed! Operation failed with $@", 1);
}
}
-
- eval {
- $self->{dbh}->begin_work();
- $self->{dbh}->do($sql_statement_drop);
- $self->{dbh}->do($sql_statement_alter);
- $self->{dbh}->commit();
- };
- if($@) {
- $self->{dbh}->rollback();
- &main::daemon_log("0 ERROR: GOSA::DBsqlite::move_table crashed! Operation failed with $@", 1);
- }
+
+ &main::daemon_log("0 INFO: GOSA::DBsqlite::move_table: Operation successful!", 7);
$self->unlock();
return;