Skip to content

Commit eadf024

Browse files
Build fixes
1 parent 3f67f4f commit eadf024

File tree

9 files changed

+27
-130
lines changed

9 files changed

+27
-130
lines changed

base/common/LocalDateTime.h

+23-1
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,30 @@ class LocalDateTime
106106
void second(unsigned char x) { m_second = x; }
107107

108108
LocalDate toDate() const { return LocalDate(m_year, m_month, m_day); }
109+
LocalDateTime toStartOfDate() const { return LocalDateTime(m_year, m_month, m_day, 0, 0, 0); }
109110

110-
LocalDateTime toStartOfDate() { return LocalDateTime(m_year, m_month, m_day, 0, 0, 0); }
111+
std::string toString() const
112+
{
113+
std::string s{"0000-00-00 00:00:00"};
114+
115+
s[0] += m_year / 1000;
116+
s[1] += (m_year / 100) % 10;
117+
s[2] += (m_year / 10) % 10;
118+
s[3] += m_year % 10;
119+
s[5] += m_month / 10;
120+
s[6] += m_month % 10;
121+
s[8] += m_day / 10;
122+
s[9] += m_day % 10;
123+
124+
s[11] += m_hour / 10;
125+
s[12] += m_hour % 10;
126+
s[14] += m_minute / 10;
127+
s[15] += m_minute % 10;
128+
s[17] += m_second / 10;
129+
s[18] += m_second % 10;
130+
131+
return s;
132+
}
111133

112134
bool operator< (const LocalDateTime & other) const
113135
{

base/mysqlxx/tests/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
add_executable (mysqlxx_test mysqlxx_test.cpp)
2-
target_link_libraries (mysqlxx_test PRIVATE mysqlxx)
3-
41
add_executable (mysqlxx_pool_test mysqlxx_pool_test.cpp)
52
target_link_libraries (mysqlxx_pool_test PRIVATE mysqlxx)

base/mysqlxx/tests/failover.xml

-21
This file was deleted.

base/mysqlxx/tests/mysqlxx_test.cpp

-77
This file was deleted.

programs/odbc-bridge/ODBCBlockInputStream.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ namespace
8787
case ValueType::vtDateTime:
8888
{
8989
Poco::DateTime datetime = value.convert<Poco::DateTime>();
90-
assert_cast<ColumnUInt32 &>(column).insertValue(time_t{LocalDateTime(
91-
datetime.year(), datetime.month(), datetime.day(), datetime.hour(), datetime.minute(), datetime.second())});
90+
assert_cast<ColumnUInt32 &>(column).insertValue(DateLUT::instance().makeDateTime(
91+
datetime.year(), datetime.month(), datetime.day(), datetime.hour(), datetime.minute(), datetime.second()));
9292
break;
9393
}
9494
case ValueType::vtUUID:

programs/odbc-bridge/ODBCBlockOutputStream.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ namespace
8181
case ValueType::vtDate:
8282
return Poco::Dynamic::Var(LocalDate(DayNum(field.get<UInt64>())).toString()).convert<String>();
8383
case ValueType::vtDateTime:
84-
return Poco::Dynamic::Var(std::to_string(LocalDateTime(time_t(field.get<UInt64>())))).convert<String>();
84+
return Poco::Dynamic::Var(DateLUT::instance().timeToString(time_t(field.get<UInt64>()))).convert<String>();
8585
case ValueType::vtUUID:
8686
return Poco::Dynamic::Var(UUID(field.get<UInt128>()).toUnderType().toHexString()).convert<std::string>();
8787
default:

src/Storages/tests/CMakeLists.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
add_executable (part_name part_name.cpp)
2-
target_link_libraries (part_name PRIVATE dbms)
3-
41
add_executable (remove_symlink_directory remove_symlink_directory.cpp)
52
target_link_libraries (remove_symlink_directory PRIVATE dbms)
63

src/Storages/tests/part_name.cpp

-21
This file was deleted.

utils/wikistat-loader/main.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ try
151151

152152
std::string time_str = options.at("time").as<std::string>();
153153
LocalDateTime time(time_str);
154-
LocalDate date(time);
154+
LocalDate date(time_str);
155155

156156
DB::ReadBufferFromFileDescriptor in(STDIN_FILENO);
157157
DB::WriteBufferFromFileDescriptor out(STDOUT_FILENO);

0 commit comments

Comments
 (0)