hii thank you for suggestion. but when reading the value from sqlite header it printing same value no change i can see i pasting the c++ code below
/****************************************************CODE****************************************************/ #include <stdio.h> #include <iostream> using namespace std; int main () { FILE * pFile; int c; int n = 0; char fcc[35] = {0}; int i = 0; int j =0; while(j < 4) { int n = 0; sleep(10); // sleep is used so that i can make any change in database so that value of counter will change pFile=fopen ("demo.sqlite","r"); //demo.sqlite is my sqlite file if (pFile==NULL) { perror ("Error opening file"); exit(-1); } else { do { c = fgetc (pFile); n++; if(n >23 && n < 28) { printf("%x",c); // printing the value of header whic in hex format i++; } }while (c != EOF); fclose (pFile); cout<<endl; } j++; } On Mon, Sep 12, 2011 at 6:45 PM, Simon Slavin <slav...@bigfraud.org> wrote: > > On 12 Sep 2011, at 1:35pm, Richard Hipp wrote: > > > On Mon, Sep 12, 2011 at 8:02 AM, Igor Tandetnik <itandet...@mvps.org> > wrote: > > > >> Simon Slavin <slav...@bigfraud.org> wrote: > >>> <http://www.sqlite.org/c3ref/total_changes.html> > >>> > >>> int sqlite3_total_changes(sqlite3*); > >>> > >>> My understanding (which might be wrong) is that this count includes all > >>> changes made by all connections to that database: not > >>> only changes made using your connection but also chances made by > another > >>> computer, process, or thread. > >> > >> I'm 99% sure your understanding is wrong [snip] > > > > Igor is right. The sqlite3_total_changes() function only reports the > number > > of rows that have been changed by the same database connection that > issued > > the sqlite3_total_changes() call. > > Okay, I find that page in the documentation ambiguous then. Could that > sentence, or something like it, be added for clarity ? > > > There is no API for accessing the database change counter. But you can > read > > it yourself by looking at bytes 24-27 of the database file. > > How hard would it be to implement this safely using sqlite3's own > filehandle to the database file ? I know we're meant to treat sqlite3* as a > black box but could it be done relatively safely, with a warning that it > might fail under certain weird conditions ? Would one use > sqlite3_file_control() ? > > Alternatively, suppose one was doing a lot of in-memory caching for a > SQLite database but didn't want to block other apps from accessing it. Is > there a clean way to say "Has anyone been messing with this but me ?" ? > > Simon. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- Akash Agrawal _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users