Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at MBAY dot NET>
Subject: Re: returning associative arrays from ct_sql
Date: Jan 21 1999 7:51PM

>>>>> "Don" == Don Hosek  writes:

Don> OK, the secret was that undef in parameter two.  Now why not just
Don> say @rows=$dbh->ct_sql(etc.)  rather than $rows= and then access
Don> it as @$rows? The @rows= syntax does work & is much more
Don> intuitive to the reader.

It's slower for large arrays. If you say @rows = $dbh->ct_sql() then
perl has to push the entire array on the stack. If you say $rows =
$dbh->ct_sql() perl only pushes one value, the pointer to the array.


Don> Michael Peppler wrote:
>> >>>>> "Don" == Don Hosek  writes:
Don> @rows=ct_sql('select etc.',,1) is apparently not the route to
Don> take to do the job. Sigh. What do I need to do here?
>> How about:
>> $rows = $dbh->ct_sql("select ...", undef, 1); foreach (@$rows) {
>> ...  }

Don> Well, that solved one of the problems, but what I'm wondering is
Don> why

Michael Peppler         -||-  Data Migrations Inc.       -||-
Int. Sybase User Group  -||-
Sybase on Linux mailing list: