Hello,
i'm trying to make a class to do select/insert/delete/update on a MySQL table (via
DBI).
this is a snip of code:
sub query{
my $self = shift;
my($sql) = @_;
my @result;
my $sth = $self->{dbh}->prepare($sql) or return undef;
if($sql =~ /delete|insert/gi){
$sth->execute() or return undef;
my $rows = $sth->rows;
($rows == 0) ? "0E0" : $rows;
} else {
$sth->execute() or return undef;
my @row;
while(@row = $sth->fetchrow_array){
foreach my $i (0..$#row){
push(@result,$row[$i]);
}
}
$sth->finish();
return @result;
}
}
I like to receive an opnion or someone to indicate me something similars.
Thnak you
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>