-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix: Tests. * Fix issue #322. * Fix: Handle SubQuery in ref_clause. * Fix: Handle TRUNCATE() function and TRUNCATE keyword. Issue #338. --------- Co-authored-by: Justin Swanhart <greenlion@gmail.com>
- Loading branch information
Showing
4 changed files
with
51 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
|
||
namespace parser; | ||
|
||
use PHPSQLParser\PHPSQLParser; | ||
|
||
class issue338Test extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testIssue338() { | ||
$sql = "SELECT id, date, type as type, libelle as libelle, TRUNCATE(debit, 2) as debit, ROUND(COALESCE(credit, 0) - COALESCE(debit, 0), 2) as solde FROM compte_cp"; | ||
|
||
$parser = new PHPSQLParser(); | ||
|
||
$parser->parse($sql, true); | ||
$parsed = $parser->parsed; | ||
|
||
$this->assertNotFalse($parsed); | ||
$this->assertTrue(is_array($parsed)); | ||
$this->assertTrue(!array_key_exists('TRUNCATE', $parsed)); | ||
|
||
$sql = "TRUNCATE TABLE truncate_table"; | ||
$parser->parse($sql, true); | ||
$parsed = $parser->parsed; | ||
|
||
$this->assertNotFalse($parsed); | ||
$this->assertTrue(is_array($parsed)); | ||
$this->assertTrue(array_key_exists('TRUNCATE', $parsed)); | ||
} | ||
|
||
} |