Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/pdo_mysql/mysql_driver.c ext/pdo_mysql/php_pdo_mysql_int.h

2011-01-07 Thread Kalle Sommer Nielsen
Hi Andrey

2011/1/7 Andrey Hristov :
> On 01/07/2011 03:39 PM, Kalle Sommer Nielsen wrote:
>
> this fix is inefficient. Implies a query to the server. Much efficient
> is using mysql_options() on a MYSQL handle after mysql_init() but before
> mysql_real_connect() (which sets the charset during the handshake).
>
> http://dev.mysql.com/doc/refman/5.5/en/mysql-options.html
> MYSQL_SET_CHARSET_NAME (argument type: char *)
>
> The name of the character set to use as the default character set.
>
> Could you change it?

I changed it to use mysql_options() prior to the connection as
suggested. Should I merge it to the 5.3 branch?
>
> Thanks!
> Andrey
>



-- 
regards,

Kalle Sommer Nielsen
ka...@php.net

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/pdo_mysql/mysql_driver.c ext/pdo_mysql/php_pdo_mysql_int.h

2011-01-07 Thread Andrey Hristov
On 01/07/2011 03:39 PM, Kalle Sommer Nielsen wrote:
> kalleFri, 07 Jan 2011 14:39:56 +
> 
> Revision: http://svn.php.net/viewvc?view=revision&revision=307224
> 
> Log:
> Implemented FR #47802, support for character sets in DSN strings for PDO_MYSQL
> 
> Bug: http://bugs.php.net/47802 (Open) PDO_MYSQL doesn't use the charset 
> parameter
>   
> Changed paths:
> U   php/php-src/trunk/NEWS
> U   php/php-src/trunk/UPGRADING
> U   php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
> U   php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h
> 
> Modified: php/php-src/trunk/NEWS
> ===
> --- php/php-src/trunk/NEWS2011-01-07 14:22:30 UTC (rev 307223)
> +++ php/php-src/trunk/NEWS2011-01-07 14:39:56 UTC (rev 307224)
> @@ -170,6 +170,10 @@
>. Added nextRowset support.
>. Fixed bug #50755 (PDO DBLIB Fails with OOM).
> 
> +- Improved PDO MySQL:
> +  . Implemented FR #47802 (Support for setting character sets in DSN 
> strings).
> +(Kalle)
> +
>  - Improved Reflection extension: (Johannes)
>. Added ReflectionExtension::isTemporary() and
>  ReflectionExtension::isPersistent() methods.
> 
> Modified: php/php-src/trunk/UPGRADING
> ===
> --- php/php-src/trunk/UPGRADING   2011-01-07 14:22:30 UTC (rev 307223)
> +++ php/php-src/trunk/UPGRADING   2011-01-07 14:39:56 UTC (rev 307224)
> @@ -161,6 +161,8 @@
>strings. This breaks code that iterated the resulting stream array using a
>numeric index, but makes easier to identify which of the passed streams are
>present in the result.
> +- pdo_mysql now supports setting character sets when connecting in the DSN
> +  string.
> 
> 
>  ===
> 
> Modified: php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
> ===
> --- php/php-src/trunk/ext/pdo_mysql/mysql_driver.c2011-01-07 14:22:30 UTC 
> (rev 307223)
> +++ php/php-src/trunk/ext/pdo_mysql/mysql_driver.c2011-01-07 14:39:56 UTC 
> (rev 307224)
> @@ -711,6 +711,13 @@
>   goto cleanup;
>   }
> 
> +#ifdef PDO_MYSQL_HAS_CHARSET
> + if (vars[0].optval && mysql_set_character_set(H->server, 
> vars[0].optval)) {
> + pdo_mysql_error(dbh);
> + goto cleanup;
> + }
> +#endif
> +
>   if (!dbh->auto_commit) {
>   mysql_handle_autocommit(dbh TSRMLS_CC);
>   }
> 
> Modified: php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h
> ===
> --- php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h   2011-01-07 
> 14:22:30 UTC (rev 307223)
> +++ php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h   2011-01-07 
> 14:39:56 UTC (rev 307224)
> @@ -33,6 +33,10 @@
>  #define PDO_MYSQL_PARAM_BIND MYSQL_BIND
>  #endif
> 
> +#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 5) || 
> MYSQL_VERSION_ID >= 50007 || defined(MYSQL_USE_MYSQLND)
> +# define PDO_MYSQL_HAS_CHARSET
> +#endif
> +
>  #if defined(PDO_USE_MYSQLND) && PHP_DEBUG && !defined(PHP_WIN32)
>  #define PDO_DBG_ENABLED 1
> 
> 
> 

