Bug 792105 - Startup takes several minutes

set/get_locale are apparently very expensive on Mingw64, and setting
the C locale for extracting a string is unnecessary.

Unfortunately the released version of libdbi still uses strtod so
setting the C locale *is* still necessary for retrieving floats
and doubles and for passing queries.

Thanks to Mkubat for the diagnosis.
This commit is contained in:
John Ralls
2018-04-14 12:33:00 -07:00
parent 4e3bf5a5cb
commit a04fd573ef

View File

@@ -144,7 +144,6 @@ GncDbiSqlResult::IteratorImpl::get_string_at_col(const char* col) const
auto attrs = dbi_result_get_field_attribs (m_inst->m_dbi_result, col);
if(type != DBI_TYPE_STRING)
throw (std::invalid_argument{"Requested string from non-string column."});
gnc_push_locale (LC_NUMERIC, "C");
auto strval = dbi_result_get_string(m_inst->m_dbi_result, col);
if (strval == nullptr)
{
@@ -152,7 +151,6 @@ GncDbiSqlResult::IteratorImpl::get_string_at_col(const char* col) const
throw (std::invalid_argument{"Column empty."});
}
auto retval = std::string{strval};
gnc_pop_locale (LC_NUMERIC);
return retval;
}
time64