jt2594838 commented on code in PR #15439: URL: https://github.com/apache/iotdb/pull/15439#discussion_r2083806719
########## iotdb-client/client-cpp/src/main/TableSession.h: ########## @@ -27,15 +27,19 @@ class TableSession { private: Session* session; + string getDatabase(); public: TableSession(Session* session) { this->session = session; } + ~TableSession() { + delete session; + session = nullptr; Review Comment: Check the nullability of session? ########## iotdb-client/client-cpp/src/main/Common.cc: ########## @@ -18,6 +18,36 @@ */ #include "Common.h" +#include <boost/date_time/gregorian/gregorian.hpp> + +int32_t parseDateExpressionToInt(const boost::gregorian::date& date) { + if(date.is_not_a_date()) { + throw IoTDBException("Date expression is null or empty."); + } + + const int year = date.year(); + if(year < 1000 || year > 9999) { + throw IoTDBException("Year must be between 1000 and 9999."); + } + + const int64_t result = static_cast<int64_t>(year) * 10000 + + date.month() * 100 + + date.day(); + if(result > INT32_MAX || result < INT32_MIN) { + throw IoTDBException("Date value overflow"); Review Comment: Give the date in the exception message. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@iotdb.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org