mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #43774
[Bug 1698978] A change has been merged
Reviewed: https://reviews.mahara.org/7828
Committed: https://git.mahara.org/mahara/mahara/commit/be550b4e067879a184d82764a9404e632be63b4b
Submitter: Robert Lyon (robertl@xxxxxxxxxxxxxxx)
Branch: master
commit be550b4e067879a184d82764a9404e632be63b4b
Author: Robert Lyon <robertl@xxxxxxxxxxxxxxx>
Date: Tue Jun 20 11:49:14 2017 +1200
Bug 1698978: get_records_*_assoc functions fail on one field
If we are trying to fetch only 1 field then we can't use the
$rs->GetAssoc() function as that expects 2 fields minimum.
We can get around this in lib/dml.php by creating our own assoc return
object.
behatnotneeded
Change-Id: I6a4a9beadc4abeebc5d73bac6128d56f46ce4676
Signed-off-by: Robert Lyon <robertl@xxxxxxxxxxxxxxx>
--
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/1698978
Title:
get_records_*_assoc giving incorrect false when records exists
Status in Mahara:
Fix Committed
Bug description:
If you try to do a get_records_*_assoc but only want 1 field returned
you get 'false' instead.
This is because the get_records_*_assoc functions need at least 2
fields to be selected to work correctly but doesn't give a warning if
you only provide one
For example
$test = get_records_sql_assoc("SELECT username FROM {usr} WHERE username LIKE 'adm%'", array());
$test2 = get_records_sql_array("SELECT username FROM {usr} WHERE username LIKE 'adm%'", array());
The $test will return false but the $test2 will return an array with
the users starting with 'adm'
So I'll add a SQL exception to avoid this trap in the future
I'll mark the bug 'high' in case we are relying in this anywhere in
Mahara currently
To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1698978/+subscriptions
References