> -----Original Message-----
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Jens Miltner
> Sent: Wednesday, March 31, 2010 8:17 PM
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Fwd: Sqlite3 crashing on multithreaded program
> 
> 
> Am 31.03.2010 um 15:14 schrieb Dan Kennedy:
> 
> >
> >
> > Begin forwarded message:
> >
> >> From: "Periasamy, Karthikeyan" <karthikeyan.perias...@adc.com>
> >> Date: March 31, 2010 7:52:55 PM GMT+07:00
> >> To: "danielk1...@gmail.com" <danielk1...@gmail.com>
> >> Subject: Re: [sqlite] Sqlite3 crashing on multithreaded program
> >>
> >> Hi,
> >>
> >> Thanks for your reply.
> >>
> >> In our application the block of code which access the DB looks like
> >> this,
> >>
> >> QueryDB(char *queryStr)
> >> {
> >>   result = dbi_conn_query(DbConnection, queryStr);
> >>   if (result)
> >>   {
> >>    if(ZERO_RESULT == dbi_result_get_numrows(result))
> >>    {
> >>      syslog( LOG_DEBUG,"[%s:%s] Empty Result. Freeing result pointer
> >> \n", __FILE__, __FUNCTION__);
> >>      dbi_result_free(result);
> >>      result = NULL;
> >>    }
> >>   }
> >>  return result;
> >> }
> >>
> >> In threads,
> >>
> >> dbi_result result = QueryDB(queryStr);
> >> if (NULL != result)
> >> {
> >>  while (dbi_result_next_row(result))
> >>  {
> >>    varibale = dbi_result_get_<type> (...);
> >>    ... /* Do some processing */
> >>  }
> >>  dbi_result_free(result);
> >> }
> >>
> >> We do not know what we are doing wrong. Do we have to take care of
> >> locking across threads in our application?
> 
> 
> Did you read <http://www.sqlite.org/threadsafe.html>?
> How did you build your SQLite libraries?
> Is DbConnection a shared object?
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
[Karthik] 
SQLite library is compiled with -DSQLITE_THREADSAFE=1.
Yes, DbConnection is a shared object. My bad.

Thank a lot for your help.

Regards,
Karthik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to