Hi,

I'm a regular user of SQLite, but a first timer in this list. A few months
ago, while doing some intensive but manual data processing, I created
(hacked) a loadable module that allowed me to run short Lua scripts
directly inside the SQL queries. That eased a lot of the work that day.

I'm making it public today, at: https://github.com/abiliojr/sqlite-lua
(under BSD license)

Yet, I have 3 questions:

1. sqlite3 CLI doesn't seem to "load" the .so easily... The generated so is
called "lua.ext". If I run "*.load lua.ext*" it claims that there is no .so
available. I went into renaming the file to lua.so, and ran *.load lua.so*
... Got: *Error: Shared object "lua.so.so <http://lua.so.so>" not found,
required by "sqlite3"* ... then tried with *.load lua* ... I guessed that
would work... but got *Error: Shared object "lua.so" not found, required by
"sqlite3*", even when the file was present at that directory... But then I
ran *.load ./lua.so* , and even *.load ./lua* ... both loaded without
problems... Is that the correct behavior?

2. Which is the convention for the file extension of a loadable module? .so
and .dll?, or is there any other name used regularly among sqlite3 users?

3. Lua can return arrays. Also, Lua can return multiple values. Tried to
take advantage of those facts, but while reading the SQLite API
documentation, found no function where I could map multiple values as the
return of a function. Am I wrong? For example:

select * from table t where fieldA in (lua('return 1,2,3'));

Could be a useful feat in real scripts with real code.


Anyways, I hope some of you can find the spirit of this plugin useful for
some applications, and of course, any ideas, suggestions, bug reports and
improvements are welcomed!

Reply via email to