src/main/java/com/conveyal/gtfs/loader/JdbcTableWriter.java
private PreparedStatement createPreparedUpdate(
        Integer id,
        boolean isCreating,
        ObjectNode jsonObject,
        Table table,
        Connection connection,
        boolean batch
    ) throws SQLException {
        String statementString;
        if (isCreating) {
            statementString = table.generateInsertSql(tablePrefix, true);
        } else {
            statementString = table.generateUpdateSql(tablePrefix, id);
        }
        // Set the RETURN_GENERATED_KEYS flag on the PreparedStatement because it may be creating new rows, in which
        // case we need to know the auto-generated IDs of those new rows.
        PreparedStatement preparedStatement = connection.prepareStatement(
                statementString,
                Statement.RETURN_GENERATED_KEYS);
        if (!batch) {
            setStatementParameters(jsonObject, table, preparedStatement, connection);
        }
        return preparedStatement;
    }
private PreparedStatement createPreparedUpdate(
        Integer id,
        boolean isCreating,
        ObjectNode jsonObject,
        Table table,
        Connection connection,
        boolean batch
    ) throws SQLException {
        String statementString;
        if (isCreating) {
            statementString = table.generateInsertSql(tablePrefix, true);
        } else {
            statementString = table.generateUpdateSql(tablePrefix, id);
        }
        // Set the RETURN_GENERATED_KEYS flag on the PreparedStatement because it may be creating new rows, in which
        // case we need to know the auto-generated IDs of those new rows.
        PreparedStatement preparedStatement = connection.prepareStatement(
                statementString,
                Statement.RETURN_GENERATED_KEYS);
        if (!batch) {
            setStatementParameters(jsonObject, table, preparedStatement, connection);
        }
        return preparedStatement;
    }
private PreparedStatement createPreparedUpdate ( Integer id , boolean isCreating , ObjectNode jsonObject , Table table , Connection connection , boolean batch ) throws SQLException { String statementString ; if ( isCreating ) { statementString = table . generateInsertSql ( tablePrefix , true ) ; } else { statementString = table . generateUpdateSql ( tablePrefix , id ) ; } // Set the RETURN_GENERATED_KEYS flag on the PreparedStatement because it may be creating new rows, in which // case we need to know the auto-generated IDs of those new rows. PreparedStatement preparedStatement = connection . prepareStatement ( statementString , Statement . RETURN_GENERATED_KEYS ) ; if ( ! batch ) { setStatementParameters ( jsonObject , table , preparedStatement , connection ) ; } return preparedStatement ; }
Creates a prepared statement for an entity create or update operation. If not performing a batch operation, the
method will set parameters for the prepared statement with values found in the provided JSON ObjectNode. The Table
object here is provided as a positional argument (rather than provided via the JdbcTableWriter instance field)
because this method is used to update both the specTable for the primary entity and any relevant child entities.
Creates a prepared statement for an entity create or update operation . If not performing a batch operation the method will set parameters for the prepared statement with values found in the provided JSON ObjectNode . The Table object here is provided as a positional argument ( rather than provided via the JdbcTableWriter instance field ) because this method is used to update both the specTable for the primary entity and any relevant child entities .