Skip to content

Commit bffbf7b

Browse files
authored
adjust cpp api in tree mode (#1021)
1 parent 2470294 commit bffbf7b

8 files changed

Lines changed: 180 additions & 24 deletions

File tree

src/UserGuide/Master/Tree/API/Programming-Cpp-Native-API.md

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- Bison 2.7+
2929
- Boost 1.56+
3030
- OpenSSL 1.0+
31-
- GCC 5.5.0+
31+
- GCC 4.8.5+
3232

3333
## 2. Installation
3434

@@ -113,9 +113,16 @@ Run Maven to compile in the IoTDB root directory:
113113
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT
114114
```
115115

116+
- Linux with glibc version >= 2.23
117+
118+
```shell
119+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
120+
```
121+
116122
- Linux with glibc version >= 2.17
123+
117124
```shell
118-
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
125+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
119126
```
120127

121128
- Windows using Visual Studio 2022
@@ -391,6 +398,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
391398
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
392399
```
393400
401+
The `SessionDataSet` class primarily provides the following methods:
402+
403+
| Method Name | Description | Parameters | Return Type |
404+
| :--- | :--- | :--- | :--- |
405+
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
406+
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
407+
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
408+
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
409+
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
410+
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
411+
| **setFetchSize(int fetchSize)** | Sets the number of rows to be fetched in each batch from the server. | `fetchSize`: The number of rows to fetch per batch | `void` |
412+
| **closeOperationHandle(bool forceClose)** | Closes the query handle on the server side and releases resources. It is recommended to call this method after finishing using the dataset. | `forceClose`: Whether to force close (defaults to `false`) | `void` |
413+
414+
394415
- Execute non query statement
395416
```cpp
396417
void executeNonQueryStatement(const std::string &sql);
@@ -401,8 +422,8 @@ void executeNonQueryStatement(const std::string &sql);
401422
402423
The sample code of using these interfaces is in:
403424
404-
- `example/client-cpp-example/src/SessionExample.cpp`: [SessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/SessionExample.cpp)
405-
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (Aligned Timeseries) : [AlignedTimeseriesSessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp)
425+
- `example/client-cpp-example/src/SessionExample.cpp`: [SessionExample](https://github.com/apache/iotdb/tree/rc/2.0.1/example/client-cpp-example/src/SessionExample.cpp)
426+
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (Aligned Timeseries) : [AlignedTimeseriesSessionExample](https://github.com/apache/iotdb/tree/rc/2.0.1/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp)
406427
407428
If the compilation finishes successfully, the example project will be placed under `example/client-cpp-example/target`
408429

src/UserGuide/V1.3.x/API/Programming-Cpp-Native-API.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- Bison 2.7+
2626
- Boost 1.56+
2727
- OpenSSL 1.0+
28-
- GCC 5.5.0+
28+
- GCC 4.8.5+
2929

3030
## Installation
3131

@@ -119,12 +119,18 @@ Run Maven to compile in the IoTDB root directory:
119119
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT
120120
```
121121

122-
- Linux with glibc version >= 2.17
122+
- Linux with glibc version >= 2.23
123123

124124
```shell
125125
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
126126
```
127127

128+
- Linux with glibc version >= 2.17
129+
130+
```shell
131+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
132+
```
133+
128134
- Windows using Visual Studio 2022
129135

130136
```batch
@@ -424,6 +430,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
424430
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
425431
```
426432
433+
The `SessionDataSet` class primarily provides the following methods:
434+
435+
| Method Name | Description | Parameters | Return Type |
436+
| :--- | :--- | :--- | :--- |
437+
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
438+
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
439+
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
440+
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
441+
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
442+
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
443+
| **setFetchSize(int fetchSize)** | Sets the number of rows to be fetched in each batch from the server. | `fetchSize`: The number of rows to fetch per batch | `void` |
444+
| **closeOperationHandle(bool forceClose)** | Closes the query handle on the server side and releases resources. It is recommended to call this method after finishing using the dataset. | `forceClose`: Whether to force close (defaults to `false`) | `void` |
445+
446+
427447
- Execute non query statement
428448
429449
```cpp

src/UserGuide/dev-1.3/API/Programming-Cpp-Native-API.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- Bison 2.7+
2626
- Boost 1.56+
2727
- OpenSSL 1.0+
28-
- GCC 5.5.0+
28+
- GCC 4.8.5+
2929

3030
## Installation
3131

@@ -119,12 +119,18 @@ Run Maven to compile in the IoTDB root directory:
119119
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT
120120
```
121121

122-
- Linux with glibc version >= 2.17
122+
- Linux with glibc version >= 2.23
123123

124124
```shell
125125
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
126126
```
127127

128+
- Linux with glibc version >= 2.17
129+
130+
```shell
131+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
132+
```
133+
128134
- Windows using Visual Studio 2022
129135

130136
```batch
@@ -424,6 +430,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
424430
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
425431
```
426432
433+
The `SessionDataSet` class primarily provides the following methods:
434+
435+
| Method Name | Description | Parameters | Return Type |
436+
| :--- | :--- | :--- | :--- |
437+
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
438+
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
439+
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
440+
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
441+
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
442+
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
443+
| **setFetchSize(int fetchSize)** | Sets the number of rows to be fetched in each batch from the server. | `fetchSize`: The number of rows to fetch per batch | `void` |
444+
| **closeOperationHandle(bool forceClose)** | Closes the query handle on the server side and releases resources. It is recommended to call this method after finishing using the dataset. | `forceClose`: Whether to force close (defaults to `false`) | `void` |
445+
446+
427447
- Execute non query statement
428448
429449
```cpp
@@ -434,8 +454,8 @@ void executeNonQueryStatement(const std::string &sql);
434454
435455
The sample code of using these interfaces is in:
436456
437-
- `example/client-cpp-example/src/SessionExample.cpp`
438-
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (Aligned Timeseries)
457+
- `example/client-cpp-example/src/SessionExample.cpp` : [SessionExample](https://github.com/apache/iotdb/tree/rc/1.3.3/example/client-cpp-example/src/SessionExample.cpp)
458+
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (Aligned Timeseries) : [AlignedTimeseriesSessionExample](https://github.com/apache/iotdb/tree/rc/1.3.3/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp)
439459
440460
If the compilation finishes successfully, the example project will be placed under `example/client-cpp-example/target`
441461

src/UserGuide/latest/API/Programming-Cpp-Native-API.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- Bison 2.7+
2929
- Boost 1.56+
3030
- OpenSSL 1.0+
31-
- GCC 5.5.0+
31+
- GCC 4.8.5+
3232

3333
## 2. Installation
3434

@@ -113,9 +113,16 @@ Run Maven to compile in the IoTDB root directory:
113113
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT
114114
```
115115

116+
- Linux with glibc version >= 2.23
117+
118+
```shell
119+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
120+
```
121+
116122
- Linux with glibc version >= 2.17
123+
117124
```shell
118-
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
125+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
119126
```
120127

121128
- Windows using Visual Studio 2022
@@ -391,6 +398,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
391398
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
392399
```
393400
401+
The `SessionDataSet` class primarily provides the following methods:
402+
403+
| Method Name | Description | Parameters | Return Type |
404+
| :--- | :--- | :--- | :--- |
405+
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
406+
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
407+
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
408+
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
409+
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
410+
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
411+
| **setFetchSize(int fetchSize)** | Sets the number of rows to be fetched in each batch from the server. | `fetchSize`: The number of rows to fetch per batch | `void` |
412+
| **closeOperationHandle(bool forceClose)** | Closes the query handle on the server side and releases resources. It is recommended to call this method after finishing using the dataset. | `forceClose`: Whether to force close (defaults to `false`) | `void` |
413+
414+
394415
- Execute non query statement
395416
```cpp
396417
void executeNonQueryStatement(const std::string &sql);

src/zh/UserGuide/Master/Tree/API/Programming-Cpp-Native-API.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- Bison 2.7+
2929
- Boost 1.56+
3030
- OpenSSL 1.0+
31-
- GCC 5.5.0+
31+
- GCC 4.8.5+
3232

3333

3434
## 2. 安装
@@ -118,11 +118,16 @@ git checkout rc/1.3.2
118118
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT
119119
```
120120

121-
- glibc 版本 >= 2.17 的 Linux
121+
- glibc 版本 >= 2.23 的 Linux
122122
```shell
123123
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
124124
```
125125

126+
- glibc 版本 >= 2.17 的 Linux
127+
```shell
128+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
129+
```
130+
126131
- 使用 Visual Studio 2022 的 Windows
127132
```batch
128133
.\mvnw.cmd clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp
@@ -398,6 +403,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
398403
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
399404
```
400405

406+
返回值 `SessionDataSet` 类主要提供如下方法:
407+
408+
| 方法名 | 描述 | 参数 | 返回值 |
409+
| :--- | :--- |:----------------------------------| :--- |
410+
| **hasNext()** | 判断结果集中是否还有更多数据行。 | - | `bool` |
411+
| **next()** | 获取结果集中的下一行数据,封装为一个 `RowRecord` 对象。 | - | `std::shared_ptr` |
412+
| **getIterator()** | 获取一个 `DataIterator` 迭代器,用于以更灵活的方式(按列)遍历数据。 | - | `SessionDataSet::DataIterator` |
413+
| **getColumnNames()** | 获取结果集中所有列的名称列表。 | - | `const std::vector&` |
414+
| **getColumnTypeList()** | 获取结果集中所有列的数据类型列表。 | - | `const std::vector&` |
415+
| **getFetchSize()** | 获取当前每次从服务器批量抓取数据的行数。 | - | `int` |
416+
| **setFetchSize(int fetchSize)** | 设置每次从服务器批量抓取数据的行数。 | `fetchSize`: 批量抓取数据的行数 | `void` |
417+
| **closeOperationHandle(bool forceClose)** | 关闭服务器端的查询句柄,释放资源。建议在数据集使用完毕后调用。 | `forceClose`: 是否强制关闭(默认为 `false`| `void` |
418+
419+
401420
- 执行非查询语句
402421
```cpp
403422
void executeNonQueryStatement(const std::string &sql);
@@ -408,8 +427,8 @@ void executeNonQueryStatement(const std::string &sql);
408427

409428
示例工程源代码:
410429

411-
- `example/client-cpp-example/src/SessionExample.cpp` : [SessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/SessionExample.cpp)
412-
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (使用对齐时间序列) : [AlignedTimeseriesSessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp)
430+
- `example/client-cpp-example/src/SessionExample.cpp` : [SessionExample](https://github.com/apache/iotdb/tree/rc/2.0.1/example/client-cpp-example/src/SessionExample.cpp)
431+
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (使用对齐时间序列) : [AlignedTimeseriesSessionExample](https://github.com/apache/iotdb/tree/rc/2.0.1/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp)
413432

414433
编译成功后,示例代码工程位于 `example/client-cpp-example/target`
415434

src/zh/UserGuide/V1.3.x/API/Programming-Cpp-Native-API.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
- Bison 2.7+
2929
- Boost 1.56+
3030
- OpenSSL 1.0+
31-
- GCC 5.5.0+
31+
- GCC 4.8.5+
3232

3333

3434
## 安装
@@ -118,11 +118,16 @@ git checkout rc/1.3.2
118118
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT
119119
```
120120

121-
- glibc 版本 >= 2.17 的 Linux
121+
- glibc 版本 >= 2.23 的 Linux
122122
```shell
123123
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT
124124
```
125125

126+
- glibc 版本 >= 2.17 的 Linux
127+
```shell
128+
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
129+
```
130+
126131
- 使用 Visual Studio 2022 的 Windows
127132
```batch
128133
.\mvnw.cmd clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp
@@ -398,6 +403,19 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
398403
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
399404
```
400405

406+
返回值 `SessionDataSet` 类主要提供如下方法:
407+
408+
| 方法名 | 描述 | 参数 | 返回值 |
409+
| :--- | :--- |:----------------------------------| :--- |
410+
| **hasNext()** | 判断结果集中是否还有更多数据行。 | - | `bool` |
411+
| **next()** | 获取结果集中的下一行数据,封装为一个 `RowRecord` 对象。 | - | `std::shared_ptr` |
412+
| **getIterator()** | 获取一个 `DataIterator` 迭代器,用于以更灵活的方式(按列)遍历数据。 | - | `SessionDataSet::DataIterator` |
413+
| **getColumnNames()** | 获取结果集中所有列的名称列表。 | - | `const std::vector&` |
414+
| **getColumnTypeList()** | 获取结果集中所有列的数据类型列表。 | - | `const std::vector&` |
415+
| **getFetchSize()** | 获取当前每次从服务器批量抓取数据的行数。 | - | `int` |
416+
| **setFetchSize(int fetchSize)** | 设置每次从服务器批量抓取数据的行数。 | `fetchSize`: 批量抓取数据的行数 | `void` |
417+
| **closeOperationHandle(bool forceClose)** | 关闭服务器端的查询句柄,释放资源。建议在数据集使用完毕后调用。 | `forceClose`: 是否强制关闭(默认为 `false`| `void` |
418+
401419
- 执行非查询语句
402420
```cpp
403421
void executeNonQueryStatement(const std::string &sql);

0 commit comments

Comments
 (0)