List:Commits« Previous MessageNext Message »
From:jwinstead Date:August 31 2007 1:46am
Subject:Connector/ODBC 3.51 commit: r725 - branches/guffert/driver
View as plain text  
Modified:
   branches/guffert/driver/unicode.c
Log:
Fix utf8_as_sqlwchar to actually return data!

Modified: branches/guffert/driver/unicode.c
===================================================================
--- branches/guffert/driver/unicode.c	2007-08-31 00:58:33 UTC (rev 724)
+++ branches/guffert/driver/unicode.c	2007-08-31 01:46:32 UTC (rev 725)
@@ -291,8 +291,8 @@
     }
   }
 
-  if (out)
-    *out= 0;
+  if (pos)
+    *pos= 0;
   return pos - out;
 }
 
@@ -504,12 +504,23 @@
   rc= MySQLDriverConnect(hdbc, hwnd, in8, in_len, out8, out8_max, out_len,
                          completion);
 
-  /* Now we have to convert out8 back into a SQLWCHAR. */
-  *out_len= utf8_as_sqlwchar(out, out_max, out8, *out_len);
+#ifdef WIN32
+  /*
+    Microsoft ADO/VB? specifies in and out to be the same, but then gives a
+    nonsense value for out_max. Just don't do anything in this case.
 
-  if (*out_len > out_max - 1)
-    rc= set_dbc_error((DBC *)hdbc, "01004", NULL, 0);
+    @todo verify that this actually happens.
+  */
+  if (in != out)
+#endif
+  {
+    /* Now we have to convert out8 back into a SQLWCHAR. */
+    *out_len= utf8_as_sqlwchar(out, out_max, out8, *out_len);
 
+    if (*out_len > out_max - 1)
+      rc= set_dbc_error((DBC *)hdbc, "01004", NULL, 0);
+  }
+
 error:
   x_free(out8);
   x_free(in8);

Thread
Connector/ODBC 3.51 commit: r725 - branches/guffert/driverjwinstead31 Aug