lua-users home
lua-l archive

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


On Tue, May 31, 2016 at 5:34 PM, Andrew Starks <andrew@starksfam.org> wrote:

Dealing with system resources is special and I find myself thinking a lot about architecture and isolation and design when I'm dealing with them.

I wish the users of my system, which embeds Lua, were the likes of you.

My users, however, are more likely to write this sort of code:

local driver = require "luasql.postgres" env = assert (driver.postgres()) con = assert (env:connect("luasql-test")) list = { { name="Jose das Couves", email="jose@couves.com", }, { name="Manoel Joaquim", email="manoel.joaquim@cafundo.com", }, { name="Maria das Dores", email="maria@dores.com", }, } for i, p in pairs (list) do res = assert (con:execute(string.format([[ INSERT INTO people VALUES ('%s', '%s')]], p.name, p.email) )) end con:close() env:close()

And who can blame them for writing this code, if this is taken form an EXAMPLE given by the LuaSQL authors? It is rather curious that the authors of the example want it to raise errors, but not to handle them.

Cheers,
V.