source: python/trunk/Doc/includes/sqlite3/countcursors.py

Last change on this file was 2, checked in by Yuri Dario, 15 years ago

Initial import for vendor code.

  • Property svn:eol-style set to native
File size: 455 bytes
Line 
1import sqlite3
2
3class CountCursorsConnection(sqlite3.Connection):
4 def __init__(self, *args, **kwargs):
5 sqlite3.Connection.__init__(self, *args, **kwargs)
6 self.numcursors = 0
7
8 def cursor(self, *args, **kwargs):
9 self.numcursors += 1
10 return sqlite3.Connection.cursor(self, *args, **kwargs)
11
12con = sqlite3.connect(":memory:", factory=CountCursorsConnection)
13cur1 = con.cursor()
14cur2 = con.cursor()
15print con.numcursors
Note: See TracBrowser for help on using the repository browser.