public static SqliteProfilerDataService Create(string filePath) { string connectionString = string.Format("Data Source=\"{0}\";journal mode=Off;page size=4096;cache size=1024;synchronous=Off", filePath); var logger = new SqliteProfilerDataService(connectionString, "System.Data.SQLite"); logger.FilePath = filePath; return logger; }
public static SqliteProfilerDataService Create(string filePath) { //string connectionString = string.Format("Data Source=\"{0}\";journal mode=Off;page size=4096;cache size=1024;synchronous=Off", filePath); //TODO: turn off journal mode. string connectionString = string.Format("Data Source=\"{0}\"", filePath); var logger = new SqliteProfilerDataService(connectionString, "System.Data.SQLite"); logger.FilePath = filePath; return(logger); }
public static SqliteProfilerDataService Create(string filePath) { //string connectionString = string.Format("Data Source=\"{0}\";journal mode=Off;page size=4096;cache size=1024;synchronous=Off", filePath); string connectionString = string.Format(CultureInfo.InvariantCulture, "Data Source=\"{0}\"", filePath); var ds = new SqliteProfilerDataService(connectionString, "System.Data.SQLite"); ds.FilePath = filePath; ds.CommandTimeout = 8; ds.IsPreventingSuperfluousUpdatesEnabled = false; return(ds); }
private void ProcessLogItems(SqliteProfilerDataService dataService) { LogItem item = null; while (!logItems.IsEmpty) { dataService.BeginTransaction(); int itemCount = 0; while (logItems.Dequeue(out item)) { dataService.LogCommandExecution(item, this.FullLogging); itemCount++; } dataService.Commit(); } }
private SqliteProfilerDataService EnsureDataServiceAndDeleteOldFiles(SqliteProfilerDataService dataService) { string filePath = null; if (dataService == null || (DateTime.Today != this.lastDataServiceCreateDay && dataService.FilePath != (filePath = this.GetDatabaseFilePath()))) { TryDisposeDataService(dataService); if (filePath == null) filePath = this.GetDatabaseFilePath(); dataService = SqliteProfilerDataService.Create(filePath); lastDataServiceCreateDay = DateTime.Today; dataService.OpenConnection(); ThreadPool.QueueUserWorkItem(DeleteOldFiles); } return dataService; }
private static void TryDisposeDataService(SqliteProfilerDataService dataService) { if (dataService != null) { try { dataService.Dispose(); } catch (Exception ex) { log.ErrorException("Error disposing data service", ex); } dataService = null; } }