From 62e9dd1c5bad5da889b1f186270f6376f571419a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C4=8Ciha=C5=99?= Date: Mon, 23 Jan 2017 13:43:28 +0100 Subject: [PATCH] Adjust examples to new code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Čihař --- CHANGELOG.md | 1 + README.md | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e4362a9f2..ed0af1da4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## [Unreleased] * Fixed CLI wrappers for new API. +* Fixed README for new API. ## [4.0.0] - 2017-01-23 diff --git a/README.md b/README.md index 6aebabf65..8eb75500f 100644 --- a/README.md +++ b/README.md @@ -48,8 +48,8 @@ echo SqlParser\Utils\Formatter::format($query, array('type' => 'html')); ### Discoverying query type ```php -use SqlParser\Parser; -use SqlParser\Utils\Query; +use PhpMyAdmin\SqlParser\Parser; +use PhpMyAdmin\SqlParser\Utils\Query; $query = 'OPTIMIZE TABLE tbl'; $parser = new Parser($query); @@ -64,16 +64,16 @@ echo $flags['querytype']; require __DIR__."/vendor/autoload.php"; $query1 = "select * from a"; -$parser = new SqlParser\Parser($query1); +$parser = new PhpMyAdmin\SqlParser\Parser($query1); // inspect query -var_dump($parser->statements[0]); // outputs object(SqlParser\Statements\SelectStatement) +var_dump($parser->statements[0]); // outputs object(PhpMyAdmin\SqlParser\Statements\SelectStatement) // modify query by replacing table a with table b -$table2 = new \SqlParser\Components\Expression("", "b", "", ""); +$table2 = new \PhpMyAdmin\SqlParser\Components\Expression("", "b", "", ""); $parser->statements[0]->from[0] = $table2; -// build query again from an array of object(SqlParser\Statements\SelectStatement) to a string +// build query again from an array of object(PhpMyAdmin\SqlParser\Statements\SelectStatement) to a string $statement = $parser->statements[0]; $query2 = $statement->build(); var_dump($query2); // outputs string(19) "SELECT * FROM `b` "