aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/db/postgres.php
diff options
context:
space:
mode:
authorDavid M <davidmj@users.sourceforge.net>2006-04-23 17:28:06 +0000
committerDavid M <davidmj@users.sourceforge.net>2006-04-23 17:28:06 +0000
commitd03e541179afa8575d6567ec12f49ea7131a734a (patch)
treed42cd47d6add6def468d77efcde55c4b3f09a565 /phpBB/includes/db/postgres.php
parentde4299c81c010c6382a3d017cde8f2c3c957b91f (diff)
downloadforums-d03e541179afa8575d6567ec12f49ea7131a734a.tar
forums-d03e541179afa8575d6567ec12f49ea7131a734a.tar.gz
forums-d03e541179afa8575d6567ec12f49ea7131a734a.tar.bz2
forums-d03e541179afa8575d6567ec12f49ea7131a734a.tar.xz
forums-d03e541179afa8575d6567ec12f49ea7131a734a.zip
- Query explain now works for MSSQL, MSSQL-ODBC and PostgreSQL
- MSSQL schema now properly includes prefixes inside of all constraints git-svn-id: file:///svn/phpbb/trunk@5839 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/db/postgres.php')
-rw-r--r--phpBB/includes/db/postgres.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/includes/db/postgres.php b/phpBB/includes/db/postgres.php
index 55f4e27eff..eb8c931fa5 100644
--- a/phpBB/includes/db/postgres.php
+++ b/phpBB/includes/db/postgres.php
@@ -368,6 +368,36 @@ class dbal_postgres extends dbal
switch ($mode)
{
case 'start':
+
+ $explain_query = $query;
+ if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m))
+ {
+ $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2];
+ }
+ else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m))
+ {
+ $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2];
+ }
+
+ if (preg_match('/^SELECT/', $explain_query))
+ {
+ $html_table = false;
+
+ if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query"))
+ {
+ while ($row = @pg_fetch_assoc($result, NULL))
+ {
+ $html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
+ }
+ }
+ @pg_free_result($result);
+
+ if ($html_table)
+ {
+ $this->html_hold .= '</table>';
+ }
+ }
+
break;
case 'fromcache':