On Wed, 05 May 2010 13:32:24 +0200, Gilles Ganault <gilles.gana...@free.fr> wrote: >I'd like to know how to use this from a Lua script.
For Lua newbies like me who'd like to access an SQLite database through the LuaSql interface, here's how to do it: 1. In the directory where the Lua interpreter is located, create a sub-directory \luasql 2. In this sub-directory, from http://luaforge.net/frs/?group_id=12, download and unzip luasql-2.1.1-sqlite3-win32-lua51.zip, which contains sqlite3.dll (a Lua-specific sqlite3.dll, not the one from www.sqlite.org) 3. In the main directory, create a source file eg. test.lua: ---------- require "luasql.sqlite3" env = luasql.sqlite3() conn = env:connect("test.sqlite") assert(conn:execute("create table if not exists tbl1(one varchar(10), two smallint)")) assert(conn:execute("insert into tbl1 values('hello!',10)")) assert(conn:execute("insert into tbl1 values('goodbye',20)")) cursor = assert(conn:execute("select * from tbl1")) row = {} while cursor:fetch(row) do print(table.concat(row, '|')) end cursor:close() conn:close() env:close() ---------- 4. Launch this script: lua5.1.exe test.lua HTH, _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users