diff options
author | David M <davidmj@users.sourceforge.net> | 2006-04-23 17:28:06 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2006-04-23 17:28:06 +0000 |
commit | d03e541179afa8575d6567ec12f49ea7131a734a (patch) | |
tree | d42cd47d6add6def468d77efcde55c4b3f09a565 /phpBB/includes/db/mssql.php | |
parent | de4299c81c010c6382a3d017cde8f2c3c957b91f (diff) | |
download | forums-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/mssql.php')
-rw-r--r-- | phpBB/includes/db/mssql.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index 3a750a2847..0e7ee89196 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -351,6 +351,36 @@ class dbal_mssql 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; + @mssql_query("SET SHOWPLAN_TEXT ON;", $this->db_connect_id); + if ($result = @mssql_query($explain_query, $this->db_connect_id)) + { + @mssql_next_result($result); + while ($row = @mssql_fetch_row($result)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + } + @mssql_query("SET SHOWPLAN_TEXT OFF;", $this->db_connect_id); + @mssql_free_result($result); + + if ($html_table) + { + $this->html_hold .= '</table>'; + } + } break; case 'fromcache': |