Merge remote-tracking branch 'github-nickvergessen/ticket/12282' into develop-ascraeus

* github-nickvergessen/ticket/12282:
  [ticket/12282] Update new references
  [ticket/12282] Update container db mock
  [ticket/12282] Add new line at EOF of the interface
  [ticket/12282] Use interface for type hinting
  [ticket/12282] Use {@inheritDoc} for inherited methods
  [ticket/12282] Add Interface for DBAL drivers
This commit is contained in:
Nils Adermann 2014-04-10 14:04:43 -07:00
commit 7a947b247d
66 changed files with 617 additions and 411 deletions

View file

@ -20,7 +20,7 @@ if (!defined('IN_PHPBB'))
*/
class acp_attachments
{
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\config\config */

View file

@ -2404,7 +2404,7 @@ function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_fr
* via admin_permissions. Changes of usernames and group names
* must be carried through for the moderators table.
*
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\cache\driver\driver_interface Cache driver
* @param \phpbb\auth\auth $auth Authentication object
* @return null
@ -2627,7 +2627,7 @@ function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id
/**
* Removes moderators and administrators from foe lists.
*
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\auth\auth $auth Authentication object
* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore
* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore

View file

@ -26,7 +26,7 @@ if (!defined('IN_PHPBB'))
* Used to bootstrap the container.
*
* @param string $config_file
* @return \phpbb\db\driver\driver
* @return \phpbb\db\driver\driver_interface
*/
function phpbb_bootstrap_db_connection($config_file)
{

View file

@ -22,14 +22,14 @@ if (!defined('IN_PHPBB'))
*
* The only supported table is bookmarks.
*
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param string $table Table on which to perform the update
* @param string $column Column whose values to change
* @param array $from_values An array of values that should be changed
* @param int $to_value The new value
* @return null
*/
function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value)
function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver_interface $db, $table, $column, $from_values, $to_value)
{
$sql = "SELECT $column, user_id
FROM $table
@ -107,14 +107,14 @@ function phpbb_update_rows_avoiding_duplicates(\phpbb\db\driver\driver $db, $tab
*
* The only supported table is topics_watch.
*
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param string $table Table on which to perform the update
* @param string $column Column whose values to change
* @param array $from_values An array of values that should be changed
* @param int $to_value The new value
* @return null
*/
function phpbb_update_rows_avoiding_duplicates_notify_status(\phpbb\db\driver\driver $db, $table, $column, $from_values, $to_value)
function phpbb_update_rows_avoiding_duplicates_notify_status(\phpbb\db\driver\driver_interface $db, $table, $column, $from_values, $to_value)
{
$sql = "SELECT $column, user_id, notify_status
FROM $table

View file

@ -596,7 +596,7 @@ function phpbb_parse_range_request($request_array, $filesize)
/**
* Increments the download count of all provided attachments
*
* @param \phpbb\db\driver\driver $db The database object
* @param \phpbb\db\driver\driver_interface $db The database object
* @param array|int $ids The attach_id of each attachment
*
* @return null
@ -617,7 +617,7 @@ function phpbb_increment_downloads($db, $ids)
/**
* Handles authentication when downloading attachments from a post or topic
*
* @param \phpbb\db\driver\driver $db The database object
* @param \phpbb\db\driver\driver_interface $db The database object
* @param \phpbb\auth\auth $auth The authentication object
* @param int $topic_id The id of the topic that we are downloading from
*
@ -663,7 +663,7 @@ function phpbb_download_handle_forum_auth($db, $auth, $topic_id)
/**
* Handles authentication when downloading attachments from PMs
*
* @param \phpbb\db\driver\driver $db The database object
* @param \phpbb\db\driver\driver_interface $db The database object
* @param \phpbb\auth\auth $auth The authentication object
* @param int $user_id The user id
* @param int $msg_id The id of the PM that we are downloading from
@ -690,7 +690,7 @@ function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id)
/**
* Checks whether a user can download from a particular PM
*
* @param \phpbb\db\driver\driver $db The database object
* @param \phpbb\db\driver\driver_interface $db The database object
* @param int $user_id The user id
* @param int $msg_id The id of the PM that we are downloading from
*

View file

@ -26,7 +26,7 @@ class apache extends \phpbb\auth\provider\base
/**
* Apache Authentication Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\config\config $config
* @param \phpbb\passwords\manager $passwords_manager
* @param \phpbb\request\request $request
@ -34,7 +34,7 @@ class apache extends \phpbb\auth\provider\base
* @param string $phpbb_root_path
* @param string $php_ext
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;

View file

@ -28,7 +28,7 @@ class db extends \phpbb\auth\provider\base
/**
* Database Authentication Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\config\config $config
* @param \phpbb\passwords\manager $passwords_manager
* @param \phpbb\request\request $request
@ -36,7 +36,7 @@ class db extends \phpbb\auth\provider\base
* @param string $phpbb_root_path
* @param string $php_ext
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;

View file

@ -28,12 +28,12 @@ class ldap extends \phpbb\auth\provider\base
/**
* LDAP Authentication Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\config\config $config
* @param \phpbb\passwords\manager $passwords_manager
* @param \phpbb\user $user
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user)
{
$this->db = $db;
$this->config = $config;

View file

@ -22,7 +22,7 @@ class oauth extends \phpbb\auth\provider\base
/**
* Database driver
*
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -106,7 +106,7 @@ class oauth extends \phpbb\auth\provider\base
/**
* OAuth Authentication Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\config\config $config
* @param \phpbb\passwords\manager $passwords_manager
* @param \phpbb\request\request_interface $request
@ -118,7 +118,7 @@ class oauth extends \phpbb\auth\provider\base
* @param string $phpbb_root_path
* @param string $php_ext
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->config = $config;

View file

@ -26,7 +26,7 @@ class token_storage implements TokenStorageInterface
/**
* Cache driver.
*
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -52,11 +52,11 @@ class token_storage implements TokenStorageInterface
/**
* Creates token storage for phpBB.
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\user $user
* @param string $auth_provider_oauth_table
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, $auth_provider_oauth_table)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $auth_provider_oauth_table)
{
$this->db = $db;
$this->user = $user;

View file

@ -106,7 +106,7 @@ interface driver_interface
* result to persistent storage. In other words, there is no need
* to call save() afterwards.
*
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param string $query SQL query, should be used for generating storage key
* @param mixed $query_result The result from \dbal::sql_query, to be passed to
* \dbal::sql_fetchrow to get all rows and store them
@ -117,7 +117,7 @@ interface driver_interface
* representing the query should be returned. Otherwise
* the original $query_result should be returned.
*/
public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl);
public function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl);
/**
* Check if result for a given SQL query exists in cache.

View file

@ -407,7 +407,7 @@ class file extends \phpbb\cache\driver\base
/**
* {@inheritDoc}
*/
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);

