[Checkins] SVN: Products.SQLAlchemyDA/trunk/da.py include real col names

Andreas Jung andreas at andreas-jung.com
Mon Apr 30 13:02:53 EDT 2007


Log message for revision 74934:
  include real col names
  

Changed:
  U   Products.SQLAlchemyDA/trunk/da.py

-=-
Modified: Products.SQLAlchemyDA/trunk/da.py
===================================================================
--- Products.SQLAlchemyDA/trunk/da.py	2007-04-30 16:47:32 UTC (rev 74933)
+++ Products.SQLAlchemyDA/trunk/da.py	2007-04-30 17:02:52 UTC (rev 74934)
@@ -79,20 +79,20 @@
         wrapper = getSAWrapper(self.sqlalchemy_wrapper_name)
         c = wrapper.connection
 
-        result = c.execute(query_string).fetchall()
+        result_proxy  = c.execute(query_string)
+        rows = result_proxy.fetchall()
 
         items = []
-        if len(result) > 0:
-           for i, v in enumerate(result[0]):
-                items.append(
-                    {'name' : 'col%d' % i,
-                     'type' : 'string',
-                     'width' : 72,
-                     'null' : True,
-                    }
-                ) 
+        for  key in result_proxy.keys:
+            items.append(
+                {'name' : key,
+                 'type' : 'string',  # fix this
+                 'width' : 0,        # fix this
+                 'null' : True,      # fix this
+                }
+            ) 
 
-        return items, result
+        return items, rows
 
     def __call__(self, *args, **kv):
         return self    



More information about the Checkins mailing list