[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freetds
Subject:    [freetds] Re: More ODBC driver documentation desired
From:       Nick Gorham <nick () lurcher ! org>
Date:       2002-02-06 7:49:03
[Download RAW message or body]



Brian Bruns wrote:

> Ok, I've hacked the code enough to support input parameters in the sql
> (it's not pretty, but I'll be cleaning it up from here).  The problem is
> that OpenLDAP is doing something like this:
>
>     stmt1 = SQLPrepare(...);
>     stmt2 = SQLPrepare(...);
>     SQLExecute(stmt1);
>     while (SQLFetch(stmt1)) {
>        SQLExecute(stmt2);
>     }
>
> which completely bombs because a query is already in progress on that
> connection.  Now my question for you ODBC experts, is this something that
> just happens to work in other drivers, or is this mandated to work by the
> ODBC spec? I'm suspecting this is supposed to work and I'm going to need
> to be able to grab a new connection as needed.

No, just about all the TDS based SQL Server drivers would fail at this point with
"stmt busy with another hstmt" type errors. The app *Should* check the SQLGetInfo
SQL_ACTIVE_STMT value (or some similar name, I will look it up later if you want),
and throw another connection as required. The commercial TDS drivers I have seen both
allow you to appear to fix this by setting a dynamic cursor type, which causes the
protocol to get a row at a time. You can get away with this, as long as you make sure
you read the entire row before switching statements.

If you don't, and I can show this with both the Microsoft and Merent driver, you can
put the server into a spin wait (and the client), in about 10 ODBC calls.

If you look at the ODBC PHP interface, you will see it quitely sets the cursor type
to dynamic, I don't think anyone rearly knows why they do this (probably lost in the
mist of time), but it can cause havoc to web servers (It did to ours).

Nick Gorham


---
You are currently subscribed to freetds as: [freetds@progressive-comp.com]
To unsubscribe, forward this message to leave-freetds-113879Q@franklin.oit.unc.edu
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic