Bad call to count_records_sql() for collection views

Bug #1644649 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Robert Lyon
16.10
Fix Released
Medium
Unassigned
17.04
Fix Released
Medium
Robert Lyon

Bug Description

In Mahara we have a db call called count_records_sql() that uses a passed in sql query.

It fetches a result set via get_recordset_sql() then calls reset() which fails if the result set is false.

Normally we use count_records_sql() with a query containing the sql COUNT() option so that it always returns a non false result.

But this is not obvious when using this function.

So I'll fix up the bad call to this function and put some notes in it about needing to use COUNT() in sql query string

Robert Lyon (robertl-9)
Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/7270

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Patch for "master" branch: https://reviews.mahara.org/7271

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/7270
Committed: https://git.mahara.org/mahara/mahara/commit/57ca7c4130daaa3b821da4c3dc681d0f79886536
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 57ca7c4130daaa3b821da4c3dc681d0f79886536
Author: Robert Lyon <email address hidden>
Date: Fri Nov 25 10:58:04 2016 +1300

Bug 1644649: getting count_recordset_sql() to throw error

If no actual 'COUNT()' in string and the sql query return no rows

behatnotneeded

Change-Id: I8d86cd0dda889c564d89e494c586a98e9425fc3e
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/7271
Committed: https://git.mahara.org/mahara/mahara/commit/b517ee2c00b2ea1029eb582bd6830708a78c226b
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit b517ee2c00b2ea1029eb582bd6830708a78c226b
Author: Robert Lyon <email address hidden>
Date: Fri Nov 25 11:19:36 2016 +1300

Bug 1644649: Fixing bad secret url checking sql queries

The sql queries were missing the COUNT() parameter, but it turns out
we should just use record_exists_select in this case as we don't care
how many exist but if they do or not.

behatnotneeded

Change-Id: Ice7cbb619701e32fd11030cd7f69e9fba0609a34
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "16.10_STABLE" branch: https://reviews.mahara.org/7302

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/7302
Committed: https://git.mahara.org/mahara/mahara/commit/ce93c15df8b63bb3176440829e83c753f92a2188
Submitter: Robert Lyon (<email address hidden>)
Branch: 16.10_STABLE

commit ce93c15df8b63bb3176440829e83c753f92a2188
Author: Robert Lyon <email address hidden>
Date: Fri Nov 25 11:19:36 2016 +1300

Bug 1644649: Fixing bad secret url checking sql queries

The sql queries were missing the COUNT() parameter, but it turns out
we should just use record_exists_select in this case as we don't care
how many exist but if they do or not.

behatnotneeded

Change-Id: Ice7cbb619701e32fd11030cd7f69e9fba0609a34
Signed-off-by: Robert Lyon <email address hidden>
(cherry picked from commit b517ee2c00b2ea1029eb582bd6830708a78c226b)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.