Skip to content
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
29 changes: 25 additions & 4 deletions src/UserGuide/Master/Tree/API/Programming-Cpp-Native-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- Bison 2.7+
- Boost 1.56+
- OpenSSL 1.0+
- GCC 5.5.0+
- GCC 4.8.5+

## 2. Installation

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

- Linux with glibc version >= 2.23

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

- Linux with glibc version >= 2.17

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

- Windows using Visual Studio 2022
Expand Down Expand Up @@ -391,6 +398,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
```

The `SessionDataSet` class primarily provides the following methods:

| Method Name | Description | Parameters | Return Type |
| :--- | :--- | :--- | :--- |
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
| **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` |
| **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` |


- Execute non query statement
```cpp
void executeNonQueryStatement(const std::string &sql);
Expand All @@ -401,8 +422,8 @@ void executeNonQueryStatement(const std::string &sql);

The sample code of using these interfaces is in:

- `example/client-cpp-example/src/SessionExample.cpp`: [SessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/SessionExample.cpp)
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (Aligned Timeseries) : [AlignedTimeseriesSessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp)
- `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)
- `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)

If the compilation finishes successfully, the example project will be placed under `example/client-cpp-example/target`

Expand Down
24 changes: 22 additions & 2 deletions src/UserGuide/V1.3.x/API/Programming-Cpp-Native-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- Bison 2.7+
- Boost 1.56+
- OpenSSL 1.0+
- GCC 5.5.0+
- GCC 4.8.5+

## Installation

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

- Linux with glibc version >= 2.17
- Linux with glibc version >= 2.23

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

- Linux with glibc version >= 2.17

```shell
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
```

- Windows using Visual Studio 2022

```batch
Expand Down Expand Up @@ -424,6 +430,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
```

The `SessionDataSet` class primarily provides the following methods:

| Method Name | Description | Parameters | Return Type |
| :--- | :--- | :--- | :--- |
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
| **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` |
| **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` |


- Execute non query statement

```cpp
Expand Down
28 changes: 24 additions & 4 deletions src/UserGuide/dev-1.3/API/Programming-Cpp-Native-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
- Bison 2.7+
- Boost 1.56+
- OpenSSL 1.0+
- GCC 5.5.0+
- GCC 4.8.5+

## Installation

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

- Linux with glibc version >= 2.17
- Linux with glibc version >= 2.23

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

- Linux with glibc version >= 2.17

```shell
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
```

- Windows using Visual Studio 2022

```batch
Expand Down Expand Up @@ -424,6 +430,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
```

The `SessionDataSet` class primarily provides the following methods:

| Method Name | Description | Parameters | Return Type |
| :--- | :--- | :--- | :--- |
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
| **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` |
| **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` |


- Execute non query statement

```cpp
Expand All @@ -434,8 +454,8 @@ void executeNonQueryStatement(const std::string &sql);

The sample code of using these interfaces is in:

- `example/client-cpp-example/src/SessionExample.cpp`
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (Aligned Timeseries)
- `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)
- `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)

If the compilation finishes successfully, the example project will be placed under `example/client-cpp-example/target`

Expand Down
25 changes: 23 additions & 2 deletions src/UserGuide/latest/API/Programming-Cpp-Native-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- Bison 2.7+
- Boost 1.56+
- OpenSSL 1.0+
- GCC 5.5.0+
- GCC 4.8.5+

## 2. Installation

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

- Linux with glibc version >= 2.23

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

- Linux with glibc version >= 2.17

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

- Windows using Visual Studio 2022
Expand Down Expand Up @@ -391,6 +398,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
```

The `SessionDataSet` class primarily provides the following methods:

| Method Name | Description | Parameters | Return Type |
| :--- | :--- | :--- | :--- |
| **hasNext()** | Checks whether there are more rows of data in the result set. | - | `bool` |
| **next()** | Retrieves the next row of data from the result set, encapsulated as a `RowRecord` object. | - | `std::shared_ptr<RowRecord>` |
| **getIterator()** | Obtains a `DataIterator` iterator for traversing the data in a more flexible manner (e.g., column-by-column). | - | `SessionDataSet::DataIterator` |
| **getColumnNames()** | Retrieves a list of names for all columns in the result set. | - | `const std::vector<std::string>&` |
| **getColumnTypeList()** | Retrieves a list of data types for all columns in the result set. | - | `const std::vector<tsfile::type::TSDataType>&` |
| **getFetchSize()** | Gets the current number of rows fetched in each batch from the server. | - | `int` |
| **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` |
| **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` |


- Execute non query statement
```cpp
void executeNonQueryStatement(const std::string &sql);
Expand Down
27 changes: 23 additions & 4 deletions src/zh/UserGuide/Master/Tree/API/Programming-Cpp-Native-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- Bison 2.7+
- Boost 1.56+
- OpenSSL 1.0+
- GCC 5.5.0+
- GCC 4.8.5+


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

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

