Recent Topics

1 Nov 01, 2005 19:24    

After I installed b2evolution v.0.9.0.12 and went to admin page,
an error came up:

MySQL error!

Illegal mix of collations for operation ' IN '(Errno=1271)

Your query:
SELECT postcat_cat_ID AS cat_ID, COUNT(*) AS cat_postcount FROM evo_postcats INNER JOIN evo_posts ON postcat_post_ID = ID WHERE ( ( post_status = 'private' AND post_author = 1 ) OR post_status IN ('published','protected','draft','deprecated') ) GROUP BY cat_ID

I tried to install either v.0.9.1 or v.0.9.0.12, none of them work.
the installation is correct.
"Installation is completed successfully!"
MySQL version: 4.1.8-standard
PHP version: 4.3.9
apache 2.0

2 Nov 02, 2005 18:41

I asked François about this and he said:

He's using a different charset for his mysql tables and for his mysql connection.

If he can't fix the defaults, he's got to use SET NAMES (search for that in the DB class). This is not fully supported yet, but I'll get back to it... you know... after Phoenix.

What he's referring to in our current DB class (see CVS) is this:

$this->query( 'SET NAMES '.$params['connection_charset'] );

Transferring this to 0.9.1 you'll have to send a query like "SET NAMES xxx" after connecting to the DB, where xxx is a mysql connection charset. Please look at the MySQL manual about this, if you should consider it.

I'd suggest trying to fix the defaults / tables.

3 Nov 03, 2005 08:36

I did the following changs to my mysql database from phpmyadmin:

set character set utf8; 
set collation_connection='utf8_general_ci';


I reinstalled the entire program in many times, but still have the same problem.
I did install other blog software connecting my same database file, there's no problem(even after I applied the character changing). What I insist and prefer b2evolution is because this software has more content protect features and nice interface, I really hope you can help me o fix this trouble.

I also did not find SET NAMES in the DB class for

$this->query( 'SET NAMES '.$params['connection_charset'] );


I only find the file named "_class_db.php" in the b2evocore folder.
and the "$this->query(" code, where is the "SET NAMES"? Do I have to input by myself? If so, how to add these code in "_class_db.php" file.

BTW: What is CVS meaning?

Thank you for your kindly responding.

4 Nov 03, 2005 10:07

I just found what is "CVS" and downloaded the "_db.class.php"(not the old version of "_class_db.php" and not in the same subfolder either). I copy the specific code(bolded) to line 201, but the problem remains.

{
$this->select($dbname);
}

if( !empty($params['connection_charset']) )
		{	// Specify which charset we are using on the client:
			$this->query( 'SET NAMES '.$params['connection_charset'] );
		}

		/*
		echo '<br />Server: '.$this->get_var( 'SELECT @@character_set_server' );
		echo '<br />Database: '.$this->get_var( 'SELECT @@character_set_database' );
		echo '<br />Connection: '.$this->get_var( 'SELECT @@character_set_connection' );
		echo '<br />Client: '.$this->get_var( 'SELECT @@character_set_client' );
		echo '<br />Results: '.$this->get_var( 'SELECT @@character_set_results' );
		*/


// Prepare aliases for replacements:
foreach( $dbaliases as $dbalias => $dbreplace )
{

I am not a good programmer, I don't know whether I copy the correct code and set in right format, because I found the structure of new code is quite different.
If I changed the code in the following way

		if( !empty($params['connection_charset']) )
		{	// Specify which charset we are using on the client:
			$this->query( 'SET NAMES '.$params['connection_charset'] );
		}

		/*
		echo '<br />Server: '.$this->get_var( 'SELECT @@character_set_server' );
		echo '<br />Database: '.$this->get_var( 'SELECT @@character_set_database' );
		echo '<br />Connection: '.$this->get_var( 'SELECT @@character_set_connection' );
		echo '<br />Client: '.$this->get_var( 'SELECT @@character_set_client' );
		echo '<br />Results: '.$this->get_var( 'SELECT @@character_set_results' );
		*/


		[color=red]if( isset($params['aliases']) )
		{ // Prepare aliases for replacements:
			foreach( $params['aliases'] as $dbalias => $dbreplace )[/color]			{
				$this->dbaliases[] = '#\b'.$dbalias.'\b#'; // \b = word boundary
				$this->dbreplaces[] = $dbreplace;
				// echo '<br />'.'#\b'.$dbalias.'\b#';
			}
			// echo count($this->dbaliases);
		}
	}

The admin page will give the message:

MySQL error!

Table 'zhou203h.T_locales' doesn't exist(Errno=1146)

Your query:

SELECT
loc_locale, loc_charset, loc_datefmt, loc_timefmt, loc_name,
loc_messages, loc_priority, loc_enabled
FROM T_locales ORDER BY loc_priority

What should I do for this???? :'( :'( :'(
Can I know what is your software setting for
default character-set and default-collation.
Thank you.

blueyed wrote:

I asked François about this and he said:

He's using a different charset for his mysql tables and for his mysql connection.

If he can't fix the defaults, he's got to use SET NAMES (search for that in the DB class). This is not fully supported yet, but I'll get back to it... you know... after Phoenix.

What he's referring to in our current DB class (see CVS) is this:

$this->query( 'SET NAMES '.$params['connection_charset'] );

Transferring this to 0.9.1 you'll have to send a query like "SET NAMES xxx" after connecting to the DB, where xxx is a mysql connection charset. Please look at the MySQL manual about this, if you should consider it.

I'd suggest trying to fix the defaults / tables.

5 Nov 03, 2005 10:26

blueyed wrote:

I'd suggest trying to fix the defaults / tables.

I think(not sure) I can do the changes for default character setting, here is phpmyadmin responding:

Your SQL-query has been executed successfully
 
SQL-query :
ALTER DATABASE db_name
DEFAULT CHARACTER SET utf8
COLLATE utf8_general_ci  


how should I change the default for others, but I still don't know what is your default character is.

6 Nov 03, 2005 10:39

FINALLY: :lol: :lol: :lol:
I got right screen, thank you so much blueyed and François for the great hints :idea: , now I know where is wrong.
After struggling for hours til I almost saw the sunrise.
Thank you again.

rz88 wrote:

blueyed wrote:

I'd suggest trying to fix the defaults / tables.

I think(not sure) I can do the changes for default character setting, here is phpmyadmin responding:

Your SQL-query has been executed successfully
 
SQL-query :
ALTER DATABASE db_name
DEFAULT CHARACTER SET utf8
COLLATE utf8_general_ci  


how should I change the default for others, but I still don't know what is your default character is.

7 Nov 03, 2005 18:34

rz88, using another file from another development branch is not good if you don't know what you're doing.. :)

How did you fix it? By altering the table like shown? I'd have suggested to set it to latin1, not utf8 - but if it works, it's fine of course.


Form is loading...