|
|||||||||||
|
Connector/ODBC 3.51 commit: r728 - in branches/guffert: driver test
From: <jwinstead(at)mysql.com>
Date: Fri Aug 31 2007 - 13:52:44 EDT
branches/guffert/driver/execute.c branches/guffert/driver/utility.c branches/guffert/test/my_types.c Log: Fix places where length of SQLWCHAR was being incorrectly handled as bytes or chars, and fix one test to match. Modified: branches/guffert/driver/execute.c
+ /* length is in bytes, we want chars */
+ length= length / sizeof(SQLWCHAR);
+
/* Use buff if it is big enough, otherwise alloc some space. */
if (sizeof(buff) >= (size_t)length * 4)
to= buff;
Modified: branches/guffert/driver/utility.c
@param[in] stmt Pointer to statement @param[out] result Buffer for result - @param[in] result_len Size of result buffer (in characters) + @param[in] avail_bytes Size of result buffer (in characters) @param[out] used_len Pointer to buffer for storing amount of buffer used @param[in] field Field being stored @param[in] src Source data for result @@ -605,7 +605,7 @@ */ SQLRETURN copy_wchar_result(STMT *stmt,
- SQLWCHAR *result, SQLINTEGER result_len, SQLLEN *avail_len,
+ SQLWCHAR *result, SQLINTEGER result_len, SQLLEN *avail_bytes,
MYSQL_FIELD *field, char *src, long src_bytes)
{
SQLRETURN rc= SQL_SUCCESS; @@ -773,15 +773,15 @@ if (stmt->getdata.dst_bytes == (ulong)~0L) {
- stmt->getdata.dst_bytes= used_chars;
+ stmt->getdata.dst_bytes= used_chars * sizeof(SQLWCHAR);
stmt->getdata.dst_offset= 0;
}
stmt->getdata.dst_offset+= min((ulong)(result_len ? result_len - 1 : 0), - used_chars); + used_chars) * sizeof(SQLWCHAR);
/* Did we truncate the data? */
Modified: branches/guffert/test/my_types.c
ok_stmt(hstmt, SQLBindParameter(hstmt, 1, SQL_PARAM_INPUT, SQL_C_WCHAR,
- SQL_WVARCHAR, 0, 0, W(wcdata), sizeof(wcdata),
+ SQL_WVARCHAR, 0, 0, W(wcdata),
+ sizeof(wcdata) * sizeof(SQLWCHAR),
NULL));
ok_stmt(hstmt, SQLExecute(hstmt));
-- MySQL Code Commits Mailing List For list archives: http://lists.mysql.com/commits To unsubscribe: http://lists.mysql.com/commits?unsub=lists@pantek.comReceived on Fri Aug 31 13:55:04 2007 This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:01:57 EDT |
||||||||||
|
|||||||||||