FeResPost Web Site                     FeResPost Online User Manual

V.1.3 SQLite examples

The use of SQLite library is explained in Python documentation. With FeResPost, the BLOB object returned by “toBlob” method must be converted into a Python buffer using the corresponding function:

for lcName in lcNames:  
    for resName in resNames:  
        results=db.getAttachmentResults(xdbFileName,lcName,scNames,resName)  
        if (results):  
            for key,res in results.iteritems():  
                print key  
                sqldb.execute(  
                    "insert or replace into dynam_results_1 values(?,?,?,?,?,?,?,?,?,?)",  
                    [lcName,key[1],resName,res.TensorOrder,  
                    res.getIntId(0),res.getIntId(1),  
                    res.getRealId(0),res.getRealId(1),  
                    res.Size,buffer(res.toBlob())])  
            sqldb.commit()  
        else:  
            print "NO FOR" + lcName + resName

Note that the call to “buffer” method seems necessary with versions 2.* of Python, but must be removed for version 3.*.