public static OptimizeEngine newInstance ( final ShardingRule shardingRule , final SQLStatement sqlStatement , final List < Object > parameters , final GeneratedKey generatedKey ) { if ( sqlStatement instanceof InsertStatement ) { return new InsertOptimizeEngine ( shardingRule , ( InsertStatement ) sqlStatement , parameters , generatedKey ) ; } if ( sqlStatement instanceof SelectStatement || sqlStatement instanceof DMLStatement ) { return new QueryOptimizeEngine ( sqlStatement . getRouteConditions ( ) . getOrCondition ( ) , parameters ) ; } // TODO do with DDL and DAL return new QueryOptimizeEngine ( sqlStatement . getRouteConditions ( ) . getOrCondition ( ) , parameters ) ; }
Create optimize engine instance .