Opps, I meant to add sample code to the last post.
ie.
sql = 'SELECT rowid,* FROM test WHERE col1 = ?';
rs = db.execute(sql,['a']);
while(rs.isValidRow())[
sql = 'UPDATE test SET col2 = ? WHERE rowid = ?';
db.execute(sql,['1',rs.fielByName('rowid')]);
rs.next();
}
rs.close();
In a statement like this, in general I shouldn't have a problem except
when I have 2 threads trying to do the same thing, which is when I
should push all db access code into a single thread. Right? I'm used
to programming in PHP where I can pretty much get away with murder.
It's been a long time since I've had to be careful about threading.
I'm probably going to get flamed for this one, however, I wonder if
the db commands couldn't be make thread safe so that programmers
wouldn't have to repeat this code pattern.
BTW, thanks for the feedback.
On Aug 4, 10:58 am, jungleforce <[email protected]> wrote:
> 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.
>