Skip to content

Commit 4532a58

Browse files
committed
Add example for Query::getFlags
Issue #42 Signed-off-by: Michal Čihař <[email protected]>
1 parent 9382faa commit 4532a58

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,19 @@ Command line utility to lint SQL query:
3939
echo SqlParser\Utils\Formatter::format($query, array('type' => 'html'));
4040
```
4141

42+
### Discoverying query type
43+
44+
```php
45+
use SqlParser\Parser;
46+
use SqlParser\Utils\Query;
47+
48+
$query = 'OPTIMIZE TABLE tbl';
49+
$parser = new Parser($query);
50+
$flags = Query::getFlags($parser->statements[0])
51+
52+
echo $flags['querytype'];
53+
```
54+
4255
### Parsing and building SQL query
4356

4457
```php

0 commit comments

Comments
 (0)