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: "Erik Wendelboe" <erik at wendelboe dot com>
Subject: RE: Too many output parameters?
Date: Sep 23 2005 12:40AM

Thanks for looking into this.  I have the output from the trace(5), but I
haven't had any luck getting the core file formatted yet, 'adb' doesn't seem
to be able to find a stack in the core file.  Hopefully the trace will help
you a little.

Thanks again!

Output from trace(5):
-> prepare for DBD::Sybase::db
(DBI::db=HASH(0x8000000100446b20)~0x80000001004b6298 'declare @script
varchar(80), @options varchar(80), @arg1 varchar(40)
@arg2 varchar(40), @arg3 varchar(40), @arg4 varchar(40), @arg5 varchar(40) 
@arg6 varchar(40) 
exec sp_get_commandline_30 'WW', 'WW', 'cdo_msg_cdolite', 
@script output, 
@options output, 
@a...') thr#800000010001a0a8 
New DBI::st (for DBD::Sybase::st, parent=DBI::db=HASH(0x80000001004b6298),
04b6610), DBD::Sybase::st, 80000001004b63d0, Null!)
dbih_make_com(DBI::db=HASH(0x80000001004b6298), 80000001004eab30,
DBD::Sybase::st, 512, 0) thr#800000010001a0a8 
dbih_setup_attrib(DBI::st=HASH(0x80000001004b6610), Err,
DBI::db=HASH(0x80000001004b6298)) SCALAR(0x80000001001ffc48) (already
dbih_setup_attrib(DBI::st=HASH(0x80000001004b6610), State,
DBI::db=HASH(0x80000001004b6298)) SCALAR(0x80000001001ffcc8) (already
dbih_setup_attrib(DBI::st=HASH(0x80000001004b6610), Errstr,
DBI::db=HASH(0x80000001004b6298)) SCALAR(0x80000001001ffc88) (already
dbih_setup_attrib(DBI::st=HASH(0x80000001004b6610), TraceLevel,
DBI::db=HASH(0x80000001004b6298)) 0 (already defined)
dbih_setup_attrib(DBI::st=HASH(0x80000001004b6610), FetchHashKeyName,
DBI::db=HASH(0x80000001004b6298)) 'NAME' (already defined)
dbih_setup_attrib(DBI::st=HASH(0x80000001004b6610), HandleSetErr,
DBI::db=HASH(0x80000001004b6298)) undef (not defined)
dbih_setup_attrib(DBI::st=HASH(0x80000001004b6610), HandleError,
DBI::db=HASH(0x80000001004b6298)) undef (not defined)
<- prepare= DBI::st=HASH(0x80000001004b64d0) at
/opt/WFM/WFM4ERIK/bin/ line 594 via /opt/WFM/WFM4ERIK/bin/
line 48
-> execute for DBD::Sybase::st
(DBI::st=HASH(0x80000001004b64d0)~0x80000001004b6610) thr#800000010001a0a8 
syb_alloc_cmd() -> CS_COMMAND 4ef9c0 for CS_CONNECTION 4ec6f0 
syb_st_execute() -> ct_command() OK 
syb_st_execute() -> ct_send() OK 
st_next_result() -> ct_results(4043) == 1 
ct_res_info() returns 1 columns 
ct_describe(0): type = 8, maxlen = 4 
describe() -> col 0, type 8, realtype 8 
describe() retcode = 1 
st_next_result() -> lasterr = 0, lastsev = 0 
<- execute= -1 at /opt/WFM/WFM4ERIK/bin/ line 595 via
/opt/WFM/WFM4ERIK/bin/ line 48 
-> fetch for DBD::Sybase::st
(DBI::st=HASH(0x80000001004b64d0)~0x80000001004b6610) thr#800000010001a0a8 
dbih_setup_fbav for 1 fields => 0x800000010001c678 
syb_st_fetch() -> 0/4/8 
<- fetch= [ 0 ] row1 at /opt/WFM/WFM4ERIK/bin/ line 600 via
/opt/WFM/WFM4ERIK/bin/ line 48 
-> fetch for DBD::Sybase::st
(DBI::st=HASH(0x80000001004b64d0)~0x80000001004b6610) thr#800000010001a0a8 
st_next_result() -> ct_results(4042) == 1 
ct_res_info() returns 8 columns 
ct_describe(0): type = 0, maxlen = 80 
describe() -> col 0, type 0, realtype 0 
ct_describe(1): type = 0, maxlen = 80 
describe() -> col 1, type 0, realtype 0 
ct_describe(2): type = 0, maxlen = 40 
describe() -> col 2, type 0, realtype 0 
ct_describe(3): type = 0, maxlen = 40 
describe() -> col 3, type 0, realtype 0 
ct_describe(4): type = 0, maxlen = 40 
describe() -> col 4, type 0, realtype 0 
ct_describe(5): type = 0, maxlen = 40 
describe() -> col 5, type 0, realtype 0 
ct_describe(6): type = 0, maxlen = 40 
describe() -> col 6, type 0, realtype 0 
ct_describe(7): type = 0, maxlen = 40 
describe() -> col 7, type 0, realtype 0 
describe() retcode = 1 
st_next_result() -> lasterr = 0, lastsev = 0 
syb_st_fetch() -> st_next_results() == 4042 
<- fetch= undef row2 at /opt/WFM/WFM4ERIK/bin/ line 603 via
/opt/WFM/WFM4ERIK/bin/ line 48 
-> FETCH for DBD::Sybase::st (DBI::st=HASH(0x80000001004b6610)~INNER
'syb_more_results') thr#800000010001a0a8 
<- FETCH= 1 at /opt/WFM/WFM4ERIK/bin/ line 598 via
/opt/WFM/WFM4ERIK/bin/ line 48 
-> fetch for DBD::Sybase::st
(DBI::st=HASH(0x80000001004b64d0)~0x80000001004b6610) thr#800000010001a0a8  

-----Original Message-----
From: [] On
Behalf Of
Sent: Wednesday, September 21, 2005 10:58 PM
Subject: Re: Too many output parameters?

I don't think that this code should cause any problems. It would be nice to
have the following data to further help with debugging this issue:

1. The output from a run with DBI->trace(5) enabled.

2. The stack trace from the core dump to see where the segfault occurs.


Internet - 22/09/2005 02:03

Sent by:

To:    sybperl-l


Subject:    Too many output parameters?


I am new to this list, and fairly new to Perl/Sybase development.  I am
maintaining an inherited program that worked like a champ, until we upgraded
(long overdue) our Perl version from 5.005_03 to 5.8.3, and reinstalled the
Sybase DBI/DBD (DBI version is 1.48, and DBD version is 1.04).  We are
running on HP-UX 11.11, and are using Sybase 12.5.

While debugging, I found that most stored procedure calls worked just fine,
only one had a problem, resulting in a Memory Fault, and coredump :-(

I found that the stored procedure that caused the coredump returned 8 output
parameters.   After poking around some, I found that by reducing the output
parameters to 5, everything worked perfectly.  I cowardly re-wrote the
stored procedure into 2 different sprocs, each returning 5 output
parameters, calling one right after the other.  It works fine, but I did it
just to keep the project going, it makes me nervous that I don't know why it
is working/not working.

Any pointers and/or help is appreciated.

Erik Wendelboe

Here is the code that calls the original stored procedure (I know I don't
test for the result type before I move it, I put in a check for that, but it
didn't make any difference.  I just wanted to show the original code, before
I 'mangled' it too much…):

sub GetCommandLine{
my($scope, $area, $temp_file) = @_;
my($tmp1, $tmp2, $key);
my($file_name, $file_date, $file_counter) = GetFileDateCounter($temp_file);
my($sql) = "declare \@script varchar(80), \@options varchar(80), \@arg1
\@arg2 varchar(40), \@arg3 varchar(40), \@arg4 varchar(40), \@arg5
\@arg6 varchar(40)\n
exec sp_get_commandline_30 '$scope', '$area', '$file_name', \@script output,
\@options output,
\@arg1 output,
\@arg2 output,
\@arg3 output,
\@arg4 output,
\@arg5 output,
\@arg6 output\n";
$sql = $DBH->prepare("$sql");
do {
while($data = $sql->fetch)
$command_array{"script"} = $data->[0];
$command_array{"options"} = $data->[1];
$command_array{"arg1"} = $data->[2];
$command_array{"arg2"} = $data->[3];
$command_array{"arg3"} = $data->[4];
$command_array{"arg4"} = $data->[5];
$command_array{"arg5"} = $data->[6];
$command_array{"arg6"} = $data->[7];
} while ($sql->{syb_more_results});

This message and any attachments (the "message") isintended solely for the
addressees and is confidential. If you receive this message in error, please
delete it and immediately notify the sender. Any use not in accord with its
purpose, any dissemination or disclosure, either whole or partial, is
prohibited except formal approval. The internetcan not guarantee the
integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will)
not therefore be liable for the message if modified. 
Ce message et toutes les pieces jointes (ci-apres le "message") sont etablis
a l'intention exclusive de ses destinataires et sont confidentiels. Si vous
recevez ce message par erreur, merci de le detruire et d'en avertir
immediatement l'expediteur. Toute utilisation de ce message non conforme a
sa destination, toute diffusion ou toute publication, totale ou partielle,
est interdite, sauf autorisation expresse. L'internet ne permettant pas
d'assurer l'integrite de ce message, BNP PARIBAS (et sesfiliales)
decline(nt) toute responsabilite au titre de ce message, dans l'hypothese ou
il aurait ete modifie.