I had the same problem. I wrote a daemon to email people who
signed up for a service and never logged in. (offering help).
In pseudo code I did this:
select * from people where user never logged in;
for each row in result set
{
email offer to help;
update column in result row so I won't process it again.
}
I used the basic C api. I could never get it to work and
had to rewrite it to copy the result set to
an STL vector and iterate through the vector.
On 5/12/05, Thomas Briggs <[EMAIL PROTECTED]> wrote:
>
> This question seems to come up often, and I'm still confused as to
> what problems people are having. What APIs are you using to perform
> these steps? In particular, when you want to update a row, are you
> using a prepared query that is executed multiple times, or are you
> creating an SQL statement and executing that with sqlite3_exec? Are you
> using 2.8 or 3.x? Maybe the confusion on my part is due to different
> database versions.
>
> I'm confused as to why executing a query would lock the database.
> The only thing I can think of is that the query required a temp table,
> and the creation of that temp table led to the database being locked.
> The entire many readers/single writer concept makes no sense if
> executing any query locks the whole database.
>
> -Tom
>
> > -----Original Message-----
> > From: Thomas Fjellstrom [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, May 12, 2005 7:10 AM
> > To: [email protected]
> > Subject: Re: [sqlite] database table is locked
> >
> > On May 12, 2005 04:59 am, Martin Engelschalk wrote:
> > > Hello,
> > >
> > > i open cursor on a table and retrieve rows from it.
> > > For every row i decide whether to update it. However, when
> > executing
> > > the update I get the error "database table is locked".
> > > My application is the only one working on the table.
> > > Is it illegal to update a table while selecting from it or
> > am i doing
> > > somethin wrong?
> > >
> > > Thanks,
> > > Martin
> >
> > Yup. you'll have to scan for updates to make, then after the
> > scan, make the
> > updates.
> >
> > --
> > Thomas Fjellstrom
> > [EMAIL PROTECTED]
> >
>
--
---
You a Gamer? If you're near Kansas City:
Conquest 36
https://events.reddawn.net
The Castles of Dereth Calendar: a tour of the art and architecture of
Asheron's Call
http://www.lulu.com/content/77264