def tableFromCursor(csr): tm = pds.stylesheet.DefaultTable.child() for (name, type_code, display_size, internal_size, \ precision, scale, null_ok) in csr.description: tm.addColumn(label=name) if pds.beginTable(model=tm): pds.setFeeder('plain') for raw in csr.fetchall(): pds.tr(*raw) pds.endTable()
def tableFromQuery(q): tm = pds.stylesheet.DefaultTable.child() for col in q.getVisibleColumns(): tm.addColumn(label=col.name) if pds.beginTable(model=tm): pds.setFeeder('plain') for row in q: if True: #pds.beginRow(): for cell in row: if True: # pds.beginCell(): #value = col.atoms2value(atomicRow) # print col.name + " = " + str(value) #pds.p(str(value)) pds.p(cell.format()) pds.endCell() pds.endRow() pds.endTable()