예제 #1
0
        /// <summary>
        /// KV执行
        /// </summary>
        /// <param name="transfer"></param>
        /// <returns></returns>
        private RequestResult KV(DBTransfer transfer)
        {
            RequestResult result = new RequestResult
            {
                Error = ErrorCode.Sucess
            };

            try
            {
                switch (transfer.SQL)
                {
                case "Put":
                    bDBHelper.PutKVS(transfer.Paramter);
                    break;

                case "Delete":
                    object[] keys = new object[transfer.Paramter.Count];
                    transfer.Paramter.Keys.CopyTo(keys, 0);
                    bDBHelper.DeleteList(keys);
                    break;

                case "Get":
                    HashSet <object> set = new HashSet <object>(transfer.Paramter.Keys);
                    result.Result = bDBHelper.GetKVS(set);
                    break;

                case "Clear":
                    bDBHelper.Clear();
                    break;
                }
            }
            catch (Exception ex)
            {
                result.Error     = ErrorCode.Exception;
                result.ReslutMsg = ex.Message;
            }
            return(result);
        }