Look in the Sqlite source for examples. Your function gets the arguments you specify in the SQL and then your program does whatever you like with them and returns a result. It could for example perform a regular expression compare etc.

You register the function with Sqlite when you open a connection.

You can compile extra functions into Sqlite if you choose so that you do not have to load custom functions when you open a DB connection.

RaghavendraK 70574 wrote:
Thats great.
If possible Can u please provide a sample,

Will this function receive the database column values or indexes?

regards
ragha

******************************************************************************************
 This email and its attachments contain confidential information from HUAWEI, 
which is intended only for the person or entity whose address is listed above. 
Any use of the information contained herein in any way (including, but not 
limited to, total or partial disclosure, reproduction, or dissemination) by 
persons other than the intended recipient(s) is prohibited. If you receive this 
e-mail in error, please notify the sender by phone or email immediately and 
delete it!
 
*****************************************************************************************

----- Original Message -----
From: Igor Tandetnik <[EMAIL PROTECTED]>
Date: Wednesday, September 5, 2007 6:20 pm
Subject: [sqlite] Re: Re: Merging two tables


RaghavendraK 70574
<[EMAIL PROTECTED]> wrote:

How to plug custom search algorthim within Sqlite?
For example,

select * from table where a = 'xxx';

Instead of using normal inbuilt search can it be userDefined
function?

Yes. You can use sqlite3_create_function to create a function taking two parameters and returning a boolean (actually, an integer with the values 0 or 1). Then you can say

select * from table where MyComparison(a, 'xxx');

Igor Tandetnik

--------------------------------------------------------------------
---------
To unsubscribe, send email to [EMAIL PROTECTED]
--------------------------------------------------------------------
---------




-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------



-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to