/// <summary> /// Close database connection /// </summary> public void Close() { log.In(); SQLiteUtil.CloseConnection(connection); log.Out(); }
/// <summary> /// Constructor /// </summary> /// <param name="fileName">Database file name</param> /// <param name="patternDef">Analyzing pattern definition</param> public IntermediateLogReader(String fileName, PatternDefinition patternDef) { log.In(fileName, patternDef); this.colDefList = patternDef.ColumnDefinitionList; connection = SQLiteUtil.OpenConnection(fileName); log.Out(); }
/// <summary> /// Constructor /// </summary> /// <param name="fileName">Database file name</param> /// <param name="patternDef">Analyzing pattern</param> public IntermediateLogWriter(string fileName, PatternDefinition patternDef) { log.In(fileName, patternDef); this.regex = new Regex(patternDef.RegularExpression); this.columnDefList = patternDef.ColumnDefinitionList; if (File.Exists(fileName) == false) { CreateDB(fileName, patternDef.ColumnDefinitionList); } connection = SQLiteUtil.OpenConnection(fileName); log.Out(); }
/// <summary> /// Create database file /// </summary> /// <param name="fileName">Database file name</param> /// <param name="colDefList">Column definition list</param> private void CreateDB(string fileName, ColumnDefinitionList colDefList) { log.InPrivate(); SQLiteConnection.CreateFile(fileName); using (SQLiteConnection initCon = SQLiteUtil.OpenConnection(fileName)) { using (SQLiteCommand com = initCon.CreateCommand()) { CreateHashedValueTable(com); CreateLogFileTable(com); CreateParsedLogTable(com, colDefList); } } log.OutPrivate(); }