Contact: fumanchu@aminus.org

Log in as guest/dejavu to create tickets

I think I've seen this ORM somewhere before...

Changeset 345

Show
Ignore:
Timestamp:
12/13/06 08:04:26
Author:
fumanchu
Message:

A couple more inlined COM calls (Execute and Fields).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/storage/storeado.py

    r344 r345  
    99import win32com.client 
    1010clientobj = win32com.client._get_good_object_ 
     11OLERecordset = win32com.client.gencache.GetClassForCLSID('{00000556-0000-0010-8000-00AA006D2EA4}') 
     12OLEFields = win32com.client.gencache.GetClassForCLSID('{00000564-0000-0010-8000-00AA006D2EA4}') 
    1113OLEField = win32com.client.gencache.GetClassForCLSID('{00000569-0000-0010-8000-00AA006D2EA4}') 
    1214LCID = 0x0 
     
    579581                    # 'conn' is a ConnectionWrapper object, which .Open 
    580582                    # won't accept. Pass the unwrapped connection instead. 
    581                     res, rows_affected = conn.conn.Execute(query) 
    582                 else: 
    583                     res, rows_affected = conn.Execute(query) 
     583                    conn = conn.conn 
     584                 
     585                obj = conn._oleobj_.InvokeTypes(6, 0, 1, (9, 0), 
     586                                                ((8, 1), (16396, 18), (3, 49)), 
     587                                                # *args = 
     588                                                query, pythoncom.Missing, -1) 
     589                res, rows_affected = obj 
     590                res = OLERecordset(res) 
    584591        except pywintypes.com_error, x: 
    585592            try: 
     
    594601         
    595602        # Using xrange(Count) is slightly faster than "for x in resFields". 
    596         resFields = res.Fields  # 3ms 
     603        resFields = res._oleobj_.InvokeTypes(0, 0, 2, (9, 0), ()) 
     604        resFields = OLEFields(resFields) 
    597605        columns = [] 
    598606        for i in xrange(resFields.Count): 
    599607            # Wow. Calling this directly (instead of resFields(i)) 
    600             # results in a 29% speedup for fetch() as a whole
     608            # results in a 29% speedup for a 1-row fetch() of 48 fields
    601609            x = resFields._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),), i) 
    602610            x = OLEField(x) 
    603611             
    604612            # Wow. Calling these directly (instead of x.Name, x.Type) 
    605             # results in a 40% speedup for fetch() as a whole
     613            # results in a 40% speedup for a 1-row fetch() of 48 fields
    606614            name = x._oleobj_.InvokeTypes(1100, 0, 2, (8, 0), ()) 
    607615            typ = x._oleobj_.InvokeTypes(1102, 0, 2, (3, 0), ())