in reply to Small Doubt Regarding Select Staement in DB

sub select_db{ my ($self,$sel) = @_; return $self->{_dbh}->selectall_arrayref($sel); }

Replies are listed 'Best First'.
Re^2: Small Doubt Regarding Select Staement in DB
by ikegami (Patriarch) on Nov 03, 2008 at 09:45 UTC
    I should have mentioned it's pretty dangerous to do things this way since you can't avail yourself of replaceable parameters. Here are two alternate solutions:
    • Let the user call selectall_arrayref (or whatever):

      sub dbh{ my ($self) = @_; return $self->{_dbh}; }
    • Accept the same parameters as selectall_arrayref:

      sub select_db{ my $self = shift; return $self->{_dbh}->selectall_arrayref(@_); }