abstract class DB in Anti Spam by CleanTalk 9.1.x
Same name in this branch
- 9.1.x src/lib/Cleantalk/Common/DB.php \Cleantalk\Common\DB
- 9.1.x src/lib/Cleantalk/ApbctDrupal/DB.php \Cleantalk\ApbctDrupal\DB
Same name and namespace in other branches
- 8.4 src/lib/Cleantalk/Common/DB.php \Cleantalk\Common\DB
CleanTalk abstract Data Base driver. Shows what should be inside. Uses singleton pattern.
@version 1.0 @author Cleantalk team (welcome@cleantalk.org) @copyright (C) 2014 CleanTalk team (http://cleantalk.org) @license GNU/GPL: http://www.gnu.org/copyleft/gpl.html
Hierarchy
- class \Cleantalk\Common\DB
Expanded class hierarchy of DB
See also
https://github.com/CleanTalk/php-antispam
5 files declare their use of DB
- AntiCrawler.php in src/
lib/ Cleantalk/ Common/ Firewall/ Modules/ AntiCrawler.php - AntiFlood.php in src/
lib/ Cleantalk/ Common/ Firewall/ Modules/ AntiFlood.php - Firewall.php in src/
lib/ Cleantalk/ Common/ Firewall/ Firewall.php - FirewallModule.php in src/
lib/ Cleantalk/ Common/ Firewall/ FirewallModule.php - FirewallUpdater.php in src/
lib/ Cleantalk/ Common/ Firewall/ FirewallUpdater.php
File
- src/
lib/ Cleantalk/ Common/ DB.php, line 17
Namespace
Cleantalk\CommonView source
abstract class DB {
private static $instance;
/**
* @var array Processed result
*/
public $result = array();
/**
* @var string Database prefix
*/
public $prefix = '';
public function __construct() {
}
public function __clone() {
}
public function __wakeup() {
}
public static function getInstance() {
if (!isset(self::$instance)) {
self::$instance = new static();
self::$instance
->init();
}
return self::$instance;
}
/**
* Alternative constructor.
* Initilize Database object and write it to property.
* Set tables prefix.
*/
protected abstract function init();
/**
* Set $this->query string for next uses
*
* @param $query
* @return $this
*/
public abstract function set_query($query);
/**
* Safely replace place holders
*
* @param string $query
* @param array $vars
*
* @return $this
*/
public abstract function prepare($query, $vars = array());
/**
* Run any raw request
*
* @param $query
*
* @return bool|int Raw result
*/
public abstract function execute($query);
/**
* Fetchs first column from query.
* May receive raw or prepared query.
*
* @param bool $query
* @param bool $response_type
*
* @return array|object|void|null
*/
public abstract function fetch($query = false, $response_type = false);
/**
* Fetchs all result from query.
* May receive raw or prepared query.
*
* @param bool $query
* @param bool $response_type
*
* @return array|object|null
*/
public abstract function fetch_all($query = false, $response_type = false);
public abstract function get_last_error();
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DB:: |
private static | property | ||
DB:: |
public | property | ||
DB:: |
public | property | ||
DB:: |
abstract public | function | Run any raw request | 1 |
DB:: |
abstract public | function | Fetchs first column from query. May receive raw or prepared query. | 1 |
DB:: |
abstract public | function | Fetchs all result from query. May receive raw or prepared query. | 1 |
DB:: |
public static | function | ||
DB:: |
abstract public | function | 1 | |
DB:: |
abstract protected | function | Alternative constructor. Initilize Database object and write it to property. Set tables prefix. | 1 |
DB:: |
abstract public | function | Safely replace place holders | 1 |
DB:: |
abstract public | function | Set $this->query string for next uses | 1 |
DB:: |
public | function | ||
DB:: |
public | function | ||
DB:: |
public | function |