Location: PHPKode > scripts > DBInterface > db.php
<?php
/*******************************************************************
* DB: Generic database abstraction, basic definition.              *
* Provides intutive, object-oriented interface for databases       *
* Abstract class: Must use child module for particular db engine   *
* ADODb module available for generic access                        *
*                                                                  *
* Copyright ©2009 David Gebler, GPL licence		           *
*                                                                  *
********************************************************************/

abstract class DB
{
   public $host = '';
   public $username = '';
   public $password = '';
   public $database = '';
   public $connection = '';
   public $error_message = 'This website is temporarily unavailable. Please try again later, or if the problem persists, please contact the website administrator.';

   function __construct($dbh='',$dbu='',$dbp='',$ddb='')
   {
      $this->host = $dbh;
      $this->username = $dbu;
      $this->password = $dbp;
      $this->database = $ddb;
      return;
   }

   public function is_digits($val)
   {
      return !preg_match('/[^0-9]/',$val);
   }

   abstract protected function connect();
   abstract protected function close();
   abstract protected function query($qry);
   abstract protected function fetch_query($qry,$assoc=1);
   abstract protected function row($res);
   abstract protected function next_id($table);
   abstract protected function last_id();
   abstract protected function insert($table,$values=array(),$columns=array());
   abstract protected function update($table,$values,$where,$limit=0);
   abstract protected function delete($table,$where,$limit=0);
   abstract protected function table_info($table);
   abstract protected function use_db($dbn);
   abstract protected function table_columns($table);
   abstract protected function escape_str($str);
}
?>
Return current item: DBInterface