Skip to content

Commit

Permalink
- Fix for PYFB-70
Browse files Browse the repository at this point in the history
  • Loading branch information
pcisar committed Jan 12, 2017
1 parent 01625d3 commit 9f1ac80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion fdb/fbcore.py
Expand Up @@ -3564,7 +3564,10 @@ def execute(self, operation, parameters=None):
if is_dead_proxy(self._ps):
self._ps = None
if self._ps != None:
self._ps.close()
# Dirty trick to check whether operation when it's
# PreparedStatement is the one we (may) have weak proxy for
if self._ps.__repr__.__self__ is not operation:
self._ps.close()
if not self._transaction.active:
self._transaction.begin()
if isinstance(operation, PreparedStatement):
Expand Down
9 changes: 6 additions & 3 deletions test/testfdb.py
Expand Up @@ -686,16 +686,19 @@ def tearDown(self):
def test_executemany(self):
cur = self.con.cursor()
cur.executemany("insert into t values(?)",[(1,),(2,)])
cur.executemany("insert into t values(?)",[(3,),(4,)])
cur.executemany("insert into t values(?)",[(3,)])
cur.executemany("insert into t values(?)",[(4,),(5,),(6,)])
self.con.commit()
p = cur.prep("insert into t values(?)")
cur.executemany(p,[(5,),(6,)])
cur.executemany(p,[(7,),(8,)])
cur.executemany(p,[(9,)])
cur.executemany(p,[(10,),(11,),(12,)])
self.con.commit()
cur.execute("select * from T order by c1")
rows = cur.fetchall()
self.assertListEqual(rows,[(1,),(2,),(3,),(4,),
(5,),(6,),(7,),(8,)])
(5,),(6,),(7,),(8,),
(9,),(10,),(11,),(12,)])
def test_iteration(self):
if self.con.ods < fdb.ODS_FB_30:
data = [('USA', 'Dollar'), ('England', 'Pound'), ('Canada', 'CdnDlr'),
Expand Down

0 comments on commit 9f1ac80

Please sign in to comment.