src/jdk.incubator.adba/share/classes/jdk/incubator/sql2/ParameterizedRowCountOperation.java
author lancea
Mon, 09 Jul 2018 15:09:06 -0400
branchJDK-8188051-branch
changeset 56824 62e92191354d
parent 56797 fb523d4d9185
child 56997 c9cbac2979fb
permissions -rw-r--r--
JDK-8188051-branch latest updates
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     1
/*
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     2
 * Copyright (c)  2017, 2018, Oracle and/or its affiliates. All rights reserved.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     4
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    10
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    15
 * accompanied this code).
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    16
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    20
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    23
 * questions.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    24
 */
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    25
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    26
package jdk.incubator.sql2;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    27
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    28
import java.time.Duration;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    29
import java.util.concurrent.CompletionStage;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    30
import java.util.function.Consumer;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    31
import java.util.function.Function;
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    32
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    33
/**
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    34
 * A {@link ParameterizedRowCountOperation} is a {@link ParameterizedOperation} that returns a count.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    35
 *
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    36
 * @param <T> the type of the result of this {@link Operation}
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    37
 */
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    38
public interface ParameterizedRowCountOperation<T> extends ParameterizedOperation<T>, RowCountOperation<T> {
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    39
  
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    40
  /**
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    41
   * Returns a {@link RowOperation} to process the auto-generated keys, if any, returned
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    42
   * by this {@link Operation}. If no keys are named the columns of the returned
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    43
   * rows are implementation dependent. If keys are specified the columns of the
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    44
   * returned rows are the keys. The {@link RowOperation} must be submitted before this 
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    45
   * {@link Operation} is submitted. If it has not submitting this {@link Operation} will
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    46
   * result throw {@link IllegalStateException}.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    47
   * 
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    48
   * ISSUE: Should this be in {@link RowCountOperation}?
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    49
   * 
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    50
   * @param keys the names of the returned columns or null.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    51
   * @return A RowOperation that will process the auto-generated keys
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    52
   * @throws IllegalStateException if this method has already been called on this
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    53
   * {@link Operation} or if this {@link Operation} has already been submitted.
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    54
   */
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    55
  public RowOperation<T> returning(String ... keys);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    56
  
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    57
  // Covariant overrides
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    58
  
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    59
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    60
  public ParameterizedRowCountOperation<T> onError(Consumer<Throwable> handler);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    61
  
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    62
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    63
  ParameterizedRowCountOperation<T> apply(Function<Result.RowCount, ? extends T> processor);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    64
  
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    65
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    66
  public ParameterizedRowCountOperation<T> set(String id, Object value);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    67
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    68
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    69
  public ParameterizedRowCountOperation<T> set(String id, Object value, SqlType type);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    70
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    71
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    72
  public ParameterizedRowCountOperation<T> set(String id, CompletionStage<?> source);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    73
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    74
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    75
  public ParameterizedRowCountOperation<T> set(String id, CompletionStage<?> source, SqlType type);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    76
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    77
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    78
  public ParameterizedRowCountOperation<T> timeout(Duration minTime);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    79
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    80
}