On Thu, Dec 16, 2010 at 9:19 AM, Igor Tandetnik <itandet...@mvps.org> wrote:

> Frank Chang <frankchan...@gmail.com> wrote:
> >   Good morning, If we use the latest version of sqlite, is it possible to
> > update the same sqlite table using two different Centos/RedHat Linux
> pthread
> > threads?
>
> Yes, but not at the same time.
>
> > We are using the same database connection on both pthreads but we
> > always update different rows on each of the two threads. We have run
> > some tests using the following code and occasionally  sqlite3_prepare and
> > sqlite2_step returns error code 21. Here is the thread function which
> each
> > thread runs. Below it, we show the main thread which creates and manages
> the
> > worker threads. Thank you.
> >
> >
> ReturnValue=sqlite3_prepare(td->This->Database,"BEGIN",-1,&(td->This->Statement),0);
> >   status =  sqlite3_step(td->This->Statement);
>
> You get SQLITE_MISUSE (error 21) when you run BEGIN statement on a
> connection that already has an explicit transaction open. SQLite doesn't
> support nested transactions.
>

SQLite does support tested transactions.  See
http://www.sqlite.org/lang_savepoint.html for details.  But I think the OP
is really asking for parallel transactions, and SQLite does not support
that.   SQLite only allows a single writer at a time.  Nested transactions
allows the same writer to layer its transaction, but there is still only a
single writer.



> --
> Igor Tandetnik
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to