本文整理汇总了C#中SQLiteConnection.GetDbPointer方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.GetDbPointer方法的具体用法?C# SQLiteConnection.GetDbPointer怎么用?C# SQLiteConnection.GetDbPointer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.GetDbPointer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteIntegerArrayQueryImpl
private static int[] ExecuteIntegerArrayQueryImpl(SQLiteConnection connection, string query, int queryIndex, object[] keys)
{
try
{
if (CacheManager.Connection != connection.GetDbPointer()) // don't cache this
{
return ExecuteIntegerArrayQuerySots(connection, query, keys);
}
if (!_queryCaches.ContainsKey(queryIndex))
{
_queryCaches[queryIndex] = new ColumnCache<int[]>(query);
}
ColumnCache<int[]> cache = (ColumnCache<int[]>)_queryCaches[queryIndex];
if (cache.Ignore)
{
return ExecuteIntegerArrayQuerySots(connection, query, keys);
}
var ts = cache.GetTS(keys);
var key = BuildKey(keys);
if (CacheManager.Invalidations.IsInvalidated(ts, cache.Tables))
{
cache.Clear();
}
int[] foundItem = new int[0];
var found = cache.TryGetItem(key, out foundItem);
if (!found)
{
foundItem = ExecuteIntegerArrayQuerySots(connection, query, keys);
cache.SetItem(key, foundItem);
}
return foundItem;
}
catch (Exception ex)
{
Sotsos_DebugHelper.SotsosLog("Error in ExecuteIntegerArrayQuery while trying to run query {0}, idx {1}", query, queryIndex);
throw;
}
}
示例2: ExecuteTableQueryImpl
//SELECT * FROM government_actions ORDER BY id DESC LIMIT 50;
private static Table ExecuteTableQueryImpl(SQLiteConnection connection, bool splitQuery, string query, object[] keys, int queryIndex)
{
try
{
if (CacheManager.Connection != connection.GetDbPointer()) // don't cache this
{
return ExecuteTableQuerySots(connection, splitQuery, query, keys);
}
if (!_queryCaches.ContainsKey(queryIndex))
{
_queryCaches[queryIndex] = new FullQueryCache(query);
}
FullQueryCache cache = (FullQueryCache)_queryCaches[queryIndex];
if (cache.Ignore)
{
return ExecuteTableQuerySots(connection, splitQuery, query, keys);
}
var ts = cache.GetTS(keys);
var key = BuildKey(keys);
if (CacheManager.Invalidations.IsInvalidated(ts, cache.Tables))
{
cache.Clear();
}
var foundTable = cache.GetItem(key);
if (foundTable == null)
{
foundTable = ExecuteTableQuerySots(connection, splitQuery, query, keys);
foundTable.Rows = foundTable.Rows.Select(r => new SotsosRow(r)).ToArray<Row>(); //Use SotsosRow wrapper so we can cache parsed values
cache.SetItem(key, foundTable);
}
return foundTable;
}
catch(Exception ex)
{
Sotsos_DebugHelper.SotsosLog("Error in ExecuteTableQueryImpl while trying to run query {0}, idx {1}", query, queryIndex);
throw;
}
}