I have a query of the following form using SQLite's built in GLOB function:

SELECT * FROM foo WHERE bar GLOB '*'

I implemented a custom glob(x,y) function to replace the built-in GLOB,
registering it with:

sqlite3_create_function(db, "glob", 2, SQLITE_ANY, NULL, my_glob, NULL,
NULL);

This all worked fine.   My custom function was called for the above query
and
worked as I expected.

I then decided it would be best to not universally replace the built-in
GLOB,
but only use my custom function on the queries that needed it.

I changed my registration to:
sqlite3_create_function(db, "my_glob", 2, SQLITE_ANY, NULL, my_glob, NULL,
NULL);

and then tried modifying my query to use the following forms:

 SELECT * FROM foo WHERE bar MY_GLOB '*'
 SELECT * FROM foo WHERE MY_GLOB(bar, '*')
 SELECT * FROM foo WHERE bar my_glob '*'
 SELECT * FROM foo WHERE my_glob(bar, '*')

They all gave SQL errors when I tried to pass them to prepare...
what am I doing wrong?  I feel like I'm missing something simple.

Thanks.
-Shane

Reply via email to