sqlparser/functions.cpp
// REPLACE in Oracle, SQL Server, DB2, MySQL, Sybase ASA
REPLACE in Oracle, SQL Server, DB2, MySQL, Sybase ASA
REPLACE in Oracle SQL Server DB2 MySQL Sybase ASA
bool SqlParser::ParseFunctionReplace(Token *name, Token* )
{
	if(name == NULL)
		return false;
	STATS_DECL
	STATS_SET_DESC(SQL_FUNC_REPLACE_DESC)
	Token *source = GetNextToken();
	ParseExpression(source);
	Token *comma = GetNextCharToken(',', L',');
	if(comma == NULL)
		return false;
	Token *search = GetNextToken();
	ParseExpression(search);
	Token *end_search = GetLastToken();
	Token *comma2 = GetNextCharToken(',', L',');
	Token *replace = NULL;
	if(comma2 != NULL)
	{
		replace = GetNextToken();
		ParseExpression(replace);
	}
	 (void) GetNextCharToken(')', L')');
	if(Target(SQL_MARIADB, SQL_MYSQL) && _source != SQL_MYSQL)
	{
		if(replace == NULL)
			Append(end_search, ", ''", L", ''", 4);
	}
	FUNC_STATS(name);
	return true;
}
bool SqlParser :: ParseFunctionReplace ( Token * name , Token * ) { if ( name == NULL ) return false ; STATS_DECL STATS_SET_DESC ( SQL_FUNC_REPLACE_DESC ) Token * source = GetNextToken ( ) ; ParseExpression ( source ) ; Token * comma = GetNextCharToken ( ' ' , L' ' ) ; if ( comma == NULL ) return false ; Token * search = GetNextToken ( ) ; ParseExpression ( search ) ; Token * end_search = GetLastToken ( ) ; Token * comma2 = GetNextCharToken ( ' ' , L' ' ) ; Token * replace = NULL ; if ( comma2 != NULL ) { replace = GetNextToken ( ) ; ParseExpression ( replace ) ; } ( void ) GetNextCharToken ( ' ' , L' ' ) ; if ( Target ( SQL_MARIADB , SQL_MYSQL ) && _source != SQL_MYSQL ) { if ( replace == NULL ) Append ( end_search , " " , L" " , 4 ) ; } FUNC_STATS ( name ) ; return true ; }
REPLACE in Oracle, SQL Server, DB2, MySQL, Sybase ASA
REPLACE in Oracle SQL Server DB2 MySQL Sybase ASA
/*open*/ // Parse source // Parse search // Replace is optional in Oracle, DB2 // Parse replace /*Token *close */ // Add third parameter in MySQL