PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: @res?
Date: May 19 1999 7:32PM

Louis Proyect writes:
 > >That said, you should probably use
 > >
 > >	$dbh->sql(...);
 > >
 > >instead. The return value is a little different, but you should be
 > >able to use it a lot better.
 > 
 > The &sql approach worked fine, but when I tried this:
 > 
 > ==========
 > #!/usr/local/bin/perl 
 > use Sybase::DBlib;
 > $dbh = Sybase::DBlib->dblogin("xxx", "yyy", "zzz");
 > @res = $dbh->sql("sp_helpdb");
 > print @res;
 > ===========
 > 
 > I got this:
 > 
 > ARRAY(0x20093590)ARRAY(0x20078588)ARRAY(0x2007b938)ARRAY(0x2007b998)ARRAY(0x
 > 2007ba40)ARRAY(0x2007baa0)ARRAY(0x2007bb00)ARRAY(0x2007bb60)ARRAY(0x2007bbc0
 > )ARRAY(0x2007bc20)ARRAY(0x2007bc80)ARRAY(0x2007bce0)ARRAY(0x2007bd40)
 > 

sql() returns an array of references.

You process it like this:

foreach $row (@res) {
    print "@$row\n";   # each element in the @res array is a reference 
			# to an array...
}

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com