Closed Bug 158474 Opened 23 years ago Closed 22 years ago

Abstract out GenerateSQL into perl module

Categories

(Bugzilla :: Query/Bug List, defect, P2)

2.17

Tracking

()

RESOLVED FIXED
Bugzilla 2.18

People

(Reporter: gerv, Assigned: gerv)

References

Details

Attachments

(1 file, 2 obsolete files)

The function GenerateSQL() in buglist.cgi turns a URL into an SQL query. This ability is needed for both generic reporting (bug 12282) and generic charting (bug 16009). The plan is to move this function into a perl module, Search.pm, so this module can be used by all the CGIs which need this ability.
-> me. Gerv
Assignee: endico → gerv
Blocks: 12282, 16009
Priority: -- → P2
Hardware: PC → All
Target Milestone: --- → Bugzilla 2.18
Attached patch Patch v.1 (obsolete) (deleted) — Splinter Review
This patch transplants the code from buglist.cgi to the new module. I have made very few changes to the code itself, in the interests of getting this patch reviewed and checked in quickly, and not destabilising things. The changes I have made to GenerateSQL() (now Search::init) are: # Brought two helper functions used only by GenerateSQL into the module # Added &:: to all the remaining global subroutines. # Fixed error calls to use ThrowUserError/ThrowCodeError # Removed commented-out "inject SQL" code # Whitespace changes Changes to buglist.cgi: # Removed code which has gone to Search.pm # Eliminated sillyness in favour of "use vars". # Whitespace changes Gerv
I've posted to reviewers@b.o about the naming convention for perl modules.
Comment on attachment 92098 [details] [diff] [review] Patch v.1 Apart from the module naming issue, r=jouni. Let's wait for that to resolve before checking this in. Let's hope nothing breaks; the patch is fairly large and I might not have trapped minor changes here and there... But I've tested it quite severely and it seems to work fine.
Attachment #92098 - Flags: review+
Is it really worth waiting for the naming issue to be resolved? Fixing it to conform to what we decide is a three-liner. Gerv
Moving files sucks with cvs. Anyway, we decided on Bugzilla::Foo.pm, didn't we?
Attached patch Patch v.2 (obsolete) (deleted) — Splinter Review
Uses new module naming convention. Gerv
Attachment #92098 - Attachment is obsolete: true
Attached patch Patch v.3 (deleted) — Splinter Review
Working version of Patch v.2. Gerv
Attachment #94681 - Attachment is obsolete: true
Jouni gave this an r= conditional on package name, and louie also said he'd looked at in in review bug 158486. Checked in. Checking in buglist.cgi; /cvsroot/mozilla/webtools/bugzilla/buglist.cgi,v <-- buglist.cgi new revision: 1.188; previous revision: 1.187 done RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v done Checking in Bugzilla/Search.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v <-- Search.pm initial revision: 1.1 done Gerv
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
*** Bug 125798 has been marked as a duplicate of this bug. ***
You missed one: Index: Search.pm =================================================================== RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Search.pm,v retrieving revision 1.1 diff -u -r1.1 Search.pm --- Search.pm 9 Aug 2002 22:12:14 -0000 1.1 +++ Search.pm 10 Aug 2002 02:16:43 -0000 @@ -827,7 +827,7 @@ my $word = $w; if ($word ne "") { $word =~ tr/A-Z/a-z/; - $word = SqlQuote(quotemeta($word)); + $word = &::SqlQuote(quotemeta($word)); $word =~ s/^'//; $word =~ s/'$//; $word = '(^|[^a-z0-9])' . $word . '($|[^a-z0-9])';
... which I've checked in
QA Contact: matty_is_a_geek → default-qa
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: