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);
        }
Example #3
0
        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);
        }
Example #4
0
 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();
     }
 }
Example #5
0
 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;
 }
Example #6
0
 private static void TryDisposeDataService(SqliteProfilerDataService dataService)
 {
     if (dataService != null)
     {
         try
         {
             dataService.Dispose();
         }
         catch (Exception ex)
         {
             log.ErrorException("Error disposing data service", ex);
         }
         dataService = null;
     }
 }