Tutaj dokumentacja: http://ww1.pelp.net/forum/viewtopic.php?f=14&t=5
Tutaj źródło w przejzystej formie: http://ww1.pelp.net/new/beynar/libs/db
<?php // // mysql service class // version 1.12 stable // refere /docs/db for documentation // beynar // class db{ // ini config path const DB_CONFIG_PATH = \"./config/config.ini\"; // singleton // access properties private $host; private $login; private $database; // data private $resource=false; private $data=false; private $status=NULL; private $rows=0; // singleton object creator self::$instance = new db(); return self::$instance; } private function __construct(){ // read config // establish connection to rdbms if($link=mysql_connect($cfg[\"db\"][\"host\"], $cfg[\"db\"][\"login\"], $cfg[\"db\"][\"password\"])) self::$link = $link; else $this -> error(); $this -> host = $cfg[\"db\"][\"host\"]; $this -> login = $cfg[\"db\"][\"login\"]; // select db $this -> database = $cfg[\"db\"][\"database\"]; else $this -> error(); } public function query($query){ $this -> error($query); return false; } self::$queries++; // gets data from resource as array $this -> resource = $resource; $this -> data = null; $this -> data[]=$res; } $this -> status = $resource; return true; } public function numRows(){ $this -> rows = $rows; return $rows; } } public function numQueries(){ return self::$queries; } public function getData(){ return $this -> data; } public function getStatus(){ return $this -> status; } public function getResource(){ return $this -> resource; } public function getHostname(){ return $this -> host; } public function getDbName(){ return $this -> database; } public function getUsername(){ return $this -> login; } // DEBUGING METHOD // ONLY FOR DEVELOPING TIME private function error($query=false){ if($query) } public function __destruct(){ } } ?>
metoda error finalnie bedzie spisywala błędy do logow lub po prostu throw exception...