feat:[TD-32642] add timezone support in windows

This commit is contained in:
wangmm0220 2024-12-05 19:41:23 +08:00
parent 77b9871c0e
commit e015f98334
3 changed files with 19 additions and 1 deletions

View File

@ -103,6 +103,16 @@ The base API is used to do things like create database connections and provide a
Set client options, currently supports region setting (`TSDB_OPTION_LOCALE`), character set (`TSDB_OPTION_CHARSET`), time zone (`TSDB_OPTION_TIMEZONE`), configuration file path (`TSDB_OPTION_CONFIGDIR`). The region setting, character set, and time zone default to the current settings of the operating system.
- `int taos_options_connection(TAOS *taos, TSDB_OPTION_CONNECTION option, const void *arg, ...)`
- **description**:Set each connection option on the client side (which does not affect the behavior of the server, especially for charset and timezone). Currently, it supports character set setting(`TSDB_OPTION_CONNECTION_CHARSET`), time zone setting(`TSDB_OPTION_CONNECTION_TIMEZONE`), user IP setting(`TSDB_OPTION_CONNECTION_USER_IP`), and user APP setting(`TSDB_OPTION_CONNECTION_USER_APP`). The character set and time zone are set to the current settings of the operating system by default. Windows does not support connection level time zone settings. If the interface is called multiple times to set the same configuration, the later settings shall prevail.
- **input**:
- `taos`: returned by taos_connect.
- `option`: option name.
- `arg`: option value.
- **return**:
- `0`: success.
- `others`: fail.
- `char *taos_get_client_info()`
Get client version information.

View File

@ -686,6 +686,14 @@ TDengine 客户端驱动的版本号与 TDengine 服务端的版本号是一一
- `arg`[入参] 设置项值。
- **返回值**`0`:成功,`-1`:失败。
- `int taos_options_connection(TAOS *taos, TSDB_OPTION_CONNECTION option, const void *arg, ...)`
- **接口说明**:设置客户端每个连接选项(不影响服务端的行为,特别对于 charset 和 timezone目前支持字符集设置`TSDB_OPTION_CONNECTION_CHARSET`)、时区设置(`TSDB_OPTION_CONNECTION_TIMEZONE`)、用户 IP 设置(`TSDB_OPTION_CONNECTION_USER_IP`)、用户 APP 设置(`TSDB_OPTION_CONNECTION_USER_APP`。字符集、时区默认为操作系统当前设置windows 不支持连接级别的时区设置,多次调用接口设置相同的配置,以后面的设置为准。
- **参数说明**
- `taos`: [入参] taos_connect 返回的连接句柄。
- `option`[入参] 设置项类型,具体类型的使用方法及约束详见 taos.h 文件。
- `arg`[入参] 设置项值。为 NULL 时表示重置该选项。
- **返回值**`0`:成功,`非0`:失败。
- `char *taos_get_client_info()`
- **接口说明**:获取客户端版本信息。
- **返回值**:返回客户端版本信息。

View File

@ -192,7 +192,7 @@ typedef struct TAOS_STMT_OPTIONS {
input:
taos: returned by taos_connect
option: option name
arg: option value(string)
arg: option value
output:
0: success
others: fail, error msg can be got by taos_errstr(NULL)