public async Task TestTimeSpan() { var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), true); var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); await TestAsyncDateTime(db); }
public void AsyncAsTicks () { var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), false); var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); TestAsyncDateTimeOffset (db); }
public Database(ISQLitePlatform platform, string databasePath) { _connectionParameters = new SQLiteConnectionString(databasePath, false); _sqliteConnectionPool = new SQLiteConnectionPool(platform); _dbConnection = new SQLiteAsyncConnection(() => _sqliteConnectionPool.GetConnection(_connectionParameters)); }
public void AsyncAsTicks() { var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformWin32()); var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), true); var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); TestAsyncDateTime(db); }
public async Task AsyncAsString() { var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); var sqLiteConnectionString = new SQLiteConnectionString(TestPath.GetTempFileName(), false); var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(sqLiteConnectionString)); await TestAsyncDateTime(db, sqLiteConnectionString.StoreDateTimeAsTicks); }
public static SQLiteDataReader select(string sql) { SQLiteCommand sQLiteCommand = new SQLiteCommand(); sQLiteCommand.CommandText = sql; sQLiteCommand.Connection = SQLiteConnectionPool.getConnection(); return(sQLiteCommand.ExecuteReader()); }
public static void execute(string sql) { SQLiteCommand sQLiteCommand = new SQLiteCommand(); sQLiteCommand.CommandText = sql; sQLiteCommand.Connection = SQLiteConnectionPool.getConnection(); Console.WriteLine($"执行成功,{sQLiteCommand.ExecuteNonQuery()}行受到影响"); }
public DataService(IDeviceInfo deviceInfo, SQLite.Net.Interop.ISQLitePlatform platform) { _deviceInfo = deviceInfo; _platform = platform; _path = Path.Combine(_deviceInfo.DatabasePath, DBNAME); _connectionString = new SQLiteConnectionString(_path, true); _connectionPool = new SQLiteConnectionPool(_platform); this.CreateTablesIfRequired(); }
public async Task UnicodePathsAsync() { string path = Path.GetTempFileName() + UnicodeText; var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformTest()); var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(new SQLiteConnectionString(path, true))); await db.CreateTableAsync <OrderLine>(); Assert.That(new FileInfo(path).Length, Is.GreaterThan(0), path); }
public void UnicodePathsAsync() { string path = Path.GetTempFileName() + UnicodeText; var sqLiteConnectionPool = new SQLiteConnectionPool(new SQLitePlatformWin32()); var db = new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(new SQLiteConnectionString(path, true))); db.CreateTableAsync<OrderLine>().Wait(); Assert.That(new FileInfo(path).Length, Is.GreaterThan(0), path); }
public SqliteEventStore(ISQLitePlatform sqLitePlatform, string databasePath, GetUtcNow getUtcNow = null) { Ensure.That(sqLitePlatform, "sqLitePlatform").IsNotNull(); Ensure.That(databasePath, "databasePath").IsNotNull(); _getUtcNow = getUtcNow ?? SystemClock.GetUtcNow; _connectionPool = new SQLiteConnectionPool(sqLitePlatform); var connectionString = new SQLiteConnectionString(databasePath, false); _getConnection = () => _connectionPool.GetConnection(connectionString); }
public void SetUp() { if (_sqliteConnectionPool != null) { _sqliteConnectionPool.Reset(); } _path = Path.Combine(Path.GetTempPath(), DatabaseName); // delete old db file File.Delete(_path); _connectionParameters = new SQLiteConnectionString(_path, false); _sqliteConnectionPool = new SQLiteConnectionPool(_sqlite3Platform); }
private SQLiteAsyncConnection CreateSqliteAsyncConnection() { var sqliteFilename = "MyDatabase.db3"; var libraryPath = _configuration.DbPath; //#if __ANDROID__ // string libraryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); ; //#else // // we need to put in /Library/ on iOS5.1 to meet Apple's iCloud terms // // (they don't want non-user-generated data in Documents) // string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder // string libraryPath = Path.Combine(documentsPath, "../Library/"); //#endif var sqLitePath = Path.Combine(libraryPath, sqliteFilename); var connectionString = new SQLiteConnectionString(sqLitePath, true); var sqLiteConnectionPool = new SQLiteConnectionPool(_configuration.SQLitePlatform); Debug.WriteLine(string.Format("sqlitePath: {0}", sqLitePath)); return(new SQLiteAsyncConnection(() => sqLiteConnectionPool.GetConnection(connectionString))); }
public void TestFixtureSetUp() { _sqlite3Platform = new SQLitePlatformTest(); _sqliteConnectionPool = new SQLiteConnectionPool(_sqlite3Platform); }
public Database() { mainPool = new SQLiteConnectionPool(MAX_CONNECTIONS, DatabasePath); logPool = new SQLiteConnectionPool(MAX_CONNECTIONS, QuerylogPath); }
/// <summary> /// Create a new connection pool lock /// </summary> public ConnectionPoolLockBox(SQLiteConnectionPool pool) { this.m_pool = pool; Monitor.Enter(this.m_pool.m_lockObject); }
public void TestFixtureSetUp() { _sqlite3Platform = new SQLitePlatformWin32(); _sqliteConnectionPool = new SQLiteConnectionPool(_sqlite3Platform); }
public static void SetConnectionPool(SQLiteConnectionPool connectionPool) { _connectionPool = connectionPool; }