Re: SQLite

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • gordyt

    Re: SQLite

    Howdy Matthias!

    The delete operation will set the rowcount member of your cursor.
    Let's assume you have an sqlite3 database with a table called 'test'
    with an id column. It does have a record with id=1. It does not have
    a record with id=2.
    >>import sqlite3
    >>connection = sqlite3.connect ('test.sqlite3' )
    >>cursor = connection.curs or()
    >>cursor.execut e('delete from test where id=1')
    <sqlite3.Curs or object at 0x7f3450>
    >>print cursor.rowcount
    1
    >>cursor.execut e('delete from test where id=2')
    <sqlite3.Curs or object at 0x7f3450>
    >>print cursor.rowcount
    0
    >>cursor.close( )
    >>connection.cl ose()

    --gordy
Working...