develooper Front page | perl.beginners | Postings from February 2002

array question and ODBC note

Thread Next
From:
John
Date:
February 13, 2002 13:19
Subject:
array question and ODBC note
Message ID:
jUsT.aNoTheR.mEsSaGe.iD.10136351456590@jpw3.com
Recently someone pointed out that it's better to use:

while( defined( my $line = <HANDLE> ))

than 

while( my $line = <HANDLE> )

so I have been moving towards this.  I noticed that with arrays, 
such as:

while( defined( my @data = $sth->fetchrow_array()))

this does not work - @data is defined (as a zero item array?) even 
when no record is returned.  Is the correct coding:

while( defined( my @data = $sth->fetchrow_array()) && $#data > -1 )

or something else, or is this just a waste of effort since:

while( my @data = $sth->fetchrow_array())

does seem to work?

Also it took a while but we found a workaround to the ODBC DBD not 
handling return parameters from stored procedures - instead of using 
return parameters, have the stored procedure return a result set,
then use execute to get a statement handler instead of do to get 
a return value, then loop through the result set in the statement 
handler.








Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About