{"action":"opened","issue":{"url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/294","repository_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser","labels_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/294/labels{/name}","comments_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/294/comments","events_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/294/events","html_url":"https://github.com/greenlion/PHP-SQL-Parser/issues/294","id":377916533,"node_id":"MDU6SXNzdWUzNzc5MTY1MzM=","number":294,"title":"Missing comma in cast","user":{"login":"nicoder","id":365210,"node_id":"MDQ6VXNlcjM2NTIxMA==","avatar_url":"https://avatars2.githubusercontent.com/u/365210?v=4","gravatar_id":"","url":"https://api.github.com/users/nicoder","html_url":"https://github.com/nicoder","followers_url":"https://api.github.com/users/nicoder/followers","following_url":"https://api.github.com/users/nicoder/following{/other_user}","gists_url":"https://api.github.com/users/nicoder/gists{/gist_id}","starred_url":"https://api.github.com/users/nicoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicoder/subscriptions","organizations_url":"https://api.github.com/users/nicoder/orgs","repos_url":"https://api.github.com/users/nicoder/repos","events_url":"https://api.github.com/users/nicoder/events{/privacy}","received_events_url":"https://api.github.com/users/nicoder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-06T16:04:54Z","updated_at":"2018-11-06T16:04:54Z","closed_at":null,"author_association":"NONE","body":"hi,\r\n\r\nIf I parse a SQL query containing `CAST (foo AS DECIMAL(16, 2))`,\r\nand then create a query with the creator,\r\nit loses the comma in `DECIMAL(16, 2)`\r\n\r\ntest code :\r\n\r\n```php\r\n<?php\r\n\r\nnamespace PHPSQLParser;\r\n\r\nrequire_once dirname(__FILE__) . '/vendor/autoload.php';\r\n\r\n$sql = 'SELECT CAST(a AS DECIMAL(16, 2)) AS f';\r\necho PHP_EOL . $sql;\r\n$parser = new PHPSQLParser($sql, true);\r\n$creator = new PHPSQLCreator($parser->parsed);\r\necho PHP_EOL . $creator->created;\r\n```\r\n\r\noutput:\r\n\r\n```sql\r\nSELECT CAST(a AS DECIMAL(16, 2)) AS f\r\nSELECT CAST(a AS DECIMAL (16 2)) AS f\r\n```\r\n\r\nI 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.\r\nI will open a pull request to show what I tried and would appreciate if someone who knows the codebase could have a look.\r\n\r\nthanks!"}}
{"actor":{"display_login":"nicoder"}}