phamtanlong / csharp-sqlite

Automatically exported from code.google.com/p/csharp-sqlite
Other
0 stars 0 forks source link

Implement application-defined SQL functions #106

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Currently, System.Data.SQLite allows defining custom functions which allows the 
REGEXP() operator to be used: see http://www.sqlite.org/lang_expr.html#regexp

Currently, there is no support for custom functions so I plan to modify 
func_c.cs for now: once that support is added, it can be moved somewhere else.

I will be posting a series of patches on this issue.

Original issue reported on code.google.com by contact....@gmail.com on 23 Mar 2011 at 9:45

GoogleCodeExporter commented 8 years ago
This patch corrects the implementation of sqlite3_{get|set}_auxdata to use an 
object (which will actually store the compiled Regex instance). This is then 
used during the execution of REGEXP() to perform the matching.

Original comment by contact....@gmail.com on 23 Mar 2011 at 9:49

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for the patch.  I've wanted to add the application-defined SQL 
functions for a while.  Can you also supply a test routine that can be compiled 
into a function (regex or not) so we can test the entire functionality

Original comment by noah.hart@gmail.com on 23 Mar 2011 at 9:59

GoogleCodeExporter commented 8 years ago
I won't be able to work on this till next week (deadline at office). I think 
initially we should implement the sqlite3_create_function APIs, and later on 
think about using the approach used by System.Data.SQLite (it reflected through 
all assemblies and tried to find a class derived from SQLiteFunction) -- using 
reflection in a library doesn't feel correct to me (what happens if the 
assembly is not loaded when the library is loaded?).

Original comment by contact....@gmail.com on 23 Mar 2011 at 10:43

GoogleCodeExporter commented 8 years ago
I agree that implementing the sqlite3_create_function API makes sense.  Also I 
thought about your original issue, and decided that there is no reason why C# 
regex should not be builtin rather than attached, since C#SQLite can only be 
used with C#.  

(See issue # 107)

Original comment by noah.hart@gmail.com on 23 Mar 2011 at 3:52

GoogleCodeExporter commented 8 years ago
This issue was closed by revision fc924358fcef.

Original comment by noah.hart@gmail.com on 23 Mar 2011 at 4:47