File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717for row in con .execute ("select firstname, lastname from person" ):
1818 print (row )
1919
20- # Using a dummy WHERE clause to not let SQLite take the shortcut table deletes.
21- print ("I just deleted" , con .execute ("delete from person where 1=1" ).rowcount , "rows" )
20+ print ("I just deleted" , con .execute ("delete from person" ).rowcount , "rows" )
Original file line number Diff line number Diff line change @@ -555,18 +555,17 @@ Cursor Objects
555555 attribute, the database engine's own support for the determination of "rows
556556 affected"/"rows selected" is quirky.
557557
558- For ``DELETE `` statements, SQLite reports :attr: `rowcount ` as 0 if you make a
559- ``DELETE FROM table `` without any condition.
560-
561558 For :meth: `executemany ` statements, the number of modifications are summed up
562559 into :attr: `rowcount `.
563560
564561 As required by the Python DB API Spec, the :attr: `rowcount ` attribute "is -1 in
565562 case no ``executeXX() `` has been performed on the cursor or the rowcount of the
566- last operation is not determinable by the interface".
563+ last operation is not determinable by the interface". This includes ``SELECT ``
564+ statements because we cannot determine the number of rows a query produced
565+ until all rows were fetched.
567566
568- This includes `` SELECT `` statements because we cannot determine the number of
569- rows a query produced until all rows were fetched .
567+ With SQLite versions before 3.6.5, :attr: ` rowcount ` is set to 0 if
568+ you make a `` DELETE FROM table `` without any condition .
570569
571570.. attribute :: Cursor.lastrowid
572571
Original file line number Diff line number Diff line change @@ -2258,8 +2258,8 @@ C-API
22582258Documentation
22592259-------------
22602260
2261- - Issue #13491: Fix many errors in sqlite3 documentation. Initial
2262- patch by Johannes Vogel.
2261+ - Issues #13491 and #13995 : Fix many errors in sqlite3 documentation.
2262+ Initial patch for #13491 by Johannes Vogel.
22632263
22642264- Issue #13402: Document absoluteness of sys.executable.
22652265
You can’t perform that action at this time.
0 commit comments