@Override
    public Collection<DatabasePacket> execute() throws SQLException {
        PostgreSQLServerPreparedStatement preparedStatement = getPreparedStatement();
        PostgreSQLBatchedStatementsExecutor executor = new PostgreSQLBatchedStatementsExecutor(connectionSession, preparedStatement, readParameterSets(preparedStatement.getParameterTypes()));
        Collection<DatabasePacket> result = new ArrayList<>(packets.size());
        int totalInserted = executor.executeBatch();
        int executePacketCount = executePacketCount();
        for (PostgreSQLCommandPacket each : packets) {
            if (each instanceof PostgreSQLComBindPacket) {
                result.add(PostgreSQLBindCompletePacket.getInstance());
            }
            if (each instanceof PostgreSQLComDescribePacket) {
                result.add(preparedStatement.describeRows().orElseGet(PostgreSQLNoDataPacket::getInstance));
            }
            if (each instanceof PostgreSQLComExecutePacket) {
                String tag = PostgreSQLCommand.valueOf(preparedStatement.getSqlStatementContext().getSqlStatement().getClass()).orElse(PostgreSQLCommand.INSERT).getTag();
                result.add(new PostgreSQLCommandCompletePacket(tag, 0 == executePacketCount ? 1 : totalInserted / executePacketCount));
            }
        }
        return result;
    }
@Test
    void assertExecute() throws SQLException {
        ConnectionSession connectionSession = mockConnectionSession();
        PostgreSQLAggregatedBatchedStatementsCommandExecutor executor = new PostgreSQLAggregatedBatchedStatementsCommandExecutor(connectionSession, createPackets());
        ContextManager contextManager = mockContextManager();
        when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
        List<DatabasePacket> actualPackets = new ArrayList<>(executor.execute());
        assertThat(actualPackets.size(), is(BATCH_SIZE * 3));
        for (int i = 0; i < BATCH_SIZE; i++) {
            assertThat(actualPackets.get(i * 3), is(PostgreSQLBindCompletePacket.getInstance()));
            assertThat(actualPackets.get(i * 3 + 1), is(PostgreSQLNoDataPacket.getInstance()));
            assertThat(actualPackets.get(i * 3 + 2), instanceOf(PostgreSQLCommandCompletePacket.class));
        }
    }