src/java.sql/share/classes/java/sql/RowId.java
author alanb
Tue, 15 May 2018 09:33:02 +0100
changeset 50109 ea54197f4fe4
parent 47216 71c04702a3d5
permissions -rw-r--r--
8203059: (so) Closing a socket channel registered with Selector and with SO_LINGER set to 0 does not reset connection Reviewed-by: chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.sql;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * The representation (mapping) in the Java programming language of an SQL ROWID
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * value. An SQL ROWID is a built-in type, a value of which can be thought of as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * an address  for its identified row in a database table. Whether that address
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * is logical or, in any  respects, physical is determined by its originating data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * Methods in the interfaces <code>ResultSet</code>, <code>CallableStatement</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * and <code>PreparedStatement</code>, such as <code>getRowId</code> and <code>setRowId</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * allow a programmer to access a SQL <code>ROWID</code>  value. The <code>RowId</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * interface provides a method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * for representing the value of the <code>ROWID</code> as a byte array or as a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * <code>String</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * The method <code>getRowIdLifetime</code> in the interface <code>DatabaseMetaData</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * can be used
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * to determine if a <code>RowId</code> object remains valid for the duration of the transaction in
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * which  the <code>RowId</code> was created, the duration of the session in which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * the <code>RowId</code> was created,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * or, effectively, for as long as its identified row is not deleted. In addition
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * to specifying the duration of its valid lifetime outside its originating data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * source, <code>getRowIdLifetime</code> specifies the duration of a <code>ROWID</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * value's valid lifetime
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * within its originating data source. In this, it differs from a large object,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * because there is no limit on the valid lifetime of a large  object within its
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * originating data source.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * All methods on the <code>RowId</code> interface must be fully implemented if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * JDBC driver supports the data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * @see java.sql.DatabaseMetaData
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
public interface RowId {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * Compares this <code>RowId</code> to the specified object. The result is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * <code>true</code> if and only if the argument is not null and is a RowId
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * object that represents the same ROWID as  this object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * It is important
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * to consider both the origin and the valid lifetime of a <code>RowId</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * when comparing it to another <code>RowId</code>. If both are valid, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * both are from the same table on the same data source, then if they are equal
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * they identify
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * the same row; if one or more is no longer guaranteed to be valid, or if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * they originate from different data sources, or different tables on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * same data source, they  may be equal but still
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * not identify the same row.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * @param obj the <code>Object</code> to compare this <code>RowId</code> object
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *     against.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @return true if the <code>RowId</code>s are equal; false otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    boolean equals(Object obj);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * Returns an array of bytes representing the value of the SQL <code>ROWID</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * designated by this <code>java.sql.RowId</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * @return an array of bytes, whose length is determined by the driver supplying
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *     the connection, representing the value of the ROWID designated by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *     java.sql.RowId object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     byte[] getBytes();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
      * Returns a String representing the value of the SQL ROWID designated by this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
      * <code>java.sql.RowId</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
      * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
      *Like <code>java.sql.Date.toString()</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
      * returns the contents of its DATE as the <code>String</code> "2004-03-17"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
      * rather than as  DATE literal in SQL (which would have been the <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
      * DATE "2004-03-17"), toString()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
      * returns the contents of its ROWID in a form specific to the driver supplying
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      * the connection, and possibly not as a <code>ROWID</code> literal.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
      * @return a String whose format is determined by the driver supplying the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
      *     connection, representing the value of the <code>ROWID</code> designated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
      *     by this <code>java.sql.RowId</code>  object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     String toString();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
      * Returns a hash code value of this <code>RowId</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      * @return a hash code for the <code>RowId</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     int hashCode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
}