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
Assignees
Labels
new feature request Planned Feature or New Feature Request

Comments

@hugoduraes
Copy link

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

+1

@mzf
Copy link

mzf commented Apr 20, 2014

+1

2 similar comments
@pusoiuandrei
Copy link

+1

@seb777
Copy link

seb777 commented Apr 22, 2014

+1

@mohammed-alsiddeeq
Copy link

+10

@londomloto
Copy link

+1000

@kbtz
Copy link

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 commented May 29, 2014

+1

1 similar comment
@konsultaner
Copy link

+1

@Samhayn
Copy link

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

+1

@salarmehr
Copy link

+100

@tmihalik
Copy link
Contributor

tmihalik commented Jun 7, 2015

+1

@Surt
Copy link
Contributor

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

+1

5 similar comments
@marianacapelo
Copy link

+1

@nejtr0n
Copy link

nejtr0n commented Oct 30, 2015

+1

@aleksandrzen
Copy link
Contributor

+1

@mansoorriaaz
Copy link

mansoorriaaz commented Apr 19, 2016

+1

@andrew-demb
Copy link
Contributor

+1

@gunelism
Copy link

1+

1 similar comment
@dacgray
Copy link

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
Sponsor Member

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 as completed Feb 23, 2019
@niden niden added the new feature request Planned Feature or New Feature Request label Mar 11, 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 Stale issue - automatically closed label Jun 9, 2019
@stale stale bot closed this as completed 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 Stale issue - automatically closed label Jun 10, 2019
@niden niden added the 4.1 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 Stale issue - automatically closed label Dec 23, 2019
@phalcon phalcon deleted a comment from stale bot Dec 23, 2019
@stale stale bot removed the stale Stale issue - automatically closed 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
Sponsor Member

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
Sponsor Member

niden commented Feb 19, 2020

Implemented in #14734

@niden niden closed this as completed 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
Labels
new feature request Planned Feature or New Feature Request
Projects
Archived in project
Phalcon Roadmap
  
Released
Development

No branches or pull requests