Hello Alexander.
Thank You for the response I removed
CLOB suffix from the parameter type
and it fixed the problem. Besides Ive found in the PTS the solution of my
trouble with trace file its sufficient to add quotation marks for file
name.
At the time I faced with strange behavior of the SQLDBC_ResultSet_getObject
function. I increase buffer from 500 to 20000 characters and try to read
chunks (see code below). If the field c1 is LONG UNICODE program is working
fine and produces the following output:
rc: 2, bytes left: 20000
rc: 2, bytes left: 11809
rc: 0, bytes left: 3618.
As soon as I change the field type from LONG UNICODE to LONG ASCII the
output is:
rc: 2, bytes left: 21780
rc: 0, bytes left: 5398
Also the loop is terminated prematurely (the last chunk is not read).
I attached two trace files (for LONG UNICODE and LONG ASCII variants
respectively)
The C code:
SQLDBC_IRuntime *runtime;
SQLDBC_Environment *environment;
SQLDBC_Connection *conn;
SQLDBC_ConnectProperties *conn_prop;
SQLDBC_PreparedStatement *stmt;
SQLDBC_ResultSet *result;
SQLDBC_Retcode rc;
char szString[8192];
char szHotelName[16];
SQLDBC_Length ind;
char errorText[200];
char a[20000];
int a_len;
ConnectArgsT connectArgs;
parseArgs (&connectArgs, argc, argv);
runtime = ClientRuntime_GetClientRuntime(errorText, sizeof(errorText));
environment = SQLDBC_Environment_new_SQLDBC_Environment(runtime);
conn = SQLDBC_Environment_createConnection(environment);
conn_prop = SQLDBC_ConnectProperties_new_SQLDBC_ConnectProperties();
SQLDBC_ConnectProperties_setProperty(conn_prop, "SQL", "1");
SQLDBC_ConnectProperties_setProperty(conn_prop, "PACKET", "1");
SQLDBC_ConnectProperties_setProperty(conn_prop, "TIMESTAMP", "1");
SQLDBC_ConnectProperties_setProperty(conn_prop, "FILENAME",
"\"c:\\temp\\logfile.txt\"");
SQLDBC_Environment_setTraceOptions(environment, conn_prop);
rc = SQLDBC_Connection_connectASCII(conn, connectArgs.host,
connectArgs.dbname, connectArgs.username, connectArgs.password, conn_prop);
stmt = SQLDBC_Connection_createPreparedStatement(conn);
rc = SQLDBC_PreparedStatement_prepareNTS(stmt, convertToUCS2("INSERT INTO
Test (id, name, c1) VALUES(1, 'test', ?)"),
SQLDBC_StringEncodingType_Encoding_UCS2Swapped);
memset(a, 'a', 20000);
a_len = 20000;
rc = SQLDBC_PreparedStatement_bindParameter(stmt, 1, SQLDBC_HOSTTYPE_ASCII,
a, NULL, a_len, SQLDBC_FALSE);
rc = SQLDBC_PreparedStatement_executeASCII(stmt);
stmt = SQLDBC_Connection_createPreparedStatement(conn);
rc = SQLDBC_PreparedStatement_prepareNTS(stmt, convertToUCS2("SELECT name,
c1 FROM Test"), SQLDBC_StringEncodingType_Encoding_UCS2Swapped);
rc = SQLDBC_PreparedStatement_executeASCII(stmt);
result = SQLDBC_PreparedStatement_getResultSet(stmt);
rc = SQLDBC_ResultSet_next(result);
rc = SQLDBC_ResultSet_getObject(result, 1, SQLDBC_HOSTTYPE_ASCII,
szHotelName, &ind, sizeof(szHotelName), SQLDBC_TRUE);
do
{
rc = SQLDBC_ResultSet_getObject(result, 2, SQLDBC_HOSTTYPE_ASCII, szString,
&ind, sizeof(szString), SQLDBC_TRUE);
printf("rc: %d, bytes left: %d\n", rc, ind);
}
while(rc == SQLDBC_DATA_TRUNC);
SQLDBC_Environment_releaseConnection(environment, conn);
SQLDBC_Environment_delete_SQLDBC_Environment(environment);
_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar - get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]