lunarmodules / luasql

LuaSQL is a simple interface from Lua to a DBMS.
http://lunarmodules.github.io/luasql
539 stars 191 forks source link

Allow for multiple commands to be executed in one go on sqlite3 #56

Closed codemedian closed 3 months ago

codemedian commented 8 years ago

I got the use-case of loading a sql file that sets up tables and triggers and run it against an in-memory database. Essentially for unit testing.

In the current version it's not easily possible to load a sql file and execute it against a sqlite3 database as the call to sqlite3_prepare only prepares the first sql statement in the string.

My approach is to simply call exec with the remaining statements if there is stuff left in the string. It's not the most elegant way but works.