[freetds] freetds - invalid cursor state
jezekj at centrum.cz
jezekj at centrum.cz
Wed Feb 10 02:02:16 EST 2016
Hello Frediano,
thank you for looking into this issue. In the meantime I will rebuild our Perl::DBD to use latest unixODBC (2.3.4) nad let you know results. Please let me know your findings about status of SQLNumResultCols and
SQLMoreResults when using Windows driver.
Thank you,
JJ
______________________________________________________________
> Od: Frediano Ziglio <freddy77 at gmail.com>
> Komu: FreeTDS Development Group <freetds at lists.ibiblio.org>
> Datum: 10.02.2016 01:05
> Předmět: Re: [freetds] freetds - invalid cursor state
>
2016-02-09 20:22 GMT+00:00 <jezekj at centrum.cz>:
>
> Hi guys, we have to find some solution.
>
> We have perl script using DBD::ODBC to connect to MSSQL using unixODBC
> driver and FreeTDS. When we execute stored procedure and this stored
> procedure is executing another stored procedure with raiserror or print
> functions we get invalid cursor state error.
>
> i.e.:
> CREATE PROCEDURE [dbo].[dummyproc] as
> RAISERROR('test', 0, 0)
> return 0
>
> CREATE PROCEDURE [dbo].[testproc] as
> select GETDATE()
> exec dummyproc
> select GETDATE()
> return 0
>
> This happens ONLY when we try to fetch results from second getdate()
> function.
> i.e.:
> my $query = 'exec testproc';
> my $sth = $dbh->prepare($query);
> $sth->execute || die "Error running query $query";
> while ( my $d = $sth->fetchrow_arrayref ) {
> print Dumper $d; #should return first getdate()
> }
> while ( my $d = $sth->fetchrow_arrayref ) {
> print Dumper $d; #should return second getdate()
> }
>
> We’re using:
> Old perl 5.8.8.
> DBD::ODBC version 1.45
> unixODBC 2.3.1 (also tried newest 2.3.4.)
> FreeTDS 0.91.dev.20110409RC1 (also tried FreeTDS 0.95.81)
>
> In case we use Easysoft database driver instead of FreeTDS the error does
> not appear.
> When I call out the procedure from tsql error does not appear.
>
> The log using latest FreeTDS can be found here:
> http://jezecek.dyndns.org/freetds.log <http://jezecek.dyndns.org/freetds.log>
> The unixODBC log (not sure it will help) can be found here:
> http://jezecek.dyndns.org/odbc.log <http://jezecek.dyndns.org/odbc.log>
>
> I would really really appreciate if you can let me know what to focus on.
> Thank you for any hints& supprt from you.
>
> Regards,
> JJ
>
Does not look so weird. In ODBC 3 resultset can have no records, for
instance they can contains an error. You got an error in between two
recordsets with rows. It seems that DBD::ODBC calls
SQLFreeStmt(SQL_UNBIND) but this should not skip the error.
I'll check exactly in this condition what SQLNumResultCols and
SQLMoreResults returns with a Windows driver. I remember a similar
problem using an old unixODBC version.
Frediano
_______________________________________________
FreeTDS mailing list
FreeTDS at lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds <http://lists.ibiblio.org/mailman/listinfo/freetds>
More information about the FreeTDS
mailing list