コード例 #1
0
 /// <summary>
 /// 重新加载数据
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="query">查询信息</param>
 internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
 {
     foreach (valueType value in SqlTable.SelectQueue(ref connection, ref query))
     {
         insert(value);
     }
 }
コード例 #2
0
        /// <summary>
        /// 重新加载数据
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="query">查询信息</param>
        internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
        {
            LeftArray <valueType> array = SqlTable.SelectQueue(ref connection, ref query);

            array.RemoveNot(isValue);
            reset(array);
        }
コード例 #3
0
ファイル: PrimaryKey.cs プロジェクト: zhangzheng1205/AutoCSer
 /// <summary>
 /// 重新加载数据
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="query">查询信息</param>
 internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
 {
     foreach (valueType value in SqlTable.SelectQueue(ref connection, ref query))
     {
         setMemberCacheAndValue(value);
         dictionary[GetKey(value)] = value;
     }
 }
コード例 #4
0
        /// <summary>
        /// 重新加载数据
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="query">查询信息</param>
        internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
        {
            ReturnValue <LeftArray <valueType> > valueArray = SqlTable.SelectQueue(ref connection, ref query);

            if (valueArray.ReturnType == ReturnType.Success)
            {
                reset(valueArray.Value);
            }
            else
            {
                SqlTable.Log.Fatal(typeof(valueType).fullName() + " 数据加载失败 " + valueArray.ReturnType.ToString(), LogLevel.Fatal | LogLevel.AutoCSer);
            }
        }
コード例 #5
0
ファイル: IdentityTree.cs プロジェクト: AutoCSer/AutoCSer
        /// <summary>
        /// 重新加载数据
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="query">查询信息</param>
        internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
        {
            ReturnValue <LeftArray <valueType> > valueArray = SqlTable.SelectQueue(ref connection, ref query);

            if (valueArray.ReturnType == ReturnType.Success)
            {
                int maxIdentity = valueArray.Value.maxKey(value => GetKey(value), 0);
                if (memberGroup == 0)
                {
                    SqlTable.Identity64 = maxIdentity + baseIdentity;
                }
                int length = maxIdentity >= IdentityArray.ArraySize ? 1 << ((uint)maxIdentity).bits() : IdentityArray.ArraySize;
                IdentityArray <valueType> newValues = new IdentityArray <valueType>(length);
                AutoCSer.Memory.Pointer   newCounts = Unmanaged.GetPointer8(length * sizeof(int), true);
                try
                {
                    int *intCounts = newCounts.Int;
                    foreach (valueType value in valueArray.Value)
                    {
                        setMemberCacheAndValue(value);
                        int identity = GetKey(value);
                        newValues[identity] = value;
                        intCounts[identity] = 1;
                    }
                    for (int step = 2; step != length; step <<= 1)
                    {
                        for (int index = step, countStep = step >> 1; index != length; index += step)
                        {
                            intCounts[index] += intCounts[index - countStep];
                        }
                    }
                    Unmanaged.Free(ref counts);
                    this.Array = newValues;
                    counts     = newCounts;
                    size       = length;
                    Count      = valueArray.Value.Length;
                    newCounts.SetNull();
                }
                catch (Exception error)
                {
                    SqlTable.Log.Exception(error, null, LogLevel.Exception | LogLevel.AutoCSer);
                }
                finally { Unmanaged.Free(ref newCounts); }
            }
            else
            {
                SqlTable.Log.Fatal(typeof(valueType).fullName() + " 数据加载失败 " + valueArray.ReturnType.ToString(), LogLevel.Fatal | LogLevel.AutoCSer);
            }
        }
コード例 #6
0
        /// <summary>
        /// 重新加载数据
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="query">查询信息</param>
        internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
        {
            ReturnValue <LeftArray <valueType> > valueArray = SqlTable.SelectQueue(ref connection, ref query);

            if (valueArray.ReturnType == ReturnType.Success)
            {
                foreach (valueType value in valueArray.Value)
                {
                    setMemberCacheAndValue(value);
                    dictionary[GetKey(value)] = value;
                }
            }
            else
            {
                SqlTable.Log.Fatal(typeof(valueType).fullName() + " 数据加载失败 " + valueArray.ReturnType.ToString(), LogLevel.Fatal | LogLevel.AutoCSer);
            }
        }
コード例 #7
0
        /// <summary>
        /// 重新加载数据
        /// </summary>
        /// <param name="connection"></param>
        /// <param name="query">查询信息</param>
        internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
        {
            LeftArray <valueType> array = SqlTable.SelectQueue(ref connection, ref query);
            int maxIdentity             = array.maxKey(value => GetKey(value), 0);

            if (memberGroup == 0)
            {
                SqlTable.Identity64 = maxIdentity + baseIdentity;
            }
            int length = maxIdentity >= IdentityArray.ArraySize ? 1 << ((uint)maxIdentity).bits() : IdentityArray.ArraySize;
            IdentityArray <valueType> newValues = new IdentityArray <valueType>(length);

            Pointer.Size newCounts = Unmanaged.GetSize64(length * sizeof(int), true);
            try
            {
                int *intCounts = newCounts.Int;
                foreach (valueType value in array)
                {
                    setMemberCacheAndValue(value);
                    int identity = GetKey(value);
                    newValues[identity] = value;
                    intCounts[identity] = 1;
                }
                for (int step = 2; step != length; step <<= 1)
                {
                    for (int index = step, countStep = step >> 1; index != length; index += step)
                    {
                        intCounts[index] += intCounts[index - countStep];
                    }
                }
                Unmanaged.Free(ref counts);
                this.Array = newValues;
                counts     = newCounts;
                size       = length;
                Count      = array.Length;
                newCounts.SetNull();
            }
            catch (Exception error)
            {
                SqlTable.Log.Add(AutoCSer.Log.LogType.Error, error);
            }
            finally { Unmanaged.Free(ref newCounts); }
        }
コード例 #8
0
 /// <summary>
 /// 重新加载数据
 /// </summary>
 /// <param name="connection"></param>
 /// <param name="query">查询信息</param>
 internal override void Reset(ref DbConnection connection, ref SelectQuery <modelType> query)
 {
     reset(SqlTable.SelectQueue(ref connection, ref query));
 }