/*
 * Copyright 2016-2018 shardingsphere.io.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * </p>
 */

package io.shardingsphere.proxy.backend.jdbc.execute;

import io.shardingsphere.core.constant.ConnectionMode;
import io.shardingsphere.core.executor.sql.SQLExecuteUnit;
import io.shardingsphere.core.routing.RouteUnit;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.sql.Statement;

/**
 * Execute unit for JDBC statement.
 *
 * @author zhangliang
 * @author panjuan
 */
@RequiredArgsConstructor
@Getter
public final class StatementExecuteUnit implements SQLExecuteUnit {
    
    private final RouteUnit routeUnit;
    
    private final Statement statement;
    
    private final ConnectionMode connectionMode;
}

@@ -857,47 +857,38 @@
 er;%0A
+%0A
 import 
-lombok.RequiredArgsConstructor;%0A
+java.sql.SQLException;
 %0Aimp
@@ -1004,33 +1004,8 @@
  */%0A
-@RequiredArgsConstructor%0A
 @Get
@@ -1097,131 +1097,905 @@
 ate 
-final RouteUnit routeUnit;%0A    %0A    private final Statement statement;%0A    %0A    private final ConnectionMode connectionMode;
+static final Integer CONNECTION_FETCH_ONE_ROW_A_TIME = 0;%0A    %0A    private static final Integer MEMORY_FETCH_ONE_ROW_A_TIME = Integer.MIN_VALUE;%0A    %0A    private final RouteUnit routeUnit;%0A    %0A    private final Statement statement;%0A    %0A    private final ConnectionMode connectionMode;%0A    %0A    public StatementExecuteUnit(final RouteUnit routeUnit, final Statement statement, final ConnectionMode connectionMode) throws SQLException %7B%0A        this.routeUnit = routeUnit;%0A        this.statement = statement;%0A        this.connectionMode = connectionMode;%0A        setFetchSizeForStatement();%0A    %7D%0A    %0A    private void setFetchSizeForStatement() throws SQLException %7B%0A        if (connectionMode == ConnectionMode.MEMORY_STRICTLY) %7B%0A            statement.setFetchSize(MEMORY_FETCH_ONE_ROW_A_TIME);%0A        %7D else %7B%0A            statement.setFetchSize(CONNECTION_FETCH_ONE_ROW_A_TIME);%0A        %7D%0A    %7D
 %0A%7D%0A

add setFetchSizeForStatement()