Skip to content

Commit dc2997b

Browse files
committed
don't mess with any globals
1 parent 7b23d24 commit dc2997b

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

run.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
if (1){
3838

39-
$GLOBALS['_find_single_table'] = 0;
39+
$obj->find_single_table = true;
4040

4141
$s = microtime(true);
4242
$obj->parse($sql);

src/SQLParser.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ class SQLParser{
1212
public $tables = array();
1313
public $source_map = array();
1414

15+
public $find_single_table = false;
16+
1517
public function parse($sql){
1618

1719
// stashes tokens and source_map in $this
@@ -206,7 +208,7 @@ function walk($tokens, $sql, $source_map){
206208
$table['sql'] = $stmt['sql'];
207209
}
208210

209-
if (isset($GLOBALS['_find_single_table']) && $GLOBALS['_find_single_table'] && count($tables)) return array(
211+
if ($this->find_single_table && count($tables)) return array(
210212
'tables' => $tables,
211213
);
212214
}

0 commit comments

Comments
 (0)