Skip to content

Commit

Permalink
Fix for PYFB-67
Browse files Browse the repository at this point in the history
  • Loading branch information
pcisar committed Nov 24, 2016
1 parent 42a54e3 commit c37c256
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions fdb/fbcore.py
Expand Up @@ -3561,6 +3561,8 @@ def execute(self, operation, parameters=None):
:raises ProgrammingError: When more parameters than expected are suplied.
:raises DatabaseError: When error is returned by server.
"""
if is_dead_proxy(self._ps):
self._ps = None
if self._ps != None:
self._ps.close()
if not self._transaction.active:
Expand Down
17 changes: 15 additions & 2 deletions test/testfdb.py
Expand Up @@ -677,12 +677,25 @@ def setUp(self):
self.dbfile = os.path.join(self.dbpath,self.FBTEST_DB)
self.con = fdb.connect(host=FBTEST_HOST,database=self.dbfile,
user=FBTEST_USER,password=FBTEST_PASSWORD)
#self.con.execute_immediate("recreate table t (c1 integer)")
#self.con.commit()
self.con.execute_immediate("recreate table t (c1 integer primary key)")
self.con.commit()
def tearDown(self):
self.con.execute_immediate("delete from t")
self.con.commit()
self.con.close()
def test_executemany(self):
cur = self.con.cursor()
cur.executemany("insert into t values(?)",[(1,),(2,)])
cur.executemany("insert into t values(?)",[(3,),(4,)])
self.con.commit()
p = cur.prep("insert into t values(?)")
cur.executemany(p,[(5,),(6,)])
cur.executemany(p,[(7,),(8,)])
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,)])
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 c37c256

Please sign in to comment.