[API break] Make date/boolean formats thread safe

Store the preferred date and boolean formats in the MdbHandle rather
than in global memory.
This commit is contained in:
Evan Miller
2020-08-19 21:26:06 -04:00
parent 7b51824c89
commit 5d078838ed
4 changed files with 41 additions and 35 deletions

View File

@@ -159,17 +159,11 @@ main(int argc, char **argv)
if (insert_dialect)
header_row = 0;
if (date_fmt)
mdb_set_date_fmt(date_fmt);
if (null_text)
null_text = escapes(null_text);
else
null_text = g_strdup("");
if (boolean_words)
mdb_set_boolean_fmt_words();
if (str_bin_mode) {
if (!strcmp(str_bin_mode, "strip"))
bin_mode = MDB_BINEXPORT_STRIP;
@@ -189,6 +183,12 @@ main(int argc, char **argv)
exit(1);
}
if (date_fmt)
mdb_set_date_fmt(mdb, date_fmt);
if (boolean_words)
mdb_set_boolean_fmt_words(mdb);
if (insert_dialect)
if (!mdb_set_default_backend(mdb, insert_dialect)) {
fputs("Invalid backend type\n", stderr);