Here you have it.
Most of the basic db functionality is in place now. Changing print_col out for a user-supplied callback function might be a cool idea.