sqlparser/postgresql.cpp
// In PostgreSQL body terminates with $$ LANGUAGE plpgsql;
In PostgreSQL body terminates with $$ LANGUAGE plpgsql.
In PostgreSQL body terminates with $$ LANGUAGE plpgsql .
bool SqlParser::ParsePostgresBodyEnd()
{
	Token *dol = GetNextCharToken('$', L'$');
	if(dol == NULL)
		return false;
	Token *dol2 = GetNextCharToken('$', L'$');
	Token *name = NULL;
	if(dol2 == NULL)
	{
		name = GetNextToken();
		dol2 = GetNextCharToken('$', L'$');
	}
	if(dol2 == NULL)
		return false;
	Token *language = NULL;
	Token *plpgsql = NULL;
	Token *semi = NULL;
	if(dol2 != NULL)
		language = GetNextWordToken("LANGUAGE", L"LANGUAGE", 8);
	if(language != NULL)
		plpgsql = GetNextWordToken("PLPGSQL", L"PLPGSQL", 7);
	if(plpgsql != NULL)
	{
		while(true)
		{
			Token *option = GetNextToken();
			if(option == NULL)
				break;
			bool exists = false;
			if(option->Compare("VOLATILE", L"VOLATILE", 8) == true)
			{
				if(_target != SQL_POSTGRESQL)
					Token::Remove(option);
				exists = true;
				continue;
			}
			else
			if(option->Compare("COST", L"COST", 4) == true)
			{
				Token *num = GetNextToken();
				if(_target != SQL_POSTGRESQL)
					Token::Remove(option, num);
				exists = true;
				continue;
			}
			PushBack(option);
			break;
		}
		semi = GetNextCharToken(';', L';');
	}
	if(_target == SQL_ORACLE)
	{
		Token::ChangeNoFormat(dol, "/", L"/", 1);
		Token::Remove(name);
		Token::Remove(dol2, plpgsql);
		Token::Remove(semi);
	}
	return true;
}
bool SqlParser :: ParsePostgresBodyEnd ( ) { Token * dol = GetNextCharToken ( ' ' , L' ' ) ; if ( dol == NULL ) return false ; Token * dol2 = GetNextCharToken ( ' ' , L' ' ) ; Token * name = NULL ; if ( dol2 == NULL ) { name = GetNextToken ( ) ; dol2 = GetNextCharToken ( ' ' , L' ' ) ; } if ( dol2 == NULL ) return false ; Token * language = NULL ; Token * plpgsql = NULL ; Token * semi = NULL ; if ( dol2 != NULL ) language = GetNextWordToken ( " " , L" " , 8 ) ; if ( language != NULL ) plpgsql = GetNextWordToken ( " " , L" " , 7 ) ; if ( plpgsql != NULL ) { while ( true ) { Token * option = GetNextToken ( ) ; if ( option == NULL ) break ; bool exists = false ; if ( option -> Compare ( " " , L" " , 8 ) == true ) { if ( _target != SQL_POSTGRESQL ) Token :: Remove ( option ) ; exists = true ; continue ; } else if ( option -> Compare ( " " , L" " , 4 ) == true ) { Token * num = GetNextToken ( ) ; if ( _target != SQL_POSTGRESQL ) Token :: Remove ( option , num ) ; exists = true ; continue ; } PushBack ( option ) ; break ; } semi = GetNextCharToken ( ' ' , L' ' ) ; } if ( _target == SQL_ORACLE ) { Token :: ChangeNoFormat ( dol , " " , L" " , 1 ) ; Token :: Remove ( name ) ; Token :: Remove ( dol2 , plpgsql ) ; Token :: Remove ( semi ) ; } return true ; }
In PostgreSQL body terminates with $$ LANGUAGE plpgsql;
In PostgreSQL body terminates with $$ LANGUAGE plpgsql ;
// $body$ // Options // VOLATILE // COST n // Change to / for Oracle