freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
RE: [freetds] Need help with SQL server stored procedure output?
- From: "Lowden, James K" <LowdenJK AT bernstein.com>
- To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] Need help with SQL server stored procedure output?
- Date: Fri, 18 Jul 2003 17:44:55 -0400
> From: Gaurav Nangia [mailto:gnangia AT mspintl.com]
> Sent: July 18, 2003 4:32 PM
>
> Thank-you very much. Also, will this work with MS-SQL server 2000?
Yes it will, Gaurav. Does, in fact. ;-)
--jkl
> From: freetds-bounces AT lists.ibiblio.org
> [mailto:freetds-bounces AT lists.ibiblio.org]On Behalf Of Lowden, James K
> Sent: Friday, July 18, 2003 3:47 PM
> > From: Gaurav Nangia [mailto:gnangia AT mspintl.com]
> > Sent: July 18, 2003 12:04 PM
> >
> > I am using freetds 0.61 with DBD::Sybase on Redhat linux to
> > connect to SQL Server 7.0.
> ...
> > I am having an issue with
> > running a stored procedure that RETURNS A VALUE. How do I
> > retrieve that value.
> ...
> > #!/usr/bin/perl
> >
> > use DBI;
> > $dbh = DBI->connect('DBI:Sybase:server=DEV;', $user, $passwd)
> > or die "Cannot
> > connect:$@\n";
> > $sql = ("declare \@test numeric(9,4) exec TEST
> > \@results=\@test OUTPUT");
> > $sth=$dbh->prepare($sql);
> > $sth->execute;
> > while(@d = $sth->fetchrow_array)
> > {
> > foreach $xyz(@d)
> > {
> > print "REsult=>$xyz<=\n";
> > }
> > }
>
> DBD::Sybase returns the procedure's return code as a row, setting a
> statement handle attribute to denote the row's type. Your
> loop isn't enough
> afaik; cf. "perldoc DBD::Sybase" for more. I think you need
> loop more like:
>
> do {
> while($d = $sth->fetch) {
> print @{$d}, $/;
> }
> } while($sth->{syb_more_results});
>
> However, FreeTDS 0.61 appears broken wrt this feature in our
> ct-lib. I just
> finished testing the above, and got these errors:
>
> 1. I got syb_result_type=4043, but no data.
> 2. $sth->{syb_more_results} always returns 1.
> 3. $sth->{syb_result_type} returns -1077946652 past the "end
> of the data".
>
> The good news is that current CVS (and recent snapshots) work
> correctly.
>
> I had to rebuild DBD::Sybase to make it link to
> /usr/local/lib/libct.so.1.
> If you're already using libct.so.1, then you need to update
> just FreeTDS.
> If you do have to rebuild DBD::Sybase, it might complain about lacking
> tdsiconv.h, which we don't install even though we should.
> I'm going to look
> at the issue more closely this weekend, to see what we really
> should do, and
> if tdsiconv.h is serving a real purpose.
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.
-
RE: [freetds] Need help with SQL server stored procedure output?,
Lowden, James K, 07/18/2003
- RE: [freetds] Need help with SQL server stored procedure output?, Gaurav Nangia, 07/18/2003
- RE: [freetds] Need help with SQL server stored procedure output?, Gaurav Nangia, 07/18/2003
- <Possible follow-up(s)>
- RE: [freetds] Need help with SQL server stored procedure output?, Lowden, James K, 07/18/2003
Archive powered by MHonArc 2.6.24.