Esempio n. 1
0
        private static void AfterBulkInsert(IDbConnection connection, SqliteSettings settings)
        {
            var pragma = connection.CreateCommand();

            pragma.CommandText = "PRAGMA synchronous = " + settings.Synchronous;
            pragma.ExecuteNonQuery();
            pragma.CommandText = "PRAGMA journal_mode = " + settings.JournalMode;
            pragma.ExecuteNonQuery();
        }
Esempio n. 2
0
        private static SqliteSettings BeforeBulkInsert(IDbConnection connection, IDbTransaction transaction = null, int?commandTimeout = null)
        {
            var settings = new SqliteSettings
            {
                Synchronous = Util.AdHoc(connection, transaction, commandTimeout.HasValue ? commandTimeout.Value : 0, "PRAGMA synchronous").ToString(),
                JournalMode = Util.AdHoc(connection, transaction, commandTimeout.HasValue ? commandTimeout.Value : 0, "PRAGMA journal_mode").ToString()
            };
            var pragma = connection.CreateCommand();

            pragma.CommandText = "PRAGMA synchronous = OFF";
            pragma.ExecuteNonQuery();
            pragma.CommandText = "PRAGMA journal_mode = MEMORY";
            pragma.ExecuteNonQuery();
            return(settings);
        }