The C code below connects to the database and adds one row to the simple
table with CLOB field. The following problems took place:
1) If I try to set the trace file name like C:\Temp\LogFile.txt library
creates the text file with name c in the working directory of MaxDB
(although change history of the SQLDBC claims that such a bug was fixed in
the version 7.6.00.19). The version of SQLDBC_C is 7.6.00.27.
2) INSERT operator uses the CLOB parameter (actually this parameter is char
array filled by a symbols). Everything is working fine except for empty
CLOB value of the new row in the data table.
Could somebody give me the hint what I did wrong in my code?
The table has the following structure:
id INT NOT NULL PRIMARY KEY
name VARCHAR(100)
c1 LONG ASCII
The sample of C code (for the sake of brevity error handling code is
removed):
SQLDBC_IRuntime *runtime;
SQLDBC_Environment *environment;
SQLDBC_Connection *conn;
SQLDBC_ConnectProperties *conn_prop;
SQLDBC_PreparedStatement *stmt;
SQLDBC_ResultSet *result;
SQLDBC_Retcode rc;
char szString[30];
char szHotelName[16];
SQLDBC_Length ind;
char errorText[200];
char a[500];
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, "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', 500);
a_len = 500;
rc = SQLDBC_PreparedStatement_bindParameter(stmt, 1,
SQLDBC_HOSTTYPE_ASCII_CLOB, 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);
rc = SQLDBC_ResultSet_getObject(result, 2, SQLDBC_HOSTTYPE_ASCII, szString,
&ind, sizeof(szString), SQLDBC_TRUE);
SQLDBC_Environment_releaseConnection(environment, conn);
SQLDBC_Environment_delete_SQLDBC_Environment(environment);
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]