예제 #1
0
        //Creates new instance of ejdb. Don't know what' is it, but it looks it should be done before opening database
        public unsafe DatabaseFunctions(LibraryHandle handle)
        {
            NewInstance    = handle.GetUnmanagedDelegate <NewInstanceDelegate>();
            DeleteInstance = handle.GetUnmanagedDelegate <DeleteInstanceDelegate>();

            OpenDatabase  = handle.GetUnmanagedDelegate <OpenDatabaseDelegate>();
            CloseDatabase = handle.GetUnmanagedDelegate <CloseDatabaseDelegate>();
            IsOpen        = handle.GetUnmanagedDelegate <IsOpenDelegate>();

            GetErrorCode = handle.GetUnmanagedDelegate <GetErrorCodeDelegate>();
            GetMetadata  = handle.GetUnmanagedDelegate <GetMetaDelegate>();


            Command = handle.GetUnmanagedDelegate <CommandDelegate>();
            Sync    = handle.GetUnmanagedDelegate <SyncDelegate>();
        }
예제 #2
0
        private unsafe Library(LibraryHandle libraryHandle)
        {
            LibraryHandle = libraryHandle;

            Functions = new Functions(libraryHandle);

            _getErrorMessage = LibraryHandle.GetUnmanagedDelegate <GetErrorMessage>();

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

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

            var version = getVersion(LibraryHandle);

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

            _version    = new string(version); //UnixMarshal.PtrToString(vres, Encoding.UTF8);
            _hexVersion = Convert.ToInt64("0x" + Version.Replace(".", ""), 16);
        }
예제 #3
0
        public unsafe CollectionFunctions(LibraryHandle handle)
        {
            CreateCollection = handle.GetUnmanagedDelegate <CreateCollectionDelegate>();
            GetCollection    = handle.GetUnmanagedDelegate <GetCollectionDelegate>();

            Remove = handle.GetUnmanagedDelegate <RemoveCollectionDelegate>();

            BeginTransaction    = handle.GetUnmanagedDelegate <BeginTransactionDelegate>();
            CommitTransaction   = handle.GetUnmanagedDelegate <CommitTransactionDelegate>();
            RollbackTransaction = handle.GetUnmanagedDelegate <RollbackTransactionDelegate>();
            TransactionStatus   = handle.GetUnmanagedDelegate <TransactionStatusDelegate>();

            SyncCollection = handle.GetUnmanagedDelegate <SyncDelegate>();

            SaveBson   = handle.GetUnmanagedDelegate <SaveBsonDelegate>();
            LoadBson   = handle.GetUnmanagedDelegate <LoadBsonDelegate>();
            DeleteBson = handle.GetUnmanagedDelegate <DeleteBsonDelegate>();

            SetIndex = handle.GetUnmanagedDelegate <SetIndexDelegate>();
        }
예제 #4
0
        public unsafe QueryFunctions(LibraryHandle handle)
        {
            Create = handle.GetUnmanagedDelegate <CreateQueryDelegate>();

            Delete = handle.GetUnmanagedDelegate <DeleteQueryDelegate>();

            Execute      = handle.GetUnmanagedDelegate <ExecuteQueryDelegate>();
            DeleteCursor = handle.GetUnmanagedDelegate <DeleteCursorDelegate>();

            SetHints = handle.GetUnmanagedDelegate <SetHintsDelegate>();
            AddOr    = handle.GetUnmanagedDelegate <AddOrDelegate>();

            CursorResult = handle.GetUnmanagedDelegate <CursorResultDelegate>();

            NewBuffer      = handle.GetUnmanagedDelegate <QueryFunctions.NewBufferDelegate>();
            DeleteBuffer   = handle.GetUnmanagedDelegate <QueryFunctions.DeleteBufferDelegate>();
            BufferSize     = handle.GetUnmanagedDelegate <GetSizeDelegate>();
            BufferToString = handle.GetUnmanagedDelegate <ToStringDelegate>();
        }