Otóż, odpalam pewien skrypcik, który wygląda tak i pobiera dane z install.php.
<?php
/*
General SQL connection handler class with main interface.
*/
abstract class SQL_Base extends PDO
{
// delimiters for names
protected $leftDelimiter;
protected $rightDelimiter;
// prefix for OTSCMS tables
protected $cms_prefix = '';
// prefix for OTServ tables
protected $ots_prefix = '';
// universal constructor
public function __construct($host, $user, $password, $database, $cms_prefix, $ots_prefix)
{
$this->cms_prefix = $cms_prefix;
$this->ots_prefix = $ots_prefix;
parent::__construct( $this->DNS($host, $user, $password, $database), $user, $password);
$this->setAttribute(PDO::ATTR_CASE, PDO::CASE_LOWER);
$this->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
// required for portable DNS generation
abstract protected function DNS($host, $user, $password, $database);
// returns field name for query
final public function fieldName($name)
{
return $this->leftDelimiter . $name . $this->rightDelimiter;
}
// with this method we dont need to call those ugly OTSTable()/CMSTable()/fieldName() directly
final protected function OTSCMSPrepare($sql)
{
//OTSTable() calls
foreach($matches as $match)
{
$sql = str_replace($match[0
], $this->fieldName($this->ots_prefix . $match[1
]), $sql); }
//CMSTable() calls
foreach($matches as $match)
{
$sql = str_replace($match[0
], $this->fieldName($this->cms_prefix . $match[1
]), $sql); }
//fieldName() calls
foreach($matches as $match)
{
$sql = str_replace($match[0
], $this->fieldName($match[1
]), $sql); }
return $sql;
}
// binds OTSCMSPrepare() to basic functions
public function query($sql)
{
return parent::query( $this->OTSCMSPrepare($sql), PDO::FETCH_ASSOC);
}
public function exec($sql) {
return parent
::exec( $this->OTSCMSPrepare($sql) ); }
public function prepare
($sql, $options = array() ) {
$statement = parent::prepare( $this->OTSCMSPrepare($sql), $options);
$statement->setFetchMode(PDO::FETCH_ASSOC);
return $statement;
}
}
?>
Podczas instalacji OTSCMS'a (Account Makera - wersja Lite)[http://www.sourceforge.net/projects/otscms]
Wyskakuje następujący błąd:
+ Configuration file loaded
Fatal error: Uncaught exception 'PDOException' with message 'could not find driver' in C:\Program Files\WebServ\httpd\cls\SQL_Base.php:44 Stack trace: #0 C:\Program Files\WebServ\httpd\cls\SQL_Base.php(44): PDO->__construct('mysql:host=loca...', 'root', 'twoja') #1 C:\Program Files\WebServ\httpd\install.php(141): SQL_Base->__construct('localhost', 'root', 'twoja', 'otserv', 'otscms_', '') #2 {main} thrown in C:\Program Files\WebServ\httpd\cls\SQL_Base.php on line 44
Najdziewniejsze jest to, że posiadam plik php_pdo_mysql.dll, więc w czym problem?
Ten post edytował Tilosag 22.02.2008, 11:19:06