示例#1
0
        protected override void ReadContent(LiteDB.ByteReader reader)
        {
            this.Nodes = new Dictionary<ushort, IndexNode>(this.ItemCount);

            for (var i = 0; i < this.ItemCount; i++)
            {
                var index = reader.ReadUInt16();
                var levels = reader.ReadByte();

                var node = new IndexNode(levels);

                node.Page = this;
                node.Position = new LiteDB.PageAddress(this.PageID, index);
                node.KeyLength = reader.ReadUInt16();
                node.Key = reader.ReadBsonValue(node.KeyLength);
                node.DataBlock = reader.ReadPageAddress();

                for (var j = 0; j < node.Prev.Length; j++)
                {
                    node.Prev[j] = reader.ReadPageAddress();
                    node.Next[j] = reader.ReadPageAddress();
                }

                this.Nodes.Add(node.Position.Index, node);
            }
        }
示例#2
0
 public static void InitializeUserSetting(string userName, LiteDB.LiteDatabase db)
 {
     if (UserSetting != null)
     {
         if(UserSetting.UserName != userName)
         UserSetting.Dispose();
         UserSetting = null;
     }
     UserSetting = new ApplicationUserSettingStorage(userName, db);
 }
        /// <summary>
        /// Read all data from datafile using a pageID as reference. If data is not in DataPage, read from ExtendPage.
        /// </summary>
        public byte[] Read(LiteDB.PageAddress blockAddress)
        {
            var block = this.GetBlock(blockAddress);

            // if there is a extend page, read bytes all bytes from extended pages
            if (block.ExtendPageID != uint.MaxValue)
            {
                return this.ReadExtendData(block.ExtendPageID);
            }

            return block.Data;
        }
示例#4
0
        protected override Int32 GetFinishedMessageCount(String userId)
        {
            if (string.IsNullOrEmpty(userId))
            {
                userId = GTP.Runtime.Common.Context.DataContextManager.SessionContext.UserID;
            }
            var     gsql = "SELECT COUNT(1) AS F_COUNT FROM T_WFM_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID='" + userId + ".S' AND task.F_STATUS='Finished';";
            DataSet ds   = LiteDB.ExecuteDataSet(gsql);

            if (ds != null)
            {
                return(Int32.Parse(ds.Tables[0].Rows[0][0].ToString()));
            }
            else
            {
                return(0);
            }
        }
示例#5
0
        protected override void ReadContent(LiteDB.ByteReader reader)
        {
            var info = reader.ReadString(HEADER_INFO.Length);
            var ver = reader.ReadByte();

            this.ChangeID = reader.ReadUInt16();
            this.FreeEmptyPageID = reader.ReadUInt32();
            this.LastPageID = reader.ReadUInt32();
            this.DbVersion = reader.ReadUInt16();
            this.Password = reader.ReadBytes(this.Password.Length);

            // read page collections references (position on end of page)
            var cols = reader.ReadByte();
            for (var i = 0; i < cols; i++)
            {
                this.CollectionPages.Add(reader.ReadString(), reader.ReadUInt32());
            }
        }
示例#6
0
        protected override Int32 GetFinishedTaskCount(String userId)
        {
            if (string.IsNullOrEmpty(userId))
            {
                userId = GTP.Runtime.Common.Context.DataContextManager.SessionContext.UserID;
            }
            var     gsql = "select count(*) as f_count from (SELECT distinct f_flow_id FROM T_WF_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID IN ('" + userId + ".S') AND task.F_STATUS ='Finished') a;";
            DataSet ds   = LiteDB.ExecuteDataSet(gsql);

            if (ds != null)
            {
                return(Int32.Parse(ds.Tables[0].Rows[0][0].ToString()));
            }
            else
            {
                return(0);
            }
        }
示例#7
0
        protected override Int32 GetToDoTaskFilterCount(String userId, String filter)
        {
            if (string.IsNullOrEmpty(userId))
            {
                userId = GTP.Runtime.Common.Context.DataContextManager.SessionContext.UserID;
            }
            var     gsql = "SELECT COUNT(1) AS F_COUNT FROM T_WF_TASK task WITH (NOLOCK) WHERE task.F_EXECUTOR_ID IN ('" + userId + ".S') AND task.F_STATUS='Running' and F_MODULE_FCODE like '%" + filter + "%';";
            DataSet ds   = LiteDB.ExecuteDataSet(gsql);

            if (ds != null)
            {
                return(Int32.Parse(ds.Tables[0].Rows[0][0].ToString()));
            }
            else
            {
                return(0);
            }
        }
