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: David Waldo <waldo at cos dot com>
Subject: Problems with dbretdata
Date: May 5 1998 3:44PM

We are having problems using the dbretdata call in
We are using sybperl 2.09_04 and cannot get dbretdata to return 
any output parameters. We've tried calling it with and without 
an argument (ie, return a hash or a list), but still get nothing. 
Please look at the sample script below. Are we calling it correctly? 
We are on Digital DEC OSF. Are there any know problems on this platform 
(we are aware of the old compilation problems with CTlib on Digital)?

We are calling the 'sql' utility method and then calling dbretdata.
Is there a problem with this usage?

Please help. This is frustrating.

Here are the details:

A sample perl script:

#!/usr/local/bin/perl -w

use Sybase::DBlib;
use Data::Dumper;

$SERVER ='foo';
$USER = 'foo';
$PASSWD ='foo';
$DB = 'foo';

$query1 = '
declare @param1 int, @param2 char(5),
@param3 datetime, @param4 float,
@param5 varchar(200),
@_result int

exec @_result = esa..paramstest
 @a = @param1 output,
 @b = @param2 output,
 @c = @param3 output,
 @d = @param4 output,
 @e = @param5 output

select @param1, @param2, @param3, @param4, @param5 

if @_result != 0
 print "ERROR"

$syb = new Sybase::DBlib($USER, $PASSWD, $SERVER);

$result = $syb->sql($query1);
print "Results:\n", Dumper($result), "\n";

%params = $syb->dbretdata(1);
print "Params:\n", Dumper(\%params), "\n";

The sample perl script output:

$VAR1 = [
            'fred ',
            'May  5 1998 11:03:30:473AM',
            'variable length string'

$VAR1 = {};

The paramstest stored proc:
create procedure paramstest
(@a int output,
 @b char(5) output,
 @c datetime output,
 @d float output,
 @e varchar(200) output


select	@a = 1, 
	@b = 'fred', 
	@c = getdate(), 
	@d = 5.4, 
	@e = 'variable length string'

return (0)
output of perl -V:

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
    osname=dec_osf, osvers=4.0, archname=alpha-dec_osf
    uname='osf1 v4.0 878 alpha '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
    cc='cc', optimize='-O4', gccversion=
    cppflags='-std -D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
    ccflags ='-std -D_INTRINSICS -I/usr/local/include -D__LANGUAGE_C__'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /usr/shlib /shlib /lib /usr/lib /usr/ccs/lib
    libs=-ldbm -lm
    libc=/usr/shlib/, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-shared -expect_unresolved "*" -O4 -msym -s -L/usr/local/lib'

Characteristics of this binary (from libperl): 
  Built under dec_osf
  Compiled at May  4 1998 23:50:26