Skip to Content.
Sympa Menu

freetds - [freetds] query and tds_set_state

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: [freetds] query and tds_set_state
  • Date: Tue, 28 Jun 2005 21:43:36 +0200

Reviewing query.c (libTDS) it appear that it contains two types of
functions
- functions to send requests (tds_submit_*, tds_cursor_*)
- functions to parse query (tds_quote*, tds_skip*...)
there isn't also a big difference from high level and low level (like
wire language query and query, just tds_submit_query do it's best to
send a query whatever token/packet it use)
I noted also that tds_cursor_* already introduce the concept of
"multiple query" (Cf "multiple query, OTL, array_out" recently) however
there is no setup, first query that enter in multiple query try to set
state to TDS_QUERYING (that is I'm sending a query).

Test to send query is

if (tds_set_state(tds, TDS_QUERYING) != TDS_QUERYING)
return TDS_FAIL;

this is bad. If state was already TDS_QUERYING it try to set state, in
tds_set_state


case TDS_QUERYING:

if (tds->state == TDS_DEAD) {
tds_client_msg(tds->tds_ctx, tds, 20006, 9, 0, 0, "Write to SQL
Server failed.");
return tds->state;
} else if (tds->state != TDS_IDLE) {
tdsdump_log(TDS_DBG_ERROR, "tds_submit_query(): state is PENDING
\n");
tds_client_msg(tds->tds_ctx, tds, 20019, 7, 0, 1,
"Attempt to initiate a new SQL Server operation with
results pending.");
return tds->state;
}

so it give error but continue... quite bad (mainly for thread reasons).
Perhaps tds_set_state should return TDS_SUCCEED/TDS_FAIL ??

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page