Update of /cvsroot/jython/jython/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv25122/Lib
Modified Files:
dbexts.py
Log Message:
added .prepare() to cursor
Index: dbexts.py
===================================================================
RCS file: /cvsroot/jython/jython/Lib/dbexts.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** dbexts.py 7 Jan 2002 04:59:50 -0000 1.5
--- dbexts.py 19 Apr 2002 19:01:06 -0000 1.6
***************
*** 47,50 ****
--- 47,51 ----
import os, re
+ from types import StringType
__author__ = "brian zimmer (bz...@zi...)"
***************
*** 282,285 ****
--- 283,294 ----
self.db.rollback()
+ def prepare(self, sql):
+ """ prepare the sql statement """
+ cur = self.begin()
+ try:
+ return cur.prepare(sql)
+ finally:
+ self.commit(cur)
+
def display(self):
""" using the formatter, display the results """
***************
*** 315,321 ****
headers = []
results = []
! if comments: sql = comments(sql)
! statements = filter(lambda x: len(x) > 0,
! map(lambda statement: statement.strip(), sql.split(delim)))
for a in statements:
self.__execute__(a, params, bindings, maxrows=maxrows)
--- 324,333 ----
headers = []
results = []
! if type(sql) == type(StringType):
! if comments: sql = comments(sql)
! statements = filter(lambda x: len(x) > 0,
! map(lambda statement: statement.strip(), sql.split(delim)))
! else:
! statements = [sql]
for a in statements:
self.__execute__(a, params, bindings, maxrows=maxrows)
|