-
Notifications
You must be signed in to change notification settings - Fork 19
/
run.php
49 lines (34 loc) · 813 Bytes
/
run.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
include('src/SQLParser.php');
use iamcal\SQLParser;
$sql = file_get_contents('data/glitch_main.sql');
$obj = new SQLParser();
if (0){
$s = microtime(true);
$tokens = $obj->lex($sql);
$e = microtime(true);
print_r($tokens);
$ms = round(1000 * ($e - $s));
echo "Lexing took $ms ms\n";
}
if (0){
$s = microtime(true);
$tokens = $obj->lex($sql);
$e = microtime(true);
$tokens = $obj->collapse_tokens($tokens);
$e2 = microtime(true);
print_r($tokens);
$ms1 = round(1000 * ($e - $s));
$ms2 = round(1000 * ($e2 - $e));
echo "Lexing took $ms1 ms\n";
echo "Collapsing took $ms2 ms\n";
}
if (1){
$obj->find_single_table = true;
$s = microtime(true);
$obj->parse($sql);
$e = microtime(true);
print_r($obj->tables);
$ms = round(1000 * ($e - $s));
echo "Parse took $ms ms\n";
}