mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-17 05:43:51 +02:00
async sqlite
This commit is contained in:
@@ -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<string, object> args = null)
|
||||
public void Execute(IJavascriptCallback rowCallback, IJavascriptCallback doneCallback, string sql, IDictionary<string, object> 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
Util.cs
2
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user