WingMan
/trunk/WingMan/AutoCompletion/AutoCompletion.cs |
@@ -124,7 +124,29 @@ |
new SqliteConnection($"URI=file:{"Autocomplete.db"}")) |
{ |
await sqliteConnection.OpenAsync(CancellationToken); |
|
// Create table if it does not exist. |
using (var sqliteCommand = |
new SqliteCommand($"CREATE TABLE IF NOT EXISTS {name} (data text UNIQUE NOT NULL)", |
sqliteConnection)) |
{ |
using (var dbtransaction = sqliteConnection.BeginTransaction()) |
{ |
try |
{ |
await sqliteCommand.ExecuteReaderAsync(CancellationToken); |
|
dbtransaction.Commit(); |
} |
catch |
{ |
dbtransaction.Rollback(); |
throw; |
} |
} |
} |
|
using (var sqliteCommand = |
new SqliteCommand($"SELECT data FROM {name}", sqliteConnection)) |
{ |
using (var dbtransaction = sqliteConnection.BeginTransaction()) |
@@ -165,4 +187,4 @@ |
} |
} |
} |
} |
} |