sqlparser/statements.cpp
// PROMPT statement in Oracle SQL*Plus
PROMPT statement in Oracle SQL*Plus
PROMPT statement in Oracle SQL * Plus
bool SqlParser::ParsePromptStatement(Token *prompt)
{
	if(prompt == NULL)
		return false;
	STATS_DECL
    STMS_STATS(prompt);
	Token *first = GetNextToken();
	Token *last = NULL;
	Token *cur = first;
	while(cur)
	{
		Token *prev = cur->prev;
		while(prev && (Token::Compare(prev, ' ', L' ') == true || Token::Compare(prev, '\t', L'\t') == true))
			prev = prev->prev;
		if(Token::Compare(prev, '\r', L'\r') == true || Token::Compare(prev, '\n', L'\n') == true)
		{
			PushBack(cur);
			break;
		}
		last = cur;
		cur = GetNextToken();
	}
	if(_target == SQL_SQL_SERVER)
	{
		Token::Change(prompt, "PRINT", L"PRINT", 5);
		PrependNoFormat(first, "'", L"'", 1);
		AppendNoFormat(last, "'", L"'", 1);
		Append(last, "\nGO", L"\nGO", 3, prompt);
	}
	return true;
}
bool SqlParser :: ParsePromptStatement ( Token * prompt ) { if ( prompt == NULL ) return false ; STATS_DECL STMS_STATS ( prompt ) ; Token * first = GetNextToken ( ) ; Token * last = NULL ; Token * cur = first ; while ( cur ) { Token * prev = cur -> prev ; while ( prev && ( Token :: Compare ( prev , ' ' , L' ' ) == true || Token :: Compare ( prev , ' \t ' , L' \t ' ) == true ) ) prev = prev -> prev ; if ( Token :: Compare ( prev , ' \r ' , L' \r ' ) == true || Token :: Compare ( prev , ' \n ' , L' \n ' ) == true ) { PushBack ( cur ) ; break ; } last = cur ; cur = GetNextToken ( ) ; } if ( _target == SQL_SQL_SERVER ) { Token :: Change ( prompt , " " , L" " , 5 ) ; PrependNoFormat ( first , " " , L" " , 1 ) ; AppendNoFormat ( last , " " , L" " , 1 ) ; Append ( last , " \n " , L" \n " , 3 , prompt ) ; } return true ; }
PROMPT statement in Oracle SQL*Plus
PROMPT statement in Oracle SQL * Plus
// Parse tokens until newline // Check if the previous non-space token is a newline  // Skip spaces // PRINT 'message' in SQL Server // Add GO to show the message even if there is an error in batch