ID:               32106
 User updated by:  vdmfun at hotmail dot com
 Reported By:      vdmfun at hotmail dot com
 Status:           Open
 Bug Type:         MySQL related
 Operating System: Windows 2003 Server
 PHP Version:      5.0.2
 New Comment:

Hello me again.

Upgrade of MySQL from 4.1.7 -> latest 4.1.10 solved the problem. Ouch,
but those headaches...

Please, close this topic.

Thanx.

Have a nice code :-)


Previous Comments:
------------------------------------------------------------------------

[2005-02-25 12:23:35] vdmfun at hotmail dot com

Description:
------------
Sometimes the UTF-8 string is not INSERTed into MySQL correctly, but
truncated. The query takes 40 seconds at 100% CPU load while the
windoze is frozen (it feels like some execution thread has elevated
thread priority and goes on full throttle).

It seems only a bit like:
http://bugs.mysql.com/bug.php?id=6527
but there is no 0x0401 and solution on that page provided by "[15 Nov
2004 6:47pm] Alexander Valyalkin" doesn't work.

More info's with syntax highlight:

http://vdm.no-ip.org/40seconds_bug/

Reproduce code:
---------------
<?php
$db_host="localhost";
$db_user="test";
$db_password="";

$cn=mysql_connect($db_host,$db_user,$db_password);
$sql="SET NAMES 'utf8'";
$rs=mysql_db_query("test",$sql,$cn);

$sql="DROP TABLE IF EXISTS sentences";
$rs=mysql_db_query("test",$sql,$cn);

$sql="CREATE TABLE sentences (id INT UNSIGNED NOT NULL AUTO_INCREMENT,
sentence_id INT NOT NULL, lang_code VARCHAR(10) NOT NULL, text_id INT
UNSIGNED NOT NULL, sentence LONGTEXT, PRIMARY KEY (id),
KEY(sentence_id, lang_code, text_id), FULLTEXT(sentence)) ENGINE=MYISAM
CHARACTER SET utf8;";
$rs=mysql_db_query("test",$sql,$cn);

$sentence_id=1;
$lang_code="sk";
$text_id=1;
$sentence="Ako nie".chr(0xA6).chr(0x8F)."o robi+".chr(0xB9)."
slovami";
$sql="INSERT INTO sentences
VALUES(NULL,\"$sentence_id\",\"$lang_code\",\"$text_id\",_utf8'".addslashes($sentence)."')";
echo "SQL Query: ".$sql."\n";
$now=time();
$rs=mysql_db_query("test",$sql,$cn);
echo "Query took strange ".(time()-$now)." seconds...\n";
?>

Expected result:
----------------
Expected result:

To INSERT this string:

Ako nie¦&#377;o robi+&#261; slovami

(not truncated one) and not to take 40 seconds of execution of query.

Actual result:
--------------
Actual result:

String in table is truncated, dump od phpMyAdmin (abridged):

-- 
-- Dumping data for table `sentences`
-- 

INSERT INTO `sentences` VALUES (1, 1, 'sk', 1, 'Ako nie');


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32106&edit=1

Reply via email to