示例#8
0
        protected override DictPoco[] GetTaskStatusCount()
        {
            var     gsql = "select f_status as status_,count(f_status) as count_ from t_wf_task with(nolock) where f_kind='Flow' and f_status in ('Running','Finished','Deleted','Aborted') GROUP BY f_status order by f_status desc";
            DataSet ds   = LiteDB.ExecuteDataSet(gsql);

            if (ds != null)
            {
                List <DictPoco> dictList = new List <DictPoco>();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    DictPoco dict = new DictPoco();
                    dict.Key   = row["status_"].ToString();
                    dict.Value = row["count_"].ToString();
                    dictList.Add(dict);
                }
                return(dictList.ToArray());
            }
            else
            {
                return(null);
            }
        }
示例#9
0
        protected override DictPoco[] GetModuleUseCount()
        {
            var     gsql = "SELECT f_module_fname as name_, COUNT(f_id) as count_ from t_wf_task with(nolock) GROUP BY f_module_fcode,f_module_fname order by count(f_id) desc";
            DataSet ds   = LiteDB.ExecuteDataSet(gsql);

            if (ds != null)
            {
                List <DictPoco> dictList = new List <DictPoco>();
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    DictPoco dict = new DictPoco();
                    dict.Key   = row["name_"].ToString();
                    dict.Value = row["count_"].ToString();
                    dictList.Add(dict);
                }
                return(dictList.ToArray());
            }
            else
            {
                return(null);
            }
        }
示例#10
0
        protected override void ReadContent(LiteDB.ByteReader reader)
        {
            this.DataBlocks = new Dictionary<ushort, DataBlock>(ItemCount);

            for (var i = 0; i < ItemCount; i++)
            {
                var block = new DataBlock();

                block.Page = this;
                block.Position = new LiteDB.PageAddress(this.PageID, reader.ReadUInt16());
                block.ExtendPageID = reader.ReadUInt32();

                for (var j = 0; j < CollectionIndex.INDEX_PER_COLLECTION; j++)
                {
                    block.IndexRef[j] = reader.ReadPageAddress();
                }

                var size = reader.ReadUInt16();
                block.Data = reader.ReadBytes(size);

                this.DataBlocks.Add(block.Position.Index, block);
            }
        }
        protected override void ReadContent(LiteDB.ByteReader reader)
        {
            this.CollectionName = reader.ReadString();
            this.FreeDataPageID = reader.ReadUInt32();
            var uintCount = reader.ReadUInt32(); // read as uint (4 bytes)

            foreach (var index in this.Indexes)
            {
                index.Field = reader.ReadString();
                index.HeadNode = reader.ReadPageAddress();
                index.TailNode = reader.ReadPageAddress();
                index.FreeIndexPageID = reader.ReadUInt32();
                index.Options.Unique = reader.ReadBoolean();
                index.Options.IgnoreCase = reader.ReadBoolean();
                index.Options.TrimWhitespace = reader.ReadBoolean();
                index.Options.EmptyStringToNull = reader.ReadBoolean();
                index.Options.RemoveAccents = reader.ReadBoolean();
            }

            // be compatible with v2_beta
            var longCount = reader.ReadInt64();
            this.DocumentCount = Math.Max(uintCount, longCount);

        }
示例#12
0
 private void OpenDBNieuw()
 {
     m_LiteDBNieuw = new LiteDB(Globals.PlacesFileNieuw);
 }
示例#13
0
 private void OpenDBOud()
 {
     m_LiteDBOud = new LiteDB(Globals.PlacesFileOud);
 }
示例#14
0
 protected override void ReadContent(LiteDB.ByteReader reader)
 {
     this.Data = reader.ReadBytes(this.ItemCount);
 }
示例#15
0
 /// <summary>
 /// Get a data block from a DataPage using address
 /// </summary>
 public DataBlock GetBlock(LiteDB.PageAddress blockAddress)
 {
     var page = _pager.GetPage<DataPage>(blockAddress.PageID);
     return page.DataBlocks[blockAddress.Index];
 }
示例#16
0
 /// <summary>
 /// Get a node inside a page using PageAddress - Returns null if address IsEmpty
 /// </summary>
 public IndexNode GetNode(LiteDB.PageAddress address)
 {
     if (address.IsEmpty) return null;
     var page = _pager.GetPage<IndexPage>(address.PageID);
     return page.Nodes[address.Index];
 }