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: michael dot peppler at bnpparibas dot com
Subject: Re: Too many output parameters?
Date: Sep 22 2005 5:57AM

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.