git://git.onelab.eu
/
plcapi.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- remove unnecessary print statement
[plcapi.git]
/
PLC
/
PostgreSQL.py
diff --git
a/PLC/PostgreSQL.py
b/PLC/PostgreSQL.py
index
f15ebf9
..
d996e72
100644
(file)
--- a/
PLC/PostgreSQL.py
+++ b/
PLC/PostgreSQL.py
@@
-5,7
+5,7
@@
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: PostgreSQL.py,v 1.1
3 2007/02/11 04:53:40
mlhuang Exp $
+# $Id: PostgreSQL.py,v 1.1
4 2007/02/11 18:34:06
mlhuang Exp $
#
import psycopg2
#
import psycopg2
@@
-130,7
+130,8
@@
class PostgreSQL:
self.connection.rollback()
def do(self, query, params = None):
self.connection.rollback()
def do(self, query, params = None):
- self.execute(query, params)
+ cursor = self.execute(query, params)
+ cursor.close()
return self.rowcount
def last_insert_id(self, table_name, primary_key):
return self.rowcount
def last_insert_id(self, table_name, primary_key):
@@
-194,7
+195,9
@@
class PostgreSQL:
to the query.
"""
to the query.
"""
- rows = self.execute(query, params).fetchall()
+ cursor = self.execute(query, params)
+ rows = cursor.fetchall()
+ cursor.close()
if hashref or key_field is not None:
# Return each row as a dictionary keyed on field name
if hashref or key_field is not None:
# Return each row as a dictionary keyed on field name