aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r--phpBB/includes/db/dbal.php9
-rw-r--r--phpBB/includes/db/firebird.php17
-rw-r--r--phpBB/includes/db/mssql.php14
-rw-r--r--phpBB/includes/db/mssql_odbc.php14
-rw-r--r--phpBB/includes/db/mysql.php17
-rw-r--r--phpBB/includes/db/mysqli.php17
-rw-r--r--phpBB/includes/db/oracle.php17
-rw-r--r--phpBB/includes/db/postgres.php28
-rw-r--r--phpBB/includes/db/sqlite.php20
9 files changed, 150 insertions, 3 deletions
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index a2a42e173c..d22d2f0520 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -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
*/
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index b258b96fa1..21dd6f0127 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -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
*/
@@ -377,6 +380,20 @@ class dbal_firebird extends dbal
}
/**
+ * 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
*/
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 1e42abcce2..f89fcb9d8f 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -309,6 +309,20 @@ class dbal_mssql extends dbal
}
/**
+ * 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
*/
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 7722f79952..5ef00c6839 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -337,6 +337,20 @@ class dbal_mssql_odbc extends dbal
}
/**
+ * 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
*/
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index 840d40b03d..108a75c0cc 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -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
@@ -302,6 +305,20 @@ class dbal_mysql extends dbal
}
/**
+ * 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
*/
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index 32765d15f7..394c547151 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -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
*/
@@ -271,6 +274,20 @@ class dbal_mysqli extends dbal
}
/**
+ * 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
*/
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 18740fb036..0640d3d354 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -534,6 +534,23 @@ class dbal_oracle extends dbal
}
/**
+ * 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
*/
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index 0ac27023f3..0f946c2d7c 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -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 !== '')
@@ -332,6 +340,20 @@ class dbal_postgres extends dbal
}
/**
+ * 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
*/
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php
index 5ae36df4f5..c6f6f8fc9b 100644
--- a/phpBB/includes/db/sqlite.php
+++ b/phpBB/includes/db/sqlite.php
@@ -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
*/
@@ -258,6 +264,20 @@ class dbal_sqlite extends dbal
}
/**
+ * 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
*/