]> err.no Git - sope/commitdiff
put connection into UTF-8 mode
authorhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 11 Apr 2005 20:06:53 +0000 (20:06 +0000)
committerhelge <helge@e4a50df8-12e2-0310-a44c-efbce7f8a7e3>
Mon, 11 Apr 2005 20:06:53 +0000 (20:06 +0000)
git-svn-id: http://svn.opengroupware.org/SOPE/trunk@726 e4a50df8-12e2-0310-a44c-efbce7f8a7e3

sope-gdl1/MySQL4/MySQL4Channel.m

index db1d80e8d9ac89c15f09f56a9cc20aad237a6b52..a61889eeb002de428fca47a33f79082085565c79 100644 (file)
@@ -163,13 +163,21 @@ static int openConnectionCount = 0;
                          [socket cString],
                          0);
   if (rc == NULL) {
-    NSLog(@"WARNING: could not open MySQL4 connection to database '%@': %s",
+    NSLog(@"ERROR: could not open MySQL4 connection to database '%@': %s",
           [adaptor databaseName], mysql_error(self->_connection));
     mysql_close(self->_connection); 
     self->_connection = NULL;
     return NO;
   }
   
+  if (mysql_query(self->_connection, "SET CHARACTER SET utf8") != 0) {
+    NSLog(@"ERROR: could not put MySQL4 connection into UTF-8 mode: %s",
+         mysql_error(self->_connection));
+    mysql_close(self->_connection); 
+    self->_connection = NULL;
+    return NO;
+  }
+  
   if (isDebuggingEnabled)
     NSLog(@"MySQL4 connection established 0x%08X", self->_connection);