static SQLiteServer GetServer(string filename) { string connectionString = "Data Source=" + filename + ";Synchronous=Off;Pooling=True;Journal Mode=Off"; SQLiteServer server = new SQLiteServer(connectionString); server.CloseAllConnections(); return(server); }
public void ReadExcelScenario() { string fn = Path.Combine(TestData.DataPath, "Scenarios", "InputScenarioConfig.xlsx"); var ds = new ScenarioManagement.ScenarioDataSet(); var fn1 = FileUtility.GetTempFileName(".pdb"); SQLiteServer svr = new SQLiteServer(fn1); var db = new TimeSeriesDatabase(svr, false); ds.Import(fn, db); Assert.IsTrue(ds.ScenarioMapping.Count > 0); // create Scenarios svr.CloseAllConnections(); File.Delete(fn1); }
public void ImportDirectory() { var dir = Path.Combine(TestData.DataPath, "Scenarios", "dir_import"); var tmp = @"c:\temp\import_dir.pdb"; if (File.Exists(tmp)) { File.Delete(tmp); } var svr = new SQLiteServer(tmp); var db = new TimeSeriesDatabase(svr); BulkImportDirectory.Import(db, dir, "*.csv", @".+dir_import\\(?<scenario>[-a-z_0-9]+)-(?<siteid>[a-z0-9]+)-biascorrected_streamflow"); Assert.IsTrue(db.GetSeriesCatalog().Rows.Count == 3); svr.CloseAllConnections(); File.Delete(tmp); }
public void ImportDirectory() { var dir = Path.Combine(TestData.DataPath, "Scenarios", "dir_import"); var tmp = FileUtility.GetTempFileName(".pdb"); if (File.Exists(tmp)) { File.Delete(tmp); } var svr = new SQLiteServer(tmp); var db = new TimeSeriesDatabase(svr); BulkImportDirectory.Import(db, dir, "*.csv", @".+dir_import\" + Path.DirectorySeparatorChar + "(?<scenario>[-a-z_0-9]+)-(?<siteid>[a-z0-9]+)-biascorrected_streamflow"); var sc = db.GetSeriesCatalog(); Assert.IsTrue(sc.Rows.Count == 3, "found " + sc.Rows.Count + " rows in catalog. expected 3"); svr.CloseAllConnections(); File.Delete(tmp); }