mahara-contributors team mailing list archive
-
mahara-contributors team
-
Mailing list archive
-
Message #43007
[Bug 1698978] [NEW] get_records_*_assoc giving incorrect false when records exists
Public bug reported:
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
** Affects: mahara
Importance: High
Assignee: Robert Lyon (robertl-9)
Status: 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/1698978
Title:
get_records_*_assoc giving incorrect false when records exists
Status in Mahara:
In Progress
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
Follow ups