dabo Commit
Revision 7289
Date: 2012-12-07 01:34:54 -0800 (Fri, 07 Dec 2012)
Author: Jacekk
Trac: http://trac.dabodev.com/changeset/7289

Changed:
U   trunk/dabo/db/dbMsSQL.py

Log:
- Fix UnboundLocalError exception when fetching results on pre Python 2.7 
version.
- Fix getFields() method issue for empty table name.

Diff:
Modified: trunk/dabo/db/dbMsSQL.py
===================================================================
--- trunk/dabo/db/dbMsSQL.py    2012-11-26 20:39:06 UTC (rev 7288)
+++ trunk/dabo/db/dbMsSQL.py    2012-12-07 09:34:54 UTC (rev 7289)
@@ -58,8 +58,11 @@
                                def fetchall(self):
                                        # In dictionary mode both column 
numbers and names are used
                                        # as keys. We need to filter them and 
leave name based keys only.
-                                       return tuple([{col: row[col]} for col 
in row if type(col) != int
-                                                       for row in 
super(ConCursor, self).fetchall()])
+                                       rows = super(ConCursor, self).fetchall()
+                                       for row in rows:
+                                               for key in range(len(row) / 2):
+                                                       row.pop(key, None)
+                                       return rows
                else:
                        class ConCursor(self.dbapi.pymssqlCursor):
                                def __init__(self, *args, **kwargs):
@@ -197,7 +200,8 @@
                        tableName = tableNamespace[-1]
                else:
                        tableSchema = "dbo"
-
+               if not tableName:
+                       return ()
                sql = """
 select COLUMN_NAME,
        DATA_TYPE



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to