Closed staabm closed 1 year ago
in https://github.com/staabm/phpstan-dba/pull/505 I was able to work arround the missing raw-expression
hi. i think i understand what you need, but it is not possible/reliable for now. all expression nodes implement SqlSerializable but, at this point model does not support whitespace and normalizes letter case on things like keywords and built in object names. so there is not guaranteed, that the serialized version matches exactly the original - e.g. COUNT( foo )
vs count(foo)
i would like to implement this later, but it is quite hard to do. right now the SQL model is minimal as can be and lot of scalars would have to be converted to expression nodes so they can hold offsets and/or original tokens
maybe i will try to provide offsets to the original SQL string as a part of SelectExpression, solely as a temporary solution to this problem with keys. that might be pretty simple
I am running the query
'SELECT count(email) from ada'
thru this code:which when hold with the debugger at
// $expression
gives me this$command
:from the command I have at hand, I can easily find the
SimpleName
of the table involved, and also the name of the arg passed tocount
. what I am missing is way to retrieve the rawcount(email)
expression, so I can combine the parser results with results of other tooling involved.