Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/java/sql/RowId.java
38829 views
/*1* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package java.sql;2627/**28*29* The representation (mapping) in the Java programming language of an SQL ROWID30* value. An SQL ROWID is a built-in type, a value of which can be thought of as31* an address for its identified row in a database table. Whether that address32* is logical or, in any respects, physical is determined by its originating data33* source.34* <p>35* Methods in the interfaces <code>ResultSet</code>, <code>CallableStatement</code>,36* and <code>PreparedStatement</code>, such as <code>getRowId</code> and <code>setRowId</code>37* allow a programmer to access a SQL <code>ROWID</code> value. The <code>RowId</code>38* interface provides a method39* for representing the value of the <code>ROWID</code> as a byte array or as a40* <code>String</code>.41* <p>42* The method <code>getRowIdLifetime</code> in the interface <code>DatabaseMetaData</code>,43* can be used44* to determine if a <code>RowId</code> object remains valid for the duration of the transaction in45* which the <code>RowId</code> was created, the duration of the session in which46* the <code>RowId</code> was created,47* or, effectively, for as long as its identified row is not deleted. In addition48* to specifying the duration of its valid lifetime outside its originating data49* source, <code>getRowIdLifetime</code> specifies the duration of a <code>ROWID</code>50* value's valid lifetime51* within its originating data source. In this, it differs from a large object,52* because there is no limit on the valid lifetime of a large object within its53* originating data source.54* <p>55* All methods on the <code>RowId</code> interface must be fully implemented if the56* JDBC driver supports the data type.57*58* @see java.sql.DatabaseMetaData59* @since 1.660*/6162public interface RowId {63/**64* Compares this <code>RowId</code> to the specified object. The result is65* <code>true</code> if and only if the argument is not null and is a RowId66* object that represents the same ROWID as this object.67* <p>68* It is important69* to consider both the origin and the valid lifetime of a <code>RowId</code>70* when comparing it to another <code>RowId</code>. If both are valid, and71* both are from the same table on the same data source, then if they are equal72* they identify73* the same row; if one or more is no longer guaranteed to be valid, or if74* they originate from different data sources, or different tables on the75* same data source, they may be equal but still76* not identify the same row.77*78* @param obj the <code>Object</code> to compare this <code>RowId</code> object79* against.80* @return true if the <code>RowId</code>s are equal; false otherwise81* @since 1.682*/83boolean equals(Object obj);8485/**86* Returns an array of bytes representing the value of the SQL <code>ROWID</code>87* designated by this <code>java.sql.RowId</code> object.88*89* @return an array of bytes, whose length is determined by the driver supplying90* the connection, representing the value of the ROWID designated by this91* java.sql.RowId object.92*/93byte[] getBytes();9495/**96* Returns a String representing the value of the SQL ROWID designated by this97* <code>java.sql.RowId</code> object.98* <p>99*Like <code>java.sql.Date.toString()</code>100* returns the contents of its DATE as the <code>String</code> "2004-03-17"101* rather than as DATE literal in SQL (which would have been the <code>String</code>102* DATE "2004-03-17"), toString()103* returns the contents of its ROWID in a form specific to the driver supplying104* the connection, and possibly not as a <code>ROWID</code> literal.105*106* @return a String whose format is determined by the driver supplying the107* connection, representing the value of the <code>ROWID</code> designated108* by this <code>java.sql.RowId</code> object.109*/110String toString();111112/**113* Returns a hash code value of this <code>RowId</code> object.114*115* @return a hash code for the <code>RowId</code>116*/117int hashCode();118119}120121122