move ref 3.0 code to main
This commit is contained in:
parent
b0338a1a6b
commit
b0714e13e9
|
@ -66,18 +66,18 @@ In the above example code, `taos_connect()` establishes a connection to port 603
|
|||
|
||||
This section shows sample code for standard access methods to TDengine clusters using the client driver.
|
||||
|
||||
- [Synchronous query example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/demo.c)
|
||||
- [Synchronous query example](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/demo.c)
|
||||
|
||||
- [Asynchronous query example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/asyncdemo.c)
|
||||
- [Asynchronous query example](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/asyncdemo.c)
|
||||
|
||||
- [Parameter binding example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/prepare.c)
|
||||
- [Parameter binding example](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/prepare.c)
|
||||
|
||||
- [Schemaless writing example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/schemaless.c)
|
||||
- [Schemaless writing example](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/schemaless.c)
|
||||
|
||||
- [Subscription and consumption example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/tmq.c)
|
||||
- [Subscription and consumption example](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/tmq.c)
|
||||
|
||||
:::info
|
||||
More example code and downloads are available at [GitHub](https://github.com/taosdata/TDengine/tree/develop/docs/examples/c).
|
||||
More example code and downloads are available at [GitHub](https://github.com/taosdata/TDengine/tree/main/docs/examples/c).
|
||||
You can find it in the installation directory under the `examples/c` path. This directory has a makefile and can be compiled under Linux/macOS by executing `make` directly.
|
||||
**Hint:** When compiling in an ARM environment, please remove `-msse4.2` from the makefile. This option is only supported on the x64/x86 hardware platforms.
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ TDengine currently supports timestamp, number, character, Boolean type, and the
|
|||
Due to historical reasons, the BINARY type data in TDengine is not truly binary data and is no longer recommended for use. Please use VARBINARY type instead.
|
||||
GEOMETRY type is binary data in little endian byte order, which complies with the WKB specification. For detailed information, please refer to [Data Type](../../taos-sql/data-type/)
|
||||
For WKB specifications, please refer to [Well Known Binary (WKB)](https://libgeos.org/specifications/wkb/)
|
||||
For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/3.0/docs/examples/java/src/main/java/com/taos/example/GeometryDemo.java)
|
||||
For Java connector, the jts library can be used to easily create GEOMETRY type objects, serialize them, and write them to TDengine. Here is an example [Geometry example](https://github.com/taosdata/TDengine/blob/main/docs/examples/java/src/main/java/com/taos/example/GeometryDemo.java)
|
||||
|
||||
|
||||
## Installation Steps
|
||||
|
@ -671,7 +671,7 @@ The source code of the sample application is under `TDengine/docs/examples/JDBC`
|
|||
- springbootdemo: using taos-jdbcdriver in Springboot.
|
||||
- consumer-demo: consumer TDengine data example, the consumption rate can be controlled by parameters.
|
||||
|
||||
[JDBC example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/JDBC)
|
||||
[JDBC example](https://github.com/taosdata/TDengine/tree/main/docs/examples/JDBC)
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ The TDengine Go client library supports subscription functionality with the foll
|
|||
|
||||
### More sample programs
|
||||
|
||||
* [sample program](https://github.com/taosdata/driver-go/tree/3.0/examples)
|
||||
* [sample program](https://github.com/taosdata/driver-go/tree/main/examples)
|
||||
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
|
|
@ -403,7 +403,7 @@ The following parameters can be configured for the TMQ DSN. Only `group.id` is m
|
|||
|
||||
#### Full Sample Code
|
||||
|
||||
For more information, see [GitHub sample file](https://github.com/taosdata/TDengine/blob/3.0/docs/examples/rust/nativeexample/examples/subscribe_demo.rs).
|
||||
For more information, see [GitHub sample file](https://github.com/taosdata/TDengine/blob/main/docs/examples/rust/nativeexample/examples/subscribe_demo.rs).
|
||||
|
||||
### Use with connection pool
|
||||
|
||||
|
@ -439,7 +439,7 @@ let taos = pool.get()?;
|
|||
|
||||
The source code of the sample application is under `TDengine/docs/examples/rust` :
|
||||
|
||||
[rust example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/rust)
|
||||
[rust example](https://github.com/taosdata/TDengine/tree/main/docs/examples/rust)
|
||||
|
||||
## Frequently Asked Questions
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
<dependency>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<version>3.3.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
|
|
@ -6,6 +6,8 @@ import com.taosdata.example.jdbcTemplate.dao.WeatherDao;
|
|||
import com.taosdata.example.jdbcTemplate.domain.Weather;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.jdbc.datasource.DriverManagerDataSource;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.Date;
|
||||
|
@ -18,30 +20,41 @@ public class App {
|
|||
|
||||
public static void main(String[] args) {
|
||||
|
||||
ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
|
||||
// ApplicationContext ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
|
||||
//
|
||||
// ExecuteAsStatement executor = ctx.getBean(ExecuteAsStatement.class);
|
||||
// // drop database
|
||||
// executor.doExecute("drop database if exists test");
|
||||
// // create database
|
||||
// executor.doExecute("create database if not exists test");
|
||||
// //use database
|
||||
// executor.doExecute("use test");
|
||||
// // create table
|
||||
// executor.doExecute("create table if not exists test.weather (ts timestamp, temperature float, humidity int)");
|
||||
//
|
||||
// WeatherDao weatherDao = ctx.getBean(WeatherDao.class);
|
||||
// Weather weather = new Weather(new Timestamp(new Date().getTime()), random.nextFloat() * 50.0f, random.nextInt(100));
|
||||
// // insert rows
|
||||
// int affectedRows = weatherDao.add(weather);
|
||||
// System.out.println("insert success " + affectedRows + " rows.");
|
||||
//
|
||||
// // query for list
|
||||
// int limit = 10, offset = 0;
|
||||
// List<Weather> weatherList = weatherDao.queryForList(limit, offset);
|
||||
// for (Weather w : weatherList) {
|
||||
// System.out.println(w);
|
||||
// }
|
||||
DriverManagerDataSource dataSource = new DriverManagerDataSource();
|
||||
dataSource.setDriverClassName("com.taosdata.jdbc.rs.RestfulDriver");
|
||||
dataSource.setUrl("jdbc:TAOS-RS://vm98:6041/?batchfetch=true&user=root&password=taosdata");
|
||||
|
||||
ExecuteAsStatement executor = ctx.getBean(ExecuteAsStatement.class);
|
||||
// drop database
|
||||
executor.doExecute("drop database if exists test");
|
||||
// create database
|
||||
executor.doExecute("create database if not exists test");
|
||||
//use database
|
||||
executor.doExecute("use test");
|
||||
// create table
|
||||
executor.doExecute("create table if not exists test.weather (ts timestamp, temperature float, humidity int)");
|
||||
|
||||
WeatherDao weatherDao = ctx.getBean(WeatherDao.class);
|
||||
Weather weather = new Weather(new Timestamp(new Date().getTime()), random.nextFloat() * 50.0f, random.nextInt(100));
|
||||
// insert rows
|
||||
int affectedRows = weatherDao.add(weather);
|
||||
System.out.println("insert success " + affectedRows + " rows.");
|
||||
|
||||
// query for list
|
||||
int limit = 10, offset = 0;
|
||||
List<Weather> weatherList = weatherDao.queryForList(limit, offset);
|
||||
for (Weather w : weatherList) {
|
||||
System.out.println(w);
|
||||
}
|
||||
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
|
||||
|
||||
jdbcTemplate.query("select * from test.meters limit ?, ?",
|
||||
(rs, rowNum) -> rs.getString("ts"), 1, 10)
|
||||
.forEach(System.out::println) ;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.1.2</version>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
|
@ -47,7 +47,7 @@
|
|||
<dependency>
|
||||
<groupId>com.taosdata.jdbc</groupId>
|
||||
<artifactId>taos-jdbcdriver</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<version>3.3.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.taosdata.example.mybatisplusdemo.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
@ -22,13 +23,10 @@ public class MybatisPlusConfig {
|
|||
// }
|
||||
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
// return new PaginationInterceptor();
|
||||
PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
|
||||
//TODO: mybatis-plus do not support TDengine, use postgresql Dialect
|
||||
paginationInterceptor.setDialectType("postgresql");
|
||||
|
||||
return paginationInterceptor;
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class TemperatureMapperTest {
|
|||
* **/
|
||||
@Test
|
||||
public void testSelectCount() {
|
||||
int count = mapper.selectCount(null);
|
||||
long count = mapper.selectCount(null);
|
||||
Assert.assertEquals(10, count);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class WeatherMapperTest {
|
|||
|
||||
@Test
|
||||
public void testSelectCount() {
|
||||
int count = mapper.selectCount(null);
|
||||
long count = mapper.selectCount(null);
|
||||
// Assert.assertEquals(5, count);
|
||||
System.out.println(count);
|
||||
}
|
||||
|
|
|
@ -40,18 +40,18 @@ TDengine 客户端驱动的版本号与 TDengine 服务端的版本号是一一
|
|||
|
||||
本节展示了使用客户端驱动访问 TDengine 集群的常见访问方式的示例代码。
|
||||
|
||||
- 同步查询示例:[同步查询](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/demo.c)
|
||||
- 同步查询示例:[同步查询](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/demo.c)
|
||||
|
||||
- 异步查询示例:[异步查询](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/asyncdemo.c)
|
||||
- 异步查询示例:[异步查询](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/asyncdemo.c)
|
||||
|
||||
- 参数绑定示例:[参数绑定](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/prepare.c)
|
||||
- 参数绑定示例:[参数绑定](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/prepare.c)
|
||||
|
||||
- 无模式写入示例:[无模式写入](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/schemaless.c)
|
||||
- 无模式写入示例:[无模式写入](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/schemaless.c)
|
||||
|
||||
- 订阅和消费示例:[订阅和消费](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/c/tmq.c)
|
||||
- 订阅和消费示例:[订阅和消费](https://github.com/taosdata/TDengine/tree/main/docs/examples/c/tmq.c)
|
||||
|
||||
:::info
|
||||
更多示例代码及下载请见 [GitHub](https://github.com/taosdata/TDengine/tree/develop/docs/examples/c)。
|
||||
更多示例代码及下载请见 [GitHub](https://github.com/taosdata/TDengine/tree/main/docs/examples/c)。
|
||||
也可以在安装目录下的 `examples/c` 路径下找到。 该目录下有 makefile,在 Linux/macOS 环境下,直接执行 make 就可以编译得到执行文件。
|
||||
**提示:**在 ARM 环境下编译时,请将 makefile 中的 `-msse4.2` 去掉,这个选项只有在 x64/x86 硬件平台上才能支持。
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ WKB规范请参考[Well-Known Binary (WKB)](https://libgeos.org/specifications/w
|
|||
- springbootdemo: Springboot 中使用 taos-jdbcdriver。
|
||||
- consumer-demo:Consumer 消费 TDengine 数据示例,可通过参数控制消费速度。
|
||||
|
||||
请参考:[JDBC example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/JDBC)
|
||||
请参考:[JDBC example](https://github.com/taosdata/TDengine/tree/main/docs/examples/JDBC)
|
||||
|
||||
## 常见问题
|
||||
|
||||
|
|
|
@ -66,6 +66,9 @@ TDengine 其他功能模块的报错,请参考 [错误码](../../../reference/
|
|||
|
||||
**注意**:JSON 类型仅在 tag 中支持。
|
||||
|
||||
## 示例程序汇总
|
||||
示例程序源码请参考:[示例程序](https://github.com/taosdata/driver-go/tree/main/examples)
|
||||
|
||||
## 常见问题
|
||||
|
||||
1. database/sql 中 stmt(参数绑定)相关接口崩溃
|
||||
|
@ -894,5 +897,4 @@ type TopicPartition struct {
|
|||
## 附录
|
||||
|
||||
* [driver-go 文档](https://pkg.go.dev/github.com/taosdata/driver-go/v3)。
|
||||
* [示例程序](https://github.com/taosdata/driver-go/tree/3.0/examples)。
|
||||
* [视频教程](https://www.taosdata.com/blog/2020/11/11/1951.html)。
|
||||
|
|
|
@ -85,7 +85,7 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Rust 对
|
|||
|
||||
## 示例程序汇总
|
||||
|
||||
示例程序源码请参考:[rust example](https://github.com/taosdata/TDengine/tree/3.0/docs/examples/rust)
|
||||
示例程序源码请参考:[rust example](https://github.com/taosdata/TDengine/tree/main/docs/examples/rust)
|
||||
|
||||
## 常见问题
|
||||
|
||||
|
|
Loading…
Reference in New Issue