示例#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
        /// <summary>
        /// Creates instance of EJDB. 
        /// </summary>
        /// <param name="library"></param>
        public Database(Library library)
        {
            var libraryHandle = library.LibraryHandle;
            DatabaseHandle = new DatabaseHandle(libraryHandle);

            Library = library;

            _openDatabase = libraryHandle.GetUnmanagedDelegate<OpenDatabaseDelegate>();
            _closeDatabase = libraryHandle.GetUnmanagedDelegate<CloseDatabaseDelegate>();
            _isOpen = libraryHandle.GetUnmanagedDelegate<IsOpenDelegate>();

            _getErrorCode = libraryHandle.GetUnmanagedDelegate<GetErrorCodeDelegate>();
            _getMetadata = libraryHandle.GetUnmanagedDelegate<GetMetaDelegate>();

            _command = libraryHandle.GetUnmanagedDelegate<CommandDelegate>();
            _sync = libraryHandle.GetUnmanagedDelegate<SyncDelegate>();
        }
示例#3
0
        /// <summary>
        /// Close database and free all resources
        /// </summary>
        public void Dispose()
        {
            Close();
            DatabaseHandle.Dispose();

            _openDatabase = null;
            _closeDatabase = null;
            _isOpen = null;
            _getErrorCode = null;
            _getMetadata = null;
            _sync = null;
            _command = null;
            DatabaseHandle = null;
        }