Opened 18 years ago
Last modified 9 years ago
#3273 new enhancement
Add REGEXP support to SQL queries
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | normal | Milestone: | next-major-releases |
Component: | report system | Version: | devel |
Severity: | minor | Keywords: | sqlite regexp patch |
Cc: | mmitar@… | Branch: | |
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
SQLite allows the use of a REGEXP search [1]. Such a feature would be useful in cases such as parsing multiple CCs, multiple asignees on a ticket [2], etc. All that has to be done is to create a user function on the connection [3].
I've attached a diff of what (I think) will enable this (I am using r3406 currently). The patch will add a user function in SQLite immediately after the connection is made. The user function is called regexp. (See trac_sqlite_regexp_r3406.patch)
References:
- http://www.sqlite.org/lang_expr.html: What is currently allowed in SQLite expressions
- #2662: Using REGEXP in SQLite to parse multi-user assignments
- http://initd.org/pub/software/pysqlite/doc/usage-guide.html#creating-user-defined-functions pysqlite documentation to add a user-defined function
Attachments (1)
Change History (10)
by , 18 years ago
Attachment: | trac_sqlite_regexp_r3406.patch added |
---|
comment:1 by , 18 years ago
Milestone: | 0.10 |
---|
comment:2 by , 18 years ago
Do not forget to catch some exceptions http://initd.org/tracker/pysqlite/wiki/SnippetsRegexp
comment:3 by , 18 years ago
Milestone: | → 0.12 |
---|
Since PostgreSQL and MySQL both have native support for regular expressions, we could indeed add this capability to the SQLite backend.
comment:4 by , 18 years ago
Although this would be useful for some specific back end parts, this would probably be most useful for adding to search, especially when searching changesets.
comment:5 by , 14 years ago
Owner: | removed |
---|
comment:6 by , 14 years ago
comment:7 by , 14 years ago
Cc: | added |
---|
comment:8 by , 14 years ago
I have ported the patch to the latest trunk available at github.com.
You can find it under https://github.com/axnsoftware/trac-bugs-n-features/tree/trac-issue-3273
Feel free to further test it. I originally tested it with sqlite. It would be nice, if you could test this with postgresql and mysql, if you happen to use use a db backend.
comment:9 by , 9 years ago
Keywords: | patch added |
---|
Adding regexp to the SQLite connection