lundi 13 juillet 2015

database locked by system.data.sqlite reader program

I have a c# program that does

        var db = new SQLiteConnection("Data Source=c:/storage/a1.db");
        db.Open();
        var st = new SQLiteCommand("select count(*) from Foo", db);
        st.ExecuteReader();
        Console.Read();

so it waits after the select.

If I fire up sqlite CLI in another window and try to do an insert I get

sqlite> insert or replace into users (_ID , name) values('xxx','yyyy');
Error: database is locked
sqlite>

I don't understand this. I thought exclusive locks lasted for the lifetime of a write, I am not even writing

Aucun commentaire:

Enregistrer un commentaire