If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Eliminate deprecated Bugzilla::DB routines from editgroups.cgi

RESOLVED FIXED in Bugzilla 2.22



12 years ago
12 years ago


(Reporter: wicked, Assigned: Frédéric Buclin)


Bugzilla 2.22
Bug Flags:
approval +



(1 attachment, 1 obsolete attachment)

21.69 KB, patch
Joel Peshkin
: review+
Details | Diff | Splinter Review


12 years ago
These lines need to rewritten to use DBI:

editgroups.cgi:150:    SendSQL("SELECT
id,name,description,userregexp,isactive,isbuggroup " .
editgroups.cgi:154:    while (MoreSQLData()) {
editgroups.cgi:156:            = FetchSQLData();
editgroups.cgi:197:    SendSQL("SELECT groups.id, groups.name,
groups.description," .
editgroups.cgi:216:    while (MoreSQLData()) {
editgroups.cgi:218:            = FetchSQLData();
editgroups.cgi:275:    SendSQL("INSERT INTO groups ( " .
editgroups.cgi:278:            SqlQuote($name) . ", " .
editgroups.cgi:279:            SqlQuote($desc) . ", " .
editgroups.cgi:281:            SqlQuote($regexp) . ", " .
editgroups.cgi:287:    SendSQL("INSERT INTO group_group_map (member_id,
grantor_id, grant_type)
editgroups.cgi:289:    SendSQL("INSERT INTO group_group_map (member_id,
grantor_id, grant_type)
editgroups.cgi:291:    SendSQL("INSERT INTO group_group_map (member_id,
grantor_id, grant_type)
editgroups.cgi:295:        SendSQL("INSERT INTO group_control_map " .
editgroups.cgi:330:    SendSQL("SELECT user_id FROM user_group_map
editgroups.cgi:332:    if (FetchOneColumn()) {
editgroups.cgi:338:    SendSQL("SELECT bug_id FROM bug_group_map WHERE group_id
= $gid");
editgroups.cgi:340:    if (MoreSQLData()) {
editgroups.cgi:343:        while (MoreSQLData()) {
editgroups.cgi:344:            my ($bug) = FetchSQLData();
editgroups.cgi:350:    SendSQL("SELECT name FROM products WHERE name=" .
editgroups.cgi:351:    if (MoreSQLData()) {
editgroups.cgi:356:    SendSQL("SELECT id FROM flagtypes
editgroups.cgi:358:    if (FetchOneColumn()) {
editgroups.cgi:396:    SendSQL("SELECT user_id FROM user_group_map
editgroups.cgi:398:    if (FetchOneColumn()) {
editgroups.cgi:403:    SendSQL("SELECT bug_id FROM bug_group_map WHERE group_id
= $gid");
editgroups.cgi:404:    if (FetchOneColumn()) {
editgroups.cgi:409:    SendSQL("SELECT name FROM products WHERE name=" .
editgroups.cgi:410:    if (FetchOneColumn()) {
editgroups.cgi:415:    SendSQL("SELECT id FROM flagtypes
editgroups.cgi:417:    if (FetchOneColumn()) {
editgroups.cgi:424:        SendSQL("UPDATE flagtypes SET grant_group_id = NULL
editgroups.cgi:426:        SendSQL("UPDATE flagtypes SET request_group_id = NULL
editgroups.cgi:428:        SendSQL("DELETE FROM user_group_map WHERE group_id =
editgroups.cgi:429:        SendSQL("DELETE FROM group_group_map WHERE grantor_id
= $gid");
editgroups.cgi:430:        SendSQL("DELETE FROM bug_group_map WHERE group_id =
editgroups.cgi:431:        SendSQL("DELETE FROM group_control_map WHERE group_id
= $gid");
editgroups.cgi:432:        SendSQL("DELETE FROM whine_schedules WHERE " .
editgroups.cgi:435:        SendSQL("DELETE FROM groups WHERE id = $gid");
editgroups.cgi:565:    SendSQL("SELECT isbuggroup FROM groups WHERE id = $gid");
editgroups.cgi:566:    my ($isbuggroup) = FetchSQLData();
editgroups.cgi:614:                    SendSQL("INSERT INTO group_group_map
editgroups.cgi:618:                    SendSQL("DELETE FROM group_group_map
editgroups.cgi:629:                    SendSQL("INSERT INTO group_group_map
editgroups.cgi:633:                    SendSQL("DELETE FROM group_group_map
editgroups.cgi:644:                    SendSQL("INSERT INTO group_group_map
editgroups.cgi:648:                    SendSQL("DELETE FROM group_group_map
editgroups.cgi:659:        SendSQL("UPDATE groups SET last_changed = NOW() WHERE
id = $gid");


12 years ago
Assignee: general → LpSolit
Target Milestone: --- → Bugzilla 2.22

Comment 1

12 years ago
Created attachment 193769 [details] [diff] [review]
patch, v1
Attachment #193769 - Flags: review?(bugreport)

Comment 2

12 years ago
Comment on attachment 193769 [details] [diff] [review]
patch, v1

The users table can have tens of thousands of records.	We really don't want to
do selectall_arrayref on queries that return every row at once.

Also, if you want to do hasusers/hasbugs in a single query, count the rows
instead of fetching them all.
Attachment #193769 - Flags: review?(bugreport) → review-

Comment 3

12 years ago
Created attachment 193831 [details] [diff] [review]
patch, v2

I now leave $dbh->prepare() alone due to the potentially high number of matches
when querying the 'profiles' table, per joel's request.

$hasbugs and $hasusers have to be determined independently. I optimised the
code a bit to stop querying the DB as soon as one match is found.
Attachment #193769 - Attachment is obsolete: true
Attachment #193831 - Flags: review?(bugreport)


12 years ago
Attachment #193831 - Flags: review?(bugreport) → review+


12 years ago
Flags: approval?
Flags: approval? → approval+

Comment 4

12 years ago
Checking in editgroups.cgi;
/cvsroot/mozilla/webtools/bugzilla/editgroups.cgi,v  <--  editgroups.cgi
new revision: 1.59; previous revision: 1.58
Last Resolved: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.