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

pkp/pkp-lib#6264 Remove adodb #6318

Closed
wants to merge 51 commits into from
Closed

Conversation

asmecher
Copy link
Member

@asmecher asmecher commented Nov 6, 2020

No description provided.

@asmecher asmecher mentioned this pull request Nov 6, 2020
Copy link
Contributor

@NateWr NateWr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Phew! A lot of painstaking work there. Looks good and the changes all sound like good improvements. Great to be rid of ADODB and an easy path for migrating more and more onto Laravel's query handling.

$returner = $this->_fromRow($result->GetRowAssoc(false));
$query = Capsule::table($this->tableName)->where($this->primaryKeyColumn, '=', (int) $announcementId);
if ($assocType !== null) $query->where('assoc_type', '=', (int) $assocType);
if ($assocId !== null) $query->where('assoc_id', '=', (int) $assocType);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just out of curiosity, does the query builder handle type conversions like this? I've often wondered whether I need to cast to int but never taken the time to experiment.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question; I'll test when I have a sec. Using ADODB, PostgreSQL would complain if the data type didn't match the column type; I would expect PDO to behave the same. This could cause SQL failures when binding a user-supplied parameter, if the user entered a string instead of a number. Putting the casts in the binding resulted in more not-foundish behaviour than fatal-errorish.

classes/db/DAO.inc.php Show resolved Hide resolved
classes/db/DAO.inc.php Outdated Show resolved Hide resolved
if ($dbResultRange && $dbResultRange->isValid()) {
$sql .= ' LIMIT ' . (int) $dbResultRange->getCount();
$offset = (int) $dbResultRange->getOffset();
$offset += max(0, $dbResultRange->getPage()-1) * Config::getVar('interface', 'items_per_page', 30);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you checked to see how this interacts with the count/offset parameters supported by the REST API? In the new submission lists I have tried to move away from using the items_per_page setting on the backend and only supporting it on the reader-facing frontend.

Also, I think that there is a context setting for items_per_page, not just a config option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, paging was broken. Fixed: asmecher@694b61a

$arrFields = array_map(array($dataSource, 'qstr'), $arrFields);
return $dataSource->Replace($table, $arrFields, $keyCols, false);
$queryBuilder = new \Staudenmeir\LaravelUpsert\Query\Builder(Capsule::connection());
return $queryBuilder->from($table)->upsert($arrFields, $keyCols);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we'll get upsert from Laravel 8 onwards.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good. I've bumped to Laravel 7 in this PR but stopped short of Laravel 8 because of PHP requirements, if I recall correctly.

classes/db/DBDataXMLParser.inc.php Outdated Show resolved Hide resolved
classes/handler/PKPHandler.inc.php Show resolved Hide resolved
classes/i18n/PKPLocale.inc.php Show resolved Hide resolved
classes/plugins/Plugin.inc.php Show resolved Hide resolved
@asmecher
Copy link
Member Author

Replaced by #6342 (rebase for Submission File overhaul)

@asmecher asmecher closed this Nov 17, 2020
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.

2 participants