Bulk insert into SQLite.Net database

I need to do a bulk attach to sqlite database in visual studio. Does anyone know how to do this?

+3
source share
6 answers

With SQLite, you can do this by opening a transaction, going through all your data and executing the appropriate SQL INSERT commands, and then complete the transaction. This is the fastest way to perform bulk inserts in SQLite.

+7
source

SQLite.Net.Async-PCL nuget sqlite UWP, , InsertAllAsync . 33 000 , 10 , InsertAsync.

, InsertAll, , , - .

+2

insert , , .

+1

I needed to do the same, I found this answer on the Sqlite.Net forum, it may be interesting for someone.

http://sqlite.phxsoftware.com/forums/t/134.aspx

+1
source

I wrote a class that will help facilitate bulk insertions in SQLite. Hope this is helpful:

http://procbits.com/2009/09/08/sqlite-bulk-insert/

-JP

+1
source
    private void prepareConnectionForBulkInsert(SQLiteConnection cn)
    {

        SQLiteCommand stmt;

        stmt = new SQLiteCommand("PRAGMA synchronous=OFF", cn);
        stmt.ExecuteNonQuery();

        stmt = new SQLiteCommand("PRAGMA count_changes=OFF", cn);
        stmt.ExecuteNonQuery();

        stmt = new SQLiteCommand("PRAGMA journal_mode=MEMORY", cn);
        stmt.ExecuteNonQuery();

        stmt = new SQLiteCommand("PRAGMA temp_store=MEMORY", cn);
        stmt.ExecuteNonQuery();

    }
+1
source

Source: https://habr.com/ru/post/1712685/


All Articles