[Checkins] SVN: Products.SQLAlchemyDA/trunk/da.py now fully working as a Zope DA. The resultset introspection

Andreas Jung andreas at andreas-jung.com
Mon Apr 30 12:47:33 EDT 2007


Log message for revision 74933:
  now fully working as a Zope DA. The resultset introspection
  however is still a fake
  

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

-=-
Modified: Products.SQLAlchemyDA/trunk/da.py
===================================================================
--- Products.SQLAlchemyDA/trunk/da.py	2007-04-30 16:21:35 UTC (rev 74932)
+++ Products.SQLAlchemyDA/trunk/da.py	2007-04-30 16:47:32 UTC (rev 74933)
@@ -73,13 +73,35 @@
         d['DSN'] = wrapper.dsn
         return d
 
-    def query(self, stmt):
+    def query(self, query_string, max_rows=None, query_data=None):
         """ foo """
+
         wrapper = getSAWrapper(self.sqlalchemy_wrapper_name)
         c = wrapper.connection
-        result = c.execute(stmt)
-        return result
-    
+
+        result = c.execute(query_string).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,
+                    }
+                ) 
+
+        return items, result
+
+    def __call__(self, *args, **kv):
+        return self    
+
+    def sql_quote__(self, s):
+        return s
+
+    def connected(self):
+        return True # this is a lie
  
     manage_info = PageTemplateFile('pt/info', 
                                    globals(), 



More information about the Checkins mailing list