Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow $query->from()->select() #201

Open
VladaHejda opened this issue Jan 12, 2016 · 2 comments
Open

Allow $query->from()->select() #201

VladaHejda opened this issue Jan 12, 2016 · 2 comments

Comments

@VladaHejda
Copy link

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'))

@VladaHejda VladaHejda changed the title Allow $query->from()->select() Allow $query->from()->select() Jan 12, 2016
@dg
Copy link
Owner

dg commented Jul 20, 2016

Can you try to fix it?

@h4kuna
Copy link

h4kuna commented Feb 23, 2018

Yeasterday, I tried fix it.

  1. table()->select() is easy fix.

  2. Do you want it?
    I expect api must support table()->insert(), table()->update() and table()->delete() this is little more complex, because class Connection has logic how works with arguments. This update change api update('table', $data) vs ->table('table')->update($data) etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants