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: Sybperl - Reference Question
Date: Mar 27 2000 2:35PM

Stephen_Schavrien@harvardpilgrim.org writes:
 > 
 > 
 > Hi,
 > 
 > I have asked this question to all four user groups listed in Massachusetts
 > without a single reply.

You should probably have directed this question to the sybperl mailing 
list (sybperl-l@list.cren.net).



[discussing using dbnextrow(1,1) instead of dbnextrow(0,0) ]

 >      I understand the first value of dbnextrow but do not understand of the
 > second value except it  returns a reference.
 > 
 > What is the advantage of using this ?  While ($ref = $dbh->dbnextrow(1,1))
 > since we are only writing the column/s value with a newline: Print MOO
 > $$ref{claim_Status_file}, ?\n?;

Passing a first param of 1 to dbnextrow makes it return a hash, keyed
on the column names. Although this slows the process down a bit (the
array that is returned is by definition twice as large, with the key,
value pairs) this makes writing the rest of the code very simple, as
you don't have to remember where in the array a certain column is
located (ie you say $data{claim_status_file} instead of $data[3]
[assuming claim_status_file is the fourth column of the output]).

The second argument to dbnextrow() is a performance enhacement that is 
valid in certain cases. What this does is to pre-allocate an array,
and the fill the *sam* array for each iteration that calls
dbnextrow(), returning a reference to this array.

This will speed up any fetch loop where the data is immediately
processed in the loop, which appears to be your case.

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