Excuse for my English and if this wrong place to explain the problem
I'm checking to replace Berkeley DB and SQLite for testing the stability against involuntary interruptions of program I have encountered the following error:
Berkeley DB trust in knowing his rnedimiento and stability with Subversion, but I doubt the API bridge SQLITE
I'm testing the Berkeley DB database using the API Berkeley DB SQLITE and I did a small test program:;
/* Open database. */
sqlite3 *db;
sqlite3_open("data/basedatos.db", &db);
sqlite3_exec(db,"CREATE TABLE [test] ([key] INTEGER, [dat] varchar(64), PRIMARY KEY ([key]))",NULL,0,NULL);
err_code = SQLITE_BUSY;
while (err_code != SQLITE_OK ) {
sqlite3_exec( db, "delete from test", NULL, 0, NULL );
err_code = sqlite3_errcode( db );
}
sqlite3_exec( db, "BEGIN", NULL, 0, NULL );+
for( int i=0; i<_numCartones; i++ ) {
char buf[1024];
sprintf_s( buf, sizeof(buf), "insert into test( key, dat) values ( %d, 'test%d' )", i, i );
sqlite3_exec( db, buf, NULL, 0, NULL );
}
sqlite3_exec( db, "COMMIT", NULL, 0, NULL );
sqlite3_close(db);
I launched the program and insert about 150000 records in 17 seconds. Perfect!
I created a file basedatos.db and basedatos.db-journal subdirectory with files: log.0000000016, __db.001, __db.002, __db.003, __db.004, __db.005, __db.006 and __db.register.
Open it and prove the usefulness dbsql
c: dbsql basedatos.db
select count(*) from test;
150000 ← Ok.
Without closing the program again dbsql run the test program and this will get stuck in the call:
sqlite3_exec( db, "delete from test", NULL, 0, NULL );
I close dbsql and automatically releases the "delete from" and the test program again inserted 150,000 records
While this by inserting 150,000 records run it again
c: dbsql basedatos.db
select count(*) from test; [WAIT]
and select count (*) remains locked until you finish the test program, normal thing locks.Once you finish the select TEST responds to 150,000
Without closing the program again dbsql run the test program and this will get stuck in the call:
sqlite3_exec( db, "delete from test", NULL, 0, NULL );
I close dbsql and automatically releases the "delete from" and the test program again inserted 150,000 records
while inserting test rerun:
c: dbsql basedatos.db
select count(*) from test;
Error: database disk image is malformed
and in my test program :
PANIC: fatal region error detected; run recovery.
Reviewing the files are only: badatos.db, log.0000000031, log.0000000032, log.0000000033, log.0000000034, log.0000000035, log.0000000036, __db.register.
and __db*.* files?