Hi Simon Slavin,
Thank you for the reply. Yes I am using single thread and single connection. 
Can you tell me what happen if i try with multiple thread and single connection 
to write the data (Multiple thread trying to write into DB will it follow the 
serialization because of the FULLMUTEX and do the write operation one by one).

Thank You

> On December 17, 2018 at 3:16 PM Simon Slavin <slav...@bigfraud.org> wrote:
> 
> 
> On 17 Dec 2018, at 9:01am, Prajeesh Prakash <prajeeshprakash@elear.solutions> 
> wrote:
> 
> > What are the possible failure cases of DB write in case of single 
> > connection. Because in my application i needs to handle those cases. Can 
> > anyone help me for the same.
> 
> You state that you're using a single connection.  I will assume your software 
> accesses the database only via a single thread, and therefore there can be no 
> contention for using that connection.  I will also assume no other program is 
> accessing the database at the same time as the software you're concerned 
> about.  If those things are not true, post again explaining the exceptions.
> 
> For failure cases which can be detected by your software ...
> 
> Record the value returned from your _step() or _exec() call.  Check to see 
> whether this value is SQLITE_OK ( which is 0 ).  If it is, the command 
> succeeded.  If it isn't, it failed, and your program should report the 
> failure and react to it.
> 
> It's that simple: check to see that the result is 0, and everything else is a 
> failure.  You can unpick this slightly, and detect database rule violations 
> (e.g. SQLITE_CONSTRAINT == 19 , indicating that you've broken database rules 
> you included in the schema) but since your software is meant to be preventing 
> all that, it really doesn't matter what the value is, just report or log it 
> and quit.
> 
> For a list of result codes see
> 
> <https://sqlite.org/c3ref/c_abort.html>
> 
> If the command failed, it never the right thing to do to just have your 
> software try again.
> 
> For failure cases which cannot be detected by your software, read
> 
> <https://www.sqlite.org/howtocorrupt.html>
> 
> Simon.
> 
> 
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to