Fix compilation errors due to database change

This commit is contained in:
Noikoio 2018-02-20 00:58:55 -08:00
parent 6a52a2ba80
commit 22af7685ee
3 changed files with 6 additions and 8 deletions

View file

@ -19,9 +19,7 @@ namespace Noikoio.RegexBot.EntityCache
public Module(DiscordSocketClient client) : base(client) public Module(DiscordSocketClient client) : base(client)
{ {
_db = RegexBot.Config.Database; if (RegexBot.Config.DatabaseAvailable)
if (_db.Available)
{ {
SqlHelper.CreateCacheTablesAsync().Wait(); SqlHelper.CreateCacheTablesAsync().Wait();

View file

@ -19,7 +19,7 @@ namespace Noikoio.RegexBot.EntityCache
// Reminder: Check Cache query methods if making changes to tables // Reminder: Check Cache query methods if making changes to tables
internal static async Task CreateCacheTablesAsync() internal static async Task CreateCacheTablesAsync()
{ {
var db = await RegexBot.Config.Database.GetOpenConnectionAsync(); var db = await RegexBot.Config.GetOpenDatabaseConnectionAsync();
if (db == null) return; if (db == null) return;
using (db) using (db)
{ {
@ -83,7 +83,7 @@ namespace Noikoio.RegexBot.EntityCache
#region Insertions and updates #region Insertions and updates
internal static async Task UpdateGuildAsync(SocketGuild g) internal static async Task UpdateGuildAsync(SocketGuild g)
{ {
var db = await RegexBot.Config.Database.GetOpenConnectionAsync(); var db = await RegexBot.Config.GetOpenDatabaseConnectionAsync();
if (db == null) return; if (db == null) return;
using (db) using (db)
{ {
@ -109,7 +109,7 @@ namespace Noikoio.RegexBot.EntityCache
} }
internal static async Task UpdateGuildMemberAsync(IEnumerable<SocketGuildUser> users) internal static async Task UpdateGuildMemberAsync(IEnumerable<SocketGuildUser> users)
{ {
var db = await RegexBot.Config.Database.GetOpenConnectionAsync(); var db = await RegexBot.Config.GetOpenDatabaseConnectionAsync();
if (db == null) return; if (db == null) return;
using (db) using (db)
{ {

View file

@ -89,7 +89,7 @@ namespace Noikoio.RegexBot.Module.ModLogs
/// <returns>Null if no result.</returns> /// <returns>Null if no result.</returns>
public static async Task<Entry> QueryIdAsync(ulong guild, int id) public static async Task<Entry> QueryIdAsync(ulong guild, int id)
{ {
using (var db = await RegexBot.Config.Database.GetOpenConnectionAsync()) using (var db = await RegexBot.Config.GetOpenDatabaseConnectionAsync())
{ {
using (var c = db.CreateCommand()) using (var c = db.CreateCommand())
{ {
@ -121,7 +121,7 @@ namespace Noikoio.RegexBot.Module.ModLogs
} }
var result = new List<Entry>(); var result = new List<Entry>();
using (var db = await RegexBot.Config.Database.GetOpenConnectionAsync()) using (var db = await RegexBot.Config.GetOpenDatabaseConnectionAsync())
{ {
using (var c = db.CreateCommand()) using (var c = db.CreateCommand())
{ {