diff --git a/SQLite.cs b/SQLite.cs index ddd2f5d6..25c194df 100644 --- a/SQLite.cs +++ b/SQLite.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Data.SQLite; using System.IO; using System.Threading; +using System.Threading.Tasks; namespace VRCX { @@ -60,11 +61,13 @@ namespace VRCX } } - public void Execute(IJavascriptCallback callback, string sql, IDictionary args = null) + public void Execute(IJavascriptCallback rowCallback, IJavascriptCallback doneCallback, string sql, IDictionary args = null) { m_ConnectionLock.EnterReadLock(); try { + using (rowCallback) + using (doneCallback) using (var command = new SQLiteCommand(sql, m_Connection)) { if (args != null) @@ -80,8 +83,9 @@ namespace VRCX { var values = new object[reader.FieldCount]; reader.GetValues(values); - callback.ExecuteAsync(values); + rowCallback.ExecuteAsync(values); } + doneCallback.ExecuteAsync(); } } } diff --git a/Util.cs b/Util.cs index d2667e50..fae67bd8 100644 --- a/Util.cs +++ b/Util.cs @@ -13,7 +13,7 @@ namespace VRCX repository.Register("VRCX", VRCX.Instance, true, options); repository.Register("SharedVariable", SharedVariable.Instance, false, options); repository.Register("VRCXStorage", VRCXStorage.Instance, false, options); - repository.Register("SQLite", SQLite.Instance, false, options); + repository.Register("SQLite", SQLite.Instance, true, options); repository.Register("LogWatcher", LogWatcher.Instance, true, options); repository.Register("Discord", Discord.Instance, true, options); }