mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-05-06 06:46:04 +02:00
async sqlite
This commit is contained in:
@@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace VRCX
|
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();
|
m_ConnectionLock.EnterReadLock();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
using (rowCallback)
|
||||||
|
using (doneCallback)
|
||||||
using (var command = new SQLiteCommand(sql, m_Connection))
|
using (var command = new SQLiteCommand(sql, m_Connection))
|
||||||
{
|
{
|
||||||
if (args != null)
|
if (args != null)
|
||||||
@@ -80,8 +83,9 @@ namespace VRCX
|
|||||||
{
|
{
|
||||||
var values = new object[reader.FieldCount];
|
var values = new object[reader.FieldCount];
|
||||||
reader.GetValues(values);
|
reader.GetValues(values);
|
||||||
callback.ExecuteAsync(values);
|
rowCallback.ExecuteAsync(values);
|
||||||
}
|
}
|
||||||
|
doneCallback.ExecuteAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace VRCX
|
|||||||
repository.Register("VRCX", VRCX.Instance, true, options);
|
repository.Register("VRCX", VRCX.Instance, true, options);
|
||||||
repository.Register("SharedVariable", SharedVariable.Instance, false, options);
|
repository.Register("SharedVariable", SharedVariable.Instance, false, options);
|
||||||
repository.Register("VRCXStorage", VRCXStorage.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("LogWatcher", LogWatcher.Instance, true, options);
|
||||||
repository.Register("Discord", Discord.Instance, true, options);
|
repository.Register("Discord", Discord.Instance, true, options);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user