Closed Bug 392099 Opened 17 years ago Closed 17 years ago

unable to search for downloads with % (SQLite MATCH_ALL) or _ (SQLite MATCH_ONE) in the name

Categories

(Toolkit :: Downloads API, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.9alpha8

People

(Reporter: moco, Assigned: moco)

References

()

Details

Attachments

(2 files)

fix LIKE search to allow for search terms with % _

the solution:

fix this code at http://lxr.mozilla.org/seamonkey/source/toolkit/mozapps/downloads/content/downloads.js#756

sql += "name LIKE '%" + terms[i] + "%' ";

to be:

sql += "name LIKE '%" + stmt.escapeStringForLIKE(terms[i], '/') + "%' ESCAPE '/' ";
Flags: in-litmus?
actually, this shouldn't this be something like:

sql += "name LIKE ?1 ESCAPE '/'";

and then bindStringParamer(x, "%" + stmt.escapeStringForLIKE(terms[i], '/') + "%");

see http://lxr.mozilla.org/seamonkey/source/storage/test/unit/test_like_escape.js#56 for an example of how to do this.
Depends on: 388517
Flags: blocking-firefox3?
Summary: fix LIKE search to allow for search terms with % _ → unable to search for downloads with % (SQLite MATCH_ALL) or _ (SQLite MATCH_ONE) in the name
Assignee: nobody → sspitzer
OS: Windows XP → All
Hardware: PC → All
Target Milestone: --- → Firefox 3 M8
Comment on attachment 276594 [details] [diff] [review]
patch, also fixes the problem that a search for "foo bar cheese" would match for items containing foo, bar, or cheese and not only items containing "foo bar cheese"

Thanks!  r=sdwilsh
Attachment #276594 - Flags: review?(sdwilsh) → review+
Status: NEW → ASSIGNED
http://litmus.mozilla.org/show_test.cgi?id=4573

in-litmus+ for comment 2 only at this time.

Let me know if you find a good, reliable (fixed-location) testcase for comment 0, and I'll write a Litmus testcase and change the ? to +
stephen, let's just attach a file with the desired name to this bug, and use that.
stephen, use https://bugzilla.mozilla.org/attachment.cgi?id=277235 for your litmus test case.

note:  with that test case, a download manager quick search for "%" gives me that file, but a download manager quick search for just "_" does not give me that file, so something is not working right.  (note, a quick earch for "e_" does give me the result.)

so this is not completely fixed.  stephen, can you add the "%" and "_" scenarios to your test litmus test case?

I'll investigate why "_" doesn't work.
actually, _ might be working, and I might just be running into bug #392386.
_ is working, I was just hitting #392386.

marking as fixed.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
http://litmus.mozilla.org/show_test.cgi?id=4574

in-litmus+ now, for both cases (comment 7 and comment 2).
Flags: in-litmus? → in-litmus+
Flags: blocking-firefox3? → blocking-firefox3+
Verified FIXED using Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9a8pre) Gecko/2007090405 Minefield/3.0a8pre with both "_" and "%" as search terms (and in conjunction in a separate search query with their surrounding filename characters).
Status: RESOLVED → VERIFIED
Product: Firefox → Toolkit
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: