[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Error with Lsqlite3
- From: "Luciano de Souza" <luchyanus@...>
- Date: Thu, 3 Jun 2010 03:24:21 -0300
I got the result with this code:
db = sqlite3.open('ting.dbl')
for record in db:nrows('select id from contacts order by id desc limit 1')
id = record.id
It works, but it's unsuitable to iterate over a single row result. Actually,
I can't understand functions returning functions. I came from Pascal world
and this feature were not available.
Sometimes, I think: what is it really occuring behind the expression for
record in db:nrows('select id from contacts order by id desc limit 1')?
When we do:
for k, v pairs(t) do
we can undestand that in each iteration, it occurs something like: t.k = v.
But which are the arguments of the iterating functions? Knwoing this,
probabily we will able to call it one single time.
Ah! But it's a curiosity. My problem you have alredy solved. Thank you.
----- Original Message -----
From: "Doug Currie" <email@example.com>
To: "Lua list" <firstname.lastname@example.org>
Sent: Wednesday, June 02, 2010 9:08 PM
Subject: Re: Error with Lsqlite3
On Jun 2, 2010, at 7:47 PM, Luciano de Souza wrote:
db = sqlite3.open('test.dbl')
The last rowid is undoubtedly 6, but I receive 0 as an answer.
This routine returns the rowid of the most recent successful INSERT into
the database from the database connection in the first argument. If no
successful INSERTs have ever occurred on that database connection, zero is
Since db (the database connection) was just opened, 0 is the expected
Perhaps you should try executing the query: select max(id) from contacts;