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: Syb perl question
Date: Jan 16 2002 10:09PM

Hmmm:

perl -v

This is perl, version 5.005_02 built for i386-freebsd

/usr/local/bin/perl -I../../../lib/products -MCTtools -e '$db=new CTtools webuser, webuser, ecircles_plum; $data=$db->HashRow("select * from oem_circle_map where org_id=117"); $kv="circleId"; print "$data->{$kv}\n";'
107787

(CTtools is essentially like Sybase::Simple - HashRow returns a
hashref to one row fetched from the db...)

Michael

Scott Zetlan writes:
 > 5.005, which is outdated but still widely used.  I think it's fixed in 5.6.
 > 
 > > -----Original Message-----
 > > From: owner-SYBPERL-L@list.cren.net
 > > [mailto:owner-SYBPERL-L@list.cren.net]On Behalf Of Michael Peppler
 > > Sent: Wednesday, January 16, 2002 4:28 PM
 > > To: SybPerl Discussion List
 > > Subject: RE: Syb perl question
 > > 
 > > 
 > > Scott Zetlan writes:
 > >  > Also, depending on your Perl version (perl -v), the line:
 > >  > print "$row->{$kv}\n";
 > >  > will not do what you expect.  You'll see something like:
 > >  > HASH=0xafde9f->{keyname}
 > > 
 > > Ouch. I don't remember seeing that - which version of perl does that?
 > > 
 > > Michael
 > > 
 > > 
 > >  > > -----Original Message-----
 > >  > > From: owner-SYBPERL-L@list.cren.net
 > >  > > [mailto:owner-SYBPERL-L@list.cren.net]On Behalf Of Michael Peppler
 > >  > > Sent: Wednesday, January 16, 2002 4:04 PM
 > >  > > To: SybPerl Discussion List
 > >  > > Subject: Re: Syb perl question
 > >  > >
 > >  > >
 > >  > > Sabherwal, Balvinder (MBS) writes:
 > >  > >  > I have a code as
 > >  > >  >
 > >  > >  > foreach my $row (@$sysdb) {
 > >  > >  >  my @cols = keys(%$row);
 > >  > >  >  foreach my $kv (@cols) {
 > >  > >  >      print "$kv";
 > >  > >  >      if($kv eq "RSSD Dataserver"){
 > >  > >  >          $rsds="$row->{$_}";
 > >  > >  >          print "$row->{$_}";
 > >  > >  >      }
 > >  > >  >      else
 > >  > >  >      {
 > >  > >  >          $rsdb="$row->{$_}";
 > >  > >  >          print "$row->{$_}";
 > >  > >  >      }
 > >  > >  >
 > >  > >  >  }
 > >  > >  > }
 > >  > >  >
 > >  > >  > after execution I am not getting the data values for the
 > >  > > columns i.e. print
 > >  > >  > "$row->{$_}"; returns blank. Am I missing something??
 > >  > >
 > >  > > Yeah :-)
 > >  > >
 > >  > > Use $row->{$kv} - $_ never gets set in your loop.
 > >  > >
 > >  > > Michael
 > >  > > --
 > >  > > Michael Peppler - Data Migrations Inc. - 
 > http://www.mbay.net/~mpeppler
 >  > > mpeppler@peppler.org - mpeppler@mbay.net
 >  > > International Sybase User Group - http://www.isug.com
 >  > >
 >  > >
 >  > 
 > 
 > -- 
 > Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
 > mpeppler@peppler.org - mpeppler@mbay.net
 > International Sybase User Group - http://www.isug.com
 > 

-- 
Michael Peppler - Data Migrations Inc. - http://www.mbay.net/~mpeppler
mpeppler@peppler.org - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com