diff --git a/perl-xCAT/xCAT/Table.pm b/perl-xCAT/xCAT/Table.pm index 854f056b3..a8d577b3d 100644 --- a/perl-xCAT/xCAT/Table.pm +++ b/perl-xCAT/xCAT/Table.pm @@ -3230,63 +3230,5 @@ sub getAutoIncrementColumns { return @ret; } -#-------------------------------------------------------------------------- - -=head3 truncate - - Description:truncates the input table ( removes all entries, but does - not drop the table) - - - Arguments: - Table Handle - Returns: - - Globals: - - Error: - - Example: - my $table=xCAT::Table->new("eventlog"); - $table->truncate(); - Comments: - TODO : NEED to add code for CSV and test - -=cut - -#-------------------------------------------------------------------------------- -sub truncate -{ - #takes table handle - my $self = shift; - my $xcatcfg =get_xcatcfg(); - my $notif = xCAT::NotifHandler->needToNotify($self->{tabname}, 'd'); - # TODO add notification - # truncate the table - my $trunstring; - if ($xcatcfg =~ /^SQLite:/) { - $trunstring = 'DROP Table ' . $self->{tabname}; - my $stmt = $self->{dbh}->prepare($trunstring); - $stmt->execute; - $stmt->finish; - if (!$self->{dbh}->{AutoCommit}) { - $self->{dbh}->commit; - } - my $self=xCAT::Table->new($self->{tabname}); # create table - return ; - } else { - if ($xcatcfg =~ /^DB2:/){ # does not support TRUNCATE - $self->{tabname} =~ tr/a-z/A-Z/; - $trunstring = 'DROP TABLE ' . q(") . $self->{tabname} . q("); - } else { # mysql/postgresql/CVS - $trunstring = 'TRUNCATE TABLE ' . $self->{tabname}; - } - my $stmt = $self->{dbh}->prepare($trunstring); - $stmt->execute; - $stmt->finish; - $self->commit; - } - return ; -} 1;