Stephen Toney has asked for the wisdom of the Perl Monks concerning the following question:

The documentation for this module says that FetchRow uses SQLFetch if there are no parameters to FetchRow, and SQLExtendedFetch if there are parameters.

But the SQL.Log shows that it is using SQLExtendedFetch even with no parameters to FetchRow. Unfortunately I am using the CodeBase driver which does not support SQLExtendedFetch, which means I get no results from any query.

Any solutions? I know I could switch to DBI, and may do so, but is there a Win32::ODBC soluttion?

Many TIA!

Replies are listed 'Best First'.
Re: Win32::ODBC FetchRow
by doowah2004 (Monk) on Aug 28, 2004 at 06:27 UTC
    Here is an easy work around. Uninstall the module Win32::ODBC, then find and install a version of Win32::ODBC that pre-dates 2/8/1999. Any version that was created before 2/8/1999 will ONLY use SQLFetch.

    That should fix it.
      I suppose I could also modify the current code using the older version as a model? Any ideas on where to find such an old module?

      Thanks for the reply!


        Any ideas on where to find such an old module?

        I don't know if this is a good solution but you can find old versions of modules on backpan.

        Win32::ODBC is part of libwin32 which you should be able to find here

        --
        John.

      Thanks for the suggestion, but it didn't work. I downloaded a version on Win32::ODBC.pm from 1998 and the code for fetchrow() is identical to the current version.

      Any suggestions would be most welcome!

      Unfortunately, this didn't work. I downloaded a version on Win32::ODBC.pm from 1998 and the code for fetchrow() is identical to the current version.

      Any further ideas would be most welcome!

Re: Win32::ODBC FetchRow
by doowah2004 (Monk) on Aug 31, 2004 at 17:38 UTC
    I may have given you some bad info on the dates, but I did some checking and I think that the version that you need is here Let me know if this fixes it.


    Update:
    After looking at the changes with winmerge, these are VERY different versions.
      Thanks! You're right, this is a much different version. When I tried to use it, I got an error that it could not make the connection. I think it is so old it requires an older ODBC.DLL, and I'm afraid that will be too different to be useful.

      So I studied the FetchRow code in the two versions of Win32::ODBC, and got nowhere! They both call ODBCFetch (in the DLL). The new version has a second argument, the one that is supposed to invoke SQLExtendedFetch. But removing this argument entirely *still* called SQLExtendedFetch.

      I think it is the ODBC.DLL that determines which Fetch to use, based on whether there are arguments, so I just don't see why SQLFetch is NOT being used when there are no arguments.

      I've tried to force ODBC.DLL to use SQLFetch, which should be the normal case. I've studied all the connection options and tried setting various cursors to no avail.

      This is a shame, because it means the CodeBase driver cannot be used with Perl. It also seems to mean that all apps that use of Win32::ODBC are using extended fetch when they could be using the simpler fetch.

      Many thanks for your help. I would say Win32::ODBC is just not a serious product.

      Stephen

        Stephen Toney,

        Did follow the install directions:

        T O I N S T A L L T H I S B E A S T : ========================================= 1) You will need to dump the ODBC.PM file into the \PERL\LIB\WIN32\ di +rectory. 2) You need to copy either ODBC105.PLL or ODBC106.PLL (depending on yo +ur version of Win32 Perl's build number. Run: perl -v to check whic +h build you have) into \PERL\LIB\AUTO\WIN32\ODBC\ODBC.PLL.\ **** Notice that we are changing the name to ODBC.PLL!!!!


        If not then it surely will not work. (Though it may not work even if you did). If that does not work, I am all out of suggestions.

        Cameron