public String rewrite ( ) { if ( sqlTokens . isEmpty ( ) ) { return originalSQL ; } SQLBuilder result = new SQLBuilder ( Collections . emptyList ( ) ) ; int count = 0 ; for ( SQLToken each : sqlTokens ) { if ( 0 == count ) { result . appendLiterals ( originalSQL . substring ( 0 , each . getStartIndex ( ) ) ) ; } if ( each instanceof SchemaToken ) { appendSchemaPlaceholder ( originalSQL , result , ( SchemaToken ) each , count ) ; } count ++ ; } return result . toSQL ( masterSlaveRule , metaData . getDataSource ( ) ) ; }
Rewrite SQL .