class OptionDAO {

    public boolean set(String optionName, String optionValue) {
        TransactionalDataSource dataSource = databaseManager.getDataSource();
        if (!exist(optionName)) {
            try (Connection con = dataSource.getConnection()) {
                PreparedStatement stmt = con.prepareStatement("INSERT INTO option (name, \"VALUE\") VALUES (?, ?)");
                stmt.setString(1, optionName);
                stmt.setString(2, optionValue);
                stmt.execute();
            } catch (SQLException e) {
                log.error("OptionDAO insert error, {}={}, {}", optionName, optionValue, e.getMessage());
            }
        } else {
            try (Connection con = dataSource.getConnection()) {
                PreparedStatement stmt = con.prepareStatement("UPDATE option set value = ? WHERE name = ?");
                stmt.setString(1, optionValue);
                stmt.setString(2, optionName);
                stmt.execute();
            } catch (SQLException e) {
                log.error("OptionDAO update error, {}={}, {}", optionName, optionValue, e.getMessage());
            }
        }
        return true;
    }

    @Inject public  OptionDAO(DatabaseManager databaseManager);

}