Skip to Content.
Sympa Menu

freetds - Re: [freetds] SQLExecDirect() of transaction statement returnsSQL_NO_DATA

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] SQLExecDirect() of transaction statement returnsSQL_NO_DATA
  • Date: Tue, 8 Jan 2008 14:09:34 +0100

>
> Is it expected that an SQLExecDirect("BEGIN TRANSACTION")
> returns SQL_NO_DATA (100) ?
>
> I would maybe expect SQL_SUCCESS_WITH_INFO, but not SQL_NO_DATA ...
>
> Attached, a sample to reproduce, give me this output:
>
> >> SQLExecDirect return code = 100 for [BEGIN TRANSACTION]
> >> SQLExecDirect return code = 100 for [COMMIT TRANSACTION]
> >> SQLExecDirect return code = 100 for [BEGIN TRANSACTION]
> >> SQLExecDirect return code = 100 for [ROLLBACK TRANSACTION]
> >> SQLExecDirect return code = 100 for [SET TRANSACTION
> ISOLATION LEVEL READ UNCOMMITTED]
> >> SQLExecDirect return code = 100 for [SET TRANSACTION
> ISOLATION LEVEL READ COMMITTED]
> >> SQLExecDirect return code = 100 for [SET TRANSACTION
> ISOLATION LEVEL REPEATABLE READ]
> >> SQLExecDirect return code = 100 for [SET TRANSACTION
> ISOLATION LEVEL SERIALIZABLE]
>
> Seb
>

Using ODBC 3 SQLExecDirect/SQLExecute can return SQL_NO_DATA with means
SQL_SUCCESS with no rows, from manual

"If SQLExecDirect executes a searched update or delete statement that
does not affect any rows at the data source, the call to SQLExecDirect
returns SQL_NO_DATA.
"

there are more sligthly difference between MS ODBC and our driver but
any ODBC compliant applications should support both results (in this
case is complitely correct). Personally sometimes I use a macro defined
as

#define SQL_SUCCEEDED_EX(rc) (((rc) & 2) == 0)

which catches SQL_SUCCESS, SQL_SUCCESS_WITH_INFO and SQL_NO_DATA.

freddy77




Archive powered by MHonArc 2.6.24.

Top of Page