Geek: notes to myself
10-Oct-06
I'm trying to select and display some rows from a FrontBase table. I'm accessing the table via a python script, which talks to the database via a pyobjc interface to an Objective-C adaptor to FrontBase.
“getSQLResultsDictionaryIter” is a method which returns an array of dictionaries containing the results.
For example, this snippet:
import objc import ObjectModel import FrontBase fbc = FrontBase.FrontBaseConnection() for m in fbc.getSQLResultsDictionaryIter("select * from MManager"): for k, v in m.items(): print "%s : %s" % (k,v)
returns this:
joined: 2003-05-06 12:00:00 encryptedpassword : D2A55F132c83686A2a3sF9a4F5b7g0D5aCBFaB05 loginname : samplemember mailtroubleindex : 0 firstname : Sample lastname : Member previouslogin : 2006-06-09 16:21:26 fullname : Sample Member logincount : 176 Traceback (most recent call last): File "", line 2, in ? File "build/lib.darwin-8.6.0-Power_Macintosh-2.4/objc/_convenience.py", line 600, in
It's barfing on the primarykey field from the first row returned. For some reason, the adaptor code doesn't want to print the primarykey. The primarykey object is of the following type:
print type(m['primarykey'])
I listed the methods for the m['primarykey'] object as follows:
methodList = [method for method in dir(m['primarykey'])
for method in methodList
FILE = open(“test2″,”w”
FILE.write(method)
FILE.write(“\n”)
FILE.close()
Among the 363 methods were returned, hexString() looked promising.
m['primarykey'].hexString().__str__