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: =?iso-8859-1?Q?Pochet_Fr=E9d=E9ric?= <Frederic dot Pochet at cockerill-sambre dot com>
Subject: RE: passing $dbh around
Date: Jun 11 1999 11:04AM


First of all, you have to know that the text type in a sybase sql server is
not a type like the other. The sybase string function doesn't work with text
col (they are working on the first 255 character).

You have 3 possibilities:
	- retrieve all row in perl (thanks Michael) and test them with
	- having no text col but char col (keep out, the string "a_char_col
like %blabla%" will be interpreted by perl. You have to write "a_char_col
like \%blabla\%" or with the single quote as delimiter (saying perl not to
interpret the string))
	- having a second table with key word

For the first solution, you 'll find below an example of how to get text
col. see also the pod (perldoc sybperl).

	$dbh->ct_execute("select id, not_a_text_col, a_text_col from
my_table"); ## keep out, all text col have to be the last col of the select

	while($dbh->ct_results($restype,0) == CS_SUCCEED)  { ## 0 = not to
bind text col
	  next unless($dbh->ct_fetchable($restype));
	  while(@row = $dbh->ct_fetch()) {
	     ($ret, $a_text_col) = $dbh -> ct_get_data(3); ## 3 = col num in
the select
		some action

Best regard


> ----------
> De : 	David Hajoglou[]
> Répondre à :
> Date :	jeudi 10 juin 1999 22:59
> A :	SybPerl Discussion List
> Objet :	passing $dbh around
> To all knowing list,
> We have decided against persistant database handles (after all of my toil
> with them).  So, I have a question:
> What is the best way to pass a database handle around to different
> modules?  Or reference the same one across functions?  i.e.
> script
> ...
> $var = &itel::itel_lib::somefunc($dbh);
> ...
> is there a way to make a pointer to the original handle?  If this is
> documented somewhere then just point me there.
> Thank You
> David Hajoglou