1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

- 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
This commit is contained in:
David M
2006-04-23 17:28:06 +00:00
parent de4299c81c
commit d03e541179
4 changed files with 401 additions and 311 deletions

View File

@@ -347,6 +347,36 @@ class dbal_mssql_odbc 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;
@odbc_exec($this->db_connect_id, "SET SHOWPLAN_TEXT ON;");
if ($result = @odbc_exec($this->db_connect_id, $explain_query))
{
@odbc_next_result($result);
while ($row = @odbc_fetch_array($result))
{
$html_table = $this->sql_report('add_select_row', $query, $html_table, $row);
}
}
@odbc_exec($this->db_connect_id, "SET SHOWPLAN_TEXT OFF;");
@odbc_free_result($result);
if ($html_table)
{
$this->html_hold .= '</table>';
}
}
break;
case 'fromcache':