Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Offset may be specified without a limit. Causes syntax error in mysql, sqlite and maybe others #5642

Closed
YonmaN opened this issue Dec 24, 2013 · 4 comments
Assignees
Labels
Milestone

Comments

@YonmaN
Copy link

YonmaN commented Dec 24, 2013

...
$sql = new Sql($adapter);
$select = $sql->select('table');
$select->offset($offset);
$statement = $sql->prepareStatementForSqlObject($select);
$result = $statement->execute();
....

Will throw a syntax error in mysql and sqlite

General error: 1 near "OFFSET": syntax error
samsonasik added a commit to samsonasik/zf2 that referenced this issue Dec 24, 2013
@samsonasik
Copy link
Contributor

@YonmaN I created PR #5643 to fix it

@ralphschindler
Copy link
Member

I think instead we should just throw an exception for the platforms that requires both to be set. If someone is using this driver to produce valid cross platform abstracted queries, I think it would be better to throw an exception so they can fix their query. Thoughts? (The exception would be thrown in the MysqlDecorator).

@samsonasik
Copy link
Contributor

@ralphschindler imho, I think the exception should not be added because on case that we don't want to limit, it will cause issue, on #5643 I remove cast (int) on $this->limit to make it possible to use maximum of unsigned bigint ( 18446744073709551615 )

@weierophinney
Copy link
Member

Fixed with #5940 , to release with 2.3.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants