Package org.tmatesoft.sqljet.core.internal

Examples of org.tmatesoft.sqljet.core.internal.ISqlJetFileSystem


     * org.tmatesoft.sqljet.core.SqlJetFileType, java.util.Set)
     */
    public void open(File filename, ISqlJetDbHandle db, Set<SqlJetBtreeFlags> flags, final SqlJetFileType type,
            final Set<SqlJetFileOpenPermission> permissions) throws SqlJetException {

        ISqlJetFileSystem pVfs; /* The VFS to use for this btree */
        SqlJetBtreeShared pBt = null; /* Shared part of btree structure */
        int nReserve;
        ISqlJetMemoryPointer zDbHeader = SqlJetUtility.allocatePtr(100);

        /*
         * Set the variable isMemdb to true for an in-memory database, or false
         * for a file-based database. This symbol is only required if either of
         * the shared-data or autovacuum features are compiled into the library.
         */
        final boolean isMemdb = filename != null && ISqlJetPager.MEMORY_DB.equals(filename.getPath());

        assert (db != null);

        pVfs = db.getFileSystem();
        this.inTrans = TransMode.NONE;
        this.db = db;

        /*
         * If this Btree is a candidate for shared cache, try to find an
         * existing BtShared object that we can share with
         */
        if (!isMemdb && !db.getFlags().contains(SqlJetDbFlags.Vtab) && filename != null
                && !"".equals(filename.getPath())) {
            if (db.getConfig().isSharedCacheEnabled()) {
                this.sharable = true;
                db.getFlags().add(SqlJetDbFlags.SharedCache);
                final String fullPathname = pVfs.getFullPath(filename);
                synchronized (sharedCacheList) {
                    final Iterator<SqlJetBtreeShared> i = sharedCacheList.iterator();
                    while (i.hasNext()) {
                        pBt = i.next();
                        assert (pBt.nRef > 0);
                        final String pagerFilename = pVfs.getFullPath(pBt.pPager.getFileName());
                        if (fullPathname.equals(pagerFilename) && pVfs == pBt.pPager.getFileSystem()) {
                            this.pBt = pBt;
                            pBt.nRef++;
                            break;
                        }
View Full Code Here


public class SqlJetFileSystemsManagerMockTest extends SqlJetAbstractFileSystemMockTest {

    @Test
    public void testFindDefault() throws SqlJetException{
        fileSystemsManager.register(fileSystem, true);
        final ISqlJetFileSystem fs = fileSystemsManager.find(null);
        Assert.assertSame(fileSystem, fs);
    }
View Full Code Here

    }

    @Test
    public void testFindByName() throws SqlJetException{
        fileSystemsManager.register(fileSystem, false);
        final ISqlJetFileSystem fs = fileSystemsManager.find(fileSystem.getName());
        Assert.assertSame(fileSystem, fs);
    }
View Full Code Here

    @Test
    public void testUnregister() throws SqlJetException{
        fileSystemsManager.register(fileSystem, false);
        Assert.assertNotNull(fileSystemsManager.find(fileSystem.getName()));
        fileSystemsManager.unregister(fileSystem);
        final ISqlJetFileSystem fs = fileSystemsManager.find(fileSystem.getName());
        Assert.assertNull(fs);
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.sqljet.core.internal.ISqlJetFileSystem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.