Kervin L. Pierre wrote:
You can write a wrapper around the sqlite3 transaction APIs that performs some sort of reference counting.Hello again,
Are there plans for supporting nested transactions in the future? Would that be a difficult extension to code ( eg. if one thought they could give it a try :) )
The current restriction makes it hard to use SQLite in developing a API eg....
exposed_func1() { sqlite3_exec("BEGIN");
[...do stuff...]
func2();
sqlite3_exec("END"); }
exposed_func2() { sqlite3_exec("BEGIN");
[...do stuff...]
sqlite3_exec("END");
[...do more stuff...]
}
I could commit early, eg. before calling expose_func2(), but on error the entire function needs to be rolled back, both inner and outer functions.
Any information and, or insight would be appreciated.
- Kervin
For example:
void BeginTransaction() { if(Counter==0) sqlite3_exec("BEGIN"); Counter++; }
void EndTransaction() { Counter--; if(Counter==0) sqlite3_exec("END"); }
This is not as nice as real nested transactions, since you can't do a partial rollback, but its better than nothing.
Jan-Eric