471 lines
28 KiB
HTML
471 lines
28 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>Cursor Object — cx_Oracle v5.0 documentation</title>
|
|
<link rel="stylesheet" href="_static/default.css" type="text/css" />
|
|
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|
<script type="text/javascript">
|
|
var DOCUMENTATION_OPTIONS = {
|
|
URL_ROOT: '',
|
|
VERSION: '5.0'
|
|
};
|
|
</script>
|
|
<script type="text/javascript" src="_static/jquery.js"></script>
|
|
<script type="text/javascript" src="_static/interface.js"></script>
|
|
<script type="text/javascript" src="_static/doctools.js"></script>
|
|
<link rel="contents" title="Global table of contents" href="contents.html" />
|
|
<link rel="index" title="Global index" href="genindex.html" />
|
|
<link rel="search" title="Search" href="search.html" />
|
|
<link rel="top" title="cx_Oracle v5.0 documentation" href="index.html" />
|
|
<link rel="next" title="Variable Objects" href="variable.html" />
|
|
<link rel="prev" title="Connection Object" href="connection.html" />
|
|
</head>
|
|
<body>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
|
|
<li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
|
|
<li class="right"><a href="variable.html" title="Variable Objects" accesskey="N">next</a> |</li>
|
|
<li class="right"><a href="connection.html" title="Connection Object" accesskey="P">previous</a> |</li>
|
|
<li><a href="index.html">cx_Oracle v5.0 documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="document">
|
|
<div class="documentwrapper">
|
|
<div class="bodywrapper">
|
|
<div class="body">
|
|
|
|
|
|
<div class="section">
|
|
<h1 id="cursor-object"><span id="cursorobj"></span>Cursor Object<a class="headerlink" href="#cursor-object" title="Permalink to this headline">¶</a></h1>
|
|
<dl class="attribute">
|
|
<dt id="Cursor.arraysize">
|
|
<!--#Cursor.arraysize#--><tt class="descclassname">Cursor.</tt><tt class="descname">arraysize</tt><a class="headerlink" href="#Cursor.arraysize" title="Permalink to this definition">¶</a></dt>
|
|
<dd>This read-write attribute specifies the number of rows to fetch at a time
|
|
internally and is the default number of rows to fetch with the
|
|
<a title="Cursor.fetchmany" class="reference" href="#Cursor.fetchmany"><tt class="xref docutils literal"><span class="pre">fetchmany()</span></tt></a> call. It defaults to 50 meaning to fetch 50
|
|
rows at a time. Note that this attribute can drastically affect the
|
|
performance of a query since it directly affects the number of network round
|
|
trips that need to be performed. This is the reason for setting it to 50
|
|
instead of the 1 that the DB API recommends.</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.bindarraysize">
|
|
<!--#Cursor.bindarraysize#--><tt class="descclassname">Cursor.</tt><tt class="descname">bindarraysize</tt><a class="headerlink" href="#Cursor.bindarraysize" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-write attribute specifies the number of rows to bind at a time and
|
|
is used when creating variables via setinputsizes() or var(). It defaults to
|
|
1 meaning to bind a single row at a time.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this attribute.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.arrayvar">
|
|
<!--#Cursor.arrayvar#--><tt class="descclassname">Cursor.</tt><tt class="descname">arrayvar</tt><big>(</big><em>dataType</em>, <em>value</em><span class="optional">[</span>, <em>size</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.arrayvar" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Create an array variable associated with the cursor of the given type and
|
|
size and return a variable object (<a class="reference" href="variable.html#varobj"><em>Variable Objects</em></a>). The value is either an
|
|
integer specifying the number of elements to allocate or it is a list and
|
|
the number of elements allocated is drawn from the size of the list. If the
|
|
value is a list, the variable is also set with the contents of the list. If
|
|
the size is not specified and the type is a string or binary, 4000 bytes
|
|
(maximum allowable by Oracle) is allocated. This is needed for passing
|
|
arrays to PL/SQL (in cases where the list might be empty and the type cannot
|
|
be determined automatically) or returning arrays from PL/SQL.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.bindnames">
|
|
<!--#Cursor.bindnames#--><tt class="descclassname">Cursor.</tt><tt class="descname">bindnames</tt><big>(</big><big>)</big><a class="headerlink" href="#Cursor.bindnames" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Return the list of bind variable names bound to the statement. Note that the
|
|
statement must have been prepared first.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.bindvars">
|
|
<!--#Cursor.bindvars#--><tt class="descclassname">Cursor.</tt><tt class="descname">bindvars</tt><a class="headerlink" href="#Cursor.bindvars" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-only attribute specifies the bind variables used for the last
|
|
execute. The value will be either a list or a dictionary depending on
|
|
whether binding was done by position or name. Care should be taken when
|
|
referencing this attribute. In particular, elements should not be removed.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this attribute.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.callfunc">
|
|
<!--#Cursor.callfunc#--><tt class="descclassname">Cursor.</tt><tt class="descname">callfunc</tt><big>(</big><em>name</em>, <em>returnType</em><span class="optional">[</span>, <em>parameters=</em><span class="optional">[</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.callfunc" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Call a function with the given name. The return type is specified in the
|
|
same notation as is required by setinputsizes(). The sequence of parameters
|
|
must contain one entry for each argument that the function expects. The
|
|
result of the call is the return value of the function.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.callproc">
|
|
<!--#Cursor.callproc#--><tt class="descclassname">Cursor.</tt><tt class="descname">callproc</tt><big>(</big><em>name</em><span class="optional">[</span>, <em>parameters=</em><span class="optional">[</span><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.callproc" title="Permalink to this definition">¶</a></dt>
|
|
<dd>Call a procedure with the given name. The sequence of parameters must
|
|
contain one entry for each argument that the procedure expects. The result
|
|
of the call is a modified copy of the input sequence. Input parameters are
|
|
left untouched; output and input/output parameters are replaced with
|
|
possibly new values.</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.close">
|
|
<!--#Cursor.close#--><tt class="descclassname">Cursor.</tt><tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#Cursor.close" title="Permalink to this definition">¶</a></dt>
|
|
<dd>Close the cursor now, rather than whenever __del__ is called. The cursor
|
|
will be unusable from this point forward; an Error exception will be raised
|
|
if any operation is attempted with the cursor.</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.connection">
|
|
<!--#Cursor.connection#--><tt class="descclassname">Cursor.</tt><tt class="descname">connection</tt><big>(</big><big>)</big><a class="headerlink" href="#Cursor.connection" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-only attribute returns a reference to the connection object on
|
|
which the cursor was created.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">This attribute is an extension to the DB API definition but it is
|
|
mentioned in PEP 249 as an optional extension.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="data">
|
|
<dt id="Cursor.description">
|
|
<!--#Cursor.description#--><tt class="descclassname">Cursor.</tt><tt class="descname">description</tt><a class="headerlink" href="#Cursor.description" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-only attribute is a sequence of 7-item sequences. Each of these
|
|
sequences contains information describing one result column: (name, type,
|
|
display_size, internal_size, precision, scale, null_ok). This attribute will
|
|
be None for operations that do not return rows or if the cursor has not had
|
|
an operation invoked via the execute() method yet.</p>
|
|
<p>The type will be one of the type objects defined at the module level.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.execute">
|
|
<!--#Cursor.execute#--><tt class="descclassname">Cursor.</tt><tt class="descname">execute</tt><big>(</big><em>statement</em><span class="optional">[</span>, <em>parameters</em><span class="optional">]</span>, <em>**keywordParameters</em><big>)</big><a class="headerlink" href="#Cursor.execute" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Execute a statement against the database. Parameters may be passed as a
|
|
dictionary or sequence or as keyword arguments. If the arguments are a
|
|
dictionary, the values will be bound by name and if the arguments are a
|
|
sequence the values will be bound by position.</p>
|
|
<p>A reference to the statement will be retained by the cursor. If None or the
|
|
same string object is passed in again, the cursor will execute that
|
|
statement again without performing a prepare or rebinding and redefining.
|
|
This is most effective for algorithms where the same statement is used, but
|
|
different parameters are bound to it (many times). Note that parameters that
|
|
are not passed in during subsequent executions will retain the value passed
|
|
in during the last execution that contained them.</p>
|
|
<p>For maximum efficiency when reusing an statement, it is best to use the
|
|
setinputsizes() method to specify the parameter types and sizes ahead of
|
|
time; in particular, None is assumed to be a string of length 1 so any
|
|
values that are later bound as numbers or dates will raise a TypeError
|
|
exception.</p>
|
|
<p>If the statement is a query, a list of variable objects (<a class="reference" href="variable.html#varobj"><em>Variable Objects</em></a>) will
|
|
be returned corresponding to the list of variables into which data will be
|
|
fetched with the <a title="Cursor.fetchone" class="reference" href="#Cursor.fetchone"><tt class="xref docutils literal"><span class="pre">fetchone()</span></tt></a>, <a title="Cursor.fetchmany" class="reference" href="#Cursor.fetchmany"><tt class="xref docutils literal"><span class="pre">fetchmany()</span></tt></a> and
|
|
<a title="Cursor.fetchall" class="reference" href="#Cursor.fetchall"><tt class="xref docutils literal"><span class="pre">fetchall()</span></tt></a> methods; otherwise, <tt class="xref docutils literal"><span class="pre">None</span></tt> will be returned.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.executemany">
|
|
<!--#Cursor.executemany#--><tt class="descclassname">Cursor.</tt><tt class="descname">executemany</tt><big>(</big><em>statement</em>, <em>parameters</em><big>)</big><a class="headerlink" href="#Cursor.executemany" title="Permalink to this definition">¶</a></dt>
|
|
<dd>Prepare a statement for execution against a database and then execute it
|
|
against all parameter mappings or sequences found in the sequence
|
|
parameters. The statement is managed in the same way as the execute()
|
|
method manages it.</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.executemanyprepared">
|
|
<!--#Cursor.executemanyprepared#--><tt class="descclassname">Cursor.</tt><tt class="descname">executemanyprepared</tt><big>(</big><em>numIters</em><big>)</big><a class="headerlink" href="#Cursor.executemanyprepared" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Execute the previously prepared and bound statement the given number of
|
|
times. The variables that are bound must have already been set to their
|
|
desired value before this call is made. This method was designed for the
|
|
case where optimal performance is required as it comes at the expense of
|
|
compatibility with the DB API.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.fetchall">
|
|
<!--#Cursor.fetchall#--><tt class="descclassname">Cursor.</tt><tt class="descname">fetchall</tt><big>(</big><big>)</big><a class="headerlink" href="#Cursor.fetchall" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Fetch all (remaining) rows of a query result, returning them as a list of
|
|
tuples. An empty list is returned if no more rows are available. Note that
|
|
the cursor’s arraysize attribute can affect the performance of this
|
|
operation, as internally reads from the database are done in batches
|
|
corresponding to the arraysize.</p>
|
|
<p>An exception is raised if the previous call to execute() did not produce any
|
|
result set or no call was issued yet.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.fetchmany">
|
|
<!--#Cursor.fetchmany#--><tt class="descclassname">Cursor.</tt><tt class="descname">fetchmany</tt><big>(</big><span class="optional">[</span><em>numRows=cursor.arraysize</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.fetchmany" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Fetch the next set of rows of a query result, returning a list of tuples. An
|
|
empty list is returned if no more rows are available. Note that the cursor’s
|
|
arraysize attribute can affect the performance of this operation.</p>
|
|
<p>The number of rows to fetch is specified by the parameter. If it is not
|
|
given, the cursor’s arrysize attribute determines the number of rows to be
|
|
fetched. If the number of rows available to be fetched is fewer than the
|
|
amount requested, fewer rows will be returned.</p>
|
|
<p>An exception is raised if the previous call to execute() did not produce any
|
|
result set or no call was issued yet.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.fetchone">
|
|
<!--#Cursor.fetchone#--><tt class="descclassname">Cursor.</tt><tt class="descname">fetchone</tt><big>(</big><big>)</big><a class="headerlink" href="#Cursor.fetchone" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Fetch the next row of a query result set, returning a single tuple or None
|
|
when no more data is available.</p>
|
|
<p>An exception is raised if the previous call to execute() did not produce any
|
|
result set or no call was issued yet.</p>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.fetchraw">
|
|
<!--#Cursor.fetchraw#--><tt class="descclassname">Cursor.</tt><tt class="descname">fetchraw</tt><big>(</big><span class="optional">[</span><em>numRows=cursor.arraysize</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.fetchraw" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Fetch the next set of rows of a query result into the internal buffers of
|
|
the defined variables for the cursor. The number of rows actually fetched is
|
|
returned. This method was designed for the case where optimal performance
|
|
is required as it comes at the expense of compatibility with the DB API.</p>
|
|
<p>An exception is raised if the previous call to execute() did not produce any
|
|
result set or no call was issued yet.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.fetchvars">
|
|
<!--#Cursor.fetchvars#--><tt class="descclassname">Cursor.</tt><tt class="descname">fetchvars</tt><a class="headerlink" href="#Cursor.fetchvars" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-only attribute specifies the list of variables created for the
|
|
last query that was executed on the cursor. Care should be taken when
|
|
referencing this attribute. In particular, elements should not be removed.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this attribute.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.inputtypehandler">
|
|
<!--#Cursor.inputtypehandler#--><tt class="descclassname">Cursor.</tt><tt class="descname">inputtypehandler</tt><a class="headerlink" href="#Cursor.inputtypehandler" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-write attribute specifies a method called for each value that is
|
|
bound to a statement executed on the cursor and overrides the attribute with
|
|
the same name on the connection if specified. The method signature is
|
|
handler(cursor, value, arraysize) and the return value is expected to be a
|
|
variable object or None in which case a default variable object will be
|
|
created. If this attribute is None, the value of the attribute with the same
|
|
name on the connection is used.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">This attribute is an extension to the DB API definition.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.__iter__">
|
|
<!--#Cursor.__iter__#--><tt class="descclassname">Cursor.</tt><tt class="descname">__iter__</tt><big>(</big><big>)</big><a class="headerlink" href="#Cursor.__iter__" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Returns the cursor itself to be used as an iterator.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">This method is an extension to the DB API definition but it is
|
|
mentioned in PEP 249 as an optional extension.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.next">
|
|
<!--#Cursor.next#--><tt class="descclassname">Cursor.</tt><tt class="descname">next</tt><big>(</big><big>)</big><a class="headerlink" href="#Cursor.next" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Fetch the next row of a query result set, using the same semantics as the
|
|
method fetchone().</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">This method is an extension to the DB API definition but it is
|
|
mentioned in PEP 249 as an optional extension.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.numbersAsStrings">
|
|
<!--#Cursor.numbersAsStrings#--><tt class="descclassname">Cursor.</tt><tt class="descname">numbersAsStrings</tt><a class="headerlink" href="#Cursor.numbersAsStrings" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This integer attribute defines whether or not numbers should be returned as
|
|
strings rather than integers or floating point numbers. This is useful to
|
|
get around the fact that Oracle floating point numbers have considerably
|
|
greater precision than C floating point numbers and not require a change to
|
|
the SQL being executed.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this attribute.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.outputtypehandler">
|
|
<!--#Cursor.outputtypehandler#--><tt class="descclassname">Cursor.</tt><tt class="descname">outputtypehandler</tt><a class="headerlink" href="#Cursor.outputtypehandler" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-write attribute specifies a method called for each value that is
|
|
to be fetched from this cursor. The method signature is
|
|
handler(cursor, name, defaultType, length, precision, scale) and the return
|
|
value is expected to be a variable object or None in which case a default
|
|
variable object will be created. If this attribute is None, the value of
|
|
the attribute with the same name on the connection is used instead.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">This attribute is an extension to the DB API definition.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.parse">
|
|
<!--#Cursor.parse#--><tt class="descclassname">Cursor.</tt><tt class="descname">parse</tt><big>(</big><em>statement</em><big>)</big><a class="headerlink" href="#Cursor.parse" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This can be used to parse a statement without actually executing it (this
|
|
step is done automatically by Oracle when a statement is executed).</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.prepare">
|
|
<!--#Cursor.prepare#--><tt class="descclassname">Cursor.</tt><tt class="descname">prepare</tt><big>(</big><em>statement</em><span class="optional">[</span>, <em>tag</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.prepare" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This can be used before a call to execute() to define the statement that
|
|
will be executed. When this is done, the prepare phase will not be performed
|
|
when the call to execute() is made with None or the same string object as
|
|
the statement. If specified (Oracle 9i and higher) the statement will be
|
|
returned to the statement cache with the given tag. See the Oracle
|
|
documentation for more information about the statement cache.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.rowcount">
|
|
<!--#Cursor.rowcount#--><tt class="descclassname">Cursor.</tt><tt class="descname">rowcount</tt><a class="headerlink" href="#Cursor.rowcount" title="Permalink to this definition">¶</a></dt>
|
|
<dd>This read-only attribute specifies the number of rows that have currently
|
|
been fetched from the cursor (for select statements) or that have been
|
|
affected by the operation (for insert, update and delete statements).</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.rowfactory">
|
|
<!--#Cursor.rowfactory#--><tt class="descclassname">Cursor.</tt><tt class="descname">rowfactory</tt><a class="headerlink" href="#Cursor.rowfactory" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-write attribute specifies a method to call for each row that is
|
|
retrieved from the database. Ordinarily a tuple is returned for each row but
|
|
if this attribute is set, the method is called with the argument tuple that
|
|
would normally be returned and the result of the method is returned instead.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this attribute.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.setinputsizes">
|
|
<!--#Cursor.setinputsizes#--><tt class="descclassname">Cursor.</tt><tt class="descname">setinputsizes</tt><big>(</big><em>*args</em>, <em>**keywordArgs</em><big>)</big><a class="headerlink" href="#Cursor.setinputsizes" title="Permalink to this definition">¶</a></dt>
|
|
<dd>This can be used before a call to execute() to predefine memory areas for
|
|
the operation’s parameters. Each parameter should be a type object
|
|
corresponding to the input that will be used or it should be an integer
|
|
specifying the maximum length of a string parameter. Use keyword arguments
|
|
when binding by name and positional arguments when binding by position. The
|
|
singleton None can be used as a parameter when using positional arguments to
|
|
indicate that no space should be reserved for that position.</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.setoutputsize">
|
|
<!--#Cursor.setoutputsize#--><tt class="descclassname">Cursor.</tt><tt class="descname">setoutputsize</tt><big>(</big><em>size</em><span class="optional">[</span>, <em>column</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.setoutputsize" title="Permalink to this definition">¶</a></dt>
|
|
<dd>This can be used before a call to execute() to predefine memory areas for
|
|
the long columns that will be fetched. The column is specified as an index
|
|
into the result sequence. Not specifying the column will set the default
|
|
size for all large columns in the cursor.</dd></dl>
|
|
|
|
<dl class="attribute">
|
|
<dt id="Cursor.statement">
|
|
<!--#Cursor.statement#--><tt class="descclassname">Cursor.</tt><tt class="descname">statement</tt><a class="headerlink" href="#Cursor.statement" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>This read-only attribute provides the string object that was previously
|
|
prepared with prepare() or executed with execute().</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this attribute.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
<dl class="method">
|
|
<dt id="Cursor.var">
|
|
<!--#Cursor.var#--><tt class="descclassname">Cursor.</tt><tt class="descname">var</tt><big>(</big><em>dataType</em><span class="optional">[</span>, <em>size</em>, <em>arraysize</em>, <em>inconverter</em>, <em>outconverter</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#Cursor.var" title="Permalink to this definition">¶</a></dt>
|
|
<dd><p>Create a variable associated with the cursor of the given type and
|
|
characteristics and return a variable object (<a class="reference" href="variable.html#varobj"><em>Variable Objects</em></a>). If the size is
|
|
not specified and the type is a string or binary, 4000 bytes (maximum
|
|
allowable by Oracle) is allocated; if the size is not specified and the type
|
|
is a long string or long binary, 128KB is allocated. If the arraysize is not
|
|
specified, the bind array size (usually 1) is used. The inconverter and
|
|
outconverter specify methods used for converting values to/from the
|
|
database. More information can be found in the section on variable objects.</p>
|
|
<p>This method was designed for use with PL/SQL in/out variables where the
|
|
length or type cannot be determined automatically from the Python object
|
|
passed in or for use in input and output type handlers defined on cursors
|
|
or connections.</p>
|
|
<div class="admonition note">
|
|
<p class="first admonition-title">Note</p>
|
|
<p class="last">The DB API definition does not define this method.</p>
|
|
</div>
|
|
</dd></dl>
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="sidebar">
|
|
<div class="sidebarwrapper">
|
|
<h4>Previous topic</h4>
|
|
<p class="topless"><a href="connection.html" title="previous chapter">Connection Object</a></p>
|
|
<h4>Next topic</h4>
|
|
<p class="topless"><a href="variable.html" title="next chapter">Variable Objects</a></p>
|
|
<h3>Quick search</h3>
|
|
<form class="search" action="search.html" method="get">
|
|
<input type="text" name="q" size="18" /> <input type="submit" value="Go" />
|
|
<input type="hidden" name="check_keywords" value="yes" />
|
|
<input type="hidden" name="area" value="default" />
|
|
</form>
|
|
</div>
|
|
</div>
|
|
<div class="clearer"></div>
|
|
</div>
|
|
<div class="related">
|
|
<h3>Navigation</h3>
|
|
<ul>
|
|
<li class="right" style="margin-right: 10px"><a href="genindex.html" title="General Index" accesskey="I">index</a></li>
|
|
<li class="right"><a href="modindex.html" title="Global Module Index" accesskey="M">modules</a> |</li>
|
|
<li class="right"><a href="variable.html" title="Variable Objects" accesskey="N">next</a> |</li>
|
|
<li class="right"><a href="connection.html" title="Connection Object" accesskey="P">previous</a> |</li>
|
|
<li><a href="index.html">cx_Oracle v5.0 documentation</a> »</li>
|
|
</ul>
|
|
</div>
|
|
<div class="footer">
|
|
© Copyright 2008, Anthony Tuininga.
|
|
Last updated on Dec 11, 2008.
|
|
</div>
|
|
</body>
|
|
</html> |