Ejemplo n.º 1
0
  Result executeQuery() {
    SqlStatement stmt = trx.prepare(sqlBuilder);
    ParameterBinder binder = stmt.parameterBinder();

    for (HasParameter parameter : parameterList) {
      parameter.bind(binder);
    }

    return stmt.executeQuery();
  }
Ejemplo n.º 2
0
  void executeInsert(Table table) {
    table.buildInsert(sqlBuilder);
    SqlStatement stmt =
        generatedList.isEmpty() ? trx.prepare(sqlBuilder) : trx.prepareAndGenerateKeys(sqlBuilder);

    for (Values values : valuesList) {
      ValuesBinder binder = stmt.valuesBinder();
      values.bind(binder);
      stmt.addBatch();
    }

    stmt.executeBatch();

    if (!generatedList.isEmpty()) {
      Result generatedKeys = stmt.generatedKeys();
      for (Generated lazy : generatedList) {
        if (generatedKeys.next()) {
          lazy.extract(generatedKeys);
        }
      }
    }
  }