2 * Copyright © 2017 AT&T and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.inventory.query;
10 import java.sql.PreparedStatement;
11 import java.sql.SQLException;
13 public final class StatementBuilder {
15 private final PreparedStatement statement;
18 private StatementBuilder(PreparedStatement statement) {
19 this.statement = statement;
23 public StatementBuilder setParameter(String value) throws SQLException {
24 this.statement.setString(this.index++, value);
28 public StatementBuilder setParameter(Long value) throws SQLException {
29 this.statement.setLong(this.index++, value);
33 public StatementBuilder setParameters(String... strings) throws SQLException {
34 for (int i = 0; i < strings.length; i++) {
35 statement.setString(i + 1, strings[i]);
40 public StatementBuilder reset() {
45 public static StatementBuilder builder(PreparedStatement statement) {
46 return new StatementBuilder(statement);