aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/db')
-rw-r--r--phpBB/includes/db/db_tools.php2
-rw-r--r--phpBB/includes/db/dbal.php27
-rw-r--r--phpBB/includes/db/firebird.php19
-rw-r--r--phpBB/includes/db/mssql.php11
-rw-r--r--phpBB/includes/db/mssql_odbc.php2
-rw-r--r--phpBB/includes/db/mssqlnative.php2
-rw-r--r--phpBB/includes/db/mysql.php2
-rw-r--r--phpBB/includes/db/mysqli.php2
-rw-r--r--phpBB/includes/db/oracle.php2
-rw-r--r--phpBB/includes/db/postgres.php18
-rw-r--r--phpBB/includes/db/sqlite.php2
11 files changed, 58 insertions, 31 deletions
diff --git a/phpBB/includes/db/db_tools.php b/phpBB/includes/db/db_tools.php
index d23323a5b1..7c96965a9b 100644
--- a/phpBB/includes/db/db_tools.php
+++ b/phpBB/includes/db/db_tools.php
@@ -2416,5 +2416,3 @@ class phpbb_db_tools
return $this->_sql_run_sql($statements);
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/dbal.php b/phpBB/includes/db/dbal.php
index 9b45c085a2..b29e2791ab 100644
--- a/phpBB/includes/db/dbal.php
+++ b/phpBB/includes/db/dbal.php
@@ -458,6 +458,28 @@ class dbal
}
/**
+ * 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
+ */
+ function cast_expr_to_bigint($expression)
+ {
+ return $expression;
+ }
+
+ /**
+ * 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
+ */
+ function cast_expr_to_string($expression)
+ {
+ return $expression;
+ }
+
+ /**
* Run more than one insert statement.
*
* @param string $table table name to run the statements on
@@ -721,8 +743,9 @@ class dbal
function sql_report($mode, $query = '')
{
global $cache, $starttime, $phpbb_root_path, $user;
+ global $request;
- if (empty($_REQUEST['explain']))
+ if (is_object($request) && !$request->variable('explain', false))
{
return false;
}
@@ -911,5 +934,3 @@ class dbal
* This variable holds the class name to use later
*/
$sql_db = (!empty($dbms)) ? 'dbal_' . basename($dbms) : 'dbal';
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/firebird.php b/phpBB/includes/db/firebird.php
index 7e3f15ed1d..8acc84b1c0 100644
--- a/phpBB/includes/db/firebird.php
+++ b/phpBB/includes/db/firebird.php
@@ -493,6 +493,23 @@ class dbal_firebird extends dbal
}
/**
+ * @inheritdoc
+ */
+ function cast_expr_to_bigint($expression)
+ {
+ // Precision must be from 1 to 18
+ return 'CAST(' . $expression . ' as DECIMAL(18, 0))';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ function cast_expr_to_string($expression)
+ {
+ return 'CAST(' . $expression . ' as VARCHAR(255))';
+ }
+
+ /**
* return sql error array
* @access private
*/
@@ -565,5 +582,3 @@ class dbal_firebird extends dbal
}
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php
index 6899a73902..386b0a9a23 100644
--- a/phpBB/includes/db/mssql.php
+++ b/phpBB/includes/db/mssql.php
@@ -41,14 +41,7 @@ class dbal_mssql extends dbal
@ini_set('mssql.textlimit', 2147483647);
@ini_set('mssql.textsize', 2147483647);
- if (version_compare(PHP_VERSION, '5.1.0', '>=') || (version_compare(PHP_VERSION, '5.0.0-dev', '<=') && version_compare(PHP_VERSION, '4.4.1', '>=')))
- {
- $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link);
- }
- else
- {
- $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword) : @mssql_connect($this->server, $this->user, $sqlpassword);
- }
+ $this->db_connect_id = ($this->persistency) ? @mssql_pconnect($this->server, $this->user, $sqlpassword, $new_link) : @mssql_connect($this->server, $this->user, $sqlpassword, $new_link);
if ($this->db_connect_id && $this->dbname != '')
{
@@ -446,5 +439,3 @@ class dbal_mssql extends dbal
}
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/mssql_odbc.php b/phpBB/includes/db/mssql_odbc.php
index 75a080b1b7..d17280c5a6 100644
--- a/phpBB/includes/db/mssql_odbc.php
+++ b/phpBB/includes/db/mssql_odbc.php
@@ -423,5 +423,3 @@ class dbal_mssql_odbc extends dbal
}
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/mssqlnative.php b/phpBB/includes/db/mssqlnative.php
index 6810562d17..2287bc716e 100644
--- a/phpBB/includes/db/mssqlnative.php
+++ b/phpBB/includes/db/mssqlnative.php
@@ -645,5 +645,3 @@ class dbal_mssqlnative extends dbal
$this->query_options = $options;
}
}
-
-?>
diff --git a/phpBB/includes/db/mysql.php b/phpBB/includes/db/mysql.php
index 1e24c79577..d0537e2fe9 100644
--- a/phpBB/includes/db/mysql.php
+++ b/phpBB/includes/db/mysql.php
@@ -488,5 +488,3 @@ class dbal_mysql extends dbal
}
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/mysqli.php b/phpBB/includes/db/mysqli.php
index 46c2f9210b..db3846e7f7 100644
--- a/phpBB/includes/db/mysqli.php
+++ b/phpBB/includes/db/mysqli.php
@@ -483,5 +483,3 @@ class dbal_mysqli extends dbal
}
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/oracle.php b/phpBB/includes/db/oracle.php
index 62b36aa8bf..e0d9370bd8 100644
--- a/phpBB/includes/db/oracle.php
+++ b/phpBB/includes/db/oracle.php
@@ -767,5 +767,3 @@ class dbal_oracle extends dbal
}
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index bb116e0763..959d8df139 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -389,6 +389,22 @@ class dbal_postgres extends dbal
}
/**
+ * @inheritdoc
+ */
+ function cast_expr_to_bigint($expression)
+ {
+ return 'CAST(' . $expression . ' as DECIMAL(255, 0))';
+ }
+
+ /**
+ * @inheritdoc
+ */
+ function cast_expr_to_string($expression)
+ {
+ return 'CAST(' . $expression . ' as VARCHAR(255))';
+ }
+
+ /**
* return sql error array
* @access private
*/
@@ -481,5 +497,3 @@ class dbal_postgres extends dbal
}
}
}
-
-?> \ No newline at end of file
diff --git a/phpBB/includes/db/sqlite.php b/phpBB/includes/db/sqlite.php
index 8de72fd394..88d92d1ff2 100644
--- a/phpBB/includes/db/sqlite.php
+++ b/phpBB/includes/db/sqlite.php
@@ -335,5 +335,3 @@ class dbal_sqlite extends dbal
}
}
}
-
-?> \ No newline at end of file