Use ctypes instead of system() for most database accesses.