lua-users home
lua-l archive

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


On Wed, Jan 29, 2014 at 11:41 AM, Gilles Ganault <gilles.ganault@free.fr> wrote:
Hello

I noticed that the "db:exec" part of the following script waits for
about 5s when running on a Linux appliance:
=================
HTTP/1.0 200 OK
Content-Type: text/plain

<?
local db = sqlite3.open('test.db')

-- stalls for about 5s
db:exec[[
  CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY, content);
  INSERT INTO test VALUES (NULL, 'Hello World');
  INSERT INTO test VALUES (NULL, 'Hello Lua');
  INSERT INTO test VALUES (NULL, 'Hello Sqlite3')
]]

for row in db:nrows("SELECT * FROM test") do
  mg.write(row.id, row.content,'\n')
end

mg.write("Done")

db:close()
?>
=================

Why is that, and is there something I could try to speed things up?

Thank you.



How do you know it's that particular line that stalls? What if you break it into four separate queries? Is it exactly 5 seconds?

--
Sent from my Game Boy.