store cookies to sqlite

This commit is contained in:
pypy
2020-11-18 21:40:10 +09:00
parent 414a9610cd
commit 0291211e4f
3 changed files with 63 additions and 18 deletions

View File

@@ -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();