cvs: pear /MDB2/MDB2/Driver mysql.php

[email protected] ("Lorenzo Alberton")
Newsgroups php.pear.cvs
Message-ID <cvsquipo1208705792@cvsserver>
quipo		Sun Apr 20 15:36:32 2008 UTC

  Modified files:              
    /pear/MDB2/MDB2/Driver	mysql.php 
  Log:
  request #13657: in setCharset(), use mysql_set_charset() if available [cwiedmann]
  
http://cvs.php.net/viewvc.cgi/pear/MDB2/MDB2/Driver/mysql.php?r1=1.210&r2=1.211&diff_format=u
Index: pear/MDB2/MDB2/Driver/mysql.php
diff -u pear/MDB2/MDB2/Driver/mysql.php:1.210 pear/MDB2/MDB2/Driver/mysql.php:1.211
--- pear/MDB2/MDB2/Driver/mysql.php:1.210	Mon Apr  7 22:02:38 2008
+++ pear/MDB2/MDB2/Driver/mysql.php	Sun Apr 20 15:36:32 2008
@@ -43,7 +43,7 @@
 // | Author: Lukas Smith <[email protected]>                           |
 // +----------------------------------------------------------------------+
 //
-// $Id: mysql.php,v 1.210 2008/04/07 22:02:38 quipo Exp $
+// $Id: mysql.php,v 1.211 2008/04/20 15:36:32 quipo Exp $
 //
 
 /**
@@ -625,6 +625,15 @@
             $collation = array_pop($charset);
             $charset   = array_pop($charset);
         }
+        $client_info = mysql_get_client_info();
+        if (function_exists('mysql_set_charset') && version_compare($client_info, '5.0.6')) {
+            if (!$result = mysql_set_charset($charset, $connection)) {
+                $err =& $this->raiseError(null, null, null,
+                    'Could not set client character set', __FUNCTION__);
+                return $err;
+            }
+            return $result;
+        }
         $query = "SET NAMES '".mysql_real_escape_string($charset, $connection)."'";
         if (!is_null($collation)) {
             $query .= " COLLATE '".mysqli_real_escape_string($connection, $collation)."'";
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.