bheeshmaraja has asked for the wisdom of the Perl Monks concerning the following question:
I have a small subroutine which fetch user details from Sybase DB. Please find my below subroutine.. Is there any way to return the query results from the subroutine straight away without using @uids array and $i variables.
sub sa_details { $dbh=Sybase::DBlib->new("user", "passwd", "host"); $dbh->dbcmd("SELECT userid FROM user"); $dbh->dbsqlexec or die "Can't execute SQL statement:\n"; while($dbh->dbresults!=NO_MORE_RESULTS){ $i=0; while(@row=$dbh->dbnextrow){ @uids[$i] = $row[0]; $i++; } return @uids; } $dbh->dbclose } @array = sa_details();
Please help me to make this code efficiently(not lousy). Thanks... Bheeshmaraja
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sybase Perl DBI
by Anonymous Monk on Oct 18, 2012 at 09:06 UTC | |
|
Re: Sybase Perl DBI
by Anonymous Monk on Oct 18, 2012 at 20:15 UTC |