Skip to content

Commit

Permalink
Ido*sqlConnection#FieldToEscapedString(): don't overflow timestamps >…
Browse files Browse the repository at this point in the history
… long
  • Loading branch information
Al2Klimov committed Oct 1, 2024
1 parent 01d3a1d commit ad6fcda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/db_ido_mysql/idomysqlconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -891,9 +891,9 @@ bool IdoMysqlConnection::FieldToEscapedString(const String& key, const Value& va

*result = static_cast<long>(dbrefcol);
} else if (DbValue::IsTimestamp(value)) {
long ts = rawvalue;
double ts = rawvalue;
std::ostringstream msgbuf;
msgbuf << "FROM_UNIXTIME(" << ts << ")";
msgbuf << "FROM_UNIXTIME(" << std::fixed << std::setprecision(0) << ts << ")";
*result = Value(msgbuf.str());
} else if (DbValue::IsObjectInsertID(value)) {
auto id = static_cast<long>(rawvalue);
Expand Down
4 changes: 2 additions & 2 deletions lib/db_ido_pgsql/idopgsqlconnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -700,9 +700,9 @@ bool IdoPgsqlConnection::FieldToEscapedString(const String& key, const Value& va

*result = static_cast<long>(dbrefcol);
} else if (DbValue::IsTimestamp(value)) {
long ts = rawvalue;
double ts = rawvalue;
std::ostringstream msgbuf;
msgbuf << "TO_TIMESTAMP(" << ts << ") AT TIME ZONE 'UTC'";
msgbuf << "TO_TIMESTAMP(" << std::fixed << std::setprecision(0) << ts << ") AT TIME ZONE 'UTC'";
*result = Value(msgbuf.str());
} else if (DbValue::IsObjectInsertID(value)) {
auto id = static_cast<long>(rawvalue);
Expand Down

0 comments on commit ad6fcda

Please sign in to comment.