PHP-SQL-Parser icon indicating copy to clipboard operation
PHP-SQL-Parser copied to clipboard

Valid query is parsed and re-created as invalid query (SQL function arguments stripped)

Open carlomanf opened this issue 3 years ago • 0 comments

The below code example attempts to parse a valid SQL query and re-create it. $this->creator and $this->parser are instances of the creator and parser.

Upon the query being re-created, the arguments of the round function are stripped, causing an SQL error.

This is a similar issue to #348 but with a different query.

var_dump(
  $this->creator->create(
    $this->parser->parse(
      "SELECT table_name AS 'name', engine AS 'engine', round( ( data_length / 1024 / 1024 ), 2 ) 'data', round( ( index_length / 1024 / 1024 ), 2 ) 'index' FROM information_schema.TABLES WHERE table_schema = 'mydb' ORDER BY name ASC;"
    )
  )
);
exit;

Tested with v4.4.0

carlomanf avatar Feb 09 '22 05:02 carlomanf