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

Pass string parameters to DB query instead of object #16588

Merged
merged 2 commits into from Oct 19, 2020
Merged

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Oct 19, 2020

In Matomo for WordPress this caused the tests to fail. I have now worked around this to ensure it won't cause any issues in Matomo for WordPress anymore (matomo-org/matomo-for-wordpress@ffe92d1#diff-c4e75ddbbcdde3ba408b5a87e273371dd3420a5d0b90a87bb4295e81787cdc31R242-R244) when this happens again but figured it be still good to pass strings directly here just in case it somehow causes other issues somehow :)

In Matomo for WordPress this caused the tests to fail.  I have now worked around this to ensure it won't cause any issues in Matomo for WordPress anymore (matomo-org/matomo-for-wordpress@ffe92d1#diff-c4e75ddbbcdde3ba408b5a87e273371dd3420a5d0b90a87bb4295e81787cdc31R242-R244) when this happens again but figured it be still good to pass strings directly here just in case it somehow causes other issues somehow :)
@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Oct 19, 2020
@tsteur tsteur added this to the 4.0.0-RC milestone Oct 19, 2020
@@ -377,7 +377,7 @@ public function deleteOlderArchives(Parameters $params, $name, $tsArchived, $idA

$sql = "SELECT idarchive FROM `$numericTable` WHERE idsite = ? AND date1 = ? AND date2 = ? AND period = ? AND name = ? AND ts_archived < ? AND idarchive < ?";

$idArchives = Db::fetchAll($sql, [$params->getSite()->getId(), $dateStart, $dateEnd, $params->getPeriod()->getId(), $name, $tsArchived, $idArchive]);
$idArchives = Db::fetchAll($sql, [$params->getSite()->getId(), $dateStart . '', $dateEnd . '', $params->getPeriod()->getId(), $name, $tsArchived, $idArchive]);
Copy link
Member

Choose a reason for hiding this comment

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

Would it be good to use ->getDatetime()? Otherwise good to merge.

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 one. So maybe partially it could have been buggy before?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe, I remember testing this and it working at least on my local setup...

Copy link
Member Author

Choose a reason for hiding this comment

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

@diosmosis updated it

@diosmosis diosmosis merged commit 800a99a into 4.x-dev Oct 19, 2020
@diosmosis diosmosis deleted the stringfetchall branch October 19, 2020 03:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants