Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2dot5
ClickHouse
提交
f890af1f
C
ClickHouse
项目概览
2dot5
/
ClickHouse
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ClickHouse
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f890af1f
编写于
1月 25, 2017
作者:
P
proller
提交者:
alexey-milovidov
1月 25, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove code and includes from Collator.h, fix including <unicode/...> in dbms (#395)
上级
8c0e81f8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
66 addition
and
60 deletion
+66
-60
CMakeLists.txt
CMakeLists.txt
+3
-0
dbms/include/DB/Common/Collator.h
dbms/include/DB/Common/Collator.h
+6
-54
dbms/src/Client/CMakeLists.txt
dbms/src/Client/CMakeLists.txt
+0
-2
dbms/src/Common/Collator.cpp
dbms/src/Common/Collator.cpp
+56
-0
dbms/src/Core/SortDescription.cpp
dbms/src/Core/SortDescription.cpp
+1
-0
libs/libcommon/CMakeLists.txt
libs/libcommon/CMakeLists.txt
+0
-2
libs/libzkutil/src/tests/CMakeLists.txt
libs/libzkutil/src/tests/CMakeLists.txt
+0
-2
未找到文件。
CMakeLists.txt
浏览文件 @
f890af1f
...
...
@@ -172,10 +172,13 @@ else ()
endif
()
include
(
cmake/find_openssl.cmake
)
include
(
cmake/find_icu4c.cmake
)
include
(
cmake/find_boost.cmake
)
include
(
cmake/find_poco.cmake
)
include
(
cmake/find_libtool.cmake
)
include
(
cmake/find_rt.cmake
)
include
(
cmake/find_readline_edit.cmake
)
if
(
ENABLE_LIBTCMALLOC
)
include
(
cmake/find_gperftools.cmake
)
endif
()
...
...
dbms/include/DB/Common/Collator.h
浏览文件 @
f890af1f
#pragma once
#pragma GCC diagnostic push
#ifdef __APPLE__
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include <unicode/ucol.h>
#pragma GCC diagnostic pop
#include <DB/Common/Exception.h>
#include <DB/IO/WriteHelpers.h>
#include <common/Common.h>
#include <Poco/String.h>
#include <string>
#include <boost/noncopyable.hpp>
struct
UCollator
;
namespace
DB
{
...
...
@@ -30,48 +18,12 @@ namespace DB
class
Collator
:
private
boost
::
noncopyable
{
public:
explicit
Collator
(
const
std
::
string
&
locale_
)
:
locale
(
Poco
::
toLower
(
locale_
))
{
UErrorCode
status
=
U_ZERO_ERROR
;
explicit
Collator
(
const
std
::
string
&
locale_
);
~
Collator
();
collator
=
ucol_open
(
locale
.
c_str
(),
&
status
);
if
(
status
!=
U_ZERO_ERROR
)
{
ucol_close
(
collator
);
throw
DB
::
Exception
(
"Unsupported collation locale: "
+
locale
,
DB
::
ErrorCodes
::
UNSUPPORTED_COLLATION_LOCALE
);
}
}
~
Collator
()
{
ucol_close
(
collator
);
}
int
compare
(
const
char
*
str1
,
size_t
length1
,
const
char
*
str2
,
size_t
length2
)
const
;
int
compare
(
const
char
*
str1
,
size_t
length1
,
const
char
*
str2
,
size_t
length2
)
const
{
UCharIterator
iter1
,
iter2
;
uiter_setUTF8
(
&
iter1
,
str1
,
length1
);
uiter_setUTF8
(
&
iter2
,
str2
,
length2
);
UErrorCode
status
=
U_ZERO_ERROR
;
UCollationResult
compare_result
=
ucol_strcollIter
(
collator
,
&
iter1
,
&
iter2
,
&
status
);
if
(
status
!=
U_ZERO_ERROR
)
throw
DB
::
Exception
(
"ICU collation comparison failed with error code: "
+
DB
::
toString
(
status
),
DB
::
ErrorCodes
::
COLLATION_COMPARISON_FAILED
);
/** Values of enum UCollationResult are equals to what exactly we need:
* UCOL_EQUAL = 0
* UCOL_GREATER = 1
* UCOL_LESS = -1
*/
return
compare_result
;
}
const
std
::
string
&
getLocale
()
const
{
return
locale
;
}
const
std
::
string
&
getLocale
()
const
;
private:
std
::
string
locale
;
...
...
dbms/src/Client/CMakeLists.txt
浏览文件 @
f890af1f
include
(
${
CMAKE_SOURCE_DIR
}
/cmake/find_readline_edit.cmake
)
add_library
(
clickhouse-client Client.cpp
)
target_link_libraries
(
clickhouse-client dbms
${
LINE_EDITING_LIBS
}
${
Boost_PROGRAM_OPTIONS_LIBRARY
}
)
install
(
FILES config.xml DESTINATION
${
CLICKHOUSE_ETC_DIR
}
/clickhouse-client COMPONENT clickhouse-client
)
...
...
dbms/src/Common/Collator.cpp
0 → 100644
浏览文件 @
f890af1f
#include <DB/Common/Collator.h>
#pragma GCC diagnostic push
#ifdef __APPLE__
#pragma GCC diagnostic ignored "-Wold-style-cast"
#endif
#include <unicode/ucol.h>
#pragma GCC diagnostic pop
#include <DB/Common/Exception.h>
#include <DB/IO/WriteHelpers.h>
#include <common/Common.h>
#include <Poco/String.h>
Collator
::
Collator
(
const
std
::
string
&
locale_
)
:
locale
(
Poco
::
toLower
(
locale_
))
{
UErrorCode
status
=
U_ZERO_ERROR
;
collator
=
ucol_open
(
locale
.
c_str
(),
&
status
);
if
(
status
!=
U_ZERO_ERROR
)
{
ucol_close
(
collator
);
throw
DB
::
Exception
(
"Unsupported collation locale: "
+
locale
,
DB
::
ErrorCodes
::
UNSUPPORTED_COLLATION_LOCALE
);
}
}
Collator
::~
Collator
()
{
ucol_close
(
collator
);
}
int
Collator
::
compare
(
const
char
*
str1
,
size_t
length1
,
const
char
*
str2
,
size_t
length2
)
const
{
UCharIterator
iter1
,
iter2
;
uiter_setUTF8
(
&
iter1
,
str1
,
length1
);
uiter_setUTF8
(
&
iter2
,
str2
,
length2
);
UErrorCode
status
=
U_ZERO_ERROR
;
UCollationResult
compare_result
=
ucol_strcollIter
(
collator
,
&
iter1
,
&
iter2
,
&
status
);
if
(
status
!=
U_ZERO_ERROR
)
throw
DB
::
Exception
(
"ICU collation comparison failed with error code: "
+
DB
::
toString
(
status
),
DB
::
ErrorCodes
::
COLLATION_COMPARISON_FAILED
);
/** Values of enum UCollationResult are equals to what exactly we need:
* UCOL_EQUAL = 0
* UCOL_GREATER = 1
* UCOL_LESS = -1
*/
return
compare_result
;
}
const
std
::
string
&
Collator
::
getLocale
()
const
{
return
locale
;
}
dbms/src/Core/SortDescription.cpp
浏览文件 @
f890af1f
#include <sstream>
#include <DB/Core/SortDescription.h>
#include <DB/Common/Collator.h>
...
...
libs/libcommon/CMakeLists.txt
浏览文件 @
f890af1f
include
(
${
CMAKE_SOURCE_DIR
}
/cmake/find_icu4c.cmake
)
SET
(
CONFIG_VERSION
${
CMAKE_CURRENT_BINARY_DIR
}
/include/common/config_version.h
)
SET
(
CONFIG_COMMON
${
CMAKE_CURRENT_BINARY_DIR
}
/include/common/config_common.h
)
...
...
libs/libzkutil/src/tests/CMakeLists.txt
浏览文件 @
f890af1f
include
(
${
CMAKE_SOURCE_DIR
}
/cmake/find_readline_edit.cmake
)
add_executable
(
zkutil_test zkutil_test.cpp
)
target_link_libraries
(
zkutil_test zkutil dbms
${
LINE_EDITING_LIBS
}
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录