[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Dado 1.0
- From: Petite Abeille <petite.abeille@...>
- Date: Fri, 2 May 2008 17:37:21 +0200
On May 2, 2008, at 2:15 PM, Tomas Guisasola Gorham wrote:
a future release of LuaSQL would have a modified `fetch' method
which closes the cursor when there is no more rows to retrieve.
This is also the approach taken by DB.lua: it automatically closes the
connection cursor after the last row has been fetched.
local aDB = DB( 'mysql://localhost/test' )
for aContact in aDB( 'select * from contact' ) do
print( aContact.name, aContact.email )
end
http://dev.alt.textdrive.com/browser/HTTP/DB.lua#L174
Alternatively, one can always close the cursor explicitly as well:
local aDB = DB( 'mysql://localhost/test' )
local aCursor = aDB( 'select * from contact' )
aCursor.close = true
--
PA.
http://alt.textdrive.com/nanoki/