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

GQL LIMIT error in production, not on dev. #125

Open
tristansokol opened this issue Jul 8, 2016 · 1 comment
Open

GQL LIMIT error in production, not on dev. #125

tristansokol opened this issue Jul 8, 2016 · 1 comment

Comments

@tristansokol
Copy link
Contributor

I get the following error when I tried my code in the actual app engine environment, but it works fine in the dev environment (presumably a difference between @tomwalder's GQL parser and Google's).

PHP Fatal error:  Uncaught exception 'google\appengine\runtime\ApplicationError' with message 'Encountered "LIMIT" at line 1, column 32.
Was expecting one of:
    <EOF> 
    "+" ...
    ' in /base/data/home/runtimes/php/sdk/google/appengine/runtime/RealApiProxy.php:53

My query is SELECT * FROM Artists OFFSET 0 used in the FetchOne command i.e.
$obj_store->fetchOne("SELECT * FROM Artists OFFSET ".$offset);

My first guess is an issue with using OFFSET before LIMIT, but I will keep investigating further if nobody intervenes.

@tristansokol
Copy link
Contributor Author

Looking at https://github.com/tomwalder/php-gds/blob/master/src/GDS/Mapper/ProtoBufGQLParser.php a little more, it appears that the dev server doesn't care which order things are in but apparently AppEngine production does.

I tried $entity = $obj_store->fetchAll( "SELECT * FROM Artists LIMIT 1 OFFSET ".$offset); and it worked fine. Although it sounds like this will be more expensive from the readme.

I can add a pull request that will throw an exception if OFFSET is used in FetchOne, and add it to the documentation if desired.

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

1 participant