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: quoted strings
Date: Jun 15 1999 2:16PM

Louis Proyect writes:
 > When I execute this from isql, the label "BatchID" precedes the actual
 > results.
 > 
 > Select distinct 'BatchID'= Batch_Identifier from IDI_BATCH_HEADER
 > 
 > But in sybperl, it doesn't. Am I to assume that this capability does not
 > exist?
 > 

Sure it does. Only in isql the results are printed and are
formatted. In sybperl you get the raw results, so you have to work
just a little bit to get the column name. You can get the column name
using various methods:

Sybase::DBlib
	$name = $dbh->dbcolname($colnum); # $colnum starts at 1 for
				# the first result column
	%data = $dbh->dbnextrow(TRUE);   # Pass TRUE to dbnextrow and it
        @names = keys(%data);      # returns a hash, keyed on the col 
				# names.

Sybase::CTlib
	@names = $dbh->ct_col_names;
	%data = $dbh->ct_fetch(CS_TRUE); # Pass CS_TRUE to ct_fetch and it
        @names = keys(%data);      # returns a hash, keyed on the col 
				# names.

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