dibi
dibi copied to clipboard
Allow $query->from()->select()
It would be nice, if I can start query with FROM part and then define columns to select.
When I call $dibi->command()->from('foo')->select('bar') Dibi will produce query FROM foo SELECT bar which is obviously syntax error. If there is a requirement to know the type of query before call of from(), it would work like $dibi->select()->from('foo')->select('bar') with no column definition at first select() call (but now it reproduces query SELECT , bar FROM foo - again error).
This change let make more comfortable APIs in some cases.
(the only way to do this now is to call something like $dibi->select('*')->removeClause('SELECT'))
Can you try to fix it?
Yeasterday, I tried fix it.
-
table()->select()is easy fix. -
Do you want it? I expect api must support
table()->insert(),table()->update()andtable()->delete()this is little more complex, because class Connection has logic how works with arguments. This update change apiupdate('table', $data)vs->table('table')->update($data)etc.