this fix is inefficient. Implies a query to the server. Much efficient
is using mysql_options() on a MYSQL handle after mysql_init() but before
mysql_real_connect() (which sets the charset during the handshake).

http://dev.mysql.com/doc/refman/5.5/en/mysql-options.html
MYSQL_SET_CHARSET_NAME (argument type: char *)

The name of the character set to use as the default character set.

Could you change it?

Thanks!
Andrey

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/trunk/ NEWS UPGRADING ext/pdo_mysql/mysql_driver.c ext/pdo_mysql/php_pdo_mysql_int.h

2011-01-07 Thread Kalle Sommer Nielsen
kalleFri, 07 Jan 2011 14:39:56 +

Revision: http://svn.php.net/viewvc?view=revision&revision=307224

Log:
Implemented FR #47802, support for character sets in DSN strings for PDO_MYSQL

Bug: http://bugs.php.net/47802 (Open) PDO_MYSQL doesn't use the charset 
parameter
  
Changed paths:
U   php/php-src/trunk/NEWS
U   php/php-src/trunk/UPGRADING
U   php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
U   php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h

Modified: php/php-src/trunk/NEWS
===
--- php/php-src/trunk/NEWS  2011-01-07 14:22:30 UTC (rev 307223)
+++ php/php-src/trunk/NEWS  2011-01-07 14:39:56 UTC (rev 307224)
@@ -170,6 +170,10 @@
   . Added nextRowset support.
   . Fixed bug #50755 (PDO DBLIB Fails with OOM).

+- Improved PDO MySQL:
+  . Implemented FR #47802 (Support for setting character sets in DSN strings).
+(Kalle)
+
 - Improved Reflection extension: (Johannes)
   . Added ReflectionExtension::isTemporary() and
 ReflectionExtension::isPersistent() methods.

Modified: php/php-src/trunk/UPGRADING
===
--- php/php-src/trunk/UPGRADING 2011-01-07 14:22:30 UTC (rev 307223)
+++ php/php-src/trunk/UPGRADING 2011-01-07 14:39:56 UTC (rev 307224)
@@ -161,6 +161,8 @@
   strings. This breaks code that iterated the resulting stream array using a
   numeric index, but makes easier to identify which of the passed streams are
   present in the result.
+- pdo_mysql now supports setting character sets when connecting in the DSN
+  string.


 ===

Modified: php/php-src/trunk/ext/pdo_mysql/mysql_driver.c
===
--- php/php-src/trunk/ext/pdo_mysql/mysql_driver.c  2011-01-07 14:22:30 UTC 
(rev 307223)
+++ php/php-src/trunk/ext/pdo_mysql/mysql_driver.c  2011-01-07 14:39:56 UTC 
(rev 307224)
@@ -711,6 +711,13 @@
goto cleanup;
}

+#ifdef PDO_MYSQL_HAS_CHARSET
+   if (vars[0].optval && mysql_set_character_set(H->server, 
vars[0].optval)) {
+   pdo_mysql_error(dbh);
+   goto cleanup;
+   }
+#endif
+
if (!dbh->auto_commit) {
mysql_handle_autocommit(dbh TSRMLS_CC);
}

Modified: php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h
===
--- php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h 2011-01-07 14:22:30 UTC 
(rev 307223)
+++ php/php-src/trunk/ext/pdo_mysql/php_pdo_mysql_int.h 2011-01-07 14:39:56 UTC 
(rev 307224)
@@ -33,6 +33,10 @@
 #  define PDO_MYSQL_PARAM_BIND MYSQL_BIND
 #endif

+#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 5) || 
MYSQL_VERSION_ID >= 50007 || defined(MYSQL_USE_MYSQLND)
+# define PDO_MYSQL_HAS_CHARSET
+#endif
+
 #if defined(PDO_USE_MYSQLND) && PHP_DEBUG && !defined(PHP_WIN32)
 #define PDO_DBG_ENABLED 1


-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php