How can I open an external sqlite3 db file?

Post Reply
zhenzh
Posts: 49
Joined: Fri Apr 17, 2020 2:23 am

How can I open an external sqlite3 db file?

Post 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?

User avatar
Vadi
Posts: 4844
Joined: Sat Mar 14, 2009 3:13 pm

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

Post 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

zhenzh
Posts: 49
Joined: Fri Apr 17, 2020 2:23 am

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

Post 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?

User avatar
Vadi
Posts: 4844
Joined: Sat Mar 14, 2009 3:13 pm

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

Post 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() :)

Post Reply