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

[NFR] Query builder for raw sql #2052

Closed
hugoduraes opened this issue Feb 17, 2014 · 26 comments
Closed

[NFR] Query builder for raw sql #2052

hugoduraes opened this issue Feb 17, 2014 · 26 comments

Comments

@hugoduraes
Copy link

@hugoduraes hugoduraes commented Feb 17, 2014

It would be nice to have a query builder for raw sql queries, similar to Zend_Db_Select:
http://framework.zend.com/manual/1.12/en/zend.db.select.html

This would be useful when you need to build select queries which rely on specific SQL extensions that aren’t supported by PHQL.

The syntax should be similar to the creation of queries using the Query Builder:
http://docs.phalconphp.com/en/latest/reference/phql.html#creating-queries-using-the-query-builder

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@bungcip
Copy link

@bungcip bungcip commented Feb 24, 2014

Yep. I also want this feature. Using plain string to build raw sql in phalcon is annoying and error prone.

@philippgerard
Copy link

@philippgerard philippgerard commented Mar 27, 2014

+1

@niden niden added Unassigned and removed Unassigned labels Apr 3, 2014
@mzf
Copy link

@mzf mzf commented Apr 20, 2014

+1

2 similar comments
@pusoiuandrei
Copy link

@pusoiuandrei pusoiuandrei commented Apr 22, 2014

+1

@seb777
Copy link

@seb777 seb777 commented Apr 22, 2014

+1

@mosid
Copy link

@mosid mosid commented May 7, 2014

+10

@londomloto
Copy link

@londomloto londomloto commented May 28, 2014

+1000

@kbtz
Copy link

@kbtz kbtz commented May 28, 2014

👍 However with sub selects coming to PHQL in 2.0.0 we would need raw SQL even less.

@ut4
Copy link

@ut4 ut4 commented May 29, 2014

+1

1 similar comment
@konsultaner
Copy link

@konsultaner konsultaner commented Jun 3, 2014

+1

@Samhayn
Copy link

@Samhayn Samhayn commented Jan 8, 2015

Actually standard query builder ALMOST allows to build raw sql, it just wraps table's name with square brackets.

example:
$this->modelsManager->createBuilder()->from('table')->where('a = "a"')->limit(1)->getPhql()

result:

SELECT [table].* FROM [table] WHERE a = "a" LIMIT 1

@mohammadhzp
Copy link

@mohammadhzp mohammadhzp commented Apr 22, 2015

+1

@salarmehr
Copy link

@salarmehr salarmehr commented Jun 7, 2015

+100

@tmihalik
Copy link
Contributor

@tmihalik tmihalik commented Jun 7, 2015

+1

@Surt
Copy link
Contributor

@Surt Surt commented Jun 15, 2015

+1

Edited: Actually I voted because I thought it was a new raw_query for the query builder. I know it is error prone but actually it's the unique way to do some complex queries.

It would be great to have a queryBuilder->rawQuery (actually I need it or I'm stuck on complex raw transformations etc on the ORM)

@sergeyklay
Copy link
Member

@sergeyklay sergeyklay commented Jun 15, 2015

+1

5 similar comments
@marianacapelo
Copy link

@marianacapelo marianacapelo commented Jul 3, 2015

+1

@nejtr0n
Copy link

@nejtr0n nejtr0n commented Oct 30, 2015

+1

@aleksandrzen
Copy link
Contributor

@aleksandrzen aleksandrzen commented Nov 1, 2015

+1

@mansoorriaaz
Copy link

@mansoorriaaz mansoorriaaz commented Apr 19, 2016

+1

@andrew-demb
Copy link
Contributor

@andrew-demb andrew-demb commented Jul 3, 2016

+1

@gunelism
Copy link

@gunelism gunelism commented Jun 29, 2017

1+

1 similar comment
@dacgray
Copy link

@dacgray dacgray commented Aug 16, 2017

1+

@sergeyklay sergeyklay self-assigned this Aug 18, 2017
@sergeyklay sergeyklay added this to the 4.0.0 milestone Aug 18, 2017
@phalcon phalcon deleted a comment from stale bot Feb 23, 2019
@niden
Copy link
Member

@niden niden commented Feb 23, 2019

Closing in favor of #13855. Will revisit if the community votes for it, or in later versions.

@niden niden closed this Feb 23, 2019
@niden niden added this to To do in 4.1 Release via automation Mar 11, 2019
@niden niden removed this from the 4.0.0 milestone Mar 11, 2019
@niden niden reopened this Mar 11, 2019
4.1 Release automation moved this from To do to In progress Mar 11, 2019
@niden niden moved this from In progress to To do in 4.1 Release Mar 11, 2019
@stale stale bot added the stale label Jun 9, 2019
@stale stale bot closed this Jun 10, 2019
4.1 Release automation moved this from To do to Done Jun 10, 2019
@phalcon phalcon deleted a comment from stale bot Jun 10, 2019
@niden niden reopened this Jun 10, 2019
4.1 Release automation moved this from Done to In progress Jun 10, 2019
@stale stale bot removed the stale label Jun 10, 2019
@niden niden added the 4.1.0 label Jun 21, 2019
@niden niden moved this from In progress to To do in 4.1 Release Jun 21, 2019
@stale stale bot added the stale label Dec 23, 2019
@phalcon phalcon deleted a comment from stale bot Dec 23, 2019
@stale stale bot removed the stale label Dec 23, 2019
@ruudboon ruudboon added this to Backlog in Phalcon Roadmap Dec 24, 2019
@niden niden removed this from To do in 4.1 Release Dec 24, 2019
@niden
Copy link
Member

@niden niden commented Jan 12, 2020

@hugoduraes and others,

How do you envision this to work i.e. what would the result be? Is it going to be an array just like fetchAll returns when running a pure PDO based query or will this return a Complex/Simple resultset object

Since this issue has the most votes I was thinking of taking a stab at it and tying it with the new ORM that we are building but also offering functionality for the current ORM.

@niden
Copy link
Member

@niden niden commented Feb 19, 2020

Implemented in #14734

@niden niden closed this Feb 19, 2020
Phalcon Roadmap automation moved this from Backlog to Implemented Feb 19, 2020
@niden niden moved this from Implemented to Released in Phalcon Roadmap Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Phalcon Roadmap
  
Released
Linked pull requests

Successfully merging a pull request may close this issue.

None yet