Within one thread if I do a SELECT call and than UPDATE or DELETE
records from the same table as the SELECT call that I'm iterating
through, I shouldn't have a problem right?  It's only when another
thread also tries to make a request while another thread is iterating
through the database and making changes that I would run into trouble,
right?  It's usually on an UPDATE statement that I run into lock
problems.

ie.


On Aug 4, 10:29 am, jungleforce <[email protected]> wrote:
> Closing all the db handlers was one of the first things that I did.
>
> Your second suggestion is interesting.  I will give that a try.  Right
> now I have db calls in the main thread as well as multiple worker
> threads and I believe this is where I'm running into issues.
>
> I guess that would mean I would have to push all my result set
> iterations into that single thread as well.  I guess I'm still to
> sequential in my thinking it should be more object oriented.
>
> On Aug 4, 4:47 am, Eduard Martini <[email protected]> wrote:
>
> > 1. Close ALL db handlers before opening a new one (rs = db.execute
> > (....); do_things; rs.close();)
>
> > 2. First one will solve 90% of your locking problems. To get rid of
> > all, you need to make a worker and move ALL db interactions there.
> > Whenever you need something from DB you will send a message to that
> > worker.
>
> > On Jul 31, 9:59 pm, jungleforce <[email protected]> wrote:
>
> > > I hope this is the right place to ask developer questions.
>
> > > I've built up a fairly substantial application using gears, but I'm
> > > running into database locking issues and am wondering if anyone has
> > > come up with strategies to resolve these locks.
>
> > > I have both a main thread and a worker thread that needs to access the
> > > database, and it seems either the threads are trying to access the
> > > database at the same time or I haven't released the access to the
> > > database correctly.
>
> > > I guess one solution would be to write a function to handle all db
> > > requests so that it uses a Try/Catch loop until successful.
>
> > > What do you think?

Reply via email to