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 | |
---|
1 | import sqlite3
|
---|
2 |
|
---|
3 | class 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 |
|
---|
12 | con = sqlite3.connect(":memory:", factory=CountCursorsConnection)
|
---|
13 | cur1 = con.cursor()
|
---|
14 | cur2 = con.cursor()
|
---|
15 | print con.numcursors
|
---|
Note:
See
TracBrowser
for help on using the repository browser.