Demo entry 6780009

Xottabuh

   

Submitted by Xottab on Dec 22, 2018 at 13:18
Language: Java. Code size: 711 Bytes.

 @Override
    public boolean addTicket(Ticket ticket) {
        StringBuilder query = new StringBuilder();
        query.append(String.format("('%s','%s','%s','%s','%s','%s');", ticket.getUser_id(), ticket.getFlightNumber(), ticket.getAirline(),
                ticket.getDeparture_at(), ticket.getReturn_at(), ticket.getPrice()));

        if (findTicket(ticket))
            return false;
        try{
            Connection connection = singleton.getConnection();
            PreparedStatement statement = connection.prepareStatement(query);

            return statement.execute();
        }catch (SQLException e){
            e.printStackTrace();
            return false;
        }
    }

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).