Beispiel #1
0
        public static void Query(this SqliteConnection source, DatabaseQueriedEventArgs args)
        {
            source.Open();

            using SqliteTransaction transaction = source.BeginTransaction();
            using (SqliteCommand command = source.CreateCommand())
            {
                command.Transaction = transaction;
                command.CommandText = args.Query;
                command.ExecuteNonQuery();
            }

            transaction.Commit();
        }
Beispiel #2
0
        public static async Task QueryAsync(this SqliteConnection source, DatabaseQueriedEventArgs args)
        {
            await source.OpenAsync();

            await using SqliteTransaction transaction = source.BeginTransaction();
            await using (SqliteCommand command = source.CreateCommand())
            {
                command.Transaction = transaction;
                command.CommandText = args.Query;
                await command.ExecuteNonQueryAsync();
            }

            transaction.Commit();
        }