Erlang wrapper for SQLite3
This library allows you to work with SQLite3 databases from Erlang.
It is compatible with Windows and Linux, and should probably work on other OSes as well.
Requirements
Erlang/OTP R14B is required, and SQLite 3 minimum version is 3.6.1.
Compiling
Linux
-
Install SQLite3 by running
sudo apt-get install sqlite3or the equivalent for your package manager, or by compiling from the source. -
make.
Cross-compiling
If you want to use erlang-sqlite3 on an embedded device, it can be cross-compiled.
-
Change variables and paths in
rebar.cross_compile.config.sampleto the desired values and rename it torebar.cross_compile.config. -
make cross_compile.
Windows with MS Visual C++
-
Download both the source amalgamation and the precompiled binary from http://www.sqlite.org/download.html. Extract files
sqlite3.hfrom the amalgamation andsqlite3.deffrom the binary. Run this command from Visual Studio command prompt:lib /def:sqlite3.defto create the import library
sqlite3.lib. Inrebar.config, set the correct paths in tuples{"win32", "CFLAGS", "/Idirectory/containing/sqlite3.h/ /Ic_src /W4 /wd4100 /wd4204"}and{"win32", "LDFLAGS", "/path/to/sqlite3.lib"}. -
nmake.
Potential compilation problems
-
On Windows,
sqlite3.dllusually won't be installed in the system-wide DLL search path. In this case, it should be placed in the working directory of your application. -
If SQLite was built with
SQLITE_OMIT_LOAD_EXTENSIONoption, you'll need to undefineERLANG_SQLITE3_LOAD_EXTENSIONmacro in <c_src/sqlite3_drv.h>.
Running the test suite
Linux
make test
Windows
-
nmake tests -
If you get the error
"Error loading sqlite3_drv: The specified module could not be found", this is becausesqlite3.dllisn't in the search path. Copy it to the.eunitdirectory.
Example usage
See tests test/sqlite3_test.erl for a starting point.
Authors
See ./AUTHORS