Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQLITE user-defined functions in Lisp

In SQLITE there is a possibility to relatively easily create User-Defined Functions and Aggregates in (extension) languages such as C, Perl, Python and others. Is there also such possibility using common-lisp as SQLITE language extension? I know there are libraries like cl-sqlite and plain-odbc but they don't seem to offer this possibility.

like image 913
francogrex Avatar asked Jul 17 '10 17:07

francogrex


People also ask

Does SQLite support user defined functions?

SQLite does not directly support user-defined functions. Sure, one can write a function in C or Python and register it within SQLite. But not in SQL itself.

Can you create functions in SQLite?

Executive Summary. Applications that use SQLite can define custom SQL functions that call back into application code to compute their results. The custom SQL function implementations can be embedded in the application code itself, or can be loadable extensions.


1 Answers

When I wrote cl-sqlite, I hadn't thought about user-defined functions.

But it's actually pretty easy. It just takes to define callbacks, foreign functions and wrap them in lispy interface. I guess I'll add this feature to cl-sqlite soon.

like image 197
dmitry_vk Avatar answered Sep 26 '22 08:09

dmitry_vk