public QueryLogBuffer(LibraryHandle libraryHandle)
            : base(true)
        {
            _newBuffder = libraryHandle.GetUnmanagedDelegate<NewBufferDelegate>();
            _delete = libraryHandle.GetUnmanagedDelegate<DeleteBufferDelegate>();
            _size = libraryHandle.GetUnmanagedDelegate<GetSizeDelegate>();
            _toString = libraryHandle.GetUnmanagedDelegate<ToStringDelegate>();

            handle = _newBuffder();
        }
        public DatabaseHandle(LibraryHandle libraryHandle)
            : base(true)
        {
            LibraryHandle = libraryHandle;
            _newInstance = libraryHandle.GetUnmanagedDelegate<NewInstanceDelegate>();
            _deleteInstance = libraryHandle.GetUnmanagedDelegate<DeleteInstanceDelegate>();

            this.handle = _newInstance(LibraryHandle);

            if (IsInvalid)
            {
                throw new EjdbException("Unable to create ejdb instance");
            }
        }
Beispiel #3
0
        private Library(LibraryHandle libraryHandle)
        {
            LibraryHandle = libraryHandle;

            _getErrorMessage = LibraryHandle.GetUnmanagedDelegate<GetErrorMessage>();

            _freeBson = libraryHandle.GetUnmanagedDelegate<FreeBsonDelegate>();
            _bsonToString = libraryHandle.GetUnmanagedDelegate<BsonToStringDelegate>();
            //_jsonToBson = libraryHandle.GetUnmanagedDelegate<JsonToBsonDelegate>();

            var getVersion = LibraryHandle.GetUnmanagedDelegate<GetVersion>();

            IntPtr version = getVersion(LibraryHandle);

            if (version == IntPtr.Zero)
            {
                throw new Exception("Unable to get ejdb library version");
            }

            _version = Native.StringFromNativeUtf8(version); //UnixMarshal.PtrToString(vres, Encoding.UTF8);
            _hexVersion = Convert.ToInt64("0x" + Version.Replace(".", ""), 16);
        }
Beispiel #4
0
 internal CursorBase(LibraryHandle libraryHandle, CursorHandle cursorHandle, int count)
 {
     _cursorHandle = cursorHandle;
     _count = count;
     _cursorResult = libraryHandle.GetUnmanagedDelegate<CursorResultDelegate>();
 }