sqlparser/select.cpp
// Returns SELECT or WITH if it is the next input token
Returns SELECT or WITH if it is the next input token
Returns SELECT or WITH if it is the next input token
Token* SqlParser::GetNextSelectStartKeyword()
{
	Token *open = TOKEN_GETNEXT('(');
	Token *select = GetNext("SELECT", L"SELECT", 6);
	Token *sel = NULL;
	if(select == NULL && _source == SQL_TERADATA)
	{
		sel = GetNext("SEL", L"SEL", 3);
		if(sel != NULL)
		{
			if(_target != SQL_TERADATA)
				Token::Change(sel, "SELECT", L"SELECT", 6);
		}
	}
	Token *with = NULL;
	if(select == NULL && sel == NULL)
		with = GetNext("WITH", L"WITH", 4);
	Token *select_keyword = Nvl(select, sel, with);
	if(open != NULL)
	{
		if(select_keyword != NULL)
		{
			PushBack(select_keyword);
			return open;
		}
		else
			PushBack(open);
	}
	return select_keyword;
}
Token * SqlParser :: GetNextSelectStartKeyword ( ) { Token * open = TOKEN_GETNEXT ( ' ' ) ; Token * select = GetNext ( " " , L" " , 6 ) ; Token * sel = NULL ; if ( select == NULL && _source == SQL_TERADATA ) { sel = GetNext ( " " , L" " , 3 ) ; if ( sel != NULL ) { if ( _target != SQL_TERADATA ) Token :: Change ( sel , " " , L" " , 6 ) ; } } Token * with = NULL ; if ( select == NULL && sel == NULL ) with = GetNext ( " " , L" " , 4 ) ; Token * select_keyword = Nvl ( select , sel , with ) ; if ( open != NULL ) { if ( select_keyword != NULL ) { PushBack ( select_keyword ) ; return open ; } else PushBack ( open ) ; } return select_keyword ; }
Returns SELECT or WITH if it is the next input token
Returns SELECT or WITH if it is the next input token
// Any SELECT can be optionally enclosed with () // SEL in Teradata // Use SELECT in other databases