Library functions for reading and writing tuples from/into database.