Exemplo n.º 1
0
        public override async Task <BerkeleyResult <long> > CreateDb(BerkeleyDb berkeleyDb, BerkeleyDbFlags flags)
        {
            String requestUri            = "api/database/create/?type=" + berkeleyDb.DbType.ToStringEx() + "&flags=" + flags.ToStringEx();
            HttpResponseMessage response = await _httpClient.GetAsync(requestUri).ConfigureAwait(false);

            if (!response.IsSuccessStatusCode)
            {
                return(new BerkeleyResult <long>(response.StatusCode));
            }

            BerkeleyDtoResult dtoHandle = await SerializeHelper.GetResultAsync(_serializer, response.Content).ConfigureAwait(false);

            if (dtoHandle.Error != 0)
            {
                return(new BerkeleyResult <long>(dtoHandle.Error));
            }

            return(new BerkeleyResult <long>(0, Int64.Parse(dtoHandle.Result)));
        }
Exemplo n.º 2
0
        public override async Task <BerkeleyResult <long> > OpenCursorAsync(BerkeleyDb db, BerkeleyDbCursorFlags flags)
        {
            String requestUri            = "api/database/opencursor/?handle=" + db.Handle.ToString() + "&flags=" + flags.ToStringEx();
            HttpResponseMessage response = await _httpClient.GetAsync(requestUri).ConfigureAwait(false);

            if (!response.IsSuccessStatusCode)
            {
                return(new BerkeleyResult <long>(response.StatusCode));
            }

            BerkeleyDtoResult result = await SerializeHelper.GetResultAsync(_serializer, response.Content).ConfigureAwait(false);

            if (result.Error != 0)
            {
                return(new BerkeleyResult <long>(result.Error));
            }

            return(new BerkeleyResult <long>(0, Int64.Parse(result.Result)));
        }
Exemplo n.º 3
0
        public override async Task <BerkeleyResult <int> > GetPageSizeAsync(BerkeleyDb db)
        {
            String requestUri            = "api/database/pagesize/?handle=" + db.Handle.ToString();
            HttpResponseMessage response = await _httpClient.GetAsync(requestUri).ConfigureAwait(false);

            if (!response.IsSuccessStatusCode)
            {
                return(new BerkeleyResult <int>(response.StatusCode));
            }

            BerkeleyDtoResult dtoResult = await SerializeHelper.GetResultAsync(_serializer, response.Content).ConfigureAwait(false);

            if (dtoResult.Error != 0)
            {
                return(new BerkeleyResult <int>(dtoResult.Error));
            }

            int pageSize = Int32.Parse(dtoResult.Result);

            return(new BerkeleyResult <int>(pageSize));
        }