mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-23 00:33:50 +02:00
store cookies to sqlite
This commit is contained in:
37
SQLite.cs
37
SQLite.cs
@@ -78,6 +78,40 @@ namespace VRCX
|
||||
callback.Dispose();
|
||||
}
|
||||
|
||||
public void Execute(Action<object[]> callback, string sql, IDictionary<string, object> args = null)
|
||||
{
|
||||
m_ConnectionLock.EnterReadLock();
|
||||
try
|
||||
{
|
||||
using (var command = new SQLiteCommand(sql, m_Connection))
|
||||
{
|
||||
if (args != null)
|
||||
{
|
||||
foreach (var arg in args)
|
||||
{
|
||||
command.Parameters.Add(new SQLiteParameter(arg.Key, arg.Value));
|
||||
}
|
||||
}
|
||||
using (var reader = command.ExecuteReader())
|
||||
{
|
||||
while (reader.Read() == true)
|
||||
{
|
||||
var values = new object[reader.FieldCount];
|
||||
reader.GetValues(values);
|
||||
callback(values);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_ConnectionLock.ExitReadLock();
|
||||
}
|
||||
}
|
||||
|
||||
public int ExecuteNonQuery(string sql, IDictionary<string, object> args = null)
|
||||
{
|
||||
int result = -1;
|
||||
@@ -97,9 +131,6 @@ namespace VRCX
|
||||
result = command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
finally
|
||||
{
|
||||
m_ConnectionLock.ExitWriteLock();
|
||||
|
||||
Reference in New Issue
Block a user