diff --git a/ZMySQLDA/lib/python/Products/ZMySQLDA/DA.py b/ZMySQLDA/lib/python/Products/ZMySQLDA/DA.py index 8118636..820bae1 100644 --- a/ZMySQLDA/lib/python/Products/ZMySQLDA/DA.py +++ b/ZMySQLDA/lib/python/Products/ZMySQLDA/DA.py @@ -100,9 +100,9 @@ manage_addZMySQLConnectionForm=HTMLFile('connectionAdd',globals()) def manage_addZMySQLConnection(self, id, title, connection_string, - check=None, transactions=None, REQUEST=None): + check=None, REQUEST=None): """Add a DB connection to a folder""" - self._setObject(id, Connection(id, title, connection_string, check, transactions)) + self._setObject(id, Connection(id, title, connection_string, check)) if REQUEST is not None: return self.manage_main(self,REQUEST) class Connection(DABase.Connection): @@ -115,37 +115,15 @@ class Connection(DABase.Connection): manage_properties=HTMLFile('connectionEdit', globals()) manage_main=HTMLFile('connectionStatus', globals()) - def __init__(self, id, title, connection_string, check=None, transactions=None): - self.id=str(id) - self.edit(title, connection_string, check, transactions) - def factory(self): return DB - def edit(self, title, connection_string, check=1, transactions=None): - self.title=title - self.connection_string=connection_string - self.transactions = transactions - if check: self.connect(connection_string) - - def manage_edit(self, title, connection_string, check=None, transactions=None, REQUEST=None): - """Change connection - """ - self.edit(title, connection_string, check, transactions) - if REQUEST is not None: - return MessageDialog( - title='Edited', - message='%s has been edited.' % self.id, - action ='./manage_main', - ) - def connect(self,s): try: self._v_database_connection.close() except: pass self._v_connected='' - if not hasattr(self, 'transactions'): self.transactions = None DB=self.factory() ## No try. DO. - self._v_database_connection=DB(s, self.transactions) + self._v_database_connection=DB(s) self._v_connected=DateTime() return self diff --git a/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionAdd.dtml b/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionAdd.dtml index e3651ba..5774531 100644 --- a/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionAdd.dtml +++ b/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionAdd.dtml @@ -34,12 +34,6 @@ - - Use transactions - - - -
diff --git a/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionEdit.dtml b/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionEdit.dtml index f1f590e..b237994 100644 --- a/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionEdit.dtml +++ b/ZMySQLDA/lib/python/Products/ZMySQLDA/connectionEdit.dtml @@ -35,13 +35,6 @@ - - Use transactions - - - - diff --git a/ZMySQLDA/lib/python/Products/ZMySQLDA/db.py b/ZMySQLDA/lib/python/Products/ZMySQLDA/db.py index 857583b..87465e4 100644 --- a/ZMySQLDA/lib/python/Products/ZMySQLDA/db.py +++ b/ZMySQLDA/lib/python/Products/ZMySQLDA/db.py @@ -140,19 +140,11 @@ class DB(TM): _p_oid=_p_changed=_registered=None - def __init__(self,connection,transactions=None): + def __init__(self,connection): self.connection=connection self.kwargs = kwargs = self._parse_connection_string(connection) self.db=apply(self.Database_Connection, (), kwargs) - self.transactions = transactions - if not transactions: return - self.db.query("SHOW VARIABLES") - r = self.db.store_result() - for row in r.fetch_row(250): - if row == ('have_bdb', 'YES'): - return - raise _mysql.OperationalError, \ - "server does not support transactions (have_bdb != 'YES')" + self.transactions = self.db.server_capabilities & CLIENT.TRANSACTIONS def _parse_connection_string(self, connection): kwargs = {'conv': self.conv}