lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks a bunch, that worked. :) Where can I find that documentation?
The page I downloaded my dll from only has
http://lua.sqlite.org/index.cgi/doc/tip/doc/lsqlite3.wiki, which
apparently documents a different library/interface.

2013/3/27 Peter Drahoš <drahosp@gmail.com>:
> On Wed, Mar 27, 2013 at 1:30 AM, Christian Bielert <cib123@googlemail.com>
> wrote:
>>
>> I would like to use sqlite3 with lua. Luckily, there exist a wrapper
>> library. As neither luadist nor luarocks seem to work out of the box
>> with msys(or if they do, both their luasql packages are broken), I've
>> downloaded the windows binary release from
>> http://lua.sqlite.org/index.cgi/index. I unpacked luasql/sqlite3.dll
>> into the directory with my lua files and called the lua interpreter to
>> try out the functionality outlined in the documentation(e.g.
>> "sqlite3.open(filename)")
>>
>> > require "stdlib"
>> > require "luasql.sqlite3"
>> > pprint(luasql)
>> {sqlite3 = 'function: 0062B810', _VERSION = 'LuaSQL 2.1.0', _DESCRIPTION =
>> 'LuaS
>> QL is a simple interface from Lua to a DBMS', _COPYRIGHT = 'Copyright (C)
>> 2003-2
>> 007 Kepler Project}
>>
>> Okay, so the only thing I can do at all is call luasql.sqlite3()?
>> Let's try that.
>>
>> > result = luasql.sqlite3()
>> > =result
>> SQLite3 environment (0062D290)
>> > =type(result)
>> userdata
>> > result.open("foo")
>
> The function to call is result:connect(). See LuaSQL documentation[1]. The
> module is included in the batteries package and works out of the box in
> LuaDist.
>
> local sql = require "luasql.sqlite3"
> local driver = sql.sqlite3()
> local db = sql:connect("test")
>
> pd
>
> [1] http://www.keplerproject.org/luasql/manual.html#drivers