9

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.

1 Answer 1

6

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I am glad it wouldn't be difficult. Actually meanwhile I wrote a C code that uses sqlite3_exec and in the callback I embedded some ECL (lisp implementation) C functions like ecl_cons(ecl_cstring_to_base_string_or_nil(p_fields[i]),... and call that in ECL using ffi:c-inline and ffi:clines. Then of course I could use the sqlite3_create_function in the C file on the C coded user-defined function. But in the updated cl-sqlite I believe it will be easier because the user will define the user-defined function in CL without getting too involved with the C code (maybe only through the CFFI).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.