mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-31 05:50:42 +02:00
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:
@@ -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)
|
||||
{
|
||||
|
355
phpBB/phpbb/db/driver/driver_interface.php
Normal file
355
phpBB/phpbb/db/driver/driver_interface.php
Normal 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);
|
||||
}
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -24,7 +24,7 @@ abstract class mssql_base extends \phpbb\db\driver\driver
|
||||
}
|
||||
|
||||
/**
|
||||
* Escape string used in sql query
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
function sql_escape($msg)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -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)
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user