Пример #1
0
 public Database(ConfigManager config, string directory = "")
 {
     this.config = config;
     databaseDirectory = Path.GetFullPath(GetDatabaseDirectory());
     if (string.IsNullOrWhiteSpace(directory))
     {
         databaseDirectory = Path.Combine(databaseDirectory, CurrentDatabase);
     }
     else
     {
         databaseDirectory = Path.Combine(databaseDirectory, directory);
     }
     databaseFullPath = Path.Combine(databaseDirectory, "NAppProfiler.edb");
     this.disposeLock = new object();
     this.tblSchema = new LogTableSchema();
     this.idxSchema = new IndexTableSchema();
 }
Пример #2
0
 public long ReAddAllLogsToIndex(JET_SESID session, IndexTableSchema idxSchema)
 {
     var ret = 0L;
     Transaction tran = new Transaction(session);
     try
     {
         var tranCount = 0;
         Api.MoveBeforeFirst(session, logTable);
         while (Api.TryMoveNext(session, logTable))
         {
             var curLogId = (long)Api.RetrieveColumnAsInt64(session, logTable, colID_ID);
             idxSchema.InsertIndexRow(session, tran, curLogId);
             tranCount++;
             ret++;
             if (tranCount >= 50)
             {
                 tran.Commit(CommitTransactionGrbit.LazyFlush);
                 tran.Dispose();
                 tran = new Transaction(session);
             }
         }
         tran.Commit(CommitTransactionGrbit.LazyFlush);
     }
     finally
     {
         tran.Dispose();
     }
     return ret;
 }
Пример #3
0
 // DateTime createdDateTime, long elapsed, byte[] data)
 public long InsertLog(JET_SESID session, Transaction tran, IndexTableSchema idxSchema, LogEntity log)
 {
     long ret = 0;
     using (var updt = new Update(session, logTable, JET_prep.Insert))
     {
         ret = (long)Api.RetrieveColumnAsInt64(session, logTable, colID_ID, RetrieveColumnGrbit.RetrieveCopy);
         Api.SetColumn(session, logTable, colID_Created, log.CreatedDateTime.Ticks);
         Api.SetColumn(session, logTable, colID_Elapsed, log.Elapsed.Ticks);
         Api.SetColumn(session, logTable, colID_Exception, log.Exception);
         Api.SetColumn(session, logTable, colID_Data, log.Data);
         updt.Save();
     }
     idxSchema.InsertIndexRow(session, tran, ret);
     return ret;
 }