Skip to Content.
Sympa Menu

freetds - RE: [freetds] dbsetopt behaviour

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: "'FreeTDS Development Group'" <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] dbsetopt behaviour
  • Date: Mon, 3 Mar 2003 14:05:59 -0500

> From: Brian Bruns [mailto:camber AT ais.org]
> Sent: March 3, 2003 1:31 PM
>
> DBPROCESS *dbproc = 0;
> dbinit();
> dbsetopt(dbproc, ...);
>
> which core dumps because dbsetopt() accesses the null pointer
> of 'dbproc'.
...
>
> I have a local patch that
> applies the option to all open dbproc's but I suspect that is wrong.

I suspect it's right. Microsoft says the same thing Sybase does: "If dbproc
is NULL, the option is set for all active DBPROCESS structures." It goes
on:

"This function does not immediately set the options specified. They are not
set until the command buffer is sent to SQL Server (by invoking the
dbsqlexec function). An additional result for each option set is returned
through the dbresults function."

If your patch detects a null dbproc and iterates over the active ones when
it sees one, I'd say it's right. As best I can tell, that would conform to
the documentation.

I'd do it recursively in dbsetopt():

if dbproc == NULL
foreach connection
dbsetopt g_dblib_ctx.connection_list[i] ...

--jkl




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.





Archive powered by MHonArc 2.6.24.

Top of Page