[unixODBC-support] unixODBC problem in HP-UX IA64

Nick Gorham nick at lurcher.org
Thu Nov 14 12:40:36 GMT 2013


On 14/11/13 12:13, 手嶋 和徹 wrote:
> (2013/11/14 19:12), Nick Gorham wrote:
>> On 14/11/13 10:01, 手嶋 和徹 wrote:
>>
> Hi.
>
> Thank you for Reply,Nick san.
>
> I am appologize for omit SQLBindCol.
>
> SQLBindCol(hstmt, 1, SQL_CHAR, (SQLPOINTER) RowData[0].xxx,10, &len);
> SQLBindCol(hstmt, 2, SQL_CHAR, (SQLPOINTER) RowData[0].yyy,15, &len);
>
> and Oracle table define is
> samle_table
> (xxx char(10),
>  yyy char(15))

Hmm,

If you are using row-wise binding, I would expect

#define ROWCOUNT 100

struct test{
	SQLCHAR  xxx[10],
	SQLLEN	len1;
	SQLCHAR  yyy[15]
	SQLLEN	len2;
};

struct test RowData[ ROWCOUNT ];

I would not use class, I would distrust there is no c++ magic being added. Though the fact that the elements are referred to by the address of the first element should mean it doesnt matter.

Then 

SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_BIND_TYPE, (SQLPOINTER) sizeof( struct test ), NULL);
SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE, (SQLPOINTER) ROWCOUNT, NULL);

SQLBindCol(hstmt, 1, SQL_CHAR, (SQLPOINTER) RowData[0].xxx,10, &RowData[0].len1);
SQLBindCol(hstmt, 2, SQL_CHAR, (SQLPOINTER) RowData[0].yyy,15, &RowData[0].len2);

-- 
Nick


More information about the unixODBC-support mailing list