pounard / goat-query

Goat SQL query builder built over a PHP to SQL and SQL to PHP type converter
GNU General Public License v2.0
2 stars 0 forks source link

Merge values and query pattern using a constant table expression #36

Closed pounard closed 4 years ago

pounard commented 4 years ago

Both MERGE and INSERT queries have two variants: one for using VALUES (...) and the other to use a nested SELECT query or arbitrary expression.

This could be solved by materialising a constant table query implementation, which would be a table expression, and be used in place of any other expression.

This way we could systematically have both ->query(Query) and ->values() methods on those queries, values accepting either a callable which gives you a ExpressionConstantTable or such parameter, which yields a ->values() method, or uses an ExpressionConstantTable internally to populate using given array.

We won't have to handle two different implementations anymore, and it would solve #11.