← Back to team overview

mahara-contributors team mailing list archive

[Bug 1644649] [NEW] Bad call to count_records_sql() for collection views

 

Public bug reported:

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

** Affects: mahara
     Importance: Medium
     Assignee: Robert Lyon (robertl-9)
         Status: In Progress

** Affects: mahara/16.10
     Importance: Medium
         Status: In Progress

** Affects: mahara/17.04
     Importance: Medium
     Assignee: Robert Lyon (robertl-9)
         Status: In Progress

** Changed in: mahara
     Assignee: (unassigned) => Robert Lyon (robertl-9)

** Also affects: mahara/16.10
   Importance: Undecided
       Status: New

** Also affects: mahara/17.04
   Importance: Medium
     Assignee: Robert Lyon (robertl-9)
       Status: In Progress

** Changed in: mahara/16.10
    Milestone: None => 16.10.1

** Changed in: mahara/16.10
   Importance: Undecided => Medium

** Changed in: mahara/16.10
       Status: New => In Progress

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1644649

Title:
  Bad call to count_records_sql() for collection views

Status in Mahara:
  In Progress
Status in Mahara 16.10 series:
  In Progress
Status in Mahara 17.04 series:
  In Progress

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1644649/+subscriptions


Follow ups