Made use of strdup; rewrote get_field_values

Finally caved and (tried to) replace all string copying with strdup instead of doing it manually, even though it's not totally 'standard C' (but it is POSIX, apparently). Also rewrote get_field_values and made some temporary changes to prevent the program from crashing in select_statement.