I am developing an application in android and I need to create an udf in sqlite. Is it possible to create it in sqlite? And if yes how to do this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
SQLite does not have support for user-defined functions in the way that Oracle or MS SQL Server does. For SQLite, you must create a callback function in C/C++ and hook the function up using the sqlite3_create_function call.
Unfortunately, the SQLite API for Android does not allow for the
sqlite3_create_functioncall directly through Java. In order to get it to work you will need to compile the SQLite C library with the NDK.And if you are still interested read 2.3 User-defined functions…
Here’s how to create a function that finds the first byte of a string.
Then attach the function to the database.
Finally, use the function in a sql statement.