-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
solve#368 add CURRENT_TIMESTAMP to the list of SQL functions
- Loading branch information
Marc Vachette
committed
Nov 18, 2022
1 parent
d23f70d
commit a60192a
Showing
2 changed files
with
31 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
/** | ||
* issue368.php | ||
* | ||
* Test case for PHPSQLCreator. | ||
*/ | ||
|
||
namespace PHPSQLParser\Test\Creator; | ||
|
||
use PHPSQLParser\PHPSQLParser; | ||
use PHPSQLParser\PHPSQLCreator; | ||
|
||
class Issue368Test extends \PHPUnit\Framework\TestCase | ||
{ | ||
/* | ||
* https://github.com/greenlion/PHP-SQL-Parser/issues/368 | ||
* CURRENT_TIMESTAMP is detected as a reserved word an generate errors when used in JOIN clause | ||
*/ | ||
public function testIssue368() | ||
{ | ||
$sql = "SELECT foo FROM barTable LEFT JOIN bazTable ON barTable.a = bazTable.a AND bazTable.d <= CURRENT_TIMESTAMP"; // KO | ||
|
||
$parser = new PHPSQLParser(); | ||
$creator = new PHPSQLCreator(); | ||
|
||
$parser->parse($sql); | ||
|
||
$this->assertEquals($sql, $creator->create($parser->parsed)); | ||
} | ||
} |