Re: [sqlite] Re: Re: Merging two tables
Thanks, i will go through it. regrads 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: Dennis Cote <[EMAIL PROTECTED]> Date: Tuesday, September 11, 2007 4:39 am Subject: Re: [sqlite] Re: Re: Merging two tables > RaghavendraK 70574 wrote: > > In sqlite3_create_function, xFunc func pointer signature does not > > allow to have a return value.Any other possible way achieving it > > apart from collation? > > > > > > > The result of your custom function is not returned directly by the > xFunc > function. your xFunc function must call one of the sqlite3_result_* > functions (see > http://www.sqlite.org/capi3ref.html#sqlite3_result_blob). > For a boolean result you would use sqlite3_result_integer and > return a > value of 1 for true or 0 for false. > > For more information see section 2.3 of > http://www.sqlite.org/capi3.html > and the func.c source file at > http://www.sqlite.org/cvstrac/fileview?f=sqlite/src/func.c=1.174 > which > uses these APIs to implement all the built in SQL functions. > > HTH > Dennis Cote > > > > - > To unsubscribe, send email to [EMAIL PROTECTED] > > - > > - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: Re: Merging two tables
RaghavendraK 70574 wrote: In sqlite3_create_function, xFunc func pointer signature does not allow to have a return value.Any other possible way achieving it apart from collation? The result of your custom function is not returned directly by the xFunc function. your xFunc function must call one of the sqlite3_result_* functions (see http://www.sqlite.org/capi3ref.html#sqlite3_result_blob). For a boolean result you would use sqlite3_result_integer and return a value of 1 for true or 0 for false. For more information see section 2.3 of http://www.sqlite.org/capi3.html and the func.c source file at http://www.sqlite.org/cvstrac/fileview?f=sqlite/src/func.c=1.174 which uses these APIs to implement all the built in SQL functions. HTH Dennis Cote - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: Re: Merging two tables
Hi, In sqlite3_create_function, xFunc func pointer signature does not allow to have a return value.Any other possible way achieving it apart from collation? 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 8:50 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] -
Re: [sqlite] Re: Re: Merging two tables
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] -
Re: [sqlite] Re: Re: Merging two tables
How can this be used to "Merge two tables"? Scott 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] - -- - Truth : the most deadly weapon ever discovered by humanity. Capable of destroying entire perceptual sets, cultures, and realities. Outlawed by all governments everywhere. Possession is normally punishable by death. Richard Childers - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Re: Re: Merging two tables
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] -