Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

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


Modified:

   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


  • branches/guffert/driver/execute.c 2007-08-31 07:57:49 UTC (rev 727) +++ branches/guffert/driver/execute.c 2007-08-31 17:52:44 UTC (rev 728)
    @@ -314,6 +314,9 @@
    char *to; int i= 0;
+            /* 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


  • branches/guffert/driver/utility.c 2007-08-31 07:57:49 UTC (rev 727) +++ branches/guffert/driver/utility.c 2007-08-31 17:52:44 UTC (rev 728)
    @@ -595,7 +595,7 @@
   @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;

   }  
  • if (avail_len)
  • *avail_len= stmt->getdata.dst_bytes - stmt->getdata.dst_offset; + if (avail_bytes) + *avail_bytes= stmt->getdata.dst_bytes - stmt->getdata.dst_offset;

   stmt->getdata.dst_offset+= min((ulong)(result_len ? result_len - 1 : 0),

-                                 used_chars);
+                                 used_chars) * sizeof(SQLWCHAR);
 

   /* Did we truncate the data? */
   if (stmt->getdata.dst_bytes > stmt->getdata.dst_offset)

Modified: branches/guffert/test/my_types.c


  • branches/guffert/test/my_types.c 2007-08-31 07:57:49 UTC (rev 727) +++ branches/guffert/test/my_types.c 2007-08-31 17:52:44 UTC (rev 728)
    @@ -711,7 +711,8 @@
    ok_stmt(hstmt, SQLFreeStmt(hstmt, SQL_RESET_PARAMS));

   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.com
Received on Fri Aug 31 13:55:04 2007
Do you need help?X

This archive was generated by hypermail 2.1.8 : Sun Oct 07 2007 - 09:01:57 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library