If I parse a SQL query containing CAST (foo AS DECIMAL(16, 2)),
and then create a query with the creator,
it loses the comma in DECIMAL(16, 2)
test code :
<?php
namespace PHPSQLParser;
require_once dirname(__FILE__) . '/vendor/autoload.php';
$sql = 'SELECT CAST(a AS DECIMAL(16, 2)) AS f';
echo PHP_EOL . $sql;
$parser = new PHPSQLParser($sql, true);
$creator = new PHPSQLCreator($parser->parsed);
echo PHP_EOL . $creator->created;
output:
SELECT CAST(a AS DECIMAL(16, 2)) AS f
SELECT CAST(a AS DECIMAL (16 2)) AS f
I have tried to change the code to add a delim to fix this problem, but I am not sure at all it is the right way to go about this.
I will open a pull request to show what I tried and would appreciate if someone who knows the codebase could have a look.
hi,
If I parse a SQL query containing
CAST (foo AS DECIMAL(16, 2))
, and then create a query with the creator, it loses the comma inDECIMAL(16, 2)
test code :
output:
I have tried to change the code to add a
delim
to fix this problem, but I am not sure at all it is the right way to go about this. I will open a pull request to show what I tried and would appreciate if someone who knows the codebase could have a look.thanks!