RowId
Stay organized with collections
Save and categorize content based on your preferences.
The representation (mapping) in the Java programming language of an SQL ROWID
value. An SQL ROWID is a built-in type, a value of which can be thought of as
an address for its identified row in a database table. Whether that address
is logical or, in any respects, physical is determined by its originating data
source.
Methods in the interfaces ResultSet
, CallableStatement
,
and PreparedStatement
, such as getRowId
and setRowId
allow a programmer to access a SQL ROWID
value. The RowId
interface provides a method
for representing the value of the ROWID
as a byte array or as a
String
.
The method getRowIdLifetime
in the interface DatabaseMetaData
,
can be used
to determine if a RowId
object remains valid for the duration of the transaction in
which the RowId
was created, the duration of the session in which
the RowId
was created,
or, effectively, for as long as its identified row is not deleted. In addition
to specifying the duration of its valid lifetime outside its originating data
source, getRowIdLifetime
specifies the duration of a ROWID
value's valid lifetime
within its originating data source. In this, it differs from a large object,
because there is no limit on the valid lifetime of a large object within its
originating data source.
All methods on the RowId
interface must be fully implemented if the
JDBC driver supports the data type.
Public Method Summary
abstract
boolean
|
equals( Object obj)
Compares this RowId to the specified object.
|
abstract
byte[]
|
getBytes()
Returns an array of bytes representing the value of the SQL ROWID
designated by this java.sql.RowId object.
|
abstract
int
|
hashCode()
Returns a hash code value of this RowId object.
|
abstract
String
|
toString()
Returns a String representing the value of the SQL ROWID designated by this
java.sql.RowId object.
|
Public Methods
public
abstract
boolean
equals
(Object obj)
Compares this RowId
to the specified object. The result is
true
if and only if the argument is not null and is a RowId
object that represents the same ROWID as this object.
It is important
to consider both the origin and the valid lifetime of a RowId
when comparing it to another RowId
. If both are valid, and
both are from the same table on the same data source, then if they are equal
they identify
the same row; if one or more is no longer guaranteed to be valid, or if
they originate from different data sources, or different tables on the
same data source, they may be equal but still
not identify the same row.
Parameters
obj |
the Object to compare this RowId object
against. |
Returns
- true if the
RowId
s are equal; false otherwise
public
abstract
byte[]
getBytes
()
Returns an array of bytes representing the value of the SQL ROWID
designated by this java.sql.RowId
object.
Returns
- an array of bytes, whose length is determined by the driver supplying
the connection, representing the value of the ROWID designated by this
java.sql.RowId object.
public
abstract
int
hashCode
()
Returns a hash code value of this RowId
object.
Returns
- a hash code for the
RowId
public
abstract
String
toString
()
Returns a String representing the value of the SQL ROWID designated by this
java.sql.RowId
object.
Like java.sql.Date.toString()
returns the contents of its DATE as the String
"2004-03-17"
rather than as DATE literal in SQL (which would have been the String
DATE "2004-03-17"), toString()
returns the contents of its ROWID in a form specific to the driver supplying
the connection, and possibly not as a ROWID
literal.
Returns
- a String whose format is determined by the driver supplying the
connection, representing the value of the
ROWID
designated
by this java.sql.RowId
object.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eRowId\u003c/code\u003e represents an SQL \u003ccode\u003eROWID\u003c/code\u003e value in Java, acting like an address for a specific row in a database table.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to access and represent the \u003ccode\u003eROWID\u003c/code\u003e value as a byte array or a \u003ccode\u003eString\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe lifetime validity of a \u003ccode\u003eRowId\u003c/code\u003e can vary and is determined by the data source and can be checked using \u003ccode\u003eDatabaseMetaData.getRowIdLifetime\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eRowId\u003c/code\u003e objects can be compared for equality but their validity and origin should be considered for accurate comparisons.\u003c/p\u003e\n"],["\u003cp\u003eJDBC drivers supporting the \u003ccode\u003eROWID\u003c/code\u003e data type must fully implement all methods in the \u003ccode\u003eRowId\u003c/code\u003e interface.\u003c/p\u003e\n"]]],["The `RowId` interface represents an SQL ROWID value, acting as an address for a row in a database table. Key actions include accessing a `ROWID` value via `getRowId` and `setRowId` methods and determining its validity using `getRowIdLifetime`. `RowId` objects can be compared for equality (`equals`), converted to a byte array (`getBytes`), and represented as a string (`toString`). Also, A hash code for the `RowId` object can be generated with `hashCode`. All methods are fully implemented by the JDBC driver.\n"],null,["public interface **RowId** \nThe representation (mapping) in the Java programming language of an SQL ROWID\nvalue. An SQL ROWID is a built-in type, a value of which can be thought of as\nan address for its identified row in a database table. Whether that address\nis logical or, in any respects, physical is determined by its originating data\nsource.\n\n\nMethods in the interfaces `ResultSet`, `CallableStatement`,\nand `PreparedStatement`, such as `getRowId` and `setRowId`\nallow a programmer to access a SQL `ROWID` value. The `RowId`\ninterface provides a method\nfor representing the value of the `ROWID` as a byte array or as a\n`String`.\n\n\nThe method `getRowIdLifetime` in the interface `DatabaseMetaData`,\ncan be used\nto determine if a `RowId` object remains valid for the duration of the transaction in\nwhich the `RowId` was created, the duration of the session in which\nthe `RowId` was created,\nor, effectively, for as long as its identified row is not deleted. In addition\nto specifying the duration of its valid lifetime outside its originating data\nsource, `getRowIdLifetime` specifies the duration of a `ROWID`\nvalue's valid lifetime\nwithin its originating data source. In this, it differs from a large object,\nbecause there is no limit on the valid lifetime of a large object within its\noriginating data source.\n\n\nAll methods on the `RowId` interface must be fully implemented if the\nJDBC driver supports the data type. \n\nSee Also\n\n- [DatabaseMetaData](../../../reference/java/sql/DatabaseMetaData.html) \n\nPublic Method Summary\n\n|-------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract boolean | [equals](../../../reference/java/sql/RowId.html#equals(java.lang.Object))([Object](../../../reference/java/lang/Object.html) obj) Compares this `RowId` to the specified object. |\n| abstract byte\\[\\] | [getBytes](../../../reference/java/sql/RowId.html#getBytes())() Returns an array of bytes representing the value of the SQL `ROWID` designated by this `java.sql.RowId` object. |\n| abstract int | [hashCode](../../../reference/java/sql/RowId.html#hashCode())() Returns a hash code value of this `RowId` object. |\n| abstract [String](../../../reference/java/lang/String.html) | [toString](../../../reference/java/sql/RowId.html#toString())() Returns a String representing the value of the SQL ROWID designated by this `java.sql.RowId` object. |\n\nPublic Methods \n\npublic abstract boolean\n**equals**\n([Object](../../../reference/java/lang/Object.html) obj) \nCompares this `RowId` to the specified object. The result is\n`true` if and only if the argument is not null and is a RowId\nobject that represents the same ROWID as this object.\n\n\nIt is important\nto consider both the origin and the valid lifetime of a `RowId`\nwhen comparing it to another `RowId`. If both are valid, and\nboth are from the same table on the same data source, then if they are equal\nthey identify\nthe same row; if one or more is no longer guaranteed to be valid, or if\nthey originate from different data sources, or different tables on the\nsame data source, they may be equal but still\nnot identify the same row. \n\nParameters\n\n| obj | the `Object` to compare this `RowId` object against. |\n|-----|------------------------------------------------------|\n\nReturns\n\n- true if the `RowId`s are equal; false otherwise \n\npublic abstract byte\\[\\]\n**getBytes**\n() \nReturns an array of bytes representing the value of the SQL `ROWID`\ndesignated by this `java.sql.RowId` object. \n\nReturns\n\n- an array of bytes, whose length is determined by the driver supplying the connection, representing the value of the ROWID designated by this java.sql.RowId object. \n\npublic abstract int\n**hashCode**\n() \nReturns a hash code value of this `RowId` object. \n\nReturns\n\n- a hash code for the `RowId` \n\npublic abstract [String](../../../reference/java/lang/String.html)\n**toString**\n() \nReturns a String representing the value of the SQL ROWID designated by this\n`java.sql.RowId` object.\n\n\nLike `java.sql.Date.toString()`\nreturns the contents of its DATE as the `String` \"2004-03-17\"\nrather than as DATE literal in SQL (which would have been the `String`\nDATE \"2004-03-17\"), toString()\nreturns the contents of its ROWID in a form specific to the driver supplying\nthe connection, and possibly not as a `ROWID` literal. \n\nReturns\n\n- a String whose format is determined by the driver supplying the connection, representing the value of the `ROWID` designated by this `java.sql.RowId` object."]]