Sqlite3?
-
Hi,
Is there any plans to add Sqlite support anytime soon? That would be wonderful to have all the popular DB supported from one source. Thanks.
-
There are quite a few sqlite bindings already here.
Maybe I will "package" one of them for luapower in the future (which basically means building sqlite for all platforms and throwing the binaries and the build scripts in a git repo). Not sure which though, I'll have to check which one is more complete. Both William's and Stefano's ones look pretty good.
-
You're welcome to give it a shot too. Making bindings for LuaJIT is very easy and making luapower packages is trivial as well.
-
I've been looking at compiling the binaries. I've got the files from the sqlite site, so I have a folder with:
- sqlite3.c
- sqlite3.h
- sqlite3ext.h
- shell.c
I run
gcc
(Linux64) on it:gcc -c -O2 -fPIC sqlite3.c
This generates a nice shiny
sqlite3.o
file.Next, I run it through some more
gcc
:gcc -shared -s -static-libgcc -L. -I. -o libsqlite3.so sqlite3.o
And then an
ar
(after making sure to create the 'static' directory):ar rcs /opt/app/bin/linux64/static/libsqlite3.a *.o
I then have a
libsqlite3.a
file in the 'static' folder. Does this mean that I now have a sqlite3 binary (at least for Linux64) ready to for mybuild.sh
scripts?Thanks in advance.
Cheers.
-
Yes, too easy? :)
No need for the static folder though -- put all .dll/.so/.dylib and .a files in
bin/<platform>
directly. Oh, and on Windows only name the binary sqlite.dll/.a instead of libsqlite so thatffi.load'sqlite'
works on all platforms.
-
Of course the proof is in the pudding -- add in the ffi binding and run some tests to see if it all works (some C libs use #defines to enable parts of the library or to configure stuff. If this is the case then you have to poke around the makefile and/or grep the C sources for #ifdefs).
Also, if you type
./mgit
you will see a section called LUAPOWER EXTENSIONS. These can help you with making binaries. You can use them to list the symbol table of the binary, to check for symbol versions to ensure that your binary is backward compatible enough, and the precompile command can generate cleaned-up cdefs for you.
-
Excellent. Thank you for the reply.
Cheers.