remove truncate routine, will no use

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@5582 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
lissav 2010-03-25 17:47:05 +00:00
parent 10c218b70d
commit c9e5a7a9d2

View File

@ -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;