wrap your rs calls with a try/finally block to make sure they get
closed:

var rs = null;
try
{
  rs.open('select blah blah balh');
}
finally
{
 if (rs) { rs.close(); }
}

Also notice that you're not closing the recordset you create on line
19.

Also, be aware if you're accessing the database from multiple worker
threads (including the main UI thread), they will block each other.
I'd recommend that you have one and only one worker that touches the
database and send the data to/from it via messages.



rob

On Mar 16, 9:10 am, Sanne <[email protected]> wrote:
> Hello,
>
> I searched the group but coundn't find the answer.
> I get the error message "database is locked", but I closed every
> resultset.
> Futhermore the problem is a new one, the script run at least three
> weeks without any problems and suddenly there is this mistake.
> I tried to delete the whole database and reinstalled Gears, but this
> didn't help.
>
> the Code is following:
>
> http://pastebin.com/m7804914b
>
> The db.execute that returns the excaption is: var rs = db.execute
> ('INSERT INTO user (userId, password, lastSync) VALUES ('+ data
> +');');
>
> I hope somebody can help me with this.
>
> Hopefully, Sanne

Reply via email to