| import{_ as s,c as a,b as l,o as n}from"./app-C-fAkKj6.js";const t={};function o(i,e){return n(),a("div",null,e[0]||(e[0]=[l(`<h1 id="c-native-api" tabindex="-1"><a class="header-anchor" href="#c-native-api"><span>C++ Native API</span></a></h1><h2 id="_1-dependencies" tabindex="-1"><a class="header-anchor" href="#_1-dependencies"><span>1. Dependencies</span></a></h2><ul><li>Java 8+</li><li>Flex</li><li>Bison 2.7+</li><li>Boost 1.56+</li><li>OpenSSL 1.0+</li><li>GCC 5.5.0+</li></ul><h2 id="_2-installation" tabindex="-1"><a class="header-anchor" href="#_2-installation"><span>2. Installation</span></a></h2><h3 id="_2-1-install-required-dependencies" tabindex="-1"><a class="header-anchor" href="#_2-1-install-required-dependencies"><span>2.1 Install Required Dependencies</span></a></h3><ul><li><p><strong>MAC</strong></p><ol><li><p>Install Bison:</p><p>Use the following brew command to install the Bison version:</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">brew</span><span style="color:#98C379;"> install</span><span style="color:#98C379;"> bison</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div></li><li><p>Install Boost: Make sure to install the latest version of Boost.</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">brew</span><span style="color:#98C379;"> install</span><span style="color:#98C379;"> boost</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div></li><li><p>Check OpenSSL: Make sure the OpenSSL library is installed. The default OpenSSL header file path is "/usr/local/opt/openssl/include".</p><p>If you encounter errors related to OpenSSL not being found during compilation, try adding <code>-Dopenssl.include.dir=""</code>.</p></li></ol></li><li><p><strong>Ubuntu 16.04+ or Other Debian-based Systems</strong></p><p>Use the following commands to install dependencies:</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">sudo</span><span style="color:#98C379;"> apt-get</span><span style="color:#98C379;"> update</span></span> |
| <span class="line"><span style="color:#61AFEF;">sudo</span><span style="color:#98C379;"> apt-get</span><span style="color:#98C379;"> install</span><span style="color:#98C379;"> gcc</span><span style="color:#98C379;"> g++</span><span style="color:#98C379;"> bison</span><span style="color:#98C379;"> flex</span><span style="color:#98C379;"> libboost-all-dev</span><span style="color:#98C379;"> libssl-dev</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div></div></div></li><li><p><strong>CentOS 7.7+/Fedora/Rocky Linux or Other Red Hat-based Systems</strong></p><p>Use the yum command to install dependencies:</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">sudo</span><span style="color:#98C379;"> yum</span><span style="color:#98C379;"> update</span></span> |
| <span class="line"><span style="color:#61AFEF;">sudo</span><span style="color:#98C379;"> yum</span><span style="color:#98C379;"> install</span><span style="color:#98C379;"> gcc</span><span style="color:#98C379;"> gcc-c++</span><span style="color:#98C379;"> boost-devel</span><span style="color:#98C379;"> bison</span><span style="color:#98C379;"> flex</span><span style="color:#98C379;"> openssl-devel</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div></div></div></li><li><p><strong>Windows</strong></p><ol><li><p>Set Up the Build Environment</p><ul><li>Install MS Visual Studio (version 2019+ recommended): Make sure to select Visual Studio C/C++ IDE and compiler (supporting CMake, Clang, MinGW) during installation.</li><li>Download and install <a href="https://cmake.org/download/" target="_blank" rel="noopener noreferrer">CMake</a>.</li></ul></li><li><p>Download and Install Flex, Bison</p><ul><li>Download <a href="https://sourceforge.net/projects/winflexbison/" target="_blank" rel="noopener noreferrer">Win_Flex_Bison</a>.</li><li>After downloading, rename the executables to flex.exe and bison.exe to ensure they can be found during compilation, and add the directory of these executables to the PATH environment variable.</li></ul></li><li><p>Install Boost Library</p><ul><li>Download <a href="https://www.boost.org/users/download/" target="_blank" rel="noopener noreferrer">Boost</a>.</li><li>Compile Boost locally: Run <code>bootstrap.bat</code> and <code>b2.exe</code> in sequence.</li><li>Add the Boost installation directory to the PATH environment variable, e.g., <code>C:\\Program Files (x86)\\boost_1_78_0</code>.</li></ul></li><li><p>Install OpenSSL</p><ul><li>Download and install <a href="http://slproweb.com/products/Win32OpenSSL.html" target="_blank" rel="noopener noreferrer">OpenSSL</a>.</li><li>Add the include directory under the installation directory to the PATH environment variable.</li></ul></li></ol></li></ul><h3 id="_2-2-compilation" tabindex="-1"><a class="header-anchor" href="#_2-2-compilation"><span>2.2 Compilation</span></a></h3><p>Clone the source code from git:</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">git</span><span style="color:#98C379;"> clone</span><span style="color:#98C379;"> https://github.com/apache/iotdb.git</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p>The default main branch is the master branch. If you want to use a specific release version, switch to that branch (e.g., version 1.3.2):</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">git</span><span style="color:#98C379;"> checkout</span><span style="color:#98C379;"> rc/1.3.2</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p>Run Maven to compile in the IoTDB root directory:</p><ul><li><p>Mac or Linux with glibc version >= 2.32</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">./mvnw</span><span style="color:#98C379;"> clean</span><span style="color:#98C379;"> package</span><span style="color:#D19A66;"> -pl</span><span style="color:#98C379;"> example/client-cpp-example</span><span style="color:#D19A66;"> -am</span><span style="color:#D19A66;"> -DskipTests</span><span style="color:#D19A66;"> -P</span><span style="color:#98C379;"> with-cpp</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div></li><li><p>Linux with glibc version >= 2.31</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">./mvnw</span><span style="color:#98C379;"> clean</span><span style="color:#98C379;"> package</span><span style="color:#D19A66;"> -pl</span><span style="color:#98C379;"> example/client-cpp-example</span><span style="color:#D19A66;"> -am</span><span style="color:#D19A66;"> -DskipTests</span><span style="color:#D19A66;"> -P</span><span style="color:#98C379;"> with-cpp</span><span style="color:#D19A66;"> -Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div></li><li><p>Linux with glibc version >= 2.17</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">./mvnw</span><span style="color:#98C379;"> clean</span><span style="color:#98C379;"> package</span><span style="color:#D19A66;"> -pl</span><span style="color:#98C379;"> example/client-cpp-example</span><span style="color:#D19A66;"> -am</span><span style="color:#D19A66;"> -DskipTests</span><span style="color:#D19A66;"> -P</span><span style="color:#98C379;"> with-cpp</span><span style="color:#D19A66;"> -Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div></li><li><p>Windows using Visual Studio 2022</p><div class="language-batch line-numbers-mode" data-highlighter="shiki" data-ext="batch" data-title="batch" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">.\\mvnw.cmd clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div></li><li><p>Windows using Visual Studio 2019</p><div class="language-batch line-numbers-mode" data-highlighter="shiki" data-ext="batch" data-title="batch" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#ABB2BF;">.\\mvnw.cmd clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Dcmake.generator=</span><span style="color:#98C379;">"Visual Studio 16 2019"</span><span style="color:#ABB2BF;"> -Diotdb-tools-thrift.version=0.14.1.1-msvc142-SNAPSHOT</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><ul><li>If you haven't added the Boost library path to the PATH environment variable, you need to add the relevant parameters to the compile command, e.g., <code>-DboostIncludeDir="C:\\Program Files (x86)\\boost_1_78_0" -DboostLibraryDir="C:\\Program Files (x86)\\boost_1_78_0\\stage\\lib"</code>.</li></ul></li></ul><p>After successful compilation, the packaged library files will be located in <code>iotdb-client/client-cpp/target</code>, and you can find the compiled example program under <code>example/client-cpp-example/target</code>.</p><h3 id="_2-3-compilation-q-a" tabindex="-1"><a class="header-anchor" href="#_2-3-compilation-q-a"><span>2.3 Compilation Q&A</span></a></h3><p>Q: What are the requirements for the environment on Linux?</p><p>A:</p><ul><li>The known minimum version requirement for glibc (x86_64 version) is 2.17, and the minimum version for GCC is 5.5.</li><li>The known minimum version requirement for glibc (ARM version) is 2.31, and the minimum version for GCC is 10.2.</li><li>If the above requirements are not met, you can try compiling Thrift locally: <ul><li>Download the code from <a href="https://github.com/apache/iotdb-bin-resources/tree/iotdb-tools-thrift-v0.14.1.0/iotdb-tools-thrift" target="_blank" rel="noopener noreferrer">https://github.com/apache/iotdb-bin-resources/tree/iotdb-tools-thrift-v0.14.1.0/iotdb-tools-thrift</a>.</li><li>Run <code>./mvnw clean install</code>.</li><li>Go back to the IoTDB code directory and run <code>./mvnw clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp</code>.</li></ul></li></ul><p>Q: How to resolve the <code>undefined reference to '_libc_single_thread'</code> error during Linux compilation?</p><p>A:</p><ul><li>This issue is caused by the precompiled Thrift dependencies requiring a higher version of glibc.</li><li>You can try adding <code>-Diotdb-tools-thrift.version=0.14.1.1-glibc223-SNAPSHOT</code> or <code>-Diotdb-tools-thrift.version=0.14.1.1-old-glibc-SNAPSHOT</code> to the Maven compile command.</li></ul><p>Q: What if I need to compile using Visual Studio 2017 or earlier on Windows?</p><p>A:</p><ul><li>You can try compiling Thrift locally before compiling the client: <ul><li>Download the code from <a href="https://github.com/apache/iotdb-bin-resources/tree/iotdb-tools-thrift-v0.14.1.0/iotdb-tools-thrift" target="_blank" rel="noopener noreferrer">https://github.com/apache/iotdb-bin-resources/tree/iotdb-tools-thrift-v0.14.1.0/iotdb-tools-thrift</a>.</li><li>Run <code>.\\mvnw.cmd clean install</code>.</li><li>Go back to the IoTDB code directory and run <code>.\\mvnw.cmd clean package -pl example/client-cpp-example -am -DskipTests -P with-cpp -Dcmake.generator="Visual Studio 15 2017"</code>.</li></ul></li></ul><h2 id="_3-usage" tabindex="-1"><a class="header-anchor" href="#_3-usage"><span>3. Usage</span></a></h2><h3 id="_3-1-tablesession-class" tabindex="-1"><a class="header-anchor" href="#_3-1-tablesession-class"><span>3.1 TableSession Class</span></a></h3><p>All operations in the C++ client are performed through the TableSession class. Below are the method descriptions defined in the TableSession interface.</p><h4 id="_3-1-1-method-list" tabindex="-1"><a class="header-anchor" href="#_3-1-1-method-list"><span>3.1.1 Method List</span></a></h4><ol><li><code>insert(Tablet& tablet, bool sorted = false)</code>: Inserts a Tablet object containing time series data into the database. The sorted parameter indicates whether the rows in the tablet are already sorted by time.</li><li><code>executeNonQueryStatement(string& sql)</code>: Executes non-query SQL statements, such as DDL (Data Definition Language) or DML (Data Manipulation Language) commands.</li><li><code>executeQueryStatement(string& sql)</code>: Executes query SQL statements and returns a SessionDataSet object containing the query results. The optional timeoutInMs parameter indicates the timeout return time.</li><li><code>open(bool enableRPCCompression = false)</code>: Opens the connection and determines whether to enable RPC compression (client state must match server state, disabled by default).</li><li><code>close()</code>: Closes the connection.</li></ol><h3 id="_3-1-2-interface-display" tabindex="-1"><a class="header-anchor" href="#_3-1-2-interface-display"><span>3.1.2 Interface Display</span></a></h3><div class="language-cpp line-numbers-mode" data-highlighter="shiki" data-ext="cpp" data-title="cpp" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#C678DD;">class</span><span style="color:#E5C07B;"> TableSession</span><span style="color:#ABB2BF;"> {</span></span> |
| <span class="line"><span style="color:#C678DD;">private:</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> Session</span><span style="color:#C678DD;">*</span><span style="color:#ABB2BF;"> session;</span></span> |
| <span class="line"><span style="color:#C678DD;">public:</span></span> |
| <span class="line"><span style="color:#61AFEF;"> TableSession</span><span style="color:#ABB2BF;">(</span><span style="color:#E5C07B;">Session</span><span style="color:#C678DD;">*</span><span style="color:#E06C75;font-style:italic;"> session</span><span style="color:#ABB2BF;">) {</span></span> |
| <span class="line"><span style="color:#E5C07B;"> this</span><span style="color:#ABB2BF;">-></span><span style="color:#E06C75;">session</span><span style="color:#C678DD;"> =</span><span style="color:#ABB2BF;"> session;</span></span> |
| <span class="line"><span style="color:#ABB2BF;"> }</span></span> |
| <span class="line"><span style="color:#C678DD;"> void</span><span style="color:#61AFEF;"> insert</span><span style="color:#ABB2BF;">(</span><span style="color:#E5C07B;">Tablet</span><span style="color:#C678DD;">&</span><span style="color:#E06C75;font-style:italic;"> tablet</span><span style="color:#ABB2BF;">, </span><span style="color:#C678DD;">bool</span><span style="color:#E06C75;font-style:italic;"> sorted</span><span style="color:#C678DD;"> =</span><span style="color:#D19A66;"> false</span><span style="color:#ABB2BF;">);</span></span> |
| <span class="line"><span style="color:#C678DD;"> void</span><span style="color:#61AFEF;"> executeNonQueryStatement</span><span style="color:#ABB2BF;">(</span><span style="color:#C678DD;">const</span><span style="color:#ABB2BF;"> std::</span><span style="color:#E5C07B;">string</span><span style="color:#C678DD;">&</span><span style="color:#E06C75;font-style:italic;"> sql</span><span style="color:#ABB2BF;">);</span></span> |
| <span class="line"><span style="color:#E5C07B;"> unique_ptr</span><span style="color:#ABB2BF;"><</span><span style="color:#E5C07B;">SessionDataSet</span><span style="color:#ABB2BF;">> </span><span style="color:#61AFEF;">executeQueryStatement</span><span style="color:#ABB2BF;">(</span><span style="color:#C678DD;">const</span><span style="color:#ABB2BF;"> std::</span><span style="color:#E5C07B;">string</span><span style="color:#C678DD;">&</span><span style="color:#E06C75;font-style:italic;"> sql</span><span style="color:#ABB2BF;">);</span></span> |
| <span class="line"><span style="color:#E5C07B;"> unique_ptr</span><span style="color:#ABB2BF;"><</span><span style="color:#E5C07B;">SessionDataSet</span><span style="color:#ABB2BF;">> </span><span style="color:#61AFEF;">executeQueryStatement</span><span style="color:#ABB2BF;">(</span><span style="color:#C678DD;">const</span><span style="color:#ABB2BF;"> std::</span><span style="color:#E5C07B;">string</span><span style="color:#C678DD;">&</span><span style="color:#E06C75;font-style:italic;"> sql</span><span style="color:#ABB2BF;">, </span><span style="color:#C678DD;">int64_t</span><span style="color:#E06C75;font-style:italic;"> timeoutInMs</span><span style="color:#ABB2BF;">);</span></span> |
| <span class="line"><span style="color:#E5C07B;"> string</span><span style="color:#61AFEF;"> getDatabase</span><span style="color:#ABB2BF;">();</span><span style="color:#7F848E;font-style:italic;"> //Get the currently selected database, can be replaced by executeNonQueryStatement</span></span> |
| <span class="line"><span style="color:#C678DD;"> void</span><span style="color:#61AFEF;"> open</span><span style="color:#ABB2BF;">(</span><span style="color:#C678DD;">bool</span><span style="color:#E06C75;font-style:italic;"> enableRPCCompression</span><span style="color:#C678DD;"> =</span><span style="color:#D19A66;"> false</span><span style="color:#ABB2BF;">);</span></span> |
| <span class="line"><span style="color:#C678DD;"> void</span><span style="color:#61AFEF;"> close</span><span style="color:#ABB2BF;">();</span></span> |
| <span class="line"><span style="color:#ABB2BF;">};</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h3 id="_3-2-tablesessionbuilder-class" tabindex="-1"><a class="header-anchor" href="#_3-2-tablesessionbuilder-class"><span>3.2 TableSessionBuilder Class</span></a></h3><p>The TableSessionBuilder class is a builder used to configure and create instances of the TableSession class. Through it, you can conveniently set connection parameters, query parameters, and other settings when creating instances.</p><h4 id="_3-2-1-usage-example" tabindex="-1"><a class="header-anchor" href="#_3-2-1-usage-example"><span>3.2.1 Usage Example</span></a></h4><div class="language-cpp line-numbers-mode" data-highlighter="shiki" data-ext="cpp" data-title="cpp" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#7F848E;font-style:italic;">//Set connection IP, port, username, password</span></span> |
| <span class="line"><span style="color:#7F848E;font-style:italic;">//The order of settings is arbitrary, just ensure build() is called last, the created instance is connected by default through open()</span></span> |
| <span class="line"><span style="color:#ABB2BF;">session </span><span style="color:#C678DD;">=</span><span style="color:#ABB2BF;"> (</span><span style="color:#C678DD;">new</span><span style="color:#61AFEF;"> TableSessionBuilder</span><span style="color:#ABB2BF;">())</span></span> |
| <span class="line"><span style="color:#C678DD;"> -></span><span style="color:#61AFEF;">host</span><span style="color:#ABB2BF;">(</span><span style="color:#98C379;">"127.0.0.1"</span><span style="color:#ABB2BF;">)</span></span> |
| <span class="line"><span style="color:#C678DD;"> -></span><span style="color:#61AFEF;">rpcPort</span><span style="color:#ABB2BF;">(</span><span style="color:#D19A66;">6667</span><span style="color:#ABB2BF;">)</span></span> |
| <span class="line"><span style="color:#C678DD;"> -></span><span style="color:#61AFEF;">username</span><span style="color:#ABB2BF;">(</span><span style="color:#98C379;">"root"</span><span style="color:#ABB2BF;">)</span></span> |
| <span class="line"><span style="color:#C678DD;"> -></span><span style="color:#61AFEF;">password</span><span style="color:#ABB2BF;">(</span><span style="color:#98C379;">"root"</span><span style="color:#ABB2BF;">)</span></span> |
| <span class="line"><span style="color:#C678DD;"> -></span><span style="color:#61AFEF;">build</span><span style="color:#ABB2BF;">();</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><h4 id="_3-2-2-configurable-parameter-list" tabindex="-1"><a class="header-anchor" href="#_3-2-2-configurable-parameter-list"><span>3.2.2 Configurable Parameter List</span></a></h4><table><thead><tr><th style="text-align:center;"><strong>Parameter Name</strong></th><th style="text-align:center;"><strong>Description</strong></th><th style="text-align:center;"><strong>Default Value</strong></th></tr></thead><tbody><tr><td style="text-align:center;">host</td><td style="text-align:center;">Set the connected node IP</td><td style="text-align:center;">"127.0.0.1" ("localhost")</td></tr><tr><td style="text-align:center;">rpcPort</td><td style="text-align:center;">Set the connected node port</td><td style="text-align:center;">6667</td></tr><tr><td style="text-align:center;">username</td><td style="text-align:center;">Set the connection username</td><td style="text-align:center;">"root"</td></tr><tr><td style="text-align:center;">password</td><td style="text-align:center;">Set the connection password</td><td style="text-align:center;">"root"</td></tr><tr><td style="text-align:center;">zoneId</td><td style="text-align:center;">Set the ZoneId related to timezone</td><td style="text-align:center;">""</td></tr><tr><td style="text-align:center;">fetchSize</td><td style="text-align:center;">Set the query result fetch size</td><td style="text-align:center;">10000</td></tr><tr><td style="text-align:center;">database</td><td style="text-align:center;">Set the target database name</td><td style="text-align:center;">""</td></tr></tbody></table><h2 id="_4-examples" tabindex="-1"><a class="header-anchor" href="#_4-examples"><span>4. Examples</span></a></h2><p>The sample code of using these interfaces is in:</p><ul><li><code>example/client-cpp-example/src/TableSessionExample.cpp</code>: <a href="https://github.com/apache/iotdb/tree/rc/2.0.1/example/client-cpp-example/src/TableSessionExample.cpp" target="_blank" rel="noopener noreferrer">TableSessionExample</a></li></ul><p>If the compilation finishes successfully, the example project will be placed under <code>example/client-cpp-example/target</code></p><h2 id="_5-faq" tabindex="-1"><a class="header-anchor" href="#_5-faq"><span>5. FAQ</span></a></h2><h3 id="_5-1-on-mac" tabindex="-1"><a class="header-anchor" href="#_5-1-on-mac"><span>5.1 on Mac</span></a></h3><p>If errors occur when compiling thrift source code, try to downgrade your xcode-commandline from 12 to 11.5</p><p>see <a href="https://stackoverflow.com/questions/63592445/ld-unsupported-tapi-file-type-tapi-tbd-in-yaml-file/65518087#65518087" target="_blank" rel="noopener noreferrer">https://stackoverflow.com/questions/63592445/ld-unsupported-tapi-file-type-tapi-tbd-in-yaml-file/65518087#65518087</a></p><h3 id="_5-2-on-windows" tabindex="-1"><a class="header-anchor" href="#_5-2-on-windows"><span>5.2 on Windows</span></a></h3><p>When Building Thrift and downloading packages via "wget", a possible annoying issue may occur with<br> error message looks like:</p><div class="language-shell line-numbers-mode" data-highlighter="shiki" data-ext="shell" data-title="shell" style="background-color:#282c34;color:#abb2bf;"><pre class="shiki one-dark-pro vp-code"><code><span class="line"><span style="color:#61AFEF;">Failed</span><span style="color:#98C379;"> to</span><span style="color:#98C379;"> delete</span><span style="color:#98C379;"> cached</span><span style="color:#98C379;"> file</span><span style="color:#98C379;"> C:</span><span style="color:#56B6C2;">\\U</span><span style="color:#98C379;">sers</span><span style="color:#56B6C2;">\\A</span><span style="color:#98C379;">dministrator</span><span style="color:#56B6C2;">\\.</span><span style="color:#98C379;">m2</span><span style="color:#56B6C2;">\\r</span><span style="color:#98C379;">epository</span><span style="color:#56B6C2;">\\.</span><span style="color:#98C379;">cache</span><span style="color:#56B6C2;">\\d</span><span style="color:#98C379;">ownload-maven-plugin</span><span style="color:#56B6C2;">\\i</span><span style="color:#98C379;">ndex.ser</span></span></code></pre><div class="line-numbers" aria-hidden="true" style="counter-reset:line-number 0;"><div class="line-number"></div></div></div><p>Possible fixes:</p><ul><li>Try to delete the ".m2\\repository\\.cache" directory and try again.</li><li>Add "<skipCache>true</skipCache>" configuration to the download-maven-plugin maven phase that complains this error.</li></ul>`,50)]))}const p=s(t,[["render",o],["__file","Programming-Cpp-Native-API.html.vue"]]),c=JSON.parse('{"path":"/UserGuide/latest-Table/API/Programming-Cpp-Native-API.html","title":"C++ Native API","lang":"en-US","frontmatter":{"description":"C++ Native API 1. Dependencies Java 8+ Flex Bison 2.7+ Boost 1.56+ OpenSSL 1.0+ GCC 5.5.0+ 2. Installation 2.1 Install Required Dependencies MAC Install Bison: Use the following...","head":[["link",{"rel":"alternate","hreflang":"zh-cn","href":"https://iotdb.apache.org/zh/UserGuide/latest-Table/API/Programming-Cpp-Native-API.html"}],["meta",{"property":"og:url","content":"https://iotdb.apache.org/UserGuide/latest-Table/API/Programming-Cpp-Native-API.html"}],["meta",{"property":"og:site_name","content":"IoTDB Website"}],["meta",{"property":"og:title","content":"C++ Native API"}],["meta",{"property":"og:description","content":"C++ Native API 1. Dependencies Java 8+ Flex Bison 2.7+ Boost 1.56+ OpenSSL 1.0+ GCC 5.5.0+ 2. Installation 2.1 Install Required Dependencies MAC Install Bison: Use the following..."}],["meta",{"property":"og:type","content":"article"}],["meta",{"property":"og:locale","content":"en-US"}],["meta",{"property":"og:locale:alternate","content":"zh-CN"}],["meta",{"property":"og:updated_time","content":"2025-03-25T03:48:34.000Z"}],["meta",{"property":"article:modified_time","content":"2025-03-25T03:48:34.000Z"}],["script",{"type":"application/ld+json"},"{\\"@context\\":\\"https://schema.org\\",\\"@type\\":\\"Article\\",\\"headline\\":\\"C++ Native API\\",\\"image\\":[\\"\\"],\\"dateModified\\":\\"2025-03-25T03:48:34.000Z\\",\\"author\\":[]}"]]},"headers":[{"level":2,"title":"1. Dependencies","slug":"_1-dependencies","link":"#_1-dependencies","children":[]},{"level":2,"title":"2. Installation","slug":"_2-installation","link":"#_2-installation","children":[{"level":3,"title":"2.1 Install Required Dependencies","slug":"_2-1-install-required-dependencies","link":"#_2-1-install-required-dependencies","children":[]},{"level":3,"title":"2.2 Compilation","slug":"_2-2-compilation","link":"#_2-2-compilation","children":[]},{"level":3,"title":"2.3 Compilation Q&A","slug":"_2-3-compilation-q-a","link":"#_2-3-compilation-q-a","children":[]}]},{"level":2,"title":"3. Usage","slug":"_3-usage","link":"#_3-usage","children":[{"level":3,"title":"3.1 TableSession Class","slug":"_3-1-tablesession-class","link":"#_3-1-tablesession-class","children":[]},{"level":3,"title":"3.1.2 Interface Display","slug":"_3-1-2-interface-display","link":"#_3-1-2-interface-display","children":[]},{"level":3,"title":"3.2 TableSessionBuilder Class","slug":"_3-2-tablesessionbuilder-class","link":"#_3-2-tablesessionbuilder-class","children":[]}]},{"level":2,"title":"4. Examples","slug":"_4-examples","link":"#_4-examples","children":[]},{"level":2,"title":"5. FAQ","slug":"_5-faq","link":"#_5-faq","children":[{"level":3,"title":"5.1 on Mac","slug":"_5-1-on-mac","link":"#_5-1-on-mac","children":[]},{"level":3,"title":"5.2 on Windows","slug":"_5-2-on-windows","link":"#_5-2-on-windows","children":[]}]}],"git":{"createdTime":1742874514000,"updatedTime":1742874514000,"contributors":[{"name":"xiangmy21","username":"xiangmy21","email":"90919434+xiangmy21@users.noreply.github.com","commits":1,"url":"https://github.com/xiangmy21"}]},"readingTime":{"minutes":4.49,"words":1348},"filePathRelative":"UserGuide/latest-Table/API/Programming-Cpp-Native-API.md","localizedDate":"March 25, 2025","autoDesc":true}');export{p as comp,c as data}; |