User Defined Functions in SQLite

Hi everyone,

I wanted to solicit the community to see if anyone has used UDF in sqlite? I have a need to do this and i have tried a few times with errors. Here is a basic SQL function creation call that is giving me a DB error 1.

Here is my basic example that I am calling after my schema is setup:

Var createFreshFunctionStr As String = "CREATE FUNCTION MyUpdateFunction(x TEXT) RETURNS INTEGER AS " + _
"BEGIN " + _
"UPDATE collectorResultsTable SET isFresh = 'false'; " + _
"RETURN 1; " + _

Thank you in advance

SQLite does not have a stored function/stored procedure language

Thanks for that info @Jean-Yves_Pochez. I guess I have been looking at the application defined function in sqlite3 api instead which probably isn’t supported in Xojo’s implementation. Application-Defined SQL Functions

Thanks for the link.

Is this anything to do with stored procedures? My understanding is hazy, but I had the impression from conversations on the SQLite Users’ Forum that while these are considered necessary for client/server databases (due to round trip time), they are not for something like SQLite which is not.

yes these are more useful on a network database.
but imagine an sqlite database, accessed from different applications, made with different programming languages. it could be interesting to store some procedures inside the database ?
I have in my xojo framework methods to convert sqltie to postgres and back, to change from a local to a network database. the main way is of course from local to network. but sometimes I can’t go from network to local because of these stored procedures in the postgres database …

Well, you’re always at liberty to argue this use case on the SQLite Users’ Forum.

not worth it ! :wink: