freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] Specifying a 0 length for the binary data
- From: "shiv kumar" <shivblore2000 AT gmail.com>
- To: freetds AT lists.ibiblio.org
- Subject: [freetds] Specifying a 0 length for the binary data
- Date: Thu, 23 Nov 2006 17:49:42 +0530
Hi all,
I have found what the error is because of the below code. The problem is
that eventhough the "len" is "0" during the return, the "length" is assigned
with a value "-4" instead of "0" . Can any one please let me know why this
happening? T(this happening only with AIX). I tried changing "size_t len" to
"TDS_INT len" but it didn't worked.
static TDS_INT
binary_to_result(const void *data, size_t len, CONV_RESULT * cr)
{
cr->ib = (TDS_CHAR *) malloc(len);
test_alloc(cr->ib);
memcpy(cr->ib, data, len);
return len;
}
static TDS_INT
tds_convert_char(int srctype, const TDS_CHAR * src, TDS_UINT srclen,
intdesttype, CONV_RESULT * cr)
{
:
case CASE_ALL_BINARY:
return binary_to_result(src, srclen, cr);
break;
* :*
*}*
* *
TDS_INT
tds_convert(TDSCONTEXT * tds_ctx, int srctype, const TDS_CHAR * src,
TDS_UINT srclen, int desttype, CONV_RESULT * cr)
{
:
case SYBLONGBINARY:
case CASE_ALL_BINARY:
length = tds_convert_binary(srctype, (const TDS_UCHAR *) src,
srclen, desttype, cr);
break;
:
return length;
}
**
*Thanks,*
*Shiva*
Hi All,(> ?, ? ) }" , SQL_NTS);
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
if(!HandleError(hstmt1, 2, retcode))SQL_RETURN_VALUE */, SQL_C_LONG, SQL_INTEGER, 0, 0, (SQLPOINTER)&p1, 0,
return 65302;
retcode = SQLBindParameter(hstmt1, 1, SQL_PARAM_OUTPUT /*>
&ValSz_ind1);
if(!HandleError(hstmt1, 2, retcode))SQL_RETURN_VALUE */, SQL_C_LONG, SQL_INTEGER, 0, 0, (SQLPOINTER)&p2,
return 65302;
retcode = SQLBindParameter(hstmt1, 2, SQL_PARAM_INPUT /*
0,&ValSz_ind2);
if(!HandleError(hstmt1, 2, retcode))SQL_PARAM_INPUT, SQL_C_BINARY, SQL_VARBINARY, 8, 0 , p3, 8, &ValSz_ind3);
return 65302;
ValSz_ind3 = 8; // If I specify this a
retcode = SQLBindParameter(hstmt1, 3,
if(!HandleError(hstmt1, 2, retcode))
return 65302;
retcode = SQLExecute(hstmt1);
if(!HandleError(hstmt1, 2, retcode))
return 65302;
retcode = SQLFetch(hstmt1);
return 0;
}
- [freetds] Specifying a 0 length for the binary data, shiv kumar, 11/23/2006
Archive powered by MHonArc 2.6.24.