public static boolean addMatchReocrd(MatchRecord record){
boolean suc = false;
try {
Connection connection = DbMysqlConnector.getConnection();
String sql = "{CALL `p_match_record_add`(?,?,?,?,?,?)}";
PreparedStatement statement = connection.prepareStatement(sql);
ByteArrayInputStream stream = null;
try{
statement.setInt(1, record.getPk_dev());
statement.setObject(2, record.getAcc_time());
stream = new ByteArrayInputStream(Base64Util.decode(record.getTpl_left()));
statement.setBinaryStream(3, stream, stream.available());
stream = new ByteArrayInputStream(Base64Util.decode(record.getTpl_right()));
statement.setBinaryStream(4, stream, stream.available());
stream = new ByteArrayInputStream(Base64Util.decode(record.getImg_left()));
statement.setBinaryStream(5, stream, stream.available());
stream = new ByteArrayInputStream(Base64Util.decode(record.getImg_right()));
statement.setBinaryStream(6, stream, stream.available());
statement.executeQuery();
}catch (Exception e){
e.printStackTrace();
}finally {
try {
statement.close();
connection.close();
if(stream != null){
stream.close();
}
}catch (Exception e){
e.printStackTrace();
}
}
suc = true;
} catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return suc;
}