Skip to content

Commit

Permalink
Fix update of timestamp data in Fb4
Browse files Browse the repository at this point in the history
fix #240
Also fix support for "current_timestamp" not showing time values
  • Loading branch information
arvanus committed Dec 13, 2021
1 parent b236510 commit e601534
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/gui/controls/DataGridRows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void GridCellFormats::loadFromConfig()
dateFormatM = config().get("DateFormat", wxString("D.M.Y"));
timeFormatM = config().get("TimeFormat", wxString("H:M:S.T"));
timestampFormatM = config().get("TimestampFormat",
wxString("D.N.Y, H:M:S.T"));
wxString("D.N.Y H:M:S.T"));
showTimezoneInfoM = (ShowTimezoneInfoType)config().get("ShowTimezoneInfo", int(tzName));

maxBlobKBytesM = config().get("DataGridFetchBlobAmount", 1);
Expand Down Expand Up @@ -819,7 +819,9 @@ void DateColumnDef::setFromString(DataGridRowBuffer* buffer,
idt.Add(-1);
else if (temp.CmpNoCase("DATE") != 0
&& temp.CmpNoCase("NOW") != 0
&& temp.CmpNoCase("TODAY") != 0)
&& temp.CmpNoCase("TODAY") != 0
&& temp.CmpNoCase("CURRENT_DATE") != 0
&& temp.CmpNoCase("CURRENT_TIMESTAMP") != 0)
{
wxString::iterator it = temp.begin();
if (!GridCellFormats::get().parseDate(it, temp.end(), true, y, m, d))
Expand Down Expand Up @@ -1052,7 +1054,7 @@ wxString TimestampColumnDef::getAsFirebirdString(DataGridRowBuffer* buffer)
ts.GetDate(year, month, day);
ts.GetTime(hour, minute, second, tenththousands);

return wxString::Format("%d-%d-%d, %d:%d:%d.%d", year, month, day,
return wxString::Format("%d-%d-%d %d:%d:%d.%d", year, month, day,
hour, minute, second, tenththousands / 10);
}

Expand All @@ -1070,7 +1072,8 @@ void TimestampColumnDef::setFromString(DataGridRowBuffer* buffer,
its.Add(1);
else if (temp.CmpNoCase("YESTERDAY") == 0)
its.Add(-1);
else if (temp.CmpNoCase("NOW") == 0)
else if ((temp.CmpNoCase("NOW") == 0) ||
(temp.CmpNoCase("CURRENT_TIMESTAMP") == 0))
its.Now(); // with time
else if (temp.CmpNoCase("DATE") != 0
&& temp.CmpNoCase("TODAY") != 0)
Expand Down

0 comments on commit e601534

Please sign in to comment.