@ -41,8 +41,7 @@ import java.util.stream.Collectors;
import com.alibaba.druid.sql.ast.SQLStatement ;
import com.alibaba.druid.sql.ast.SQLStatement ;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser ;
import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser ;
import com.alibaba.druid.sql.parser.SQLParserFeature ;
import com.alibaba.druid.sql.parser.SQLParserUtils ;
import com.alibaba.druid.sql.parser.SQLStatementParser ;
import com.google.auto.service.AutoService ;
import com.google.auto.service.AutoService ;
@AutoService ( DataSourceProcessor . class )
@AutoService ( DataSourceProcessor . class )
@ -149,9 +148,11 @@ public class OracleDataSourceProcessor extends AbstractDataSourceProcessor {
@Override
@Override
public List < String > splitAndRemoveComment ( String sql ) {
public List < String > splitAndRemoveComment ( String sql ) {
SQLStatementParser parser = new OracleStatementParser ( sql , SQLParserFeature . KeepComments ) ;
if ( sql . toUpperCase ( ) . contains ( "BEGIN" ) & & sql . toUpperCase ( ) . contains ( "END" ) ) {
List < SQLStatement > statementList = parser . parseStatementList ( ) ;
return new OracleStatementParser ( sql ) . parseStatementList ( ) . stream ( ) . map ( SQLStatement : : toString )
return statementList . stream ( ) . map ( SQLStatement : : toString ) . collect ( Collectors . toList ( ) ) ;
. collect ( Collectors . toList ( ) ) ;
}
return SQLParserUtils . splitAndRemoveComment ( sql , com . alibaba . druid . DbType . oracle ) ;
}
}
private String transformOther ( Map < String , String > otherMap ) {
private String transformOther ( Map < String , String > otherMap ) {