2010-11-11 55 views

回答

4

fetchall做它说的 - 它提取所有。那之后什么都没有了。要获得更多结果,您需要运行另一个查询(或再次查询同一个查询)。

从Python db-api 2.0 specification

cursor.fetchall() 

     Fetch all (remaining) rows of a query result, returning 
     them as a sequence of sequences (e.g. a list of tuples). 
     Note that the cursor's arraysize attribute can affect the 
     performance of this operation. 

cursor.fetchone() 

     Fetch the next row of a query result set, returning a 
     single sequence, or None when no more data is 
     available. [6] 
+0

不过,什么是 “一”?检索到的查询的一项? – relima 2010-11-11 02:47:34

+0

@relima:“检索到的查询中的一项?”它还能是什么? – 2010-11-11 02:52:40

+0

@relima:从文档中添加引用 – 2010-11-11 02:53:36