ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzaik_5.4.0.1/rzaiksqlfetchgetdata.htm

66 lines
4.3 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="SQLFetch and SQLGetData" />
<meta name="abstract" content="SQLGetData provides an alternative to SQLBindCol to retrieve data from the columns of a retrieved row. It can only be called after calling fetch APIs and when the array size is 1." />
<meta name="description" content="SQLGetData provides an alternative to SQLBindCol to retrieve data from the columns of a retrieved row. It can only be called after calling fetch APIs and when the array size is 1." />
<meta name="DC.Relation" scheme="URI" content="rzaikodbcapiinfo.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="sqlfetchgetdata" />
<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>SQLFetch and SQLGetData</title>
</head>
<body id="sqlfetchgetdata"><a name="sqlfetchgetdata"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">SQLFetch and SQLGetData</h1>
<div><p><strong>SQLGetData</strong> provides an alternative to <strong>SQLBindCol</strong> to
retrieve data from the columns of a retrieved row. It can only be called after
calling fetch APIs and when the array size is 1.</p>
<div class="section"></div>
<div class="section"><p>As a general rule, <strong>SQLBindCol</strong> is preferable to <strong>SQLGetData</strong>.
There is less performance overhead; you need to run <strong>SQLBindCol</strong> only
once rather than after every fetch. However, there are special considerations
for using <strong>SQLBindCol</strong> in Visual Basic.</p>
</div>
<div class="section"><p>Visual Basic moves character strings to different locations to
conserve memory. If a string variable is bound to a column, the memory that
is referenced by a subsequent <strong>SQLFetch</strong> may not place the data in the
desired variable. It is likely that a <strong>General Protection Fault</strong> will
result. A similar problem can occur with <strong>SQLBindParameter</strong>.</p>
</div>
<div class="section"><p>Using strings in Visual Basic is not recommended. One way to avoid
this problem is to use <strong>byte arrays</strong>. Byte arrays are of a fixed size
and are not subject to movement in memory.</p>
</div>
<div class="section"><p>Another circumvention is to employ Windows<sup>®</sup> memory allocation API functions
that are documented in the <a href="http://msdn.microsoft.com/library/default.asp">Microsoft<sup>®</sup> Development Library</a> Knowledge
Base. However, this method involves some difficult programming that is not
totally transportable between Windows 3.1 and later releases.</p>
</div>
<div class="section"><p>Using <strong>SQLGetData</strong> rather than <strong>SQLBindCol</strong> and <strong>SQLParamData</strong> and <strong>SQLPutData</strong> in
conjunction with <strong>SQLBindParameter</strong> produce software that is more in
keeping with Visual Basic. However, this method involves some difficult programming.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikodbcapiinfo.htm" title="Identify the files required to build an ODBC application.">Files required to build an ODBC application</a></div>
</div>
</div>
</body>
</html>