Esempio n. 1
0
        public unsafe ResultSet Scan(byte[] skey, byte[] ekey, ScanFilter sf, DataVar dv)
        {
            ScanFilterStruct sfs   = sf.sfs;
            long *           sfptr = (long *)&sfs;

            IntPtr pBuf   = dv.bufferPointer;
            int    buflen = dv.bufferLength;
            int    dlen   = dv.dataLength;
            int    dofft  = dv.dataOffset;
            int    eflag  = (int)dv.opsFlag;

            IntPtr rsptr = BangDBNative.Scan_DVW(_wconnection, skey, skey.Length, ekey, ekey.Length, (IntPtr)sfptr, pBuf, buflen, ref dlen, dofft, ref eflag);

            dv.opsFlag       = (BangDBDataOpsFlag)eflag;
            dv.bufferPointer = pBuf;
            dv.dataLength    = dlen;

            if (rsptr == IntPtr.Zero)
            {
                return(null);
            }
            sf.skeyOp     = sfs.skeyOp;
            sf.ekeyOp     = sfs.ekeyOp;
            sf.skip_count = sfs.skip_count;
            return(new ResultSet(rsptr));
        }
Esempio n. 2
0
        public bool Get(long key, ref DataVar dv, Transaction txn)
        {
            IntPtr pBuf   = dv.bufferPointer;
            int    buflen = dv.bufferLength;
            int    dlen   = dv.dataLength;
            int    dofft  = dv.dataOffset;
            int    eflag  = (int)dv.opsFlag;

            int retval = BangDBNative.GetAdvancedTran(_connection, key, ref pBuf, buflen, ref dlen, dofft, ref eflag, txn.GetTranPtr());

            dv.opsFlag       = (BangDBDataOpsFlag)eflag;
            dv.bufferPointer = pBuf;
            dv.dataLength    = dlen;
            return(retval < 0 ? false : true);
        }
Esempio n. 3
0
        public long Put(byte[] key, ref DataVar dv, InsertOptions flag, Transaction txn)
        {
            if (key == null)
            {
                throw new Exception("key can't be null");
            }

            IntPtr pBuf   = dv.bufferPointer;
            int    buflen = dv.bufferLength;
            int    dlen   = dv.dataLength;
            int    dofft  = dv.dataOffset;
            int    eflag  = (int)dv.opsFlag;

            long retval = BangDBNative.PutAdvanced_Tran(_connection, key, key.Length, pBuf, buflen, ref dlen, dofft, ref eflag, (int)flag, txn.GetTranPtr());

            dv.dataLength = dlen;
            dv.opsFlag    = (BangDBDataOpsFlag)eflag;
            return(retval);
        }
Esempio n. 4
0
        public bool Get(byte[] key, ref DataVar dv, Transaction txn)
        {
            if (key == null)
            {
                throw new Exception("key can't be null");
            }

            IntPtr pBuf   = dv.bufferPointer;
            int    buflen = dv.bufferLength;
            int    dlen   = dv.dataLength;
            int    dofft  = dv.dataOffset;
            int    eflag  = (int)dv.opsFlag;

            int retval = BangDBNative.GetAdvancedTran(_connection, key, key.Length, ref pBuf, buflen, ref dlen, dofft, ref eflag, txn.GetTranPtr());

            dv.opsFlag       = (BangDBDataOpsFlag)eflag;
            dv.bufferPointer = pBuf;
            dv.dataLength    = dlen;
            return(retval < 0 ? false : true);
        }
Esempio n. 5
0
        public bool Get(long key, ref DataVar dv)
        {
            IntPtr _conn = BangDBNative.GetMainConn(_wconnection);

            if (_conn == IntPtr.Zero)
            {
                return(false);
            }
            IntPtr pBuf   = dv.bufferPointer;
            int    buflen = dv.bufferLength;
            int    dlen   = dv.dataLength;
            int    dofft  = dv.dataOffset;
            int    eflag  = (int)dv.opsFlag;

            int retval = BangDBNative.GetAdvanced(_conn, key, ref pBuf, buflen, ref dlen, dofft, ref eflag);

            dv.opsFlag       = (BangDBDataOpsFlag)eflag;
            dv.bufferPointer = pBuf;
            dv.dataLength    = dlen;
            return(retval < 0 ? false : true);
        }
Esempio n. 6
0
        public unsafe ResultSet ScanDoc(string idxName, string skey, string ekey, ScanFilter sf, DataVar dv)
        {
            ScanFilterStruct sfs   = sf.sfs;
            long *           sfptr = (long *)&sfs;
            int sklen = (skey != null) ? skey.Length : 0;
            int eklen = (ekey != null) ? ekey.Length : 0;

            IntPtr pBuf   = dv.bufferPointer;
            int    buflen = dv.bufferLength;
            int    dlen   = dv.dataLength;
            int    dofft  = dv.dataOffset;
            int    eflag  = (int)dv.opsFlag;

            IntPtr rsptr = BangDBNative.Scan_Doc_Idx_DV(_wconnection, idxName, skey, sklen, ekey, eklen, (IntPtr)sfptr, pBuf, buflen, ref dlen, dofft, ref eflag);

            dv.opsFlag       = (BangDBDataOpsFlag)eflag;
            dv.bufferPointer = pBuf;
            dv.dataLength    = dlen;

            if (rsptr == IntPtr.Zero)
            {
                return(null);
            }
            sf.skeyOp     = sfs.skeyOp;
            sf.ekeyOp     = sfs.ekeyOp;
            sf.skip_count = sfs.skip_count;
            return(new ResultSet(rsptr));
        }