private void Initialize() { IGVFSConnectionPool connectionPool = this; using (IDbConnection connection = connectionPool.GetConnection()) using (IDbCommand command = connection.CreateCommand()) { command.CommandText = "PRAGMA journal_mode=WAL;"; command.ExecuteNonQuery(); command.CommandText = "PRAGMA cache_size=-40000;"; command.ExecuteNonQuery(); command.CommandText = "PRAGMA synchronous=NORMAL;"; command.ExecuteNonQuery(); command.CommandText = "PRAGMA user_version;"; object userVersion = command.ExecuteScalar(); if (userVersion == null || Convert.ToInt64(userVersion) < 1) { command.CommandText = "PRAGMA user_version=1;"; command.ExecuteNonQuery(); } PlaceholderTable.CreateTable(connection, GVFSPlatform.Instance.Constants.CaseSensitiveFileSystem); SparseTable.CreateTable(connection, GVFSPlatform.Instance.Constants.CaseSensitiveFileSystem); } }
public void GetConnectionAfterDisposeShouldThrowException() { this.TestGVFSDatabase(database => { database.Dispose(); IGVFSConnectionPool connectionPool = database; Assert.Throws <ObjectDisposedException>(() => connectionPool.GetConnection()); }); }
public void GetConnectionMoreThanInPoolTest() { this.TestGVFSDatabase(database => { IGVFSConnectionPool connectionPool = database; using (IDbConnection pooledConnection1 = connectionPool.GetConnection()) using (IDbConnection pooledConnection2 = connectionPool.GetConnection()) { pooledConnection1.Equals(pooledConnection2).ShouldBeFalse(); } }); }
public PlaceholderTable(IGVFSConnectionPool connectionPool) { this.connectionPool = connectionPool; }
public SparseTable(IGVFSConnectionPool connectionPool) { this.connectionPool = connectionPool; }
protected override PlaceholderTable TableFactory(IGVFSConnectionPool pool) { return(new PlaceholderTable(pool)); }
protected abstract T TableFactory(IGVFSConnectionPool pool);
protected override SparseTable TableFactory(IGVFSConnectionPool pool) { return(new SparseTable(pool)); }