<p>在我看来,这只是一个误用的抽象概念。db游标是一个抽象,用于数据集遍历。</p>
<p>来自<a href="http://en.wikipedia.org/wiki/Cursor_%28databases%29" rel="noreferrer">Wikipedia article on subject</a>:</p>
<blockquote>
<p>In computer science and technology, a database cursor is a control
structure that enables traversal over the records in a database.
Cursors facilitate subsequent processing in conjunction with the
traversal, such as retrieval, addition and removal of database
records. The database cursor characteristic of traversal makes cursors
akin to the programming language concept of iterator.</p>
</blockquote>
<p>以及:</p>
<blockquote>
<p>Cursors can not only be used to fetch data from the DBMS into an
application but also to identify a row in a table to be updated or
deleted. The SQL:2003 standard defines positioned update and
positioned delete SQL statements for that purpose. Such statements do
not use a regular WHERE clause with predicates. Instead, a cursor
identifies the row. The cursor must be opened and already positioned
on a row by means of FETCH statement.</p>
</blockquote>
<p>如果您检查<a href="http://docs.python.org/2/library/sqlite3.html" rel="noreferrer">docs on Python sqlite module</a>,您可以看到甚至对于<code>CREATE TABLE</code>语句也需要一个python模块<code>cursor</code>,因此它被用于仅需要<code>connection</code>对象就足够的情况-正如OP正确指出的那样。这种抽象不同于人们理解的db游标,因此,用户的困惑/沮丧。不管效率如何,这只是一个概念性的开销。如果在文档中指出python模块<code>cursor</code>与SQL和数据库中的游标有点不同,那就太好了。</p>