public BerkeleyDtoResult OpenCursor([FromUri] ulong handle, [FromUri] String flags)
        {
            DbHandle db = GetDb(handle);
            BerkeleyDbCursorFlags cursorFlags = flags == null ? 0 : BerkeleyEnumParser.CursorFlags(flags);

            ulong cursorHandle = 0;
            IntPtr pdbc;
            BerkeleyDbError error = BDbcMethods.Create(BDbOffsetOfInstance.Instance, db.Handle, db.Methods.DbType, cursorFlags, out pdbc);
            if (error == 0)
            {
                DbcHandle dbc = new DbcHandle(pdbc, BDbcMethods.GetMethods(db.Methods.DbType));
                cursorHandle = DbcInstance.AddDbc(dbc);
                if (cursorHandle == 0)
                {
                    dbc.Methods.Close(dbc.Handle);
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }

            return new BerkeleyDtoResult(error, cursorHandle.ToString());
        }
Exemple #2
0
        public BerkeleyDtoResult OpenCursor([FromUri] ulong handle, [FromUri] String flags)
        {
            DbHandle db = GetDb(handle);
            BerkeleyDbCursorFlags cursorFlags = flags == null ? 0 : BerkeleyEnumParser.CursorFlags(flags);

            ulong           cursorHandle = 0;
            IntPtr          pdbc;
            BerkeleyDbError error = BDbcMethods.Create(BDbOffsetOfInstance.Instance, db.Handle, db.Methods.DbType, cursorFlags, out pdbc);

            if (error == 0)
            {
                DbcHandle dbc = new DbcHandle(pdbc, BDbcMethods.GetMethods(db.Methods.DbType));
                cursorHandle = DbcInstance.AddDbc(dbc);
                if (cursorHandle == 0)
                {
                    dbc.Methods.Close(dbc.Handle);
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }

            return(new BerkeleyDtoResult(error, cursorHandle.ToString()));
        }
Exemple #3
0
        public BerkeleyDbError WritePartial([FromUri] ulong handle, BerkeleyDtoPartialPut data)
        {
            DbcHandle dbc = GetDbc(handle);

            return(dbc.Methods.PutPartial(dbc.Handle, data.Key, data.Value.Data, data.Value.Offset, data.Value.Length));
        }
Exemple #4
0
        public BerkeleyDbError DeleteCurrent([FromUri] ulong handle, [FromUri] BerkeleyDbDelete flag)
        {
            DbcHandle dbc = GetDbc(handle);

            return(dbc.Methods.Del(dbc.Handle, flag));
        }