Closed Bug 300549 Opened 19 years ago Closed 18 years ago

Eliminate deprecated Bugzilla::DB routines from Flag.pm and FlagType.pm

Categories

(Bugzilla :: Bugzilla-General, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 3.0

People

(Reporter: LpSolit, Assigned: LpSolit)

References

Details

Attachments

(1 file)

.
Status: NEW → ASSIGNED
Target Milestone: --- → Bugzilla 2.22
Deprecated DB routines have been removed from Attachment.pm thanks to myk's
patch in bug 302669. Updating the summary accordingly.
Summary: Eliminate deprecated Bugzilla::DB routines from Attachment.pm, Flag.pm and FlagType.pm → Eliminate deprecated Bugzilla::DB routines from Flag.pm and FlagType.pm
Target Milestone: Bugzilla 2.22 → Bugzilla 2.24
Duping to the bug I have a patch for.... 

*** This bug has been marked as a duplicate of 317149 ***
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → DUPLICATE
Assignee: LpSolit → general
Target Milestone: Bugzilla 2.24 → ---
Version: 2.21 → unspecified
Status: RESOLVED → REOPENED
Depends on: 304699
Resolution: DUPLICATE → ---
Target Milestone: --- → Bugzilla 2.24
Assignee: general → LpSolit
Status: REOPENED → NEW
Status: NEW → ASSIGNED
*** Bug 317149 has been marked as a duplicate of this bug. ***
Blocks: 331343
No longer blocks: 331343
Blocks: 304699
No longer depends on: 304699
Attached patch patch, v1Splinter Review
As future(?) improvements, we could try to:
- force sqlify_criteria() to separate the SQL fragment from values and to return them separately;
- convert the column list in FlagType.pm to be a constant, but this would involve a lot of work due to the way sqlify_criteria() works, i.e. altering this list depending on your requests.

Anyway, as I plan to rewrite Flag.pm and FlagType.pm in bug 304699 very soon now (to use real flag objects), I won't waste too much time on it here.
Attachment #218682 - Flags: review?(wicked+bz)
Comment on attachment 218682 [details] [diff] [review]
patch, v1

Looks ok, passes tests and atleast seems to work on few simple flag related changes I did.

>Index: Bugzilla/Flag.pm
>===================================================================
>@@ -192,7 +149,7 @@
> =item C<count($criteria)>
>-Queries the database for flags matching the given criteria 
>+Queries the database for flags matching the given criteria
> (specified as a hash of field names and their matching values)
> and returns an array of matching records.

Nit: Correct rest of the comment while you are at it. Surely this doesn't return an array of matches..

>+        $dbh->do('UPDATE bugs SET delta_ts = ? WHERE bug_id = ?',
>+                  undef, $timestamp, $bug_id);

Nit: Multiple values, so add brackets like in others.

>Index: Bugzilla/FlagType.pm
>===================================================================
>-    my $select_clause = "SELECT " . join(", ", @base_columns);
>-    my $from_clause = "FROM " . join(" ", @base_tables);
>+    my $columns = join(", ", @base_columns);
>+    my @data = $dbh->selectrow_array("SELECT $columns FROM flagtypes

Nit: Since base_tables has not removed from other places, don't remove it from here either. This is for consistency in case the list is changed later.

>Index: sanitycheck.cgi
>===================================================================
>-my @open_states = map(SqlQuote($_), BUG_STATE_OPEN);
>+my @open_states = map($dbh->quote($_), BUG_STATE_OPEN);

Oops, sorry about letting that SqlQuote in there. :)
Attachment #218682 - Flags: review?(wicked+bz) → review+
Flags: approval?
Flags: approval? → approval+
Checking in attachment.cgi;
/cvsroot/mozilla/webtools/bugzilla/attachment.cgi,v  <--  attachment.cgi
new revision: 1.109; previous revision: 1.108
done
Checking in editusers.cgi;
/cvsroot/mozilla/webtools/bugzilla/editusers.cgi,v  <--  editusers.cgi
new revision: 1.120; previous revision: 1.119
done
Checking in sanitycheck.cgi;
/cvsroot/mozilla/webtools/bugzilla/sanitycheck.cgi,v  <--  sanitycheck.cgi
new revision: 1.113; previous revision: 1.112
done
Checking in Bugzilla/Flag.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/Flag.pm,v  <--  Flag.pm
new revision: 1.63; previous revision: 1.62
done
Checking in Bugzilla/FlagType.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/FlagType.pm,v  <--  FlagType.pm
new revision: 1.26; previous revision: 1.25
done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago18 years ago
Resolution: --- → FIXED
Blocks: 345032
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: