-1
我有一個運行查詢命令的SQLite/Python代碼,如下所示。爲什麼執行後我們需要connector.commit()?
def queryDB(self, command_):_
self.cursor.execute(command_)
self.connector.commit() # <---- ???
...
它工作得很好,但我有一些問題。
- 爲什麼需要connector.commit()?它有什麼作用?
- cursor.execute()做什麼?
這些是SQL問題。不是Python或SQLite連接。閱讀:http://en.wikipedia.org/wiki/Commit_(data_management) – 2010-09-11 00:31:56
http://docs.python.org/library/sqlite3.html – 2010-09-11 07:28:40