freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
RE: [freetds] problem with ODBC and store procedure output params
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] problem with ODBC and store procedure output params
- Date: Thu, 22 Apr 2004 17:32:05 +0200
>
> Not sure whether this is something I'm doing wrong,
> a general characteristic of ODBC, or a new or existing
> problem with the freetds ODBC mechanism...
>
...
>
> >From freetds ODBC however, things aren't so good...
>
> I prepare the statement as
>
> {call sp_test_1(9,9,?)}
>
This syntax is still not supported...
> and bind parameter like so:
>
> int val=0, indicator=0;
> SQLBindParameter(stmtHandle, 1, SQL_PARAM_OUTPUT,
> SQL_C_LONG, SQL_INTEGER,
> 0, 0, &val, sizeof(val), &indicator);
>
> The problem is, when I SQLExecute the statement, it returns
> SQL_SUCCESS_WITH_INFO. Using SqlGetDiagRec I see the
> error code is 8162 and the message is
> [FreeTDS][SQL Server]Formal parameter '@P1' was defined as
> OUTPUT but the actual parameter not declared OUTPUT.
>
>
> However, I have noticed that if I change the invocation to
> { call sp_test_1(?,?,?) }
> and then also bind parameters for the first two parameters,
> then the SQLExecute returns SQL_SUCCESS, and the output
> parameter value is properly returned to my application.
>
>
> I was able to demonstrate the same behavior by
> mucking around with the odbc/unittest/params.c slightly,
> and I have included the full version of that file below.
>
>
> So, the question is - what's up here?
>
> Any help would be much appreciated.
>
A workaround is to prepare a ms sql syntax like "sp_test_1 9,9,?" (I'm
not that sure is works....). Or prepare something like "{call
sp_test_1(?,?,?)}" and bind parameters according.
>
> Modified odbc/unittest/params.c:
>
I'll have a look
bye
freddy77
-
[freetds] problem with ODBC and store procedure output params,
Roger Reynolds, 04/22/2004
- <Possible follow-up(s)>
- RE: [freetds] problem with ODBC and store procedure output params, Rogers, Tom, 04/22/2004
- RE: [freetds] problem with ODBC and store procedure output params, ZIGLIO, Frediano, VF-IT, 04/22/2004
- RE: [freetds] problem with ODBC and store procedure output params, Roger Reynolds, 04/22/2004
Archive powered by MHonArc 2.6.24.