[pLog-svn] r3308 - plog/trunk

mark at devel.lifetype.net mark at devel.lifetype.net
Mon May 1 16:38:37 GMT 2006


Author: mark
Date: 2006-05-01 16:38:36 +0000 (Mon, 01 May 2006)
New Revision: 3308

Modified:
   plog/trunk/wizard.php
Log:
Fixed the bug that elena reported here: http://forums.lifetype.net/viewtopic.php?p=25275#25275

Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2006-04-30 12:10:39 UTC (rev 3307)
+++ plog/trunk/wizard.php	2006-05-01 16:38:36 UTC (rev 3308)
@@ -657,55 +657,62 @@
 	    {
 	        // check mysql version first. Version lower than 4.1 doesn't support utf8
 	        $serverVersion = mysql_get_server_info( $this->_connection );
-	        $version = explode('.', $serverVersion);
-	        if ($version[0] < 4) return false;
-	        if ( ($version[0] == 4) && ($version[1] == 0) ) return false;
+	        $version = explode( '.', $serverVersion );
+	        if ( $version[0] < 4 ) return false;
+	        if ( ( $version[0] == 4 ) && ( $version[1] == 0 ) ) return false;
 	        
 	        // check if utf8 support was compiled in
 	        $result = mysql_query( "SHOW CHARACTER SET", $this->_connection );
-	        if (mysql_num_rows($result) > 0) {
-	            // iterate through resultset
-	            $availableCharacterSets = array();
-	            while( $row = mysql_fetch_array( $result, MYSQL_ASSOC ) )
-	            {
-					array_push( $availableCharacterSets, $row['Charset'] );
-	            }
-	            return $availableCharacterSets;
-	
-	        }
+	        if( $result )
+	        {
+		        if( mysql_num_rows($result) > 0 ) {
+		            // iterate through resultset
+		            $availableCharacterSets = array();
+		            while( $row = mysql_fetch_array( $result, MYSQL_ASSOC ) )
+		            {
+						array_push( $availableCharacterSets, $row['Charset'] );
+		            }
+		            return $availableCharacterSets;
+		        }
+		    }
 	        return false;
 	    }
 	    
 	    function getDatabaseCharacterSet()
 	    {
-			if (!@mysql_select_db( $this->_dbName, $this->_connection )) {
+			if( !@mysql_select_db( $this->_dbName, $this->_connection ) ) {
 				return false;
 			}
 	        
 	        // We use a SHOW CREATE DATABASE command to show the original
 	        // SQL character set when DB was created.
-	        $result = mysql_query("SHOW CREATE DATABASE `".$this->_dbName."`", $this->_connection);
-	        if (mysql_num_rows($result) < 0 ) {
-	            // The specified db name is wrong!
-	            return false;
-	        }
-	        $dbInfo = mysql_fetch_row($result);
-	        $pattern = '/40100 DEFAULT CHARACTER SET (\w+) /';
-	        if ( (preg_match($pattern, $dbInfo[1], $match) > 0) ) {
-	            return $match[1];
-	        }
+	        $result = mysql_query( "SHOW CREATE DATABASE `".$this->_dbName."`", $this->_connection );
+	        if( $result )
+	        {
+		        if( mysql_num_rows( $result ) < 0 ) {
+		            // The specified db name is wrong!
+		            return false;
+		        }
+		        $dbInfo = mysql_fetch_row( $result );
+		        $pattern = '/40100 DEFAULT CHARACTER SET (\w+) /';
+		        if( ( preg_match( $pattern, $dbInfo[1], $match ) > 0 ) ) {
+		            return $match[1];
+		        }
+		    }
 	        return false;
 	    }
 	
 	    function getServerCharacterSet(){
 	        // We use a SHOW CREATE DATABASE command to show the original
 	        // SQL character set when DB was created.
-	        $result = mysql_query("SHOW VARIABLES LIKE 'character_set_server'", $this->_connection);
-	        if (mysql_num_rows($result) > 0 ) {
-	            $row = mysql_fetch_array( $result, MYSQL_ASSOC );
-	            return $row['Value'];
-	        }
-	
+	        $result = mysql_query( "SHOW VARIABLES LIKE 'character_set_server'", $this->_connection );
+	        if( $result )
+	        {
+		        if( mysql_num_rows( $result ) > 0 ) {
+		            $row = mysql_fetch_array( $result, MYSQL_ASSOC );
+		            return $row['Value'];
+		        }
+			}
 	        return false;
 	    }
     }



More information about the pLog-svn mailing list