-
Notifications
You must be signed in to change notification settings - Fork 13
Conversation
SQLite fail to handle the scroll cursor option. We can know if the driver support cursors by doing an attribute request before our query.
$options[\PDO::ATTR_CURSOR] = \PDO::CURSOR_SCROLL; | ||
try { | ||
$this->getConnection()->getAttribute(\PDO::ATTR_CURSOR); | ||
$options[\PDO::ATTR_CURSOR] = \PDO::CURSOR_SCROLL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, the ATTR_CURSOR
is supported, but not the CURSOR_SCROLL
value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try with this branch ?
I had the same error as you and this patch fix it (with sqlite3 on win10 x64)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I will try. However, iterator support will no be longer be available if scroll cursor is not enabled. Should we throw an error then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if this patch works, then this is a bug in PDO with SQLite driver and we should open a bug on bugs.php.net, do you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, if this patch works, then this is a bug in PDO with SQLite driver and we should open a bug on bugs.php.net, do you agree?
Yes.
Hmm, I will try. However, iterator support will no be longer be available if scroll cursor is not enabled. Should we throw an error then?
Forward only iterator will be available. Scrollable cursor is used to customize the fetch orientation.
Throw an error if the user want to use a feature which is not supported by the driver is interesting but we have to re-think the way we prepare our statement.
Currently we enable the scroll cursor before the user has chosen if he want to use the feature so we can't throw an error according to his choice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with your strategy. Are you willing to do a PR?
$this->getConnection()->getAttribute(\PDO::ATTR_CURSOR); | ||
$options[\PDO::ATTR_CURSOR] = \PDO::CURSOR_SCROLL; | ||
} catch (\PDOException $e) { | ||
// Cursors isn't supported by the driver, see issue #35. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- isn't
+ are not
Fixed by me.
Thanks for the PR! |
Fix #35
Hi,
I don't really like the
getAttribute
call but I don't see any other way to fix that properly.NB: We need
Hoa\Protocol
since we do a call toresolve
inDal.php
.