Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Support for Fetch Modes #4

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
211 changes: 150 additions & 61 deletions SeasClick.cpp

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ if test "$PHP_SEASCLICK" != "no"; then
lib/clickhouse-cpp/clickhouse/columns/string.cpp \
lib/clickhouse-cpp/clickhouse/columns/tuple.cpp \
lib/clickhouse-cpp/clickhouse/columns/uuid.cpp \
lib/clickhouse-cpp/clickhouse/columns/decimal.cpp \
lib/clickhouse-cpp/clickhouse/columns/ip4.cpp \
lib/clickhouse-cpp/clickhouse/columns/ip6.cpp \
lib/clickhouse-cpp/clickhouse/types/type_parser.cpp \
lib/clickhouse-cpp/clickhouse/types/types.cpp \
lib/clickhouse-cpp/contrib/cityhash/city.cc \
Expand Down
20 changes: 0 additions & 20 deletions lib/clickhouse-cpp/BUCK

This file was deleted.

26 changes: 18 additions & 8 deletions lib/clickhouse-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2)

INCLUDE (cmake/cpp11.cmake)
INCLUDE (cmake/cpp17.cmake)
INCLUDE (cmake/subdirs.cmake)

OPTION(BUILD_BENCHMARK "Build benchmark" OFF)
OPTION(BUILD_TESTS "Build tests" OFF)

PROJECT (CLICKHOUSE-CLIENT)

USE_CXX11()
USE_CXX17()

IF ("${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE "Debug")
ENDIF()

IF (UNIX)
IF (APPLE)
SET (CMAKE_CXX_FLAGS "-O2 -Wall -Wextra -Werror")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -Wall -Wextra -Werror")
ELSE ()
SET (CMAKE_CXX_FLAGS "-O2 -pthread -Wall -Wextra -Werror")
SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2 -pthread -Wall -Wextra -Werror")
ENDIF ()
SET (CMAKE_EXE_LINKER_FLAGS, "-lpthread")
SET (CMAKE_EXE_LINKER_FLAGS, "${CMAKE_EXE_LINKER_FLAGS} -lpthread")
ENDIF ()

INCLUDE_DIRECTORIES(.)
Expand All @@ -24,12 +29,17 @@ PROJECT (CLICKHOUSE-CLIENT)
SUBDIRS (
clickhouse
contrib/cityhash
contrib/gtest
contrib/lz4
tests/simple
ut
)

IF (BUILD_BENCHMARK)
SUBDIRS(bench)
ENDIF (BUILD_BENCHMARK)

IF (BUILD_TESTS)
SUBDIRS(
contrib/gtest
tests/simple
ut
)
ENDIF (BUILD_TESTS)
2 changes: 1 addition & 1 deletion lib/clickhouse-cpp/LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2017 Pavel Artemkin
Copyright 2017 - 2020 Pavel Artemkin

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
9 changes: 4 additions & 5 deletions lib/clickhouse-cpp/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
ClickHouse C++ client [![Build Status](https://travis-ci.org/artpaul/clickhouse-cpp.svg?branch=master)](https://travis-ci.org/artpaul/clickhouse-cpp)
=====

C++ client for [Yandex ClickHouse](https://clickhouse.yandex/)

## This repositorie change
* [Add InsertQuery and InsertData methods](https://github.com/aiwhj/clickhouse-cpp/commit/bab28bcb5a509d80b8e2e0c7e89512446283dde5)
C++ client for [ClickHouse](https://clickhouse.tech/)

## Supported data types

* Array(T)
* Date
* DateTime
* Decimal32, Decimal64, Decimal128
* Enum8, Enum16
* FixedString(N)
* Float32, Float64
* IPv4, IPv6
* Nullable(T)
* String
* Tuple
Expand All @@ -24,7 +23,7 @@ C++ client for [Yandex ClickHouse](https://clickhouse.yandex/)
```sh
$ mkdir build .
$ cd build
$ cmake ..
$ cmake .. [-DBUILD_TESTS=ON]
$ make
```

Expand Down
13 changes: 12 additions & 1 deletion lib/clickhouse-cpp/clickhouse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ADD_LIBRARY (clickhouse-cpp-lib
SET ( clickhouse-cpp-lib-src
base/coded.cpp
base/compressed.cpp
base/input.cpp
Expand All @@ -8,8 +8,11 @@ ADD_LIBRARY (clickhouse-cpp-lib

columns/array.cpp
columns/date.cpp
columns/decimal.cpp
columns/enum.cpp
columns/factory.cpp
columns/ip4.cpp
columns/ip6.cpp
columns/nullable.cpp
columns/numeric.cpp
columns/string.cpp
Expand All @@ -24,10 +27,18 @@ ADD_LIBRARY (clickhouse-cpp-lib
query.cpp
)

ADD_LIBRARY (clickhouse-cpp-lib SHARED ${clickhouse-cpp-lib-src})

SET_TARGET_PROPERTIES(clickhouse-cpp-lib
PROPERTIES LINKER_LANGUAGE CXX)

TARGET_LINK_LIBRARIES (clickhouse-cpp-lib
cityhash-lib
lz4-lib
)

ADD_LIBRARY (clickhouse-cpp-lib-static STATIC ${clickhouse-cpp-lib-src})
TARGET_LINK_LIBRARIES (clickhouse-cpp-lib-static
cityhash-lib
lz4-lib
)
6 changes: 3 additions & 3 deletions lib/clickhouse-cpp/clickhouse/base/coded.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ bool CodedInputStream::Skip(size_t count) {
bool CodedInputStream::ReadVarint64(uint64_t* value) {
*value = 0;

for (size_t i = 0; i < 9; ++i) {
for (size_t i = 0; i < MAX_VARINT_BYTES; ++i) {
uint8_t byte;

if (!input_->ReadByte(&byte)) {
return false;
} else {
*value |= (byte & 0x7F) << (7 * i);
*value |= uint64_t(byte & 0x7F) << (7 * i);

if (!(byte & 0x80)) {
return true;
Expand Down Expand Up @@ -81,7 +81,7 @@ void CodedOutputStream::WriteVarint64(uint64_t value) {
uint8_t bytes[MAX_VARINT_BYTES];
int size = 0;

for (size_t i = 0; i < 9; ++i) {
for (size_t i = 0; i < MAX_VARINT_BYTES; ++i) {
uint8_t byte = value & 0x7F;
if (value > 0x7F)
byte |= 0x80;
Expand Down
8 changes: 0 additions & 8 deletions lib/clickhouse-cpp/clickhouse/base/compressed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@ CompressedInput::CompressedInput(CodedInputStream* input)
{
}

CompressedInput::~CompressedInput() {
if (!mem_.Exhausted()) {
if (!std::uncaught_exception()) {
throw std::runtime_error("some data was not readed");
}
}
}

size_t CompressedInput::DoNext(const void** ptr, size_t len) {
if (mem_.Exhausted()) {
if (!Decompress()) {
Expand Down
1 change: 0 additions & 1 deletion lib/clickhouse-cpp/clickhouse/base/compressed.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace clickhouse {
class CompressedInput : public ZeroCopyInput {
public:
CompressedInput(CodedInputStream* input);
~CompressedInput();

protected:
size_t DoNext(const void** ptr, size_t len) override;
Expand Down
2 changes: 1 addition & 1 deletion lib/clickhouse-cpp/clickhouse/base/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# define _win_
#endif

#if defined(_linux_)
#if defined(_linux_) || defined (_darwin_)
# define _unix_
#endif

Expand Down
Loading