Re: Stored procedures and DBD::Sybase

From: Chuck Fox (chuckfox2_at_aol.com)
Date: 11/10/03


Date: Mon, 10 Nov 2003 12:50:38 -0500
To: svelez@ironcad.com

Steven,

I believe that you are misunderstanding what it is that you are
receiving. The only output from your commands is the print @c. This
comes through the error handler since a print statement is a level 0 or
level 10 message from the server and not a result set. Try changing the
print to a select and then you can receive it as a row result.

Regards,

Chuck

svelez@ironcad.com wrote:

>Hello,
>
>I am using DBI v. 1.38, DBD::Sybase v. 1.01 (?), and FreeTDS 0.61.2 to
>connect to an MSSQL 6.5 database from a Linux client and I am having
>problems retrieving the values of out parameters to a stored procedure
>call.
>
>I followed the example in the DBD::Sybase docs modifying for my purpose
>as follows:
>
>#!/usr/bin/perl
>
>use DBI;
>use DBD::Sybase;
>
>my $dbh = DBI->connect('dbi:Sybase:server=****',
> 'sa', '****', {PrintError => 1, AutoCommit => 1});
>
>$dbh->do('use tempdb');
>my $sql = q{
>declare @a int
>declare @b varchar(10)
>exec foo @a output, @b output
>declare @c varchar(255)
>select @c = @b + ' : ' + convert(varchar(3), @a)
>print @c
>};
>
>my $sth = $dbh->prepare($sql);
>$sth->execute;
>do {
> while ($d = $sth->fetch) {
> $rt = $sth->{'syb_result_type'};
> print("Iterating: $rt\n");
> if ($rt == DBD::Sybase::CS_PARAM_RESULT) {
> print("found param result [@$d]\n");
> $a = $$d[0];
> $b = $$d[1];
> } elsif ($rt == DBD::Sybase::CS_ROW_RESULT) {
> print("found row result [@$d]\n");
> } elsif ($rt == DBD::Sybase::CS_STATUS_RESULT) {
> print("found status result [@$d]\n");
> }
> }
>} while($sth->{'syb_more_results'});
>print("Retrieved values $a $b\n");
>
>
>And received the following output:
>
>Iterating: 4043
>found status result [0]
>hello : 5
>Retrieved values
>
>
>As I understand the docs, the there should have been a CS_PARAM_RESULT
>result set but there was not. As you see, I even printed out the
>results from the sql to make sure the out params were being set. Am I
>doing something wrong or is this a known limitation when using my
>configuration. Perhaps I can use the Sybase Open Client libraries
>instead?
>
>I help will be greatly appreciated.
>
>Thank you,
>Steven
>
>



Relevant Pages

  • Re: Dual boot with dos on floppy
    ... procedure - messge you are receiving re:HAL.DLL indicates system ... - Recovery console commands are DOS based - and finally how does XP ... While the commands in the recovery console are similar to DOS commands the ...
    (microsoft.public.windowsxp.help_and_support)
  • PHP/MySQL not playing nicely. Server drops connection. . .
    ... I recently installed PHP, APACHE, MYSQL per the method at the following site: ... and I keep receiving the following error: ... but it keeps telling me that I can't access the database with the "connect" commands I'm using (although I've adjusted them. ...
    (php.general)
  • [SLE] list messages
    ... I am not receiving any mail from the list. ... Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com ...
    (SuSE)
  • Re: [SLE] PC Crash: Hard Disk Problems
    ... it must be your receiving side of things. ... Check the headers for your unsubscription address ... For additional commands send e-mail to suse-linux-e-help@suse.com ... Please read the FAQs: suse-linux-e-faq@suse.com ...
    (SuSE)
  • [opensuse] still having problems
    ... list but only received off list replies. ... wrong with the list host. ... erroneously been set to stop me from receiving email. ... For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx ...
    (SuSE)