当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteConnection.GetDbPointer方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:nugarin,项目名称:sotsos,代码行数:45,代码来源:SotsosConnection.cs

示例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;
            }
        }
开发者ID:nugarin,项目名称:sotsos,代码行数:45,代码来源:SotsosConnection.cs


注:本文中的SQLiteConnection.GetDbPointer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。