2006年04月25日 星期二 13:09
imcs ee£º
>ÏÖÔÚµÚÒ»¸ö·½·¨ºÃÏñ·µ»ØµÄÊÇintÀàÐÍÁË£¬µÚ¶þ¸ö·½·¨·µ»Ø£1ÁË¡£
ÎҵĻ·¾³£º
pysqlite-2.2.2.win32-py2.4.exe
²âÊÔ½á¹û£º
>>> cur.execute('select * from test');
>>> print cur.fetchall()
[(1, u'name1')]
>>> cur.execute('select * from test');
>>> cur.rowcount
-1
>>> cur.execute('delete from test');
>>> cur.rowcount
0
ÎĵµËµÃ÷£º
¡¶pysqlite usage guide¡·
rowcount attribute
Although pysqlite's Cursors implement this attribute, the database engine's own support for the determination of "rows affected"/"rows selected" is quirky.
For SELECT statements, rowcount is always None because pysqlite cannot determine the number of rows a query produced until all rows were fetched.
For DELETE statements, SQLite reports rowcount as 0 if you make a DELETE FROM table without any condition.
For executemany statements, pysqlite sums up the number of modifications into rowcount.
As required by the Python DB API Spec, the rowcount attribute "is -1 in case no executeXX() has been performed on the cursor or the rowcount of the last operation is not determinable by the interface".
= = = = = = = = = = = = = = = = = = = =
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ nsinit
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ 2006-04-25
Zeuux © 2025
京ICP备05028076号