Open jankatins opened 3 years ago
Hey @jankatins thank you for the issue. Yeah, if the usual output is TRUE/FALSE then we should aim for that. The way we're displaying data in our tables is using the following piece of code, that can be found here:
try {
switch(props.get_data_type())
{
case soci::dt_string:
cell = r.get<std::string>(i, "NULL");
break;
case soci::dt_double:
cell = std::to_string(r.get<double>(i));
cell.erase(cell.find_last_not_of('0') + 1, std::string::npos);
if (cell.back() == '.') {
cell.pop_back();
}
break;
case soci::dt_integer:
cell = std::to_string(r.get<int>(i));
break;
case soci::dt_long_long:
cell = std::to_string(r.get<long long>(i));
break;
case soci::dt_unsigned_long_long:
cell = std::to_string(r.get<unsigned long long>(i));
break;
case soci::dt_xml:
case soci::dt_blob:
break;
case soci::dt_date:
std::tm when = r.get<std::tm>(i);
cell = std::asctime(&when);
break;
}
} catch (...) {
cell = "NULL";
}
This was copied from SOCI's docs on how to display data. As you can see... It doesn't have a special case treating bools
, I think the problem might be related to that? I don't have the time in the moment, but here's how I'd tackle the problem in case someone else is interested in doing it:
soci::dt_bool
1.1. If it does, just include this case on the switch
statement, get the data with r.get
and either attribute TRUE/FALSE
to the cell
var.
1.2 If it doesn't maybe it's possible to add an if
inside the switch
statement that is catching the bool types (maybe it's soci::dt_integer
?) read the value inputed by the user with r.get
and either attribute TRUE/FALSE
to the cell
var.Thanks again!
We could also just overwrite this locally. Easier than proposing upstream.
Using
I get a display of
Which looks wrong to my eyes which are used to normal psql output. If this has to be fixed deeper, I can also open a ticket in soci...