freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Specifying a 0 for the "StrLen_or_IndPtr
- From: "ZIGLIO, Frediano, VF-IT" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Specifying a 0 for the "StrLen_or_IndPtr
- Date: Thu, 23 Nov 2006 11:43:49 +0100
>
> Thanks a lot freddy,
>
> The return value of RPC_Read is int.
> The first paramater type is also int.
> The second paramter is of type timestamp.
>
> Shiva
>
I don't understand... I tried to reproduce your problem adding these
lines to fnuccall test (src/odbc/unittests, before Disconnect)
/* test from shiv kumar (cfr ML 2006-11-21) */
if (CommandWithResult(Statement, "drop proc rpc_read") != SQL_SUCCESS)
printf("Unable to execute statement\n");
SQLCloseCursor(Statement);
Command(Statement, "create proc rpc_read @i int, @x timestamp as begin
select 1 return 1234 end");
SQLCloseCursor(Statement);
SQLFreeStmt(Statement, SQL_CLOSE);
SQLFreeStmt(Statement, SQL_UNBIND);
if (SQLPrepare(Statement, (SQLCHAR *) "{ ? = CALL rpc_read ( ?, ? ) }" ,
SQL_NTS) != SQL_SUCCESS)
ODBC_REPORT_ERROR("Unable to prepare statement\n");
ind = 0;
if (SQLBindParameter(Statement, 1, SQL_PARAM_OUTPUT, SQL_C_LONG,
SQL_INTEGER, 0, 0, &output, 0, &ind) != SQL_SUCCESS)
ODBC_REPORT_ERROR("Unable to bind output parameter\n");
ind2 = 0;
if (SQLBindParameter(Statement, 2, SQL_PARAM_INPUT, SQL_C_LONG,
SQL_INTEGER, 0, 0, &input, 0, &ind2) != SQL_SUCCESS)
ODBC_REPORT_ERROR("Unable to bind input parameter\n");
ind3 = 0;
if (SQLBindParameter(Statement, 3, SQL_PARAM_INPUT, SQL_C_BINARY,
SQL_VARBINARY, 8, 0, out2, 8, &ind3) != SQL_SUCCESS)
ODBC_REPORT_ERROR("Unable to bind output parameter\n");
if (SQLExecute(Statement) != SQL_SUCCESS)
ODBC_REPORT_ERROR("Unable to execute statement\n");
if (SQLFetch(Statement) != SQL_NO_DATA)
ODBC_REPORT_ERROR("Data not expected\n");
but it reach SQLFetch and send rpc call to db.... I tried both CVS HEAD
and 0.64.
Perhaps there is some problems in your types. retcode should be
SQLRETURN, ValSz_ind1, ValSz_ind2 and ValSz_ind3 SQLLEN while p1 and p2
should be SQLINTEGER.
freddy77
> >
> > Hi All,
> >
> >
> >
> > Please find the simplified below code which is giving
> > problem: In the code
> > if I replace the "ValSz_ind3 = 8;" to "ValSz_ind3 = 0;" then the
> > SQLExecute is returning the SQL_ERROR. Unfortunately after
> > this if I call
> > "SQLGetDiagRec" it is returning a null empty string. The
> same code is
> > working well with the solaris and unix. I am using the uniXODBC
> > 2.2.11version and hopefully I am not building it as 64-bit driver. I
> > have tried
> > with both FreeTDS0.63 and FreeTDS 0.64 version.
> >
> > PLEASE HELP.
> >
> >
> >
> > int spcall (char*)
> >
> > {
> >
> > int retcode;
> >
> > long ValSz_ind1, ValSz_ind2, ValSz_ind3 = 0 ;
> >
> > int p1 = 0, p2 = 1;
> >
> > char p3[32];
> >
> >
> >
> >
> >
> > retcode = SQLFreeStmt(hstmt1, SQL_CLOSE);
> >
> > retcode = HandleError( hstmt1, 2, retcode);
> >
> >
> >
> > retcode = SQLFreeStmt(hstmt1, SQL_UNBIND);
> >
> > retcode = HandleError( hstmt1, 2, retcode);
> >
> >
> >
> > retcode = SQLPrepare (hstmt1, (SQLCHAR *) "{ ? =
> > CALL RPC_Read (
> > ?, ? ) }" , SQL_NTS);
> >
> > if(!HandleError(hstmt1, 2, retcode))
> >
> > return 65302;
> >
> >
> >
> > retcode = SQLBindParameter(hstmt1, 1,
> SQL_PARAM_OUTPUT /*
> > SQL_RETURN_VALUE */, SQL_C_LONG, SQL_INTEGER,
> >
> > 0, 0,
> > (SQLPOINTER)&p1, 0,
> > &ValSz_ind1);
> >
> > if(!HandleError(hstmt1, 2, retcode))
> >
> > return 65302;
> >
> >
> >
> > retcode = SQLBindParameter(hstmt1, 2,
> SQL_PARAM_INPUT /*
> > SQL_RETURN_VALUE */, SQL_C_LONG, SQL_INTEGER,
> >
> > 0, 0,
> > (SQLPOINTER)&p2, 0,
> > &ValSz_ind2);
> >
> > if(!HandleError(hstmt1, 2, retcode))
> >
> > return 65302;
> >
> >
> >
> > ValSz_ind3 = 8; // If I specify this a
> >
> > retcode = SQLBindParameter(hstmt1, 3, SQL_PARAM_INPUT,
> > SQL_C_BINARY, SQL_VARBINARY,
> >
> > 8, 0 , p3, 8, &ValSz_ind3);
> >
> > if(!HandleError(hstmt1, 2, retcode))
> >
> > return 65302;
> >
> >
> >
> > retcode = SQLExecute(hstmt1);
> >
> > if(!HandleError(hstmt1, 2, retcode))
> >
> > return 65302;
> >
> >
> >
> > retcode = SQLFetch(hstmt1);
> >
> > if(!HandleError(hstmt1, 2, retcode))
> >
> > return 65302;
> >
> >
> >
> > return 0;
> >
> >
> >
> > }
>
> >What are RPC_Read parameter types ??
>
> >freddy77
-
Re: [freetds] Specifying a 0 for the "StrLen_or_IndPtr,
shiv kumar, 11/22/2006
- <Possible follow-up(s)>
- Re: [freetds] Specifying a 0 for the "StrLen_or_IndPtr, ZIGLIO, Frediano, VF-IT, 11/23/2006
- Re: [freetds] Specifying a 0 for the "StrLen_or_IndPtr, shiv kumar, 11/24/2006
Archive powered by MHonArc 2.6.24.