- glibc 版本 >= 2.17 的 Linux
```shell
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
```

- 使用 Visual Studio 2022 的 Windows
```batch
.\mvnw.cmd clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp
Expand Down Expand Up @@ -398,6 +403,20 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
```

返回值 `SessionDataSet` 类主要提供如下方法:

| 方法名 | 描述 | 参数 | 返回值 |
| :--- | :--- |:----------------------------------| :--- |
| **hasNext()** | 判断结果集中是否还有更多数据行。 | - | `bool` |
| **next()** | 获取结果集中的下一行数据,封装为一个 `RowRecord` 对象。 | - | `std::shared_ptr` |
| **getIterator()** | 获取一个 `DataIterator` 迭代器,用于以更灵活的方式(按列)遍历数据。 | - | `SessionDataSet::DataIterator` |
| **getColumnNames()** | 获取结果集中所有列的名称列表。 | - | `const std::vector&` |
| **getColumnTypeList()** | 获取结果集中所有列的数据类型列表。 | - | `const std::vector&` |
| **getFetchSize()** | 获取当前每次从服务器批量抓取数据的行数。 | - | `int` |
| **setFetchSize(int fetchSize)** | 设置每次从服务器批量抓取数据的行数。 | `fetchSize`: 批量抓取数据的行数 | `void` |
| **closeOperationHandle(bool forceClose)** | 关闭服务器端的查询句柄,释放资源。建议在数据集使用完毕后调用。 | `forceClose`: 是否强制关闭(默认为 `false`) | `void` |


- 执行非查询语句
```cpp
void executeNonQueryStatement(const std::string &sql);
Expand All @@ -408,8 +427,8 @@ void executeNonQueryStatement(const std::string &sql);

示例工程源代码:

- `example/client-cpp-example/src/SessionExample.cpp` : [SessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/SessionExample.cpp)
- `example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp` (使用对齐时间序列) : [AlignedTimeseriesSessionExample](https://github.com/apache/iotdb/tree/master/example/client-cpp-example/src/AlignedTimeseriesSessionExample.cpp)
- `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)
- `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)

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

Expand Down
22 changes: 20 additions & 2 deletions src/zh/UserGuide/V1.3.x/API/Programming-Cpp-Native-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
- Bison 2.7+
- Boost 1.56+
- OpenSSL 1.0+
- GCC 5.5.0+
- GCC 4.8.5+


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

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

- glibc 版本 >= 2.17 的 Linux
```shell
./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Diotdb-tools-thrift.version=0.14.1.1-gcc4-SNAPSHOT
```

- 使用 Visual Studio 2022 的 Windows
```batch
.\mvnw.cmd clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp
Expand Down Expand Up @@ -398,6 +403,19 @@ void deleteData(const std::vector<std::string> &paths, int64_t startTime, int64_
unique_ptr<SessionDataSet> executeQueryStatement(const std::string &sql);
```

返回值 `SessionDataSet` 类主要提供如下方法:

| 方法名 | 描述 | 参数 | 返回值 |
| :--- | :--- |:----------------------------------| :--- |
| **hasNext()** | 判断结果集中是否还有更多数据行。 | - | `bool` |
| **next()** | 获取结果集中的下一行数据,封装为一个 `RowRecord` 对象。 | - | `std::shared_ptr` |
| **getIterator()** | 获取一个 `DataIterator` 迭代器,用于以更灵活的方式(按列)遍历数据。 | - | `SessionDataSet::DataIterator` |
| **getColumnNames()** | 获取结果集中所有列的名称列表。 | - | `const std::vector&` |
| **getColumnTypeList()** | 获取结果集中所有列的数据类型列表。 | - | `const std::vector&` |
| **getFetchSize()** | 获取当前每次从服务器批量抓取数据的行数。 | - | `int` |
| **setFetchSize(int fetchSize)** | 设置每次从服务器批量抓取数据的行数。 | `fetchSize`: 批量抓取数据的行数 | `void` |
| **closeOperationHandle(bool forceClose)** | 关闭服务器端的查询句柄,释放资源。建议在数据集使用完毕后调用。 | `forceClose`: 是否强制关闭(默认为 `false`) | `void` |

- 执行非查询语句
```cpp
void executeNonQueryStatement(const std::string &sql);
Expand Down
Loading