summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorKoosha KM <koosha.khajeh@gmail.com>2014-08-12 08:00:21 +0200
committerByron Jones <glob@mozilla.com>2014-08-12 08:00:21 +0200
commit2f5c78b7362cc604f341bb1d3a2c4d486f19ce5c (patch)
tree378f85e86c32de5d2f7aade841f35e485f5c63cf /Bugzilla
parent2957d625cc4390d99154fa37fb2158b597cdaec4 (diff)
downloadbugzilla-2f5c78b7362cc604f341bb1d3a2c4d486f19ce5c.tar.gz
bugzilla-2f5c78b7362cc604f341bb1d3a2c4d486f19ce5c.tar.xz
Bug 498890: Bugzilla::User::Setting doesn't need to sort DB results
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/User/Setting.pm25
1 files changed, 10 insertions, 15 deletions
diff --git a/Bugzilla/User/Setting.pm b/Bugzilla/User/Setting.pm
index 958a95580..27470f435 100644
--- a/Bugzilla/User/Setting.pm
+++ b/Bugzilla/User/Setting.pm
@@ -166,21 +166,18 @@ sub add_setting {
sub get_all_settings {
my ($user_id) = @_;
- my $settings = get_defaults($user_id); # first get the defaults
+ my $settings = {};
my $dbh = Bugzilla->dbh;
- my $sth = $dbh->prepare(
+ my $rows = $dbh->selectall_arrayref(
q{SELECT name, default_value, is_enabled, setting_value, subclass
FROM setting
LEFT JOIN profile_setting
ON setting.name = profile_setting.setting_name
- WHERE profile_setting.user_id = ?
- ORDER BY name});
+ AND profile_setting.user_id = ?}, undef, ($user_id));
- $sth->execute($user_id);
- while (my ($name, $default_value, $is_enabled, $value, $subclass)
- = $sth->fetchrow_array())
- {
+ foreach my $row (@$rows) {
+ my ($name, $default_value, $is_enabled, $value, $subclass) = @$row;
my $is_default;
@@ -206,13 +203,11 @@ sub get_defaults {
$user_id ||= 0;
- my $sth = $dbh->prepare(q{SELECT name, default_value, is_enabled, subclass
- FROM setting
- ORDER BY name});
- $sth->execute();
- while (my ($name, $default_value, $is_enabled, $subclass)
- = $sth->fetchrow_array())
- {
+ my $rows = $dbh->selectall_arrayref(q{SELECT name, default_value, is_enabled, subclass
+ FROM setting});
+
+ foreach my $row (@$rows) {
+ my ($name, $default_value, $is_enabled, $subclass) = @$row;
$default_settings->{$name} = new Bugzilla::User::Setting(
$name, $user_id, $is_enabled, $default_value, $default_value, 1,