Author: scotsmatrix
Date: Thu Jun 28 17:02:10 2007
New Revision: 551737
URL: http://svn.apache.org/viewvc?view=rev&rev=551737
Log:
DERBY-2850: Porting changes to 10.3 branch. Patch committed by me.
Modified:
db/derby/docs/branches/10.3/src/ref/crefjavstateautogen.dita
Modified: db/derby/docs/branches/10.3/src/ref/crefjavstateautogen.dita
URL: http://svn.apache.org/viewvc/db/derby/docs/branches/10.3/src/ref/crefjavstateautogen.dita?view=diff&rev=551737&r1=551736&r2=551737
==============================================================================
--- db/derby/docs/branches/10.3/src/ref/crefjavstateautogen.dita (original)
+++ db/derby/docs/branches/10.3/src/ref/crefjavstateautogen.dita Thu Jun 28 17:02:10 2007
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
+
<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN"
"../dtd/concept.dtd">
<!--
@@ -23,75 +24,58 @@
<keywords><indexterm>autogenerated keys</indexterm></keywords>
</metadata></prolog>
<conbody>
-<p>JDBC 3.0's autogenerated keys feature provides a way to retrieve values
+<p>JDBC 3.0's auto-generated keys feature provides a way to retrieve values
from columns that are part of an index or have a default value assigned. <ph
-conref="../conrefs.dita#prod/productshortname"></ph> supports the autoincrement
+conref="../conrefs.dita#prod/productshortname"></ph> supports the auto-increment
feature, which allows users to create columns in tables for which the database
system automatically assigns increasing integer values. In JDBC 3.0, the method <i>Statement.getGeneratedKeys</i>
can
be called to retrieve the value of such a column. This method returns a <i>ResultSet</i>
object
with a column for the automatically generated key. Calling <i>ResultSet.getMetaData</i>
on
-the <i>ResultSet</i> object returned by <i>getGeneratedKeys</i> produces
a <i>ResultSetMetaData</i> object that is similar to that returned by <xref
href="rrefidentityvallocal.dita#rrefidentityvallocal">IDENTITY_VAL_LOCAL</xref>.
-</p><p>
-Users can indicate that auto-generated columns should be made available for
-retrieval by passing one of the following values as a second argument to the
-<i>Connection.prepareStatement</i>, <i>Statement.execute</i>, or
-<i>Statement.executeUpdate</i> methods:</p>
+the <i>ResultSet</i> object returned by <i>getGeneratedKeys</i> produces
a <i>ResultSetMetaData</i> object
+that is similar to that returned by <xref href="rrefidentityvallocal.dita#rrefidentityvallocal">IDENTITY_VAL_LOCAL</xref>.
</p>
+<p> Users can indicate that auto-generated columns should be made available
+for retrieval by passing one of the following values as a second argument
+to the <i>Connection.prepareStatement</i>, <i>Statement.execute</i>,
or <i>Statement.executeUpdate</i> methods:</p>
<ul>
-<li>A constant indicating that auto-generated keys should be made available.
-The specific constant to use is
-<codeph>Statement.RETURN_GENERATED_KEYS</codeph>.
-</li>
-<li>An array of the names of the columns in the inserted row that should be
-made available. If any column name in the array does <i>not</i> designate an
-auto-increment column, <ph conref="../conrefs.dita#prod/productshortname"></ph>
-will throw an error. (This argument is supported only with the
-<ph conref="../conrefs.dita#prod/productshortname"></ph> embedded driver.)
-</li>
-<li>An array of the positions of the columns in the inserted row that should be
-made available. If any column position in the array does <i>not</i> correlate
-to an auto-increment column,
-<ph conref="../conrefs.dita#prod/productshortname"></ph> will throw an error.
-(This argument is supported only with the
-<ph conref="../conrefs.dita#prod/productshortname"></ph> embedded driver.)
-</li>
+<li>A constant indicating that auto-generated keys should be made available.
+ The specific constant to use is <codeph>Statement.RETURN_GENERATED_KEYS</codeph>.
</li>
+<li>An array of the names of the columns in the inserted row that should be
+ made available. If any column name in the array does <i>not</i> designate
+an auto-increment column, <ph conref="../conrefs.dita#prod/productshortname"></ph>
+will throw an error. (This argument is supported only with the <ph conref="../conrefs.dita#prod/productshortname"></ph>
embedded
+driver.) </li>
+<li>An array of the positions of the columns in the inserted row that should
+be made available. If any column position in the array does <i>not</i> correlate
+ to an auto-increment column, <ph conref="../conrefs.dita#prod/productshortname"></ph>
will
+throw an error. (This argument is supported only with the <ph conref="../conrefs.dita#prod/productshortname"></ph>
embedded
+driver.) </li>
</ul>
-<section><title>Example</title>
-<p>Assume that we have a table TABLE1 defined as follows:</p>
-<codeblock>CREATE TABLE TABLE1 (C11 int, C12 int GENERATED ALWAYS AS IDENTITY)
-</codeblock>
-<p>The following three code fragments will all do the same thing: that is, they
-will create a <i>ResultSet</i> that contains the value of <codeph>C12</codeph>
-that is inserted into TABLE1.</p>
-<p>Code fragment 1:</p>
-<codeblock>
+<section><title>Example</title> <p>Assume that we have a table TABLE1
defined
+as follows:</p> <codeblock>CREATE TABLE TABLE1 (C11 int, C12 int GENERATED ALWAYS
AS IDENTITY)
+</codeblock> <p>The following three code fragments will all do the same thing:
+that is, they will create a <i>ResultSet</i> that contains the value of <codeph>C12</codeph>
+that is inserted into TABLE1.</p> <p>Code fragment 1:</p> <codeblock>
Statement stmt = conn.createStatement();
stmt.execute(
"INSERT INTO TABLE1 (C11) VALUES (1)",
- Statement.RETURN_GENERATED_KEY);
+ Statement.RETURN_GENERATED_KEYS);
ResultSet rs = stmt.getGeneratedKeys();
-</codeblock>
-<p>Code fragment 2:</p>
-<codeblock>
+</codeblock> <p>Code fragment 2:</p> <codeblock>
Statement stmt = conn.createStatement();
String [] colNames = new String [] { "C12" };
stmt.execute(
"INSERT INTO TABLE1 (C11) VALUES (1)",
colNames);
ResultSet rs = stmt.getGeneratedKeys();
-</codeblock>
-<p>Code fragment 3:</p>
-<codeblock>
+</codeblock> <p>Code fragment 3:</p> <codeblock>
Statement stmt = conn.createStatement();
int [] colIndexes = new int [] { 2 };
stmt.execute(
"INSERT INTO TABLE1 (C11) VALUES (1)",
colIndexes);
ResultSet rs = stmt.getGeneratedKeys();
-</codeblock>
-<p>If there is no indication that auto-generated columns should be made
-available for retrieval, a call to <i>Statement.getGeneratedKeys</i> will
-return a null <i>ResultSet</i>.</p>
-</section>
+</codeblock> <p>If there is no indication that auto-generated columns should
+be made available for retrieval, a call to <i>Statement.getGeneratedKeys</i>
will
+ return a null <i>ResultSet</i>.</p> </section>
</conbody>
</concept>
-
|