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

escape rowcount alias #12951

Merged
merged 2 commits into from
Jul 19, 2017
Merged

escape rowcount alias #12951

merged 2 commits into from
Jul 19, 2017

Conversation

dnapierata
Copy link
Contributor

@dnapierata dnapierata commented Jul 10, 2017

Hello!

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines?
  • I have checked that another pull request for this purpose does not exist.
  • I wrote some tests for this PR.

Small description of change: Escaped row count aliases with double quotes

Thanks

@sergeyklay
Copy link
Contributor

As you can see the tests failed. And yes, I'm not sure about escaping the PHQL

@dnapierata
Copy link
Contributor Author

I agree I don't think that is the correct way to escape when using PHQL.
I used this as a reference:
https://github.com/phalcon/cphalcon/blob/master/phalcon/mvc/model.zep#L1135
but it is not actally using PHQL, just raw SQL.
What about using the built in escaping of PHQL by using brackets?
Ex: [rowcount]

@Jurigag
Copy link
Contributor

Jurigag commented Jul 11, 2017

Well the failing test is about PHQL, i guess it should be [rowcount] most likely yea.

@dnapierata
Copy link
Contributor Author

Any idea about the AppVeyor tests? It is getting a 404 when trying to download a php release

@Jurigag
Copy link
Contributor

Jurigag commented Jul 11, 2017

Not sure, seems unrelated to PR, also update changelog.md and squash commits.

Use phql bracket escaping instead of double quotes

Escape raw SQL portion with double quotes

changelog update

added delimiters to escape reserved words in getPaginate
@sergeyklay
Copy link
Contributor

sergeyklay commented Jul 17, 2017

@dnapierata Could you please create a small test which will cover code you have changed? Don't pay attention to the AppVeyor builds. I'll take a look a bit later

@dnapierata
Copy link
Contributor Author

The tests which are already written for the querybuilder paginator cover this block of code. The only true way to test this feature would be to set up a database that has ROWCOUNT as a reserved word such as MSSQL, OpenEdge, Rave, etc. I'm not well familiar enough in this testing environment with setting up this level of config.

@sergeyklay sergeyklay merged commit 4f29913 into phalcon:3.2.x Jul 19, 2017
@sergeyklay
Copy link
Contributor

Thank you

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

Successfully merging this pull request may close these issues.

3 participants