1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-08 17:56:52 +02:00

Ch-ch-ch-changes

- Made us more DB independent by making many queries capability based instead of DB specific
- Finished PHP5ifying of the acm_file class, now with some (hopefully) enhancements to its performance
- Sped up viewforum considerably (also goes towards mcp_forum)

I really hope I didn't explode CVS...


git-svn-id: file:///svn/phpbb/trunk@8301 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
David M
2008-01-04 18:35:49 +00:00
parent edd6c34eda
commit af738dbc2a
23 changed files with 346 additions and 296 deletions

View File

@@ -52,6 +52,15 @@ class dbal
// Supports multi inserts?
var $multi_insert = false;
// Supports COUNT(DISTINCT ...)?
var $count_distinct = true;
// Supports multiple table deletion
var $multi_table_deletion = false;
// Supports table truncation
var $truncate = true;
/**
* Current sql layer
*/

View File

@@ -28,6 +28,9 @@ class dbal_firebird extends dbal
var $last_query_text = '';
var $service_handle = false;
// can't truncate a table
var $truncate = false;
/**
* Connect to server
*/
@@ -376,6 +379,20 @@ class dbal_firebird extends dbal
return str_replace("'", "''", $msg);
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
case 'length_text':
return 'OCTET_LENGTH(' . $col . ')';
break;
}
}
/**
* Build LIKE expression
* @access private

View File

@@ -308,6 +308,20 @@ class dbal_mssql extends dbal
return str_replace("'", "''", $msg);
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
case 'length_text':
return 'DATALENGTH(' . $col . ')';
break;
}
}
/**
* Build LIKE expression
* @access private

View File

@@ -336,6 +336,20 @@ class dbal_mssql_odbc extends dbal
return str_replace("'", "''", $msg);
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
case 'length_text':
return 'DATALENGTH(' . $col . ')';
break;
}
}
/**
* Build LIKE expression
* @access private

View File

@@ -32,6 +32,9 @@ class dbal_mysql extends dbal
var $mysql_version;
var $multi_insert = true;
// Supports multiple table deletion
var $multi_table_deletion = false;
/**
* Connect to server
* @access public
@@ -301,6 +304,20 @@ class dbal_mysql extends dbal
return @mysql_real_escape_string($msg, $this->db_connect_id);
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
case 'length_text':
return 'LENGTH(' . $col . ')';
break;
}
}
/**
* Build LIKE expression
* @access private

View File

@@ -28,6 +28,9 @@ class dbal_mysqli extends dbal
{
var $multi_insert = true;
// Supports multiple table deletion
var $multi_table_deletion = false;
/**
* Connect to server
*/
@@ -270,6 +273,20 @@ class dbal_mysqli extends dbal
return @mysqli_real_escape_string($this->db_connect_id, $msg);
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
case 'length_text':
return 'LENGTH(' . $col . ')';
break;
}
}
/**
* Build LIKE expression
* @access private

View File

@@ -533,6 +533,23 @@ class dbal_oracle extends dbal
return str_replace("'", "''", $msg);
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
return 'LENGTH(' . $col . ')';
break;
case 'length_text':
return 'dbms_lob.getlength(' . $col . ')';
break;
}
}
/**
* Build LIKE expression
* @access private

View File

@@ -27,7 +27,7 @@ class dbal_postgres extends dbal
{
var $last_query_text = '';
var $pgsql_version;
/**
* Connect to server
*/
@@ -84,9 +84,17 @@ class dbal_postgres extends dbal
// determine what version of PostgreSQL is running, we can be more efficient if they are running 8.2+
$this->pgsql_version = @pg_parameter_status($this->db_connect_id, 'server_version');
if (!empty($this->pgsql_version) && $this->pgsql_version[0] >= '8' && $this->pgsql_version[2] >= '2')
if (!empty($this->pgsql_version) && $this->pgsql_version[0] >= '8')
{
$this->multi_insert = true;
if ($this->pgsql_version[2] >= '1')
{
$this->multi_table_deletion = true;
}
if ($this->pgsql_version[2] >= '2')
{
$this->multi_insert = true;
}
}
if ($schema !== '')
@@ -331,6 +339,20 @@ class dbal_postgres extends dbal
return @pg_escape_string($msg);
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
case 'length_text':
return 'LENGTH(' . $col . ')';
break;
}
}
/**
* Build LIKE expression
* @access private

View File

@@ -25,6 +25,12 @@ include_once($phpbb_root_path . 'includes/db/dbal.' . $phpEx);
*/
class dbal_sqlite extends dbal
{
// like MS ACCESS, SQLite does not support COUNT(DISTINCT ...)
var $count_distinct = false;
// can't truncate a table
var $truncate = false;
/**
* Connect to server
*/
@@ -257,6 +263,20 @@ class dbal_sqlite extends dbal
return 'GLOB \'' . $this->sql_escape($expression) . '\'';
}
/**
* Expose a DBMS specific function
*/
function sql_function($type, $col)
{
switch ($type)
{
case 'length_varchar':
case 'length_text':
return 'LENGTH(' . $col . ')';
break;
}
}
/**
* return sql error array
* @access private