Closed
Bug 391750
Opened 17 years ago
Closed 6 years ago
support non-ascii GLOB, MATCH, REGEX support
Categories
(Toolkit :: Storage, defect)
Tracking
()
RESOLVED
INACTIVE
People
(Reporter: moco, Unassigned)
References
Details
support non-ascii GLOB, MATCH, REGEX support
spun off from bug #391156, where sdwilsh added support for non-ascii UPPER, LOWER and LIKE.
Note, I think only non-ascii LIKE is actually used right now.
Comment 2•16 years ago
|
||
Perhaps dmandelin knows how we could tap into the JS regular expression engine (which supports unicode).
Comment 3•16 years ago
|
||
Without bug 348642 I don't think there are any good ways to hook into this in C++. But Dave's idea from bug 474274 of using a JS component should work, right?
Comment 4•16 years ago
|
||
Dave's idea would work, but it has a horrible side effect of having to cross xpconnect for every row processed. It's not going to be fast at all.
That would work for an add-on, but not for core code (or a built in feature as far as I'm concerned)
Depends on: 348642
Turns out there is a fairly simple solution, (thanks to Mirnal Kant)
In javascript:
//functions to be created for the db
var smDbFunctions = {
//for use as where col regexp string_for_re
// col goes as the second argument
regexp: {
onFunctionCall: function(val) {
var re = new RegExp(val.getString(0));
if (val.getString(1).match(re))
return 1;
else
return 0;
}
}
};
after instantiating a SQLite instance:
Database.createFunction("REGEXP", 2, smDbFunctions.regexp);
This does work, see Mirnal's SQLite Manager version 4.3 for proof of concept.
Comment 6•16 years ago
|
||
Yes it does work. And well should I say.
But this does not means REGEXP is really supported because user has to define the regexp function nd have it "attached" to the database connection.
This is unfortuntely no doable in all contexts where SQLite connection is possible. I'm thinking (and having issues there) about templates. I wish I could use the REGEXP operator in an SQLite template query tag but I can't since I do not have access to the connection object to do that "createFunction" thing.
Or have I ?
Comment 7•16 years ago
|
||
OK, it is possible to add REGEXP support to sqlite templates : you need to get the connection object : document.getElementById('my-tree').builder.datasource.QueryInterface(Components.interfaces.mozIStorageConnection)
It's a bit slow though.
Comment 8•6 years ago
|
||
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•