function checkCharsetPriv( $charset, &$currentCharset ) { $query = "SHOW CREATE DATABASE `{$this->DB}`"; $status = mysql_query( $query, $this->DBConnection ); $this->reportQuery( __CLASS__, $query, false, false ); if ( !$status ) { $this->setError(); eZDebug::writeWarning( "Connection warning: " . mysql_errno( $this->DBConnection ) . ": " . mysql_error( $this->DBConnection ), "eZMySQLDB" ); return false; } $numRows = mysql_num_rows( $status ); if ( $numRows == 0 ) return false; for ( $i = 0; $i < $numRows; ++$i ) { $tmpRow = mysql_fetch_array( $status, MYSQL_ASSOC ); if ( $tmpRow['Database'] == $this->DB ) { $createText = $tmpRow['Create Database']; if ( preg_match( '#DEFAULT CHARACTER SET ([a-zA-Z0-9_-]+)#', $createText, $matches ) ) { $currentCharset = $matches[1]; $currentCharset = eZCharsetInfo::realCharsetCode( $currentCharset ); // Convert charset names into something MySQL will understand $unmappedCurrentCharset = eZMySQLCharset::mapFrom( $currentCharset ); if ( is_array( $charset ) ) { if ( in_array( $unmappedCurrentCharset, $charset ) ) { return $unmappedCurrentCharset; } } else if ( $unmappedCurrentCharset == $charset ) { return true; } return false; } break; } } return true; }
public function testUnknownUppercaseCharsetMapFrom() { $this->assertSame( "uNknOwN", eZMySQLCharset::mapFrom( "uNknOwN" ) ); }