FeResPost Web Site                     FeResPost Online User Manual

V.1.3 SQLite examples

The use of the SQLite library is explained in the Python documentation. With FeResPost, the BLOB object returned by the “toBlob” method must be converted into a buffer using the “sqlite3.Binary” 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,sqlite3.Binary(res.toBlob())])
            sqldb.commit()
        else:
            print "NO FOR" + lcName + resName