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

Open
hugoduraes opened this Issue Feb 17, 2014 · 24 comments

Comments

Projects
None yet
@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

This comment has been minimized.

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

This comment has been minimized.

philippgerard commented Mar 27, 2014

+1

@niden niden added Unassigned and removed Unassigned labels Apr 3, 2014

@mzf

This comment has been minimized.

mzf commented Apr 20, 2014

+1

2 similar comments
@pusoiuandrei

This comment has been minimized.

pusoiuandrei commented Apr 22, 2014

+1

@seb777

This comment has been minimized.

seb777 commented Apr 22, 2014

+1

@mosid

This comment has been minimized.

mosid commented May 7, 2014

+10

@londomloto

This comment has been minimized.

londomloto commented May 28, 2014

+1000

@csguimraes

This comment has been minimized.

csguimraes commented May 28, 2014

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

@ut4

This comment has been minimized.

ut4 commented May 29, 2014

+1

1 similar comment
@konsultaner

This comment has been minimized.

konsultaner commented Jun 3, 2014

+1

@Samhayn

This comment has been minimized.

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

This comment has been minimized.

mohammadhzp commented Apr 22, 2015

+1

@salarmehr

This comment has been minimized.

salarmehr commented Jun 7, 2015

+100

@tmihalik

This comment has been minimized.

Contributor

tmihalik commented Jun 7, 2015

+1

@Surt

This comment has been minimized.

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

This comment has been minimized.

Member

sergeyklay commented Jun 15, 2015

+1

5 similar comments
@marianacapelo

This comment has been minimized.

marianacapelo commented Jul 3, 2015

+1

@nejtr0n

This comment has been minimized.

nejtr0n commented Oct 30, 2015

+1

@aleksandrzen

This comment has been minimized.

Contributor

aleksandrzen commented Nov 1, 2015

+1

@mansoorriaaz

This comment has been minimized.

mansoorriaaz commented Apr 19, 2016

+1

@andrew-demb

This comment has been minimized.

andrew-demb commented Jul 3, 2016

+1

@gunelism

This comment has been minimized.

gunelism commented Jun 29, 2017

1+

1 similar comment
@dacgray

This comment has been minimized.

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

@stale

This comment has been minimized.

stale bot commented Apr 16, 2018

Thank you for contributing to this issue. As it has been 90 days since the last activity, we are automatically closing the issue. This is often because the request was already solved in some way and it just wasn't updated or it's no longer applicable. If that's not the case, please feel free to either reopen this issue or open a new one. We will be more than happy to look at it again! You can read more here: https://blog.phalconphp.com/post/github-closing-old-issues

@stale stale bot added the stale label Apr 16, 2018

@sergeyklay sergeyklay closed this Apr 16, 2018

@sergeyklay sergeyklay reopened this May 2, 2018

@stale stale bot removed the stale label May 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment