class DBAccessorImpl implements DBAccessor {

  protected String buildQuery(String tableName, String[] requestedColumnNames, String[] conditionColumnNames, String[] conditionValues) throws SQLException {
    if (!tableExists(tableName)) {
      throw new IllegalArgumentException(String.format("%s table does not exist", tableName));
    }
    StringBuilder builder = new StringBuilder();
    builder.append("SELECT ");

    // Append the requested column names:
    if ((requestedColumnNames == null) || (requestedColumnNames.length == 0)) {
      throw new IllegalArgumentException("no columns for the select have been set");
    }
    for (String name : requestedColumnNames) {
      if (!tableHasColumn(tableName, name)) {
        throw new IllegalArgumentException(String.format("%s table does not contain %s column", tableName, name));
      }
    }
    builder.append(requestedColumnNames[0]);
    for (int i = 1; i < requestedColumnNames.length; i++) {
      builder.append(", ").append(requestedColumnNames[1]);
    }

    // Append the source table
    builder.append(" FROM ").append(tableName);

    // Add the WHERE clause using the conditionColumnNames and the conditionValues
    if (conditionColumnNames != null && conditionColumnNames.length > 0) {
      for (String name : conditionColumnNames) {
        if (!tableHasColumn(tableName, name)) {
          throw new IllegalArgumentException(String.format("%s table does not contain %s column", tableName, name));
        }
      }
      if (conditionColumnNames.length != conditionValues.length) {
        throw new IllegalArgumentException("number of columns should be equal to number of values");
      }
      builder.append(" WHERE ").append(conditionColumnNames[0]).append("='").append(conditionValues[0]).append("'");
      for (int i = 1; i < conditionColumnNames.length; i++) {
        builder.append(" AND ").append(conditionColumnNames[i]).append("='").append(conditionValues[i]).append("'");
      }
    }

    return builder.toString();
  }

  @Inject public  DBAccessorImpl(Configuration configuration);

}