Changeset 325
- Timestamp:
- 06/12/2004 11:27:04 AM (5 years ago)
- Files:
-
- trunk/biz/dBizobj.py (modified) (1 diff)
- trunk/db/dBackend.py (modified) (1 diff)
- trunk/db/dCursorMixin.py (modified) (1 diff)
- trunk/db/dbFirebird.py (modified) (3 diffs)
- trunk/ui/uiwx/classes/dProgressDialog.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/biz/dBizobj.py
r324 r325 28 28 self.__currentCursorKey = None 29 29 self._conn = conn 30 self.__params = None# tuple of params to be merged with the sql in the cursor30 self.__params = () # tuple of params to be merged with the sql in the cursor 31 31 self.__children = [] # Collection of child bizobjs 32 32 self._baseClass = dBizobj trunk/db/dBackend.py
r324 r325 78 78 See dCursorMixin.getFields() for a description of the return value. 79 79 """ 80 # It is too bad, but dbapi2.0's cursor().description doesn't cut it. 81 # It will give the field names, but the type info and pk info isn't 82 # adequate generically yet. 80 83 return () 81 84 trunk/db/dCursorMixin.py
r320 r325 100 100 method will detect that, and convert the results to a dictionary. 101 101 """ 102 res = self.superCursor.execute(self, sql, params) 102 if params is None or len(params) == 0: 103 res = self.superCursor.execute(self, sql) 104 else: 105 res = self.superCursor.execute(self, sql, params) 103 106 self._records = self.fetchall() 104 107 trunk/db/dbFirebird.py
r324 r325 1 import datetime 2 import kinterbasdb 1 3 from dBackend import dBackend 2 import datetime 4 from dCursorMixin import dCursorMixin 5 from dSqlBuilderMixin import dSqlBuilderMixin 3 6 4 7 class Firebird(dBackend): … … 8 11 9 12 def getConnection(self, connectInfo): 10 import kinterbasdb11 12 13 # Port doesn't seem to work, but I need to research... for now it's disabled. 13 14 # port = connectInfo.Port … … 27 28 28 29 def getDictCursorClass(self): 29 import kinterbasdb30 30 return kinterbasdb.Cursor 31 31 32 32 33 def getCursor(self, cursorClass): 33 return self._connection.cursor() 34 dbCursorClass = self.getDictCursorClass() 35 connection = self._connection 36 backendObject = self 37 class dCursor(dCursorMixin, dbCursorClass, dSqlBuilderMixin): 38 def __init__(self): 39 dCursorMixin.__init__(self) 40 dbCursorClass.__init__(self, connection) 41 dSqlBuilderMixin.__init__(self) 42 self.superCursor = dbCursorClass 43 self.BackendObject = backendObject 44 45 return dCursor() 46 34 47 35 48 def formatDateTime(self, val): trunk/ui/uiwx/classes/dProgressDialog.py
r232 r325 30 30 from threading import * 31 31 import wx 32 import time32 import dMessageBox 33 33 34 34 ID_CANCEL = wx.NewId() 35 35 EVT_RESULT_ID = wx.NewId() 36 EVT_EXCEPTION_ID = wx.NewId() 36 37 37 38 def EVT_RESULT(win, func): 38 39 win.Connect(-1, -1, EVT_RESULT_ID, func) 40 41 def EVT_EXCEPTION(win, func): 42 win.Connect(-1, -1, EVT_EXCEPTION_ID, func) 39 43 40 44 class ResultEvent(wx.PyEvent): … … 45 49 wx.PyEvent.__init__(self) 46 50 self.SetEventType(EVT_RESULT_ID) 51 self.response = response 52 53 class ExceptionEvent(wx.PyEvent): 54 """ Simple event to carry arbitrary result data. 55 """ 56 57 def __init__(self, response): 58 wx.PyEvent.__init__(self) 59 self.SetEventType(EVT_EXCEPTION_ID) 47 60 self.response = response 48 61 … … 63 76 64 77 def run(self): 65 response = self._func() 66 # Done, send notify: 67 wx.PostEvent(self._notify_window,ResultEvent(response)) 78 try: 79 response = self._func() 80 # Done, send notify: 81 wx.PostEvent(self._notify_window,ResultEvent(response)) 82 except Exception, e: 83 wx.PostEvent(self._notify_window,ExceptionEvent(e)) 68 84 69 85 # GUI Frame class that spins off the worker thread … … 81 97 # Set up event handler for any worker thread results 82 98 EVT_RESULT(self, self.OnResult) 99 EVT_EXCEPTION(self, self.OnException) 83 100 84 101 # And indicate we don't have a worker thread yet … … 98 115 self.Hide() 99 116 117 def OnException(self, event): 118 dMessageBox.stop("Error encountered:\n\n%s" % str(event.response)) 119 self.Hide() 120 100 121 def OnClose(self, event): 101 122 # Don't let the window close.
