-
Notifications
You must be signed in to change notification settings - Fork 189
[Cleanup] Make DBRowProvisioner use Database class #9509
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
Conversation
|
|
||
| $provisioner = $provisioner->filter($filter); | ||
|
|
||
| $traversable = (new \LORIS\Data\Table()) |
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.
This part didn't seem to be useful, so I verified and removed while testing.
| */ | ||
| public function getAllInstances() : \Traversable | ||
| { | ||
| $DB = (\NDB_Factory::singleton())->database(); |
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.
This is the bulk of the PR. The rest is mostly just propagating LorisInstance objects places that didn't have it.
3732d13 to
04ddf5c
Compare
| self::$display, | ||
| self::$clearFilter, | ||
| '0', | ||
| '2 rows' |
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.
This test was failing and when I investigated I don't see any rows with a value of "0" in RB and nothing inserted from the test, so I'm not sure where "2" was coming from and I think it's an error.
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.
Can you change it to test '4300' with '1 rows' so that the test is still testing the filter? I feel like testing for no results is less foolproof, and the max age test covers that below anyway
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.
That's a good idea. I'll try.
4411abd to
2f23574
Compare
| self::$display, | ||
| self::$clearFilter, | ||
| '0', | ||
| '2 rows' |
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.
Can you change it to test '4300' with '1 rows' so that the test is still testing the filter? I feel like testing for no results is less foolproof, and the max age test covers that below anyway
This is no longer required and causes obscure differences between pselect and DBRowProvisioner. Resolves aces#9335
2f23574 to
4f13b5a
Compare
|
@skarya22 I believe I've done all your requested changes and rebased this. |
skarya22
left a comment
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.
LGTM!
This updates DBRowProvisioner to remove the strval (and fixes #9335).
After doing that, it became clear that the inner class could be replaced by a generator while still fulfilling the contract of returning a
\Traversable. Doing this made it more obvious that since #9334, pselect could be used directly while maintaining the lazy evaluation instead of bypassing the Database object to use the PDO directly. However this required injecting aLorisInstanceobject to the constructor to get the database connection.With access to the
LorisInstanceobject, theDBRowProvisionercan also get a new database connection and disable query buffering to lazily retrieve rows since PR #9344. This may theoretically improve performance and memory usage on large provisioners but has not been tested. (Performance did not decrease in raisinbread but it is not a large dataset where it would be noticeable.)