On Thu, May 17, 2012 at 08:58:39PM +0530, Rajesh Kumar scratched on the wall: > Hi Richard, > > Thanks for the reply. fsync() is related to system call, which is > working fine.
I believe you're missing Richard's point. I'm sure fsync() is returning a success error code. That doesn't mean it is working correctly. fsync() is a hardware call that dives deep, deep into the OS, hardware, and even storage sub-system of your device. All of those items need to function correctly for the return code of fsync() to actually mean anything. As the URL provided points out, many commercial hard drives and storage systems, designed for desktops and server systems, get this wrong-- or flat out lie about it. If the hardware lies about what's going on, there is nothing the OS-- or SQLite-- can do about it. Nor is there anything an additional API call is going to fix. I wouldn't be all that shocked to find out an embedded system has an fsync() call that looks like this: int fsync( int fd ) { return 0; } > But I am looking for a C API that can do the commit thing, > which is same as commit on command promt. There isn't one. But even if there was, it wouldn't work any differently, or any better. It wouldn't fix the corruption issues you're seeing. -j > On Thu, May 17, 2012 at 8:52 PM, Richard Hipp <d...@sqlite.org> wrote: > > > On Thu, May 17, 2012 at 11:18 AM, Rajesh Kumar <thisiz...@gmail.com> > > wrote: > > > > > Hi all, > > > > > > Am using sqlite database on my ARM processor based Embedded system . > > > Whenever power failures or due to uneven shutdown of device, my database > > > is being corrupted which leading to data lost. > > > > > > That should never happen. It suggests that fsync() is not working on your > > OS. Further information: http://www.sqlite.org/atomiccommit.html and > > http://www.sqlite.org/howtocorrupt.html > > > > > > > > > Am using C API interface for > > > accessing database. Is there any C API that I can use to commit my DB > > > manually. I know sqlite has own auto commit mechanism but it's not > > working > > > for me. > > > > > > Thanks in advance. > > > > > > -- > > > * > > > Thanks & Regards, > > > Rajesh Kumar P > > > * > > > _______________________________________________ > > > 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 > > > > > > -- > * > Thanks & Regards, > Rajesh Kumar P > * > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users -- Jay A. Kreibich < J A Y @ K R E I B I.C H > "Intelligence is like underwear: it is important that you have it, but showing it to the wrong people has the tendency to make them feel uncomfortable." -- Angela Johnson _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users