Bug #54100 Connector/C lacks geostd8 charset support

Submitted: 31 May 2010 9:41 Modified: 14 Jun 2010 15:51
Reporter: Ulf Wendel Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / C Severity:S3 (Non-critical)
Version:6.0.3-dev OS:Any
Assigned to: Georg Richter CPU Architecture:Any

[31 May 2010 9:41] Ulf Wendel
Description:
The development version of Connector/C from Lauchpad (lp:libmysql) lacks support for the "geostd8" character set.

I can't say for sure if other character sets are missing which are supported by a default MySQL server.

nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_3_conn_c_lp> uname -a
Linux linux-fuxh 2.6.31.12-0.2-desktop #1 SMP PREEMPT 2010-03-16 21:25:39 +0100 x86_64 x86_64 x86_64 GNU/Linux

nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_3_conn_c_lp> sapi/cli/php -v
PHP 5.3.3-dev (cli) (built: May 31 2010 10:33:36) (DEBUG)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_3_conn_c_lp> sapi/cli/php -i | grep mysql
Configure Command =>  './configure'  '--with-mysql=/home/nixnutz/ftp/conn_c_lp/' '--with-mysqli=/home/nixnutz/ftp/conn_c_lp/bin/mysql_config' '--with-pdo-mysql=/home/nixnutz/ftp/conn_c_lp/bin/mysql_config' '--enable-debug'
mysql
MYSQL_SOCKET => /tmp/mysql.sock
MYSQL_LIBS => -L/home/nixnutz/ftp/conn_c_lp//lib -lmysqlclient
mysql.allow_local_infile => On => On
mysql.allow_persistent => On => On
mysql.connect_timeout => 60 => 60
mysql.default_host => no value => no value
mysql.default_password => no value => no value
mysql.default_port => no value => no value
mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock
mysql.default_user => no value => no value
mysql.max_links => Unlimited => Unlimited
mysql.max_persistent => Unlimited => Unlimited
mysql.trace_mode => Off => Off
mysqli
MYSQLI_SOCKET => /tmp/mysql.sock
mysqli.allow_local_infile => On => On
mysqli.allow_persistent => On => On
mysqli.default_host => no value => no value
mysqli.default_port => 3306 => 3306
mysqli.default_pw => no value => no value
mysqli.default_socket => no value => no value
mysqli.default_user => no value => no value
mysqli.max_links => Unlimited => Unlimited
mysqli.max_persistent => Unlimited => Unlimited
mysqli.reconnect => Off => Off
PDO drivers => mysql, sqlite, sqlite2
pdo_mysql
PDOTEST_DSN => mysql:dbname=phptest;unix_socket=/tmp/mysql.sock
PDO_MYSQL_TEST_SOCKET => /tmp/mysql.sock
PDO_MYSQL_TEST_DSN => mysql:dbname=phptest;unix_socket=/tmp/mysql.sock
MYSQL_TEST_SOCKET => /tmp/mysql.sock
_SERVER["PDOTEST_DSN"] => mysql:dbname=phptest;unix_socket=/tmp/mysql.sock
_SERVER["PDO_MYSQL_TEST_SOCKET"] => /tmp/mysql.sock
_SERVER["PDO_MYSQL_TEST_DSN"] => mysql:dbname=phptest;unix_socket=/tmp/mysql.sock
_SERVER["MYSQL_TEST_SOCKET"] => /tmp/mysql.sock
_ENV["PDOTEST_DSN"] => mysql:dbname=phptest;unix_socket=/tmp/mysql.sock
_ENV["PDO_MYSQL_TEST_SOCKET"] => /tmp/mysql.sock
_ENV["PDO_MYSQL_TEST_DSN"] => mysql:dbname=phptest;unix_socket=/tmp/mysql.sock
_ENV["MYSQL_TEST_SOCKET"] => /tmp/mysql.sock

How to repeat:
Compile PHP 5.3.3-dev against Connector/C 6.0.3-dev.  Run test script:

sapi/cli/php -r '$mysqli = new mysqli("localhost", "root", "root", "test");  var_dump(mysqli_get_client_info($mysqli)); var_dump(mysqli_get_server_info($mysqli)); var_dump($mysqli->set_charset("geostd8")); $res = $mysqli->query("SHOW CHARACTER SET LIKE \"geostd8\""); var_dump($mysqli->error); while ($row = $res->fetch_assoc()) var_dump($row); '
string(5) "6.0.3"
string(12) "5.1.45-debug"
bool(false)  <------------------------- should read true!
string(0) ""
array(4) {
  ["Charset"]=>
  string(7) "geostd8"
  ["Description"]=>
  string(16) "GEOSTD8 Georgian"
  ["Default collation"]=>
  string(18) "geostd8_general_ci"
  ["Maxlen"]=>
  string(1) "1"
}

The server knows about the charset but mysqli->set_charset("geostd8") fails and returns false. The same code won't will return true for mysqli->set_charset("geostd8") if PHP is compiled against mysqlnd or libmysql from the server.

Alternatively run the following PHP tests. They pass with libmysql/mysqlnd but fail with C/C:

ext/mysqli/tests/mysqli_set_charset.phpt
ext/mysqli/tests/mysqli_character_set.phpt

You can also verify it indirectly by inspecting the Connector/C source code:

nixnutz@linux-fuxh:~/src/1.0> grep -R geostd8 mysys/charset-def.c
(no hit = geostd8 missing)

nixnutz@linux-fuxh:~/src/1.0> grep -R latin1 mysys/charset-def.c
  add_compiled_collation(&my_charset_latin1);
  add_compiled_collation(&my_charset_latin1_bin);
  add_compiled_collation(&my_charset_latin1_german2_ci);
[1 Jun 2010 5:43] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/109643

2895 Georg Richter	2010-06-01
      Fix for bug #54100
[7 Jun 2010 8:11] Georg Richter
Fixed in rev. 2895. Will be available in C/C ver. 6.0.3
[14 Jun 2010 15:51] Tony Bedford
An entry has been added to the 6.0.3 changelog:

MySQL Connector/C did not include support for the geostd8 character set.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.056 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.