Esempio n. 1
0
 public void Parse()
 {
     _schema.Clear();
     using (var filestream = new FileStream(SchemaFilename, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
         using (var sr = new StreamReader(filestream, Encoding.UTF8, true, 4096))
         {
             string line;
             while ((line = sr.ReadLine()) != null)
             {
                 var fields = line.Split('^');
                 if (fields.Length >= 5)
                 {
                     SchemaTable table;
                     if (!_schema.TryGetValue(fields[0], out table))
                     {
                         table = new SchemaTable(fields[0]);
                         _schema[fields[0]] = table;
                     }
                     var schemaColumn = new SchemaColumn(fields[0], fields[1], fields[2], fields[3], fields[4]);
                     if (!table.Columns.ContainsKey(schemaColumn.Name))
                     {
                         table.Columns[schemaColumn.Name] = schemaColumn;
                     }
                 }
             }
         }
 }
Esempio n. 2
0
 public IAnalysisResult GetTable(string tablename)
 {
     lock (_currentParserLock)
     {
         SchemaTable result = null;
         if (CurrentParser != null)
         {
             CurrentParser.Schema.TryGetValue(tablename, out result);
         }
         return(result);
     }
 }