NobuNobu
nobun****@users*****
2006年 5月 16日 (火) 21:59:36 JST
Index: xoops2jp/html/install/class/dbmanager.php diff -u xoops2jp/html/install/class/dbmanager.php:1.2.8.2 xoops2jp/html/install/class/dbmanager.php:1.2.8.3 --- xoops2jp/html/install/class/dbmanager.php:1.2.8.2 Tue Mar 7 22:11:39 2006 +++ xoops2jp/html/install/class/dbmanager.php Tue May 16 21:59:36 2006 @@ -32,7 +32,7 @@ * database manager for XOOPS installer * * @author Haruki Setoyama <haruk****@plane*****> -* @version $Id: dbmanager.php,v 1.2.8.2 2006/03/07 13:11:39 nobunobu Exp $ +* @version $Id: dbmanager.php,v 1.2.8.3 2006/05/16 12:59:36 nobunobu Exp $ * @access public **/ class db_manager { @@ -47,17 +47,28 @@ $this->db->setLogger(XoopsLogger::instance()); } + function connectDB($selectdb = true) { + $ret = $this->db->connect($selectdb); + if ($ret != false) { + $fname = dirname(dirname(__FILE__)).'/language/'.$GLOBALS['language'].'/charset_mysql.php'; + if (file_exists($fname)) { + require_once($fname); + } + } + return $ret; + } + function isConnectable(){ - return ($this->db->connect(false) != false) ? true : false; + return ($this->connectDB(false) != false) ? true : false; } function dbExists(){ - return ($this->db->connect() != false) ? true : false; + return ($this->connectDB() != false) ? true : false; } function createDB() { - $this->db->connect(false); + $this->connectDB(false); $result = $this->db->query("CREATE DATABASE ".XOOPS_DB_NAME); @@ -72,7 +83,7 @@ } $sql_query = trim(fread(fopen($sql_file_path, 'r'), filesize($sql_file_path))); OldSqlUtility::splitMySqlFile($pieces, $sql_query); - $this->db->connect(); + $this->connectDB(); foreach ($pieces as $piece) { $piece = trim($piece); // [0] contains the prefixed query @@ -178,22 +189,22 @@ } function query($sql){ - $this->db->connect(); + $this->connectDB(); return $this->db->query($sql); } function prefix($table){ - $this->db->connect(); + $this->connectDB(); return $this->db->prefix($table); } function fetchArray($ret){ - $this->db->connect(); + $this->connectDB(); return $this->db->fetchArray($ret); } function insert($table, $query){ - $this->db->connect(); + $this->connectDB(); $table = $this->db->prefix($table); $query = 'INSERT INTO '.$table.' '.$query; if(!$this->db->queryF($query)){ @@ -219,7 +230,7 @@ function deleteTables($tables){ $deleted = array(); - $this->db->connect(); + $this->connectDB(); foreach ($tables as $key => $val) { if(! $this->db->query("DROP TABLE ".$this->db->prefix($key))){ $deleted[] = $ct; @@ -232,7 +243,7 @@ $table = trim($table); $ret = false; if ($table != '') { - $this->db->connect(); + $this->connectDB(); $sql = 'SELECT * FROM '.$this->db->prefix($table); $ret = (false != $this->db->query($sql)) ? true : false; }