sqlparser/statements.cpp
// DROP DATABASE statement in DB2, MySQL
DROP DATABASE statement in DB2, MySQL
DROP DATABASE statement in DB2 MySQL
bool SqlParser::ParseDropDatabaseStatement(Token *drop, Token *database)
{
	if(drop == NULL || database == NULL)
		return false;
	STATS_DECL
    STMS_STATS_V("DROP DATABASE", drop);
	Token *if_ = GetNext("IF", L"IF", 2);
	Token *exists = GetNext(if_, "EXISTS", L"EXISTS", 6);
	Token *name = GetNextIdentToken(SQL_IDENT_OBJECT);
	if(name == NULL)
		return false;
	if(_target == SQL_ORACLE)
	{
		if(_source == SQL_DB2)
			Comment(drop, GetLastToken(GetNextCharToken(';', L';')));
		else
		if(_source == SQL_MYSQL)
		{
			Token::Change(database, "USER", L"USER", 4);
			Append(name, " CASCADE", L" CASCADE", 8, drop);
			Token::Remove(if_, exists);
		}
	}
	return true;
}
bool SqlParser :: ParseDropDatabaseStatement ( Token * drop , Token * database ) { if ( drop == NULL || database == NULL ) return false ; STATS_DECL STMS_STATS_V ( " " , drop ) ; Token * if_ = GetNext ( " " , L" " , 2 ) ; Token * exists = GetNext ( if_ , " " , L" " , 6 ) ; Token * name = GetNextIdentToken ( SQL_IDENT_OBJECT ) ; if ( name == NULL ) return false ; if ( _target == SQL_ORACLE ) { if ( _source == SQL_DB2 ) Comment ( drop , GetLastToken ( GetNextCharToken ( ' ' , L' ' ) ) ) ; else if ( _source == SQL_MYSQL ) { Token :: Change ( database , " " , L" " , 4 ) ; Append ( name , " " , L" " , 8 , drop ) ; Token :: Remove ( if_ , exists ) ; } } return true ; }
DROP DATABASE statement in DB2, MySQL
DROP DATABASE statement in DB2 MySQL
// IF EXISTS in MySQL // Database name // DB2 database not mapped to schema in Oracle, so comment the statement // Use DROP USER in Oracle // CASCADE must be added to drop a user having objects