94 lines
5.5 KiB
HTML
94 lines
5.5 KiB
HTML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE html
|
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html lang="en-us" xml:lang="en-us">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<meta name="security" content="public" />
|
|
<meta name="Robots" content="index,follow" />
|
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
|
<meta name="DC.Type" content="reference" />
|
|
<meta name="DC.Title" content="Cursor Behavior Notes" />
|
|
<meta name="abstract" content="Cursor behaviors can affect how data is fetched when working with the iSeries Access ODBC driver." />
|
|
<meta name="description" content="Cursor behaviors can affect how data is fetched when working with the iSeries Access ODBC driver." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzaikodbcapifunctions.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="cursorrow" />
|
|
<meta name="DC.Language" content="en-us" />
|
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|
<!-- US Government Users Restricted Rights -->
|
|
<!-- Use, duplication or disclosure restricted by -->
|
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
|
<title>Cursor Behavior Notes</title>
|
|
</head>
|
|
<body id="cursorrow"><a name="cursorrow"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Cursor Behavior Notes<sup>®</sup></h1>
|
|
<div><p>Cursor behaviors can affect how data is fetched when working with
|
|
the iSeries™ Access
|
|
ODBC driver.</p>
|
|
<div class="section"><p>Cursor types can be set via SQLSetStmtAttr with the SQL_ATTR_CURSOR_TYPE
|
|
option. </p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Cursor types: </h4><ul><li>SQL_CURSOR_FORWARD_ONLY - All catalog and stored procedure result sets
|
|
use this type of cursor. When a catalog or stored procedure result set has
|
|
been generated the cursor type will be automatically changed to this. </li>
|
|
<li>SQL_CURSOR_KEYSET_DRIVEN - mapped to SQL_CURSOR_STATIC if the host supports
|
|
it, otherwise it is mapped to SQL_CURSOR_DYNAMIC </li>
|
|
<li>SQL_CURSOR_DYNAMIC - supported.</li>
|
|
<li>SQL_CURSOR_STATIC - A static cursor is supported to V5R1 and later iSeries servers.
|
|
This cursor type is mapped to SQL_CURSOR_DYNAMIC for earlier iSeries versions.</li>
|
|
</ul>
|
|
<div class="note"><span class="notetitle">Note:</span> For more information on cursor types and stored procedure result
|
|
sets see <a href="rzaikspresultsets.htm">Stored procedure result sets</a>.</div>
|
|
</div>
|
|
<div class="section"><p>The following factors can affect the concurrency of the cursor:</p>
|
|
<ul><li>If the SQL statement contains the "FOR UPDATE" clause the value for SQL_ATTR_CONCURRENCY
|
|
will be set to SQL_CONCUR_LOCK. </li>
|
|
<li> If the CONCURRENCY keyword / DSN setting is set to 1 (checked) then if
|
|
the SQL statement does not have "FOR FETCH ONLY" clause in it the ODBC driver
|
|
will lock records from the result set.</li>
|
|
</ul>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Rowset size: </h4><p>The ODBC driver uses the value of
|
|
SQL_ROWSET_SIZE when dealing with SQLExtendedFetch. The driver uses the value
|
|
of SQL_ATTR_ROW_ARRAY_SIZE when dealing with SQLFetch and SQLFetchScroll.
|
|
</p>
|
|
</div>
|
|
<div class="section"><p>When there are LOBs in a result set there is a chance that locators
|
|
may be used by the driver. Locators are internal handles to LOB fields. Locators
|
|
are used when the setting for the MAXFIELDLEN connection option has a smaller
|
|
value than the size of a LOB column in the result set. Locators can improve
|
|
performance in some cases as the driver only gets the data the application
|
|
asks for. The downside of locators is that there is some extra communication
|
|
needed with the server. When locators are not used the driver will download
|
|
more LOB data even if it is not used. It is strongly encouraged that the
|
|
COMPRESSION connection option be enabled if locators are not being used. See
|
|
Connection String keywords descriptions for more details on the MAXFIELDLEN
|
|
keyword</p>
|
|
</div>
|
|
<div class="section"><p>SQLGetData can only be used for accessing data from single row
|
|
fetches. Calling SQLGetData with multiple-row fetches is not supported.</p>
|
|
</div>
|
|
<div class="section"><h4 class="sectiontitle">Result set row counts:</h4><p>There are several options
|
|
that your application can use to determine the row count before fetching data: </p>
|
|
<ul><li>You can set the cursor type to SQL_CURSOR_STATIC. </li>
|
|
<li>If your application uses ADO, you can use client-side cursors. </li>
|
|
<li>Your application can use the COUNT() function by calling SELECT COUNT(*)
|
|
FROM MYTABLE prior to running the actual query. </li>
|
|
<li>You can run the same query twice. The first time the query is run, fetch
|
|
all the data to count the number of rows.</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikodbcapifunctions.htm" title="Learn about implementations issues when using ODBC APIs.">Implementation issues of ODBC APIs</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |