"Robert Simpson" <[EMAIL PROTECTED]> wrote: > > -----Original Message----- > > From: Igor Tandetnik [mailto:[EMAIL PROTECTED] > > Sent: Thursday, July 27, 2006 7:48 AM > > To: SQLite > > Subject: [sqlite] Re: User function in WHERE clause > > > > Stan <[EMAIL PROTECTED]> wrote: > > > is there a way to create user function similar to LIKE? > > > I'd like to use my function in clause WHERE. E.g. this selection: > > > SELECT * FROM Table WHERE Name MYFUNCTION param > > > Param is integer. > > > > Not like this, but you can create a function and use it this way: > > > > SELECT * FROM Table WHERE MYFUNCTION(Name, param) > > Actually with a userdef function, > > SELECT * FROM Table WHERE MYFUNCTION(Name, param) > > .... is identical to: > > SELECT * FROM Table WHERE param MYFUNCTION Name >
"param MYFUNCTION Name" is equivalent to "MYFUNCTION(Name, param)" onoly if MYFUNCTION is one of: LIKE GLOB REGEXP MATCH Only LIKE and GLOB are defined by default. MATCH is not in 3.3.6, but is in the source tree. Note that you can use sqlite3_create_function() to replace the build-in LIKE or GLOB function to do whatever it is you want. REGEXP is undefined, so you can define it to do whatever you need, though as you can probably guess, it is intended for regular expression matching. -- D. Richard Hipp <[EMAIL PROTECTED]>