[unixODBC-dev] Calling a store procedure

Nick Gorham nick at lurcher.org
Thu Feb 23 12:52:55 GMT 2012


On 23/02/12 12:14, Jaime Stuardo wrote:
> Hello and thanks for answering...
>
> SQLExecDirect returns 100. By looking at the header files, that code means
> SQL_NO_DATA according to this:
>
> #if (ODBCVER>= 0x0300)
> #define SQL_NO_DATA              100
> #endif
>
> Since I am using ODBC version 3, I am getting this code which is not an
> error actually, but a result condition. The stored procedure does only an
> UPDATE and currently it is not updating nothing.
>
> I think that "#define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)" macro should be
> updated to include SQL_NO_DATA as a succeeded condition. That is why the
> diagnostics does not return any message.

I see what you are saying, but if that change was made in unixODBC it 
would diverge from the Microsoft implementation, compatibility with that 
is one of unixODBC goals.

I can also see situations where SQL_NO_DATA could be considered a error 
condition, depending on the use in question.
> By the way, I used tsql and isql command with the stored procedure and it
> worked, so I discarded problem with FreeTDS.
>
> What do you think?

Not sure what you mean?

I would think that changing your code to be

      if (!SQL_SUCCEEDED(ret)&&  ret != SQL__NO_DATA ) {


Would give you want you want and work across platforms as well.


-- 
Nick



More information about the unixODBC-dev mailing list