Re: Stored procedures and DBD::Sybase
From: Chuck Fox (chuckfox2_at_aol.com)
Date: 11/10/03
- Next message: Colin Wetherbee: "Re: nmaking dbd-mysql errors"
- Previous message: Chuck Fox: "Re: nmaking dbd-mysql errors"
- In reply to: Steven Velez: "Stored procedures and DBD::Sybase"
- Next in thread: Steven Velez: "RE: Stored procedures and DBD::Sybase"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
>
>
- Next message: Colin Wetherbee: "Re: nmaking dbd-mysql errors"
- Previous message: Chuck Fox: "Re: nmaking dbd-mysql errors"
- In reply to: Steven Velez: "Stored procedures and DBD::Sybase"
- Next in thread: Steven Velez: "RE: Stored procedures and DBD::Sybase"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|