From 43c6c23c6af81c8ef44e0d2a012bd4539cfad55d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Chapeaux?= Date: Fri, 15 Feb 2002 12:32:04 +0000 Subject: [PATCH] optimized a bit --- sql.php3 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sql.php3 b/sql.php3 index 9214883e8..17989cd5e 100755 --- a/sql.php3 +++ b/sql.php3 @@ -73,8 +73,9 @@ if (isset($btnDrop) || isset($navig)) { // query may contain aliases. // (todo: check for embedded comments...) -if (eregi('SELECT[[:space:]]', $sql_query)) { - eregi('SELECT[[:space:]](.*)[[:space:]]FROM[[:space:]]+(`[^`]+`|[A-Za-z0-9_$]+)([\.]*)(`[^`]*`|[A-Za-z0-9_$]*)', $sql_query, $tmp); +$is_select = eregi('^SELECT[[:space:]]+', $sql_query); +if ($is_select) { + eregi('^SELECT[[:space:]]+(.*)[[:space:]]+FROM[[:space:]]+(`[^`]+`|[A-Za-z0-9_$]+)([\.]*)(`[^`]*`|[A-Za-z0-9_$]*)', $sql_query, $tmp); if ($tmp[3] == '.') { $prev_db = $db; @@ -85,7 +86,8 @@ if (eregi('SELECT[[:space:]]', $sql_query)) { else { $table = str_replace('`', '', $tmp[2]); } -} +} // end if + /** * Sets or modifies the $goto variable if required @@ -193,13 +195,12 @@ else { $repeat_cells = $cfgRepeatCells; } - $is_explain = $is_select = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = FALSE; - if (eregi('^EXPLAIN[[:space:]]+', $sql_query)) { + $is_explain = $is_count = $is_export = $is_delete = $is_insert = $is_affected = $is_show = $is_maint = FALSE; + if ($is_select) { // see line 76 + $is_count = (eregi('^SELECT[[:space:]]+COUNT\((.*\.+)?.*\)', $sql_query)); + $is_export = (eregi('[[:space:]]+INTO OUTFILE[[:space:]]+', $sql_query)); + } else if (eregi('^EXPLAIN[[:space:]]+', $sql_query)) { $is_explain = TRUE; - } else if (eregi('^SELECT[[:space:]]+', $sql_query)) { - $is_select = TRUE; - $is_count = (eregi('^SELECT COUNT\((.*\.+)?.*\)', $sql_query)); - $is_export = (eregi(' INTO OUTFILE ', $sql_query)); } else if (eregi('^DELETE[[:space:]]+', $sql_query)) { $is_delete = TRUE; $is_affected = TRUE;