|
From: Andy T. <an...@us...> - 2005-12-13 11:14:09
|
Update of /cvsroot/pythoncard/PythonCard/samples/dbBrowser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19204/dbBrowser Modified Files: csvBrowse.py dbBrowser.py dbBrowser2.py dbLogin.py gadflyBrowse.py metakitBrowse.py mySQLBrowse.py oracleBrowse.py postgreBrowse.py pysqlite2Browse.py pysqliteBrowse.py Log Message: Removed all of the plain except: clauses I could Index: pysqlite2Browse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/pysqlite2Browse.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** pysqlite2Browse.py 17 May 2005 20:33:53 -0000 1.1 --- pysqlite2Browse.py 13 Dec 2005 11:13:22 -0000 1.2 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: pysqlite2Browse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" # AGT 2005-05-17 *************** *** 80,89 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result = self._cursor.fetchone() ! except: ! print "AGT argh" ! result=[] ! return result --- 79,83 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result = self._cursor.fetchone() return result *************** *** 93,100 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result=self._cursor.fetchall() ! except: ! result=[] return result --- 87,91 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result=self._cursor.fetchall() return result Index: oracleBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/oracleBrowse.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** oracleBrowse.py 19 Jun 2003 12:34:18 -0000 1.8 --- oracleBrowse.py 13 Dec 2005 11:13:22 -0000 1.9 *************** *** 2,9 **** """ - __version__='$Revision$'[11:-2] - __date__='9th November 2001' - __author__='Andy Todd <an...@ha...>' - Module Name: oracleBrowse Description: Plug in for PythonCard application dbBrowse to provide Oracle specific functionality --- 2,5 ---- *************** *** 20,29 **** 04-Apr-2002 Changed the format of columnDefs that is passed from the db handler modules back to dbBrowser in the getColumns method. This actually makes the code in this module simpler, which must be a good thing """ try: ! import DCOracle2 ! oracle = DCOracle2 ! except: ! import cx_Oracle ! oracle = cx_Oracle class browse: --- 16,29 ---- 04-Apr-2002 Changed the format of columnDefs that is passed from the db handler modules back to dbBrowser in the getColumns method. This actually makes the code in this module simpler, which must be a good thing """ + __version__='$Revision$'[11:-2] + __date__='9th November 2001' + __author__='Andy Todd <an...@ha...>' + try: ! import cx_Oracle ! oracle = cx_Oracle ! except ImportError: ! import DCOracle2 ! oracle = DCOracle2 class browse: *************** *** 33,51 **** "Setup the database connection" # self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user'] ! try: ! # Not providing some values is guaranteed to ruin our connection ! if ('username' not in connection) and ('password' not in connection): ! raise ValueError ! connectString = connection['username']+'/'+connection['password'] ! if 'database' in connection: ! if connection['database']: ! connectString += '@' + connection['database'] ! self._db = oracle.connect( connectString ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 33,47 ---- "Setup the database connection" # self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user'] ! # Not providing some values is guaranteed to ruin our connection ! if ('username' not in connection) and ('password' not in connection): ! raise ValueError ! connectString = connection['username']+'/'+connection['password'] ! if 'database' in connection: ! if connection['database']: ! connectString += '@' + connection['database'] ! self._db = oracle.connect( connectString ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): Index: gadflyBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/gadflyBrowse.py,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** gadflyBrowse.py 19 Jun 2003 12:34:18 -0000 1.5 --- gadflyBrowse.py 13 Dec 2005 11:13:22 -0000 1.6 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: gadflyBrowse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" import gadfly *************** *** 23,38 **** "Setup the database connection" self._system_tables=['__TABLE_NAMES__', '__INDEXCOLS__', '__COLUMNS__', '__INDICES__', '__DATADEFS__', 'DUAL'] ! try: ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['databasename']: ! raise ValueError ! self._db = gadfly.gadfly( databasename=connection['databasename'] ! ,directory=connection['directory'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 22,33 ---- "Setup the database connection" self._system_tables=['__TABLE_NAMES__', '__INDEXCOLS__', '__COLUMNS__', '__INDICES__', '__DATADEFS__', 'DUAL'] ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['databasename']: ! raise ValueError ! self._db = gadfly.gadfly( databasename=connection['databasename'] ! ,directory=connection['directory'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): Index: mySQLBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/mySQLBrowse.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mySQLBrowse.py 19 Jun 2003 12:34:18 -0000 1.10 --- mySQLBrowse.py 13 Dec 2005 11:13:22 -0000 1.11 *************** *** 2,9 **** """ - __version__="0.3" - __date__="30th March, 2002" - __author__="Andy Todd <an...@ha...>" - Module Name: mySQLBrowse Description: Plug in for PythonCard application dbBrowse to provide MySQL specific functionality --- 2,5 ---- *************** *** 15,23 **** The only manipulation to data is to format date values as DD-Mon-YYYY ! Class named changed to 'browse' for version 0.2.1, this allows us to use the ! same class name in each database handler module. ! Data returned from getColumns has been changed for version 0.3. This enables dbBrowser.DbBrowser to be a lot more generic and removes a lot of data manipulationin the on_btnBrowse_mouseClick method. Also added 'func' to the list of system tables (it was added after version 3.23.37 """ import MySQLdb --- 11,23 ---- The only manipulation to data is to format date values as DD-Mon-YYYY ! The class name was changed to 'browse' for version 0.2.1, this allows us to use ! the same class name in each database handler module. ! Data returned from getColumns has been changed for version 0.3. This enables dbBrowser.DbBrowser to be a lot more generic and removes a lot of data manipulationin the on_btnBrowse_mouseClick method. Also added 'func' to the list of system tables (it was added after version 3.23.37) """ + __version__="0.3" + __date__="30th March, 2002" + __author__="Andy Todd <an...@ha...>" + import MySQLdb *************** *** 29,45 **** "Setup the database connection" self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user', 'func'] ! try: ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = MySQLdb.connect( user=connection['username'] ! ,passwd=connection['password'] ! ,db=connection['database'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 29,41 ---- "Setup the database connection" self._system_tables=['columns_priv', 'db', 'host', 'tables_priv', 'user', 'func'] ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = MySQLdb.connect( user=connection['username'] ! ,passwd=connection['password'] ! ,db=connection['database'] ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): Index: csvBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/csvBrowse.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** csvBrowse.py 4 Sep 2004 11:46:39 -0000 1.1 --- csvBrowse.py 13 Dec 2005 11:13:22 -0000 1.2 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: csvBrowse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" import csv, os *************** *** 29,33 **** self._db = "ok" self._cursor="ok" ! except: self._db = None self._cursor = None --- 28,32 ---- self._db = "ok" self._cursor="ok" ! except IOError: self._db = None self._cursor = None *************** *** 61,68 **** if tableName!=self._tableName: self._tableName=tableName ! try: ! result = self.reader.next() ! except: ! result = None return result --- 60,64 ---- if tableName!=self._tableName: self._tableName=tableName ! result = self.reader.next() return result Index: dbLogin.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/dbLogin.py,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** dbLogin.py 18 Sep 2005 03:59:22 -0000 1.13 --- dbLogin.py 13 Dec 2005 11:13:22 -0000 1.14 *************** *** 2,12 **** """ - __version__ = '$Revision$'[11:-2] - __date__ = "16th September, 2002" - __author__ = "Andy Todd <an...@ha...>" - App Name: dbBrowser Description: Provide a login dialog for the dbBrowser application """ import os --- 2,11 ---- """ App Name: dbBrowser Description: Provide a login dialog for the dbBrowser application """ + __version__ = '$Revision$'[11:-2] + __date__ = "16th September, 2002" + __author__ = "Andy Todd <an...@ha...>" import os Index: pysqliteBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/pysqliteBrowse.py,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** pysqliteBrowse.py 19 Jun 2003 12:34:18 -0000 1.4 --- pysqliteBrowse.py 13 Dec 2005 11:13:22 -0000 1.5 *************** *** 1,8 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - """ Module Name: gadflyBrowse --- 1,4 ---- *************** *** 13,16 **** --- 9,15 ---- The structure of this module should be replicated for different RDBMS so that they can be interchanged by dbBrowse - hopefully. """ + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" # KEA 2003-01-19 *************** *** 26,37 **** def __init__(self, connection): "Setup the database connection" - ##self._system_tables=['__TABLE_NAMES__', '__INDEXCOLS__', '__COLUMNS__', '__INDICES__', '__DATADEFS__', 'DUAL'] self._system_tables=[] - ##try: - # Not providing a db name is guaranteed to ruin our connection if not connection['databasename']: raise ValueError - ##db = gadfly.gadfly( databasename=connection['databasename'] - ## ,directory=connection['directory'] ) filename = os.path.join(connection['directory'], connection['databasename']) # not sure about the mode to use, I assume we just want read-only --- 25,31 ---- *************** *** 40,46 **** # This one is used in getRow self._tableName='' - ##except: - ## self._cursor=None - ## self._tableName=None def getTables(self): --- 34,37 ---- *************** *** 65,81 **** precision = 255 columnDefs.append((columnName, dataType, precision, nullable, key, default)) - """ - # format of Gadfly definitions is; - # column name - # format of dbBrowser column definitions is - # column name, data type, length (for display), nullable, key, default - columnDefs = [] - for column in self._cursor.fetchall(): - columnName = column[0] - dataType, nullable, key, default = "varchar", "", "", "" - # Dodgy default, but if works for me - precision = 255 - columnDefs.append((columnName, dataType, precision, nullable, key, default)) - """ return columnDefs --- 56,59 ---- *************** *** 98,108 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result = self._cursor.fetchone() ! ##except gadfly.database.error: ! ## result = None ! except: ! print "KEA argh" ! result=[] return result --- 76,80 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result = self._cursor.fetchone() return result *************** *** 112,119 **** self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! try: ! result=self._cursor.fetchall() ! except: ! result=[] return result --- 84,88 ---- self._tableName=tableName self._cursor.execute(self.getQueryString(tableName)) ! result=self._cursor.fetchall() return result Index: dbBrowser2.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/dbBrowser2.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** dbBrowser2.py 18 Sep 2005 03:59:22 -0000 1.9 --- dbBrowser2.py 13 Dec 2005 11:13:22 -0000 1.10 *************** *** 37,41 **** try: self.readme=open('readme.txt').read() ! except: self.readme='' --- 37,41 ---- try: self.readme=open('readme.txt').read() ! except IOError: self.readme='' Index: metakitBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/metakitBrowse.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** metakitBrowse.py 10 May 2003 17:31:32 -0000 1.3 --- metakitBrowse.py 13 Dec 2005 11:13:22 -0000 1.4 *************** *** 1,10 **** #!/usr/bin/python - __version__="$Revision $"[11:-2] - __date__="$Date $" - __author__="Andy Todd <an...@ha...>" - - #jm - marked changes 030218 - """ Module Name: metakitBrowse --- 1,4 ---- *************** *** 18,21 **** --- 12,19 ---- Because metakit isn't a relational database we probably don't need to support the getQueryString method in this class. Its only really an internal utility method for the other, public, classes anyway. """ + #jm - marked changes 030218 + __version__="$Revision $"[11:-2] + __date__="$Date $" + __author__="Andy Todd <an...@ha...>" import metakit *************** *** 95,99 **** try: result.append(getattr(row, c)) ! except: result.append('') #print result --- 93,97 ---- try: result.append(getattr(row, c)) ! except AttributeError: result.append('') #print result Index: postgreBrowse.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/postgreBrowse.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** postgreBrowse.py 25 Jun 2003 20:03:08 -0000 1.2 --- postgreBrowse.py 13 Dec 2005 11:13:22 -0000 1.3 *************** *** 2,9 **** """ - __version__="$Release $" - __date__="Sat Jun 7 13:39:12 BST 2003" - __author__="Jon Dyte <jo...@to...>" - Module Name: psyopg Description: Plug in for PythonCard application dbBrowse to provide Psycopg specific functionality --- 2,5 ---- *************** *** 11,14 **** --- 7,13 ---- Psycopg version of the mysqlBrowse class """ + __version__="$Release $" + __date__="Sat Jun 7 13:39:12 BST 2003" + __author__="Jon Dyte <jo...@to...>" import psycopg *************** *** 23,39 **** "Setup the database connection" self._system_tables = [] ! try: ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = psycopg.connect( "user=%s password=%s dbname=%s" % (connection['username'], ! connection['password'], ! connection['database']) ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' ! except: ! self._cursor=None ! self._tableName=None def getTables(self): --- 22,34 ---- "Setup the database connection" self._system_tables = [] ! # Not providing a db name is guaranteed to ruin our connection ! if not connection['database']: ! raise ValueError ! self._db = psycopg.connect( "user=%s password=%s dbname=%s" % (connection['username'], ! connection['password'], ! connection['database']) ) ! self._cursor=self._db.cursor() ! # This one is used in getRow ! self._tableName='' def getTables(self): *************** *** 51,55 **** try: self._cursor.execute(stmt) ! except: return () desc = self._cursor.description --- 46,50 ---- try: self._cursor.execute(stmt) ! except psycopg.Error: return () desc = self._cursor.description Index: dbBrowser.py =================================================================== RCS file: /cvsroot/pythoncard/PythonCard/samples/dbBrowser/dbBrowser.py,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** dbBrowser.py 24 Apr 2004 21:09:18 -0000 1.32 --- dbBrowser.py 13 Dec 2005 11:13:22 -0000 1.33 *************** *** 2,9 **** """ - __version__ = '$Revision$'[11:-2] - __date__ = "20th November, 2001" - __author__ = "Andy Todd <an...@ha...>" - App Name: dbBrowser Description: A PythonCard sample application to browse data from external data --- 2,5 ---- *************** *** 30,33 **** --- 26,33 ---- When switching between different databases the dynamically created widgets should be cleared up, they currently do not get changed until a table from the new database is selected. """ + __version__ = '$Revision$'[11:-2] + __date__ = "20th November, 2001" + __author__ = "Andy Todd <an...@ha...>" + from PythonCard import configuration, model, dialog #import wx *************** *** 45,50 **** try: self.readme=open('readme.txt').read() ! except: ! self.readme='' def _enableButton(self, enabled): --- 45,50 ---- try: self.readme=open('readme.txt').read() ! except IOError: ! self.readme=__doc__ def _enableButton(self, enabled): |