hi,
i am trying to integrate sqlite into mobile platform, and porting layer,
like 'win_os.c' , have been created for that purpose.
the integrated sqlite works well on our mobile platform with the default
settings, but error come out when i try to tune the performance with 'pragma
cache_size = 1'.
what i have done is:
/* create a new database*/
sqlite3_open("contacts.db", &contactsdb);
/*tune the cache_size for m */
sqlite3_exec(contactsdb,"pragma default_cache_size = 1" , callback, 0,
&zErrMsg);
/*create a table */
sqlite3_exec(contactsdb,"create table IF NOT EXISTS contacts (name
text,phone int)" , callback, 0, &zErrMsg);
/*insert values into the table, totally 250 entries*/
for ( i< 250)
{
sqlite3_exec(("insert xxx,xxx");
}
the symptom is :
after the size of the database increased to 3K, the prgram can not insert
entries into the table anymore. the error returned is ' The database disk
image is malformed'
i have checked the porting layer i have made, the read, write, and offset
operations seems correct.
then, i recompile the sqlite codes with SQLITE_DEBUG and add
' sqlite3_exec(contactsdb,"PRAGMA vdbe_trace=ON" , callback, 0,
&zErrMsg);',
an assetion stalled the execution: "assert( pPager->journalOff==jSz );" in
pager.c
the stacked vaules at the broken time is :
pPager->journalOff= 1544
jSz= 1543
file size of contacts.db-journal is 1543 (checked from windows)
i guess the problems are related to file offset, reading, and writing. or
related to bugs of SQlite, i am not quite sure.
so, is there anyone can help me out?
best regards,
yang