예제 #1
0
		public override bool NextState(TheWord word)
		{
			if (word.text.ToLower() == "select")
			{
				//Тогда вложенный запрос.
				Link l = new Link(this.mainClass.Tr, this.mainClass.ArrayWords);
				l.AddWordBegin("select", TypeWord.TERM);
				l.Run();

				SQLStruct st = (SQLStruct) this.mainClass.data;
				if (l.data != null)
					st.select.Add(l.data);
				else
					throw new NoOneClass("Ошибка во вложенном запросе.");
				this.link = this.mainClass.select_stmt_1;
			}/*else if (word.text.ToLower() == "once")
			{
				mainClass.data.select.selectType = SELECTTYPE.ONCE;
                this.link = this.mainClass.select_stmt_0;
			}else if (word.text.ToLower() == "all")
			{
				mainClass.data.select.selectType = SELECTTYPE.ALL;
                this.link = this.mainClass.select_all;
			}*/else if (word.text.ToLower() == "use")
			{
                this.link = this.mainClass.select_all_use;                
			}
			/*else if (word.type == TypeWord.TERM && word.text.ToLower() == "*")
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}*/
			else if (word.type == TypeWord.TERM)
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}
			else
				throw new NoOneClass("Состояние: Select_stmt, слово = " + word.text);
			return true;
		}
예제 #2
0
		public override bool NextState(TheWord word)
		{
			//int u=0;
			////Console.WriteLine(this.ToString() + ": " + word.text);

			if (word.text.ToLower() == "select")
			{
				//Тогда вложенный запрос.
				Link l = new Link(this.mainClass.Tr, this.mainClass.ArrayWords);
				l.AddWordBegin("select", TypeWord.TERM);
				l.Run();

				SQLStruct st = (SQLStruct) this.mainClass.data;
				if (l.data != null)
					st.select.Add(l.data);
				else
					throw new NoOneClass("Ошибка во вложенном запросе.");
				this.link = this.mainClass.select_stmt_1;
			}
			/*else if (word.type == TypeWord.TERM && word.text.ToLower() == "*")
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}*/
			else if (word.type == TypeWord.TERM)
			{
				SQLStruct st = (SQLStruct) this.mainClass.data;
				st.select.Add(word.text);
				this.link = this.mainClass.select_stmt_1;
			}
			else
				throw new NoOneClass("Состояние: Select_stmt, слово = " + word.text);
			return true;
		}