コード例 #1
0
 public static CsvCommandParser GetInstance()
 {
     if (instance == null)
     {
         instance = new CsvCommandParser();
     }
     return(instance);
 }
コード例 #2
0
        public CsvUpdateCommand(string s) : base(s)
        {
            var parser = CsvCommandParser.GetInstance();
            var match  = Pattern.Match(s);

            if (!match.Success)
            {
                throw new Exception("Cannot parse into update command");
            }
            var updateStr = match.Groups[1].Value;

            Updaters = parser.ParseUpdaters(updateStr);
            var conditionStr = match.Groups[2].Value;

            Condition   = parser.ParseCondition(conditionStr);
            CommandType = CsvCommandType.Update;
        }
コード例 #3
0
        public CsvSelectCommand(string s) : base(s)
        {
            var parser = CsvCommandParser.GetInstance();
            var match  = Pattern.Match(s);

            if (!match.Success)
            {
                throw new Exception("Cannot parse into select command");
            }
            var headerStr = match.Groups[1].Value;

            Headers    = parser.ParseHeaders(headerStr);
            AllHeaders = Headers.Count == 1 && Headers[0] == "*";
            var conditionStr = match.Groups[2].Value;

            Condition   = parser.ParseCondition(conditionStr);
            CommandType = CsvCommandType.Select;
        }