SQLite Forum

User Defined Functions
Login
> When should I use sqlite3_create_function as opposed to building an SQLite extension and loading it? 

The sqlite3_create_function is how you "hook up" a function so it can be executed by the SQLite3 engine.  An "SQLite3 extension" is merely a wrapping paper packaging for functions which are added to SQLite3 via sqlite3_create_function.

That is, if you want to make toast, you need to make a toaster (write the function).  Then you need to hook it up (plug it into the electrical outlet -- as in call sqlite3_create_function to "hook up" the toaster").

The "packaging" the toaster arrives in makes no difference.  It does not matter whether you build it from scratch yourself, or order it in an Amazon box from Amazon (a loadable extension).  In both cases you have to take it out of the box (if any) and plug it in (call sqlite3_create_function) before you can make toast.