src/jdk.incubator.adba/share/classes/jdk/incubator/sql2/ParameterizedRowCountOperation.java
author lancea
Sat, 20 Oct 2018 08:17:38 -0400
branchJDK-8188051-branch
changeset 56997 c9cbac2979fb
parent 56797 fb523d4d9185
permissions -rw-r--r--
JDK-8188051-branch October 20 ABDA 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
/**
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    34
 * A {@code ParameterizedRowCountOperation} is a {@link ParameterizedOperation} that returns a count.
56797
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
  
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    59
  /**
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    60
   * {@inheritDoc}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    61
   * 
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    62
   * @return this {@code ParameterizedRowCountOperation}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    63
   */
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    64
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    65
  public ParameterizedRowCountOperation<T> onError(Consumer<Throwable> handler);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    66
  
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    67
  /**
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    68
   * {@inheritDoc}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    69
   * 
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    70
   * @return this {@code ParameterizedRowCountOperation}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    71
   */
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    72
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    73
  ParameterizedRowCountOperation<T> apply(Function<Result.RowCount, ? extends T> processor);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    74
  
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    75
  /**
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    76
   * {@inheritDoc}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    77
   * 
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    78
   * @return this {@code ParameterizedRowCountOperation}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    79
   */
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    80
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    81
  public ParameterizedRowCountOperation<T> set(String id, Object value);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    82
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    83
  /**
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    84
   * {@inheritDoc}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    85
   * 
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    86
   * @return this {@code ParameterizedRowCountOperation}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    87
   */
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    88
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    89
  public ParameterizedRowCountOperation<T> set(String id, Object value, SqlType type);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    90
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    91
  /**
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    92
   * {@inheritDoc}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    93
   * 
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    94
   * @return this {@code ParameterizedRowCountOperation}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    95
   */
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    96
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    97
  public ParameterizedRowCountOperation<T> set(String id, CompletionStage<?> source);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
    98
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
    99
  /**
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   100
   * {@inheritDoc}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   101
   * 
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   102
   * @return this {@code ParameterizedRowCountOperation}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   103
   */
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
   104
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
   105
  public ParameterizedRowCountOperation<T> set(String id, CompletionStage<?> source, SqlType type);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
   106
56997
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   107
  /**
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   108
   * {@inheritDoc}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   109
   * 
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   110
   * @return this {@code ParameterizedRowCountOperation}
c9cbac2979fb JDK-8188051-branch October 20 ABDA updates
lancea
parents: 56797
diff changeset
   111
   */
56797
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
   112
  @Override
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
   113
  public ParameterizedRowCountOperation<T> timeout(Duration minTime);
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
   114
fb523d4d9185 JDK-8188051-branch updates
lancea
parents:
diff changeset
   115
}