3

According to the answer on this post it states:

Did you know that ReadUncommitted will revert to Serialized isolation unless you've enabled the shared cache and both connections are from the same thread?

Working in C#, I then went ahead and defined a DLL import as follows:

[DllImport("System.Data.SQLite.dll", CallingConvention=CallingConvention.Cdecl)]
public static extern int sqlite3_enable_shared_cache(int enable);

I called this function to enable the cache and got a successful result status of 0 when called. Nonetheless, I still get the exception "isolationlevel", when executing the below lines and attempting to set the isolation level to ReadUncommitted.

string connectionString = @"data source=d:\db\test.db3;datetimeformat=Ticks";
SQLiteConnection conn = new SQLiteConnection(connectionString);
conn.Open();
IDbTransaction tran = conn.BeginTransaction(IsolationLevel.ReadUncommitted);

This question is related to another question I posted here.

How can I pull off a query with an isolation level of ReadUncommitted in SQLite?

Community
  • 1
  • 1
Elan
  • 6,084
  • 12
  • 64
  • 84
  • Can you please show a little more of your source code following BeginTransaction? Is there any reason you are assigning conn.BeginTransaction to an Interface rather than Concrete type? – timothyclifford Mar 20 '11 at 21:06
  • In actuality I am using the provider factory, but for the sake of this posting, I simplified the code to isolate the exception. The exception occurs right on the call to conn.BeginTransaction(IsolationLevel.ReadUncommited). While I can post more code, I am not clear why code after this is relevant. – Elan Mar 21 '11 at 02:19

1 Answers1

2

To accomplish uncommitted reads see the following question and answer:

How perform SQLite query with a data reader without locking database?

Community
  • 1
  • 1
Elan
  • 6,084
  • 12
  • 64
  • 84