Page 1 of 1

How can I open an external sqlite3 db file?

Posted: Wed Apr 22, 2020 7:37 pm
by zhenzh
I find there's a sqlite3 module installed by mudlet when resetProfile()
[ OK ] - Lua module sqlite3 loaded.
But when I try to open an external db file by sqlite3.open(), it reports no such function.
Is the lua sqlite3 module embeded in mudlet? How to open the db files?

Re: How can I open an external sqlite3 db file?

Posted: Wed Apr 22, 2020 8:19 pm
by Vadi
Either by using the database functions which are an easier wrapper: https://wiki.mudlet.org/w/Manual:Database_Functions (see tutorial https://wiki.mudlet.org/w/Manual:Script ... e_frontend) or using luasql directly: https://keplerproject.github.io/luasql/manual.html

Re: How can I open an external sqlite3 db file?

Posted: Thu Apr 23, 2020 2:24 am
by zhenzh
the database functions provided by mudlet has only create/close, no open or conn. How to work for external file?
Besides, how to save the db created by db:create? Where is the db file?

Re: How can I open an external sqlite3 db file?

Posted: Thu Apr 23, 2020 4:58 am
by Vadi
> the database functions provided by mudlet has only create/close, no open or conn. How to work for external file?

It works with it's own that it creates.

> Besides, how to save the db created by db:create?

That's saved automatically for you.

> Where is the db file?

In getMudletHomeDir() :)