python-cx_Oracle/html/lobobj.html

204 lines
8.2 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="cx_Oracle.css" type='text/css' />
<link rel="first" href="cx_Oracle.html" title='cx_Oracle' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="dateobj.html" />
<link rel="prev" href="sesspool.html" />
<link rel="parent" href="cx_Oracle.html" />
<link rel="next" href="dateobj.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>6. LOB Objects</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="5. sessionpool Objects"
href="sesspool.html"><img src='previous.png'
border='0' height='32' alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="cx_Oracle"
href="cx_Oracle.html"><img src='up.png'
border='0' height='32' alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7. date Objects"
href="dateobj.html"><img src='next.png'
border='0' height='32' alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">cx_Oracle</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='contents.png'
border='0' height='32' alt='Contents' width='32' /></a></td>
<td class='online-navigation'><img src='blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
border='0' height='32' alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="sesspool.html">5. SessionPool Objects</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="cx_Oracle.html">cx_Oracle</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="dateobj.html">7. Date Objects</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->
<h1><a name="SECTION008000000000000000000"></a><a name="lobobj"></a>
<br>
6. LOB Objects
</h1>
<p>
<strong>NOTE</strong>: This object is an extension the DB API. It is returned whenever
Oracle CLOB, BLOB and BFILE columns are fetched.
<p>
<strong>NOTE</strong>: Internally, Oracle uses LOB locators which are allocated based
on the cursor array size. Thus, it is important that the data in the LOB object
be manipulated before another internal fetch takes place. The safest way to do
this is to use the cursor as an iterator. In particular, do not use the
fetchall() method. The exception "LOB variable no longer valid after
subsequent fetch" will be raised if an attempt to access a LOB variable after
a subsequent fetch is detected.
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-139' xml:id='l2h-139' class="function">close</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Close the LOB. Call this when writing is completed so that the indexes
associated with the LOB can be updated.
</dl>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-140' xml:id='l2h-140' class="function">fileexists</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Return a boolean indicating if the file referenced by the BFILE type LOB
exists.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-141' xml:id='l2h-141' class="function">getchunksize</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Return the chunk size for the internal LOB. Reading and writing to the LOB
in chunks of multiples of this size will improve performance.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-142' xml:id='l2h-142' class="function">getfilename</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Return a two-tuple consisting of the directory alias and file name for a
BFILE type LOB.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-143' xml:id='l2h-143' class="function">isopen</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Return a boolean indicating if the LOB is opened.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-144' xml:id='l2h-144' class="function">open</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Open the LOB for writing. This will improve performance when writing to a LOB
in chunks and there are functional or extensible indexes associated with the
LOB.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-145' xml:id='l2h-145' class="function">read</tt></b>(</nobr></td>
<td><var></var><big>[</big><var><var>offset = 1</var>, </var><big>[</big><var><var>amount</var></var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Return a portion (or all) of the data in the LOB object.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-146' xml:id='l2h-146' class="function">setfilename</tt></b>(</nobr></td>
<td><var><var>dirAlias</var>, <var>name</var></var>)</td></tr></table></dt>
<dd>
Set the directory alias and name of the BFILE type LOB.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-147' xml:id='l2h-147' class="function">size</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Returns the size of the data in the LOB object.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-148' xml:id='l2h-148' class="function">trim</tt></b>(</nobr></td>
<td><var></var><big>[</big><var><var>newSize = 0</var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Trim the LOB to the new size.
</dl>
<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-149' xml:id='l2h-149' class="function">write</tt></b>(</nobr></td>
<td><var><var>data</var>, </var><big>[</big><var><var>offset = 1</var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Write the data to the LOB object at the given offset. Note that if you want
to make the LOB value smaller, you must use the trim() function.
</dl>
<p>
<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="5. sessionpool Objects"
href="sesspool.html"><img src='previous.png'
border='0' height='32' alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="cx_Oracle"
href="cx_Oracle.html"><img src='up.png'
border='0' height='32' alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="7. date Objects"
href="dateobj.html"><img src='next.png'
border='0' height='32' alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">cx_Oracle</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='contents.png'
border='0' height='32' alt='Contents' width='32' /></a></td>
<td class='online-navigation'><img src='blank.png'
border='0' height='32' alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
border='0' height='32' alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="sesspool.html">5. SessionPool Objects</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="cx_Oracle.html">cx_Oracle</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="dateobj.html">7. Date Objects</a>
</div>
</div>
<hr />
<span class="release-info">Release HEAD, documentation updated on October 1, 2007.</span>
</div>
<!--End of Navigation Panel-->
</body>
</html>