View file

@ -279,7 +279,7 @@ abstract class memory extends \phpbb\cache\driver\base
/**
* {@inheritDoc}
*/
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl)
{
// Remove extra spaces and tabs
$query = preg_replace('/[\n\r\s\t]+/', ' ', $query);

View file

@ -101,7 +101,7 @@ class null extends \phpbb\cache\driver\base
/**
* {@inheritDoc}
*/
function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl)
{
return $query_result;
}

View file

@ -32,7 +32,7 @@ class service
/**
* Database connection.
*
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -55,11 +55,11 @@ class service
*
* @param \phpbb\cache\driver\driver_interface $driver The cache driver
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP extension
*/
public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\cache\driver\driver_interface $driver, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext)
{
$this->set_driver($driver);
$this->config = $config;

View file

@ -23,7 +23,7 @@ class db extends \phpbb\config\config
/**
* Database connection
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -36,11 +36,11 @@ class db extends \phpbb\config\config
/**
* Creates a configuration container with a default set of values
*
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\cache\driver\driver_interface $cache Cache instance
* @param string $table Configuration table name
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $table)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, $table)
{
$this->db = $db;
$this->cache = $cache;

View file

@ -20,7 +20,7 @@ class db_text
{
/**
* Database connection
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -31,10 +31,10 @@ class db_text
protected $table;
/**
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param string $table Table name
*/
public function __construct(\phpbb\db\driver\driver $db, $table)
public function __construct(\phpbb\db\driver\driver_interface $db, $table)
{
$this->db = $db;
$this->table = $this->db->sql_escape($table);

View file

@ -13,10 +13,10 @@ use Symfony\Component\Console\Output\OutputInterface;
class recalculate_email_hash extends \phpbb\console\command\command
{
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
function __construct(\phpbb\db\driver\driver $db)
function __construct(\phpbb\db\driver\driver_interface $db)
{
$this->db = $db;

View file

@ -18,7 +18,7 @@ class content_visibility
{
/**
* Database object
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -50,13 +50,13 @@ class content_visibility
* Constructor
*
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param \phpbb\user $user User object
* @param string $phpbb_root_path Root path
* @param string $php_ext PHP Extension
* @return null
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table)
{
$this->auth = $auth;
$this->db = $db;

View file

@ -31,9 +31,9 @@ class prune_all_forums extends \phpbb\cron\task\base
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection
* @param \phpbb\db\driver\driver_interface $db The db connection
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

View file

@ -41,9 +41,9 @@ class prune_forum extends \phpbb\cron\task\base implements \phpbb\cron\task\para
* @param string $phpbb_root_path The root path
* @param string $php_ext The PHP extension
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection
* @param \phpbb\db\driver\driver_interface $db The db connection
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
public function __construct($phpbb_root_path, $php_ext, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

View file

@ -32,10 +32,10 @@ class tidy_search extends \phpbb\cron\task\base
* @param string $php_ext The PHP extension
* @param \phpbb\auth\auth $auth The auth
* @param \phpbb\config\config $config The config
* @param \phpbb\db\driver\driver $db The db connection
* @param \phpbb\db\driver\driver_interface $db The db connection
* @param \phpbb\user $user The user
*/
public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\user $user)
public function __construct($phpbb_root_path, $php_ext, \phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user)
{
$this->phpbb_root_path = $phpbb_root_path;
$this->php_ext = $php_ext;

View file

@ -13,7 +13,7 @@ namespace phpbb\db\driver;
* Database Abstraction Layer
* @package dbal
*/
class driver
abstract class driver implements driver_interface
{
var $db_connect_id;
var $query_result;
@ -84,7 +84,7 @@ class driver
}
/**
* return on error or display error message
* {@inheritDoc}
*/
function sql_return_on_error($fail = false)
{
@ -95,7 +95,7 @@ class driver
}
/**
* Return number of sql queries and cached sql queries used
* {@inheritDoc}
*/
function sql_num_queries($cached = false)
{
@ -103,7 +103,7 @@ class driver
}
/**
* Add to query count
* {@inheritDoc}
*/
function sql_add_num_queries($cached = false)
{
@ -113,7 +113,7 @@ class driver
}
/**
* DBAL garbage collection, close sql connection
* {@inheritDoc}
*/
function sql_close()
{
@ -146,8 +146,7 @@ class driver
}
/**
* Build LIMIT query
* Doing some validation here.
* {@inheritDoc}
*/
function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0)
{
@ -164,7 +163,7 @@ class driver
}
/**
* Fetch all rows
* {@inheritDoc}
*/
function sql_fetchrowset($query_id = false)
{
@ -188,8 +187,7 @@ class driver
}
/**
* Seek to given row number
* rownum is zero-based
* {@inheritDoc}
*/
function sql_rowseek($rownum, &$query_id)
{
@ -231,8 +229,7 @@ class driver
}
/**
* Fetch field
* if rownum is false, the current row is used, else it is pointing to the row (zero-based)
* {@inheritDoc}
*/
function sql_fetchfield($field, $rownum = false, $query_id = false)
{
@ -263,11 +260,7 @@ class driver
}
/**
* Correctly adjust LIKE expression for special characters
* Some DBMS are handling them in a different way
*
* @param string $expression The expression to use. Every wildcard is escaped, except $this->any_char and $this->one_char
* @return string LIKE expression including the keyword!
* {@inheritDoc}
*/
function sql_like_expression($expression)
{
@ -278,14 +271,7 @@ class driver
}
/**
* Build a case expression
*
* Note: The two statements action_true and action_false must have the same data type (int, vchar, ...) in the database!
*
* @param string $condition The condition which must be true, to use action_true rather then action_else
* @param string $action_true SQL expression that is used, if the condition is true
* @param string $action_else SQL expression that is used, if the condition is false, optional
* @return string CASE expression including the condition and statements
* {@inheritDoc}
*/
public function sql_case($condition, $action_true, $action_false = false)
{
@ -297,11 +283,7 @@ class driver
}
/**
* Build a concatenated expression
*
* @param string $expr1 Base SQL expression where we append the second one
* @param string $expr2 SQL expression that is appended to the first expression
* @return string Concatenated string
* {@inheritDoc}
*/
public function sql_concatenate($expr1, $expr2)
{
@ -309,9 +291,7 @@ class driver
}
/**
* Returns whether results of a query need to be buffered to run a transaction while iterating over them.
*
* @return bool Whether buffering is required.
* {@inheritDoc}
*/
function sql_buffer_nested_transactions()
{
@ -319,15 +299,14 @@ class driver
}
/**
* SQL Transaction
* @access private
* {@inheritDoc}
*/
function sql_transaction($status = 'begin')
{
switch ($status)
{
case 'begin':
// If we are within a transaction we will not open another one, but enclose the current one to not loose data (prevening auto commit)
// If we are within a transaction we will not open another one, but enclose the current one to not loose data (preventing auto commit)
if ($this->transaction)
{
$this->transactions++;
@ -345,14 +324,16 @@ class driver
break;
case 'commit':
// If there was a previously opened transaction we do not commit yet... but count back the number of inner transactions
// If there was a previously opened transaction we do not commit yet...
// but count back the number of inner transactions
if ($this->transaction && $this->transactions)
{
$this->transactions--;
return true;
}
// Check if there is a transaction (no transaction can happen if there was an error, with a combined rollback and error returning enabled)
// Check if there is a transaction (no transaction can happen if
// there was an error, with a combined rollback and error returning enabled)
// This implies we have transaction always set for autocommit db's
if (!$this->transaction)
{
@ -385,11 +366,7 @@ class driver
}
/**
* Build sql statement from array for insert/update/select statements
*
* Idea for this from Ikonboard
* Possible query values: INSERT, INSERT_SELECT, UPDATE, SELECT, DELETE
*
* {@inheritDoc}
*/
function sql_build_array($query, $assoc_ary = false)
{
@ -437,14 +414,7 @@ class driver
}
/**
* Build IN or NOT IN sql comparison string, uses <> or = on single element
* arrays to improve comparison speed
*
* @access public
* @param string $field name of the sql column that shall be compared
* @param array $array array of values that are allowed (IN) or not allowed (NOT IN)
* @param bool $negate true for NOT IN (), false for IN () (default)
* @param bool $allow_empty_set If true, allow $array to be empty, this function will return 1=1 or 1=0 then. Default to false.
* {@inheritDoc}
*/
function sql_in_set($field, $array, $negate = false, $allow_empty_set = false)
{
@ -489,12 +459,7 @@ class driver
}
/**
* Run binary AND operator on DB column.
* Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}"
*
* @param string $column_name The column name to use
* @param int $bit The value to use for the AND operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29
* @param string $compare Any custom SQL code after the check (for example "= 0")
* {@inheritDoc}
*/
function sql_bit_and($column_name, $bit, $compare = '')
{
@ -507,12 +472,7 @@ class driver
}
/**
* Run binary OR operator on DB column.
* Results in sql statement: "{$column_name} | (1 << {$bit}) {$compare}"
*
* @param string $column_name The column name to use
* @param int $bit The value to use for the OR operator, will be converted to (1 << $bit). Is used by options, using the number schema... 0, 1, 2...29
* @param string $compare Any custom SQL code after the check (for example "= 0")
* {@inheritDoc}
*/
function sql_bit_or($column_name, $bit, $compare = '')
{
@ -525,10 +485,7 @@ class driver
}
/**
* Returns SQL string to cast a string expression to an int.
*
* @param string $expression An expression evaluating to string
* @return string Expression returning an int
* {@inheritDoc}
*/
function cast_expr_to_bigint($expression)
{
@ -536,10 +493,7 @@ class driver
}
/**
* Returns SQL string to cast an integer expression to a string.
*
* @param string $expression An expression evaluating to int
* @return string Expression returning a string
* {@inheritDoc}
*/
function cast_expr_to_string($expression)
{
@ -547,11 +501,7 @@ class driver
}
/**
* Run LOWER() on DB column of type text (i.e. neither varchar nor char).
*
* @param string $column_name The column name to use
*
* @return string A SQL statement like "LOWER($column_name)"
* {@inheritDoc}
*/
function sql_lower_text($column_name)
{
@ -559,13 +509,7 @@ class driver
}
/**
* Run more than one insert statement.
*
* @param string $table table name to run the statements on
* @param array $sql_ary multi-dimensional array holding the statement data.
*
* @return bool false if no statements were executed.
* @access public
* {@inheritDoc}
*/
function sql_multi_insert($table, $sql_ary)
{
@ -637,9 +581,7 @@ class driver
}
/**
* Build sql statement from array for select and select distinct statements
*
* Possible query values: SELECT, SELECT_DISTINCT
* {@inheritDoc}
*/
function sql_build_query($query, $array)
{
@ -742,7 +684,7 @@ class driver
}
/**
* display sql error page
* {@inheritDoc}
*/
function sql_error($sql = '')
{
@ -812,7 +754,7 @@ class driver
}
/**
* Explain queries
* {@inheritDoc}
*/
function sql_report($mode, $query = '')
{
@ -1002,14 +944,7 @@ class driver
}
/**
* Gets the estimated number of rows in a specified table.
*
* @param string $table_name Table name
*
* @return string Number of rows in $table_name.
* Prefixed with ~ if estimated (otherwise exact).
*
* @access public
* {@inheritDoc}
*/
function get_estimated_row_count($table_name)
{
@ -1017,13 +952,7 @@ class driver
}
/**
* Gets the exact number of rows in a specified table.
*
* @param string $table_name Table name
*
* @return string Exact number of rows in $table_name.
*
* @access public
* {@inheritDoc}
*/
function get_row_count($table_name)
{

View file

@ -0,0 +1,355 @@
<?php
/**
*
* @package dbal
* @copyright (c) 2014 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/
namespace phpbb\db\driver;
interface driver_interface
{
/**
* Gets the exact number of rows in a specified table.
*
* @param string $table_name Table name
* @return string Exact number of rows in $table_name.
*/
public function get_row_count($table_name);
/**
* Gets the estimated number of rows in a specified table.
*
* @param string $table_name Table name
* @return string Number of rows in $table_name.
* Prefixed with ~ if estimated (otherwise exact).
*/
public function get_estimated_row_count($table_name);
/**
* Run LOWER() on DB column of type text (i.e. neither varchar nor char).
*
* @param string $column_name The column name to use
* @return string A SQL statement like "LOWER($column_name)"
*/
public function sql_lower_text($column_name);
/**
* Display sql error page
*
* @param string $sql The SQL query causing the error
* @return mixed Returns the full error message, if $this->return_on_error
* is set, null otherwise
*/
public function sql_error($sql = '');
/**
* Returns whether results of a query need to be buffered to run a
* transaction while iterating over them.
*
* @return bool Whether buffering is required.
*/
public function sql_buffer_nested_transactions();
/**
* Run binary OR operator on DB column.
*
* @param string $column_name The column name to use
* @param int $bit The value to use for the OR operator,
* will be converted to (1 << $bit). Is used by options,
* using the number schema... 0, 1, 2...29
* @param string $compare Any custom SQL code after the check (e.g. "= 0")
* @return string A SQL statement like "$column | (1 << $bit) {$compare}"
*/
public function sql_bit_or($column_name, $bit, $compare = '');
/**
* Version information about used database
*
* @param bool $raw Only return the fetched sql_server_version
* @param bool $use_cache Is it safe to retrieve the value from the cache
* @return string sql server version
*/
public function sql_server_info($raw = false, $use_cache = true);
/**
* Return on error or display error message
*
* @param bool $fail Should we return on errors, or stop
* @return null
*/
public function sql_return_on_error($fail = false);
/**
* Build sql statement from an array
*
* @param string $query Should be on of the following strings:
* INSERT, INSERT_SELECT, UPDATE, SELECT, DELETE
* @param array $assoc_ary Array with "column => value" pairs
* @return string A SQL statement like "c1 = 'a' AND c2 = 'b'"
*/
public function sql_build_array($query, $assoc_ary = array());
/**
* Fetch all rows
*
* @param mixed $query_id Already executed query to get the rows from,
* if false, the last query will be used.
* @return mixed Nested array if the query had rows, false otherwise
*/
public function sql_fetchrowset($query_id = false);
/**
* SQL Transaction
*
* @param string $status Should be one of the following strings:
* begin, commit, rollback
* @return mixed Buffered, seekable result handle, false on error
*/
public function sql_transaction($status = 'begin');
/**
* Build a concatenated expression
*
* @param string $expr1 Base SQL expression where we append the second one
* @param string $expr2 SQL expression that is appended to the first expression
* @return string Concatenated string
*/
public function sql_concatenate($expr1, $expr2);
/**
* Build a case expression
*
* Note: The two statements action_true and action_false must have the same
* data type (int, vchar, ...) in the database!
*
* @param string $condition The condition which must be true,
* to use action_true rather then action_else
* @param string $action_true SQL expression that is used, if the condition is true
* @param mixed $action_false SQL expression that is used, if the condition is false
* @return string CASE expression including the condition and statements
*/
public function sql_case($condition, $action_true, $action_false = false);
/**
* Build sql statement from array for select and select distinct statements
*
* Possible query values: SELECT, SELECT_DISTINCT
*
* @param string $query Should be one of: SELECT, SELECT_DISTINCT
* @param array $array Array with the query data:
* SELECT A comma imploded list of columns to select
* FROM Array with "table => alias" pairs,
* (alias can also be an array)
* Optional: LEFT_JOIN Array of join entries:
* FROM Table that should be joined
* ON Condition for the join
* Optional: WHERE Where SQL statement
* Optional: GROUP_BY Group by SQL statement
* Optional: ORDER_BY Order by SQL statement
* @return string A SQL statement ready for execution
*/
public function sql_build_query($query, $array);
/**
* Fetch field
* if rownum is false, the current row is used, else it is pointing to the row (zero-based)
*
* @param string $field Name of the column
* @param mixed $rownum Row number, if false the current row will be used
* and the row curser will point to the next row
* Note: $rownum is 0 based
* @param mixed $query_id Already executed query to get the rows from,
* if false, the last query will be used.
* @return mixed String value of the field in the selected row,
* false, if the row does not exist
*/
public function sql_fetchfield($field, $rownum = false, $query_id = false);
/**
* Fetch current row
*
* @param mixed $query_id Already executed query to get the rows from,
* if false, the last query will be used.
* @return mixed Array with the current row,
* false, if the row does not exist
*/
public function sql_fetchrow($query_id = false);
/**
* Returns SQL string to cast a string expression to an int.
*
* @param string $expression An expression evaluating to string
* @return string Expression returning an int
*/
public function cast_expr_to_bigint($expression);
/**
* Get last inserted id after insert statement
*
* @return string Autoincrement value of the last inserted row
*/
public function sql_nextid();
/**
* Add to query count
*
* @param bool $cached Is this query cached?
* @return null
*/
public function sql_add_num_queries($cached = false);
/**
* Build LIMIT query
*
* @param string $query The SQL query to execute
* @param int $total The number of rows to select
* @param int $offset
* @param int $cache_ttl Either 0 to avoid caching or
* the time in seconds which the result shall be kept in cache
* @return mixed Buffered, seekable result handle, false on error
*/
public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0);
/**
* Base query method
*
* @param string $query The SQL query to execute
* @param int $cache_ttl Either 0 to avoid caching or
* the time in seconds which the result shall be kept in cache
* @return mixed Buffered, seekable result handle, false on error
*/
public function sql_query($query = '', $cache_ttl = 0);
/**
* Returns SQL string to cast an integer expression to a string.
*
* @param string $expression An expression evaluating to int
* @return string Expression returning a string
*/
public function cast_expr_to_string($expression);
/**
* Connect to server
*
* @param string $sqlserver Address of the database server
* @param string $sqluser User name of the SQL user
* @param string $sqlpassword Password of the SQL user
* @param string $database Name of the database
* @param mixed $port Port of the database server
* @param bool $persistency
* @param bool $new_link Should a new connection be established
* @return mixed Connection ID on success, string error message otherwise
*/
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false);
/**
* Run binary AND operator on DB column.
* Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}"
*
* @param string $column_name The column name to use
* @param int $bit The value to use for the AND operator,
* will be converted to (1 << $bit). Is used by
* options, using the number schema: 0, 1, 2...29
* @param string $compare Any custom SQL code after the check (for example "= 0")
* @return string A SQL statement like: "{$column} & (1 << {$bit}) {$compare}"
*/
public function sql_bit_and($column_name, $bit, $compare = '');
/**
* Free sql result
*
* @param mixed $query_id Already executed query result,
* if false, the last query will be used.
* @return null
*/
public function sql_freeresult($query_id = false);
/**
* Return number of sql queries and cached sql queries used
*
* @param bool $cached Should we return the number of cached or normal queries?
* @return int Number of queries that have been executed
*/
public function sql_num_queries($cached = false);
/**
* Run more than one insert statement.
*
* @param string $table Table name to run the statements on
* @param array $sql_ary Multi-dimensional array holding the statement data
* @return bool false if no statements were executed.
*/
public function sql_multi_insert($table, $sql_ary);
/**
* Return number of affected rows
*
* @return mixed Number of the affected rows by the last query
* false if no query has been run before
*/
public function sql_affectedrows();
/**
* DBAL garbage collection, close SQL connection
*
* @return mixed False if no connection was opened before,
* Server response otherwise
*/
public function sql_close();
/**
* Seek to given row number
*
* @param mixed $rownum Row number the curser should point to
* Note: $rownum is 0 based
* @param mixed $query_id ID of the query to set the row cursor on
* if false, the last query will be used.
* $query_id will then be set correctly
* @return bool False if something went wrong
*/
public function sql_rowseek($rownum, &$query_id);
/**
* Escape string used in sql query
*
* @param string $msg String to be escaped
* @return string Escaped version of $msg
*/
public function sql_escape($msg);
/**
* Correctly adjust LIKE expression for special characters
* Some DBMS are handling them in a different way
*
* @param string $expression The expression to use. Every wildcard is
* escaped, except $this->any_char and $this->one_char
* @return string A SQL statement like: "LIKE 'bertie_%'"
*/
public function sql_like_expression($expression);
/**
* Explain queries
*
* @param string $mode Available modes: display, start, stop,
* add_select_row, fromcache, record_fromcache
* @param string $query The Query that should be explained
* @return mixed Either a full HTML page, boolean or null
*/
public function sql_report($mode, $query = '');
/**
* Build IN or NOT IN sql comparison string, uses <> or = on single element
* arrays to improve comparison speed
*
* @param string $field Name of the sql column that shall be compared
* @param array $array Array of values that are (not) allowed
* @param bool $negate true for NOT IN (), false for IN ()
* @param bool $allow_empty_set If true, allow $array to be empty,
* this function will return 1=1 or 1=0 then.
* @return string A SQL statement like: "IN (1, 2, 3, 4)" or "= 1"
*/
public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false);
}

View file

@ -22,7 +22,7 @@ class firebird extends \phpbb\db\driver\driver
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -79,10 +79,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache forced to false for Interbase
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -127,13 +124,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -297,7 +288,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -313,7 +304,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -351,7 +342,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -379,7 +370,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
@ -405,7 +396,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* Escape string used in sql query
* {@inheritDoc}
*/
function sql_escape($msg)
{
@ -441,7 +432,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* @inheritdoc
* {@inheritDoc}
*/
function cast_expr_to_bigint($expression)
{
@ -450,7 +441,7 @@ class firebird extends \phpbb\db\driver\driver
}
/**
* @inheritdoc
* {@inheritDoc}
*/
function cast_expr_to_string($expression)
{

View file

@ -19,7 +19,7 @@ class mssql extends \phpbb\db\driver\driver
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -55,10 +55,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache If true, it is safe to retrieve the value from the cache
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -124,13 +121,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -215,7 +206,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -223,7 +214,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -259,8 +250,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Seek to given row number
* rownum is zero-based
* {@inheritDoc}
*/
function sql_rowseek($rownum, &$query_id)
{
@ -280,7 +270,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -299,7 +289,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
@ -325,7 +315,7 @@ class mssql extends \phpbb\db\driver\driver
}
/**
* Escape string used in sql query
* {@inheritDoc}
*/
function sql_escape($msg)
{

View file

@ -24,7 +24,7 @@ abstract class mssql_base extends \phpbb\db\driver\driver
}
/**
* Escape string used in sql query
* {@inheritDoc}
*/
function sql_escape($msg)
{

View file

@ -26,7 +26,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -83,10 +83,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache If true, it is safe to retrieve the value from the cache
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -144,13 +141,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -236,7 +227,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -244,8 +235,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
}
/**
* Fetch current row
* @note number of bytes returned depends on odbc.defaultlrl php.ini setting. If it is limited to 4K for example only 4K of data is returned max.
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -265,7 +255,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -286,7 +276,7 @@ class mssql_odbc extends \phpbb\db\driver\mssql_base
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{

View file

@ -24,7 +24,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -53,10 +53,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache If true, it is safe to retrieve the value from the cache
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -113,13 +110,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -215,7 +206,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -223,7 +214,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -263,7 +254,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -283,7 +274,7 @@ class mssqlnative extends \phpbb\db\driver\mssql_base
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{

View file

@ -24,8 +24,7 @@ class mysql extends \phpbb\db\driver\mysql_base
var $connect_error = '';
/**
* Connect to server
* @access public
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -103,10 +102,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache If true, it is safe to retrieve the value from the cache
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -154,13 +150,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -213,7 +203,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -221,7 +211,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -241,8 +231,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Seek to given row number
* rownum is zero-based
* {@inheritDoc}
*/
function sql_rowseek($rownum, &$query_id)
{
@ -262,7 +251,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -270,7 +259,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
@ -296,7 +285,7 @@ class mysql extends \phpbb\db\driver\mysql_base
}
/**
* Escape string used in sql query
* {@inheritDoc}
*/
function sql_escape($msg)
{

View file

@ -43,14 +43,7 @@ abstract class mysql_base extends \phpbb\db\driver\driver
}
/**
* Gets the estimated number of rows in a specified table.
*
* @param string $table_name Table name
*
* @return string Number of rows in $table_name.
* Prefixed with ~ if estimated (otherwise exact).
*
* @access public
* {@inheritDoc}
*/
function get_estimated_row_count($table_name)
{
@ -72,13 +65,7 @@ abstract class mysql_base extends \phpbb\db\driver\driver
}
/**
* Gets the exact number of rows in a specified table.
*
* @param string $table_name Table name
*
* @return string Exact number of rows in $table_name.
*
* @access public
* {@inheritDoc}
*/
function get_row_count($table_name)
{

View file

@ -21,7 +21,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -96,10 +96,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache If true, it is safe to retrieve the value from the cache
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -151,13 +148,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -205,7 +196,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -213,7 +204,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -239,8 +230,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Seek to given row number
* rownum is zero-based
* {@inheritDoc}
*/
function sql_rowseek($rownum, &$query_id)
{
@ -260,7 +250,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -268,7 +258,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
@ -288,7 +278,7 @@ class mysqli extends \phpbb\db\driver\mysql_base
}
/**
* Escape string used in sql query
* {@inheritDoc}
*/
function sql_escape($msg)
{

View file

@ -19,7 +19,7 @@ class oracle extends \phpbb\db\driver\driver
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -72,10 +72,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache forced to false for Oracle
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -240,13 +237,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -473,7 +464,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -481,7 +472,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -532,8 +523,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Seek to given row number
* rownum is zero-based
* {@inheritDoc}
*/
function sql_rowseek($rownum, &$query_id)
{
@ -570,7 +560,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -602,7 +592,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
@ -628,7 +618,7 @@ class oracle extends \phpbb\db\driver\driver
}
/**
* Escape string used in sql query
* {@inheritDoc}
*/
function sql_escape($msg)
{

View file

@ -20,7 +20,7 @@ class postgres extends \phpbb\db\driver\driver
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -115,10 +115,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache If true, it is safe to retrieve the value from the cache
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -166,13 +163,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -253,7 +244,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -261,7 +252,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -281,8 +272,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Seek to given row number
* rownum is zero-based
* {@inheritDoc}
*/
function sql_rowseek($rownum, &$query_id)
{
@ -302,7 +292,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -331,7 +321,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
@ -357,8 +347,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* Escape string used in sql query
* Note: Do not use for bytea values if we may use them at a later stage
* {@inheritDoc}
*/
function sql_escape($msg)
{
@ -375,7 +364,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* @inheritdoc
* {@inheritDoc}
*/
function cast_expr_to_bigint($expression)
{
@ -383,7 +372,7 @@ class postgres extends \phpbb\db\driver\driver
}
/**
* @inheritdoc
* {@inheritDoc}
*/
function cast_expr_to_string($expression)
{

View file

@ -19,7 +19,7 @@ class sqlite extends \phpbb\db\driver\driver
var $connect_error = '';
/**
* Connect to server
* {@inheritDoc}
*/
function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
@ -58,10 +58,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache if true, it is safe to retrieve the stored value from the cache
* @return string sql server version
* {@inheritDoc}
*/
function sql_server_info($raw = false, $use_cache = true)
{
@ -108,13 +105,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Base query method
*
* @param string $query Contains the SQL query which shall be executed
* @param int $cache_ttl Either 0 to avoid caching or the time in seconds which the result shall be kept in cache
* @return mixed When casted to bool the returned value returns true on success and false on failure
*
* @access public
* {@inheritDoc}
*/
function sql_query($query = '', $cache_ttl = 0)
{
@ -185,7 +176,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Return number of affected rows
* {@inheritDoc}
*/
function sql_affectedrows()
{
@ -193,7 +184,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Fetch current row
* {@inheritDoc}
*/
function sql_fetchrow($query_id = false)
{
@ -213,8 +204,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Seek to given row number
* rownum is zero-based
* {@inheritDoc}
*/
function sql_rowseek($rownum, &$query_id)
{
@ -234,7 +224,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Get last inserted id after insert statement
* {@inheritDoc}
*/
function sql_nextid()
{
@ -242,7 +232,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Free sql result
* {@inheritDoc}
*/
function sql_freeresult($query_id = false)
{
@ -262,7 +252,7 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Escape string used in sql query
* {@inheritDoc}
*/
function sql_escape($msg)
{
@ -270,7 +260,8 @@ class sqlite extends \phpbb\db\driver\driver
}
/**
* Correctly adjust LIKE expression for special characters
* {@inheritDoc}
*
* For SQLite an underscore is a not-known character... this may change with SQLite3
*/
function sql_like_expression($expression)

View file

@ -23,7 +23,7 @@ abstract class migration
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\db\tools */
@ -48,13 +48,13 @@ abstract class migration
* Constructor
*
* @param \phpbb\config\config $config
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\db\tools $db_tools
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $table_prefix
*/
public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
{
$this->config = $config;
$this->db = $db;

View file

@ -19,7 +19,7 @@ class schema_generator
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\db\tools */
@ -46,7 +46,7 @@ class schema_generator
/**
* Constructor
*/
public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
public function __construct(array $class_names, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools $db_tools, $phpbb_root_path, $php_ext, $table_prefix)
{
$this->config = $config;
$this->db = $db;

View file

@ -19,7 +19,7 @@ class module implements \phpbb\db\migration\tool\tool_interface
/** @var \phpbb\cache\service */
protected $cache;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\user */
@ -37,14 +37,14 @@ class module implements \phpbb\db\migration\tool\tool_interface
/**
* Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\cache\service $cache
* @param \phpbb\user $user
* @param string $phpbb_root_path
* @param string $php_ext
* @param string $modules_table
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\user $user, $phpbb_root_path, $php_ext, $modules_table)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\user $user, $phpbb_root_path, $php_ext, $modules_table)
{
$this->db = $db;
$this->cache = $cache;

View file

@ -22,7 +22,7 @@ class permission implements \phpbb\db\migration\tool\tool_interface
/** @var \phpbb\cache\service */
protected $cache;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var string */
@ -34,13 +34,13 @@ class permission implements \phpbb\db\migration\tool\tool_interface
/**
* Constructor
*
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\cache\service $cache
* @param \phpbb\auth\auth $auth
* @param string $phpbb_root_path
* @param string $php_ext
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext)
{
$this->db = $db;
$this->cache = $cache;

View file

@ -19,7 +19,7 @@ class migrator
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\db\tools */
@ -68,7 +68,7 @@ class migrator
/**
* Constructor of the database migrator
*/
public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\db\tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper)
public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper)
{
$this->config = $config;
$this->db = $db;

View file

@ -49,7 +49,7 @@ namespace phpbb\db;
*/
class sql_insert_buffer
{
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var string */
@ -62,11 +62,11 @@ class sql_insert_buffer
protected $buffer = array();
/**
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param string $table_name
* @param int $max_buffered_rows
*/
public function __construct(\phpbb\db\driver\driver $db, $table_name, $max_buffered_rows = 500)
public function __construct(\phpbb\db\driver\driver_interface $db, $table_name, $max_buffered_rows = 500)
{
$this->db = $db;
$this->table_name = $table_name;

View file

@ -304,10 +304,10 @@ class tools
/**
* Constructor. Set DB Object and set {@link $return_statements return_statements}.
*
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param bool $return_statements True if only statements should be returned and no SQL being executed
*/
public function __construct(\phpbb\db\driver\driver $db, $return_statements = false)
public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false)
{
$this->db = $db;
$this->return_statements = $return_statements;

View file

@ -34,7 +34,7 @@ class manager
* Creates a manager and loads information from database
*
* @param ContainerInterface $container A container
* @param \phpbb\db\driver\driver $db A database connection
* @param \phpbb\db\driver\driver_interface $db A database connection
* @param \phpbb\config\config $config \phpbb\config\config
* @param \phpbb\filesystem $filesystem
* @param string $extension_table The name of the table holding extensions
@ -43,7 +43,7 @@ class manager
* @param \phpbb\cache\driver\driver_interface $cache A cache instance or null
* @param string $cache_name The name of the cache variable, defaults to _ext
*/
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext')
public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null, $cache_name = '_ext')
{
$this->container = $container;
$this->phpbb_root_path = $phpbb_root_path;

View file

@ -25,7 +25,7 @@ abstract class base
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\cache\driver\driver_interface */
@ -70,7 +70,7 @@ abstract class base
*
* @param \phpbb\feed\helper $helper Feed helper
* @param \phpbb\config\config $config Config object
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\cache\driver\driver_interface $cache Cache object
* @param \phpbb\user $user User object
* @param \phpbb\auth\auth $auth Auth object
@ -78,7 +78,7 @@ abstract class base
* @param string $phpEx php file extension
* @return null
*/
function __construct(\phpbb\feed\helper $helper, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, $phpEx)
function __construct(\phpbb\feed\helper $helper, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, \phpbb\user $user, \phpbb\auth\auth $auth, \phpbb\content_visibility $content_visibility, $phpEx)
{
$this->config = $config;
$this->helper = $helper;

View file

@ -24,7 +24,7 @@ class factory
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/**
@ -32,10 +32,10 @@ class factory
*
* @param objec $container Container object
* @param \phpbb\config\config $config Config object
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @return null
*/
public function __construct($container, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
public function __construct($container, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db)
{
$this->container = $container;
$this->config = $config;

View file

@ -26,7 +26,7 @@ class legend implements \phpbb\groupposition\groupposition_interface
/**
* Database object
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -39,10 +39,10 @@ class legend implements \phpbb\groupposition\groupposition_interface
/**
* Constructor
*
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param \phpbb\user $user User object
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user)
{
$this->db = $db;
$this->user = $user;

View file

@ -30,7 +30,7 @@ class teampage implements \phpbb\groupposition\groupposition_interface
/**
* Database object
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -49,11 +49,11 @@ class teampage implements \phpbb\groupposition\groupposition_interface
/**
* Constructor
*
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param \phpbb\user $user User object
* @param \phpbb\cache\driver\driver_interface $cache Cache object
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, \phpbb\cache\driver\driver_interface $cache)
{
$this->db = $db;
$this->user = $user;

View file

@ -42,7 +42,7 @@ class db
/**
* A database connection
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
private $db;
@ -53,9 +53,9 @@ class db
*
* @param string $config_name A config variable to be used for locking
* @param array $config The phpBB configuration
* @param \phpbb\db\driver\driver $db A database connection
* @param \phpbb\db\driver\driver_interface $db A database connection
*/
public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver $db)
public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db)
{
$this->config_name = $config_name;
$this->config = $config;

View file

@ -93,10 +93,10 @@ class log implements \phpbb\log\log_interface
/**
* Constructor
*
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param \phpbb\user $user User object
* @param \phpbb\auth\auth $auth Auth object
* @param phpbb_dispatcher $phpbb_dispatcher Event dispatcher
* @param \phpbb\event\dispatcher $phpbb_dispatcher Event dispatcher
* @param string $phpbb_root_path Root path
* @param string $relative_admin_path Relative admin root path
* @param string $php_ext PHP Extension

View file

@ -30,7 +30,7 @@ class manager
/** @var \phpbb\config\config */
protected $config;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\cache\service */
@ -62,7 +62,7 @@ class manager
* @param ContainerBuilder $phpbb_container
* @param \phpbb\user_loader $user_loader
* @param \phpbb\config\config $config
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\user $user
* @param string $phpbb_root_path
* @param string $php_ext
@ -71,7 +71,7 @@ class manager
* @param string $user_notifications_table
* @return \phpbb\notification\manager
*/
public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
public function __construct($notification_types, $notification_methods, $phpbb_container, \phpbb\user_loader $user_loader, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, $user, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
{
$this->notification_types = $notification_types;
$this->notification_methods = $notification_methods;

View file

@ -21,7 +21,7 @@ abstract class base implements \phpbb\notification\method\method_interface
/** @var \phpbb\user_loader */
protected $user_loader;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\cache\driver\driver_interface */
@ -59,7 +59,7 @@ abstract class base implements \phpbb\notification\method\method_interface
* Notification Method Base Constructor
*
* @param \phpbb\user_loader $user_loader
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\cache\driver\driver_interface $cache
* @param \phpbb\user $user
* @param \phpbb\auth\auth $auth
@ -68,7 +68,7 @@ abstract class base implements \phpbb\notification\method\method_interface
* @param string $php_ext
* @return \phpbb\notification\method\base
*/
public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext)
public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext)
{
$this->user_loader = $user_loader;
$this->db = $db;

View file

@ -21,7 +21,7 @@ abstract class base implements \phpbb\notification\type\type_interface
/** @var \phpbb\user_loader */
protected $user_loader;
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\cache\driver\driver_interface */
@ -89,7 +89,7 @@ abstract class base implements \phpbb\notification\type\type_interface
* Notification Type Base Constructor
*
* @param \phpbb\user_loader $user_loader
* @param \phpbb\db\driver\driver $db
* @param \phpbb\db\driver\driver_interface $db
* @param \phpbb\cache\driver\driver_interface $cache
* @param \phpbb\user $user
* @param \phpbb\auth\auth $auth
@ -101,7 +101,7 @@ abstract class base implements \phpbb\notification\type\type_interface
* @param string $user_notifications_table
* @return \phpbb\notification\type\base
*/
public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
public function __construct(\phpbb\user_loader $user_loader, \phpbb\db\driver\driver_interface $db, \phpbb\cache\driver\driver_interface $cache, $user, \phpbb\auth\auth $auth, \phpbb\config\config $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table)
{
$this->user_loader = $user_loader;
$this->db = $db;

View file

@ -23,7 +23,7 @@ class lang_helper
/**
* Database object
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -36,7 +36,7 @@ class lang_helper
/**
* Construct
*
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param string $language_table Table where the language strings are stored
*/
public function __construct($db, $language_table)

View file

@ -23,7 +23,7 @@ class manager
/**
* Database object
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;
@ -63,7 +63,7 @@ class manager
* Construct
*
* @param \phpbb\auth\auth $auth Auth object
* @param \phpbb\db\driver\driver $db Database object
* @param \phpbb\db\driver\driver_interface $db Database object
* @param \phpbb\request\request $request Request object
* @param \phpbb\template\template $template Template object
* @param \phpbb\di\service_collection $type_collection
@ -72,7 +72,7 @@ class manager
* @param string $fields_language_table
* @param string $fields_data_table
*/
public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\di\service_collection $type_collection, \phpbb\user $user, $fields_table, $fields_language_table, $fields_data_table)
public function __construct(\phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db, \phpbb\request\request $request, \phpbb\template\template $template, \phpbb\di\service_collection $type_collection, \phpbb\user $user, $fields_table, $fields_language_table, $fields_data_table)
{
$this->auth = $auth;
$this->db = $db;

View file

@ -36,7 +36,7 @@ class fulltext_mysql extends \phpbb\search\base
/**
* Database connection
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;

View file

@ -80,7 +80,7 @@ class fulltext_native extends \phpbb\search\base
/**
* Database connection
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;

View file

@ -61,7 +61,7 @@ class fulltext_postgres extends \phpbb\search\base
/**
* Database connection
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;

View file

@ -77,7 +77,7 @@ class fulltext_sphinx
/**
* Database connection
* @var \phpbb\db\driver\driver
* @var \phpbb\db\driver\driver_interface
*/
protected $db;

View file

@ -11,7 +11,7 @@ namespace phpbb\tree;
abstract class nestedset implements \phpbb\tree\tree_interface
{
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db;
/** @var \phpbb\lock\db */
@ -52,7 +52,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
/**
* Construct
*
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around
* @param string $table_name Table name
* @param string $message_prefix Prefix for the messages thrown by exceptions
@ -60,7 +60,7 @@ abstract class nestedset implements \phpbb\tree\tree_interface
* @param array $item_basic_data Array with basic item data that is stored in item_parents
* @param array $columns Array with column names to overwrite
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array())
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\lock\db $lock, $table_name, $message_prefix = '', $sql_where = '', $item_basic_data = array(), $columns = array())
{
$this->db = $db;
$this->lock = $lock;

View file

@ -14,11 +14,11 @@ class nestedset_forum extends \phpbb\tree\nestedset
/**
* Construct
*
* @param \phpbb\db\driver\driver $db Database connection
* @param \phpbb\db\driver\driver_interface $db Database connection
* @param \phpbb\lock\db $lock Lock class used to lock the table when moving forums around
* @param string $table_name Table name
*/
public function __construct(\phpbb\db\driver\driver $db, \phpbb\lock\db $lock, $table_name)
public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\lock\db $lock, $table_name)
{
parent::__construct(
$db,

View file

@ -19,7 +19,7 @@ namespace phpbb;
*/
class user_loader
{
/** @var \phpbb\db\driver\driver */
/** @var \phpbb\db\driver\driver_interface */
protected $db = null;
/** @var string */
@ -41,12 +41,12 @@ class user_loader
/**
* User loader constructor
*
* @param \phpbb\db\driver\driver $db A database connection
* @param \phpbb\db\driver\driver_interface $db A database connection
* @param string $phpbb_root_path Path to the phpbb includes directory.
* @param string $php_ext php file extension
* @param string $users_table The name of the database table (phpbb_users)
*/
public function __construct(\phpbb\db\driver\driver $db, $phpbb_root_path, $php_ext, $users_table)
public function __construct(\phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext, $users_table)
{
$this->db = $db;

View file

@ -59,19 +59,43 @@ namespace phpbb\db\driver
{
class container_mock extends \phpbb\db\driver\driver
{
public function sql_connect()
public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false)
{
}
public function sql_query()
public function sql_query($query = '', $cache_ttl = 0)
{
}
public function sql_fetchrow()
public function sql_fetchrow($query_id = false)
{
}
public function sql_freeresult()
public function sql_freeresult($query_id = false)
{
}
function sql_server_info($raw = false, $use_cache = true)
{
}
function sql_affectedrows()
{
}
function sql_rowseek($rownum, &$query_id)
{
}
function sql_nextid()
{
}
function sql_escape($msg)
{
}
function sql_like_expression($expression)
{
}
}

View file

@ -140,7 +140,7 @@ class phpbb_mock_cache implements \phpbb\cache\driver\driver_interface
/**
* {@inheritDoc}
*/
public function sql_save(\phpbb\db\driver\driver $db, $query, $query_result, $ttl)
public function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl)
{
return $query_result;
}

View file

@ -63,10 +63,10 @@ class phpbb_session_testable_factory
/**
* Retrieve the configured session class instance
*
* @param \phpbb\db\driver\driver $dbal The database connection to use for session data
* @param \phpbb\db\driver\driver_interface $dbal The database connection to use for session data
* @return phpbb_mock_session_testable A session instance
*/
public function get_session(\phpbb\db\driver\driver $dbal)
public function get_session(\phpbb\db\driver\driver_interface $dbal)
{
// set up all the global variables used by session
global $SID, $_SID, $db, $config, $cache, $request, $phpbb_container;

View file

@ -321,7 +321,7 @@ class phpbb_database_test_connection_manager
* Compile the correct schema filename (as per create_schema_files) and
* load it into the database.
*/
protected function load_schema_from_file($directory, \phpbb\db\driver\driver $db)
protected function load_schema_from_file($directory, \phpbb\db\driver\driver_interface $db)
{
$schema = $this->dbms['SCHEMA'];

View file

@ -150,7 +150,7 @@ class phpbb_functional_test_case extends phpbb_test_case
{
global $phpbb_root_path, $phpEx;
// so we don't reopen an open connection
if (!($this->db instanceof \phpbb\db\driver\driver))
if (!($this->db instanceof \phpbb\db\driver\driver_interface))
{
$dbms = self::$config['dbms'];
$this->db = new $dbms();