Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
a6c918bf
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a6c918bf
编写于
10月 17, 2020
作者:
F
freemine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. msvc: C4244, conversion-loss-of-data
2. msvc: C4477, "%ld" => "%" PRId64 ""
上级
1df27392
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
32 addition
and
31 deletion
+32
-31
src/client/src/tscPrepare.c
src/client/src/tscPrepare.c
+21
-20
src/connector/odbc/src/todbc.c
src/connector/odbc/src/todbc.c
+11
-11
未找到文件。
src/client/src/tscPrepare.c
浏览文件 @
a6c918bf
...
...
@@ -290,15 +290,15 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
if
(
u
.
v1
==
0
||
u
.
v1
==
1
)
break
;
}
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
{
u
.
v1
=
*
(
int16_t
*
)
bind
->
buffer
;
u
.
v1
=
(
int8_t
)
*
(
int16_t
*
)
bind
->
buffer
;
if
(
u
.
v1
==
0
||
u
.
v1
==
1
)
break
;
}
break
;
case
TSDB_DATA_TYPE_INT
:
{
u
.
v1
=
*
(
int32_t
*
)
bind
->
buffer
;
u
.
v1
=
(
int8_t
)
*
(
int32_t
*
)
bind
->
buffer
;
if
(
u
.
v1
==
0
||
u
.
v1
==
1
)
break
;
}
break
;
case
TSDB_DATA_TYPE_BIGINT
:
{
u
.
v1
=
*
(
int64_t
*
)
bind
->
buffer
;
u
.
v1
=
(
int8_t
)
*
(
int64_t
*
)
bind
->
buffer
;
if
(
u
.
v1
==
0
||
u
.
v1
==
1
)
break
;
}
break
;
case
TSDB_DATA_TYPE_BINARY
:
...
...
@@ -334,19 +334,19 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
}
break
;
case
TSDB_DATA_TYPE_SMALLINT
:
{
int16_t
v
=
*
(
int16_t
*
)
bind
->
buffer
;
u
.
v1
=
v
;
u
.
v1
=
(
int8_t
)
v
;
if
(
v
>=
SCHAR_MIN
&&
v
<=
SCHAR_MAX
)
break
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
break
;
case
TSDB_DATA_TYPE_INT
:
{
int32_t
v
=
*
(
int32_t
*
)
bind
->
buffer
;
u
.
v1
=
v
;
u
.
v1
=
(
int8_t
)
v
;
if
(
v
>=
SCHAR_MIN
&&
v
<=
SCHAR_MAX
)
break
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
break
;
case
TSDB_DATA_TYPE_BIGINT
:
{
int64_t
v
=
*
(
int64_t
*
)
bind
->
buffer
;
u
.
v1
=
v
;
u
.
v1
=
(
int8_t
)
v
;
if
(
v
>=
SCHAR_MIN
&&
v
<=
SCHAR_MAX
)
break
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
break
;
...
...
@@ -354,9 +354,9 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_NCHAR
:
{
int64_t
v
;
int
n
,
r
;
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
ld
%n"
,
&
v
,
&
n
);
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
"
PRId64
"
%n"
,
&
v
,
&
n
);
if
(
r
==
1
&&
n
==
strlen
((
const
char
*
)
bind
->
buffer
))
{
u
.
v1
=
v
;
u
.
v1
=
(
int8_t
)
v
;
if
(
v
>=
SCHAR_MIN
&&
v
<=
SCHAR_MAX
)
break
;
}
return
TSDB_CODE_TSC_INVALID_VALUE
;
...
...
@@ -377,17 +377,17 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_TINYINT
:
case
TSDB_DATA_TYPE_SMALLINT
:
{
int
v
=
*
(
int16_t
*
)
bind
->
buffer
;
u
.
v2
=
v
;
u
.
v2
=
(
int16_t
)
v
;
}
break
;
case
TSDB_DATA_TYPE_INT
:
{
int32_t
v
=
*
(
int32_t
*
)
bind
->
buffer
;
u
.
v2
=
v
;
u
.
v2
=
(
int16_t
)
v
;
if
(
v
>=
SHRT_MIN
&&
v
<=
SHRT_MAX
)
break
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
break
;
case
TSDB_DATA_TYPE_BIGINT
:
{
int64_t
v
=
*
(
int64_t
*
)
bind
->
buffer
;
u
.
v2
=
v
;
u
.
v2
=
(
int16_t
)
v
;
if
(
v
>=
SHRT_MIN
&&
v
<=
SHRT_MAX
)
break
;
return
TSDB_CODE_TSC_INVALID_VALUE
;
}
break
;
...
...
@@ -395,9 +395,9 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_NCHAR
:
{
int64_t
v
;
int
n
,
r
;
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
ld
%n"
,
&
v
,
&
n
);
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
"
PRId64
"
%n"
,
&
v
,
&
n
);
if
(
r
==
1
&&
n
==
strlen
((
const
char
*
)
bind
->
buffer
))
{
u
.
v2
=
v
;
u
.
v2
=
(
int16_t
)
v
;
if
(
v
>=
SHRT_MIN
&&
v
<=
SHRT_MAX
)
break
;
}
return
TSDB_CODE_TSC_INVALID_VALUE
;
...
...
@@ -430,7 +430,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_NCHAR
:
{
int64_t
v
;
int
n
,
r
;
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
ld
%n"
,
&
v
,
&
n
);
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
"
PRId64
"
%n"
,
&
v
,
&
n
);
if
(
r
==
1
&&
n
==
strlen
((
const
char
*
)
bind
->
buffer
))
{
u
.
v4
=
v
;
if
(
v
>=
INT_MIN
&&
v
<=
INT_MAX
)
break
;
...
...
@@ -457,11 +457,11 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
u
.
f4
=
*
(
int16_t
*
)
bind
->
buffer
;
}
break
;
case
TSDB_DATA_TYPE_INT
:
{
u
.
f4
=
*
(
int32_t
*
)
bind
->
buffer
;
u
.
f4
=
(
float
)
*
(
int32_t
*
)
bind
->
buffer
;
// shall we check equality?
}
break
;
case
TSDB_DATA_TYPE_BIGINT
:
{
u
.
f4
=
*
(
int64_t
*
)
bind
->
buffer
;
u
.
f4
=
(
float
)
*
(
int64_t
*
)
bind
->
buffer
;
// shall we check equality?
}
break
;
case
TSDB_DATA_TYPE_FLOAT
:
{
...
...
@@ -509,7 +509,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_NCHAR
:
{
int64_t
v
;
int
n
,
r
;
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
ld
%n"
,
&
v
,
&
n
);
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%
"
PRId64
"
%n"
,
&
v
,
&
n
);
if
(
r
==
1
&&
n
==
strlen
((
const
char
*
)
bind
->
buffer
))
{
u
.
v8
=
v
;
break
;
...
...
@@ -539,7 +539,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
u
.
f8
=
*
(
int32_t
*
)
bind
->
buffer
;
}
break
;
case
TSDB_DATA_TYPE_BIGINT
:
{
u
.
f8
=
*
(
int64_t
*
)
bind
->
buffer
;
u
.
f8
=
(
double
)
*
(
int64_t
*
)
bind
->
buffer
;
}
break
;
case
TSDB_DATA_TYPE_FLOAT
:
{
u
.
f8
=
*
(
float
*
)
bind
->
buffer
;
...
...
@@ -553,7 +553,7 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
int
n
,
r
;
r
=
sscanf
((
const
char
*
)
bind
->
buffer
,
"%lf%n"
,
&
v
,
&
n
);
if
(
r
==
1
&&
n
==
strlen
((
const
char
*
)
bind
->
buffer
))
{
u
.
v
8
=
v
;
u
.
f
8
=
v
;
break
;
}
return
TSDB_CODE_TSC_INVALID_VALUE
;
...
...
@@ -574,7 +574,8 @@ static int doBindParam(char* data, SParamInfo* param, TAOS_BIND* bind) {
case
TSDB_DATA_TYPE_BINARY
:
case
TSDB_DATA_TYPE_NCHAR
:
{
// is this the correct way to call taosParseTime?
if
(
taosParseTime
(
bind
->
buffer
,
&
u
.
v8
,
*
bind
->
length
,
3
,
tsDaylight
)
==
TSDB_CODE_SUCCESS
)
{
int32_t
len
=
(
int32_t
)
*
bind
->
length
;
if
(
taosParseTime
(
bind
->
buffer
,
&
u
.
v8
,
len
,
3
,
tsDaylight
)
==
TSDB_CODE_SUCCESS
)
{
break
;
}
return
TSDB_CODE_TSC_INVALID_VALUE
;
...
...
src/connector/odbc/src/todbc.c
浏览文件 @
a6c918bf
...
...
@@ -2690,7 +2690,7 @@ static SQLRETURN conv_tsdb_v8_to_c_double(sql_t *sql, c_target_t *target, TAOS_F
static
SQLRETURN
conv_tsdb_v8_to_c_char
(
sql_t
*
sql
,
c_target_t
*
target
,
TAOS_FIELD
*
field
,
int64_t
v8
)
{
char
buf
[
64
];
int
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"%
ld
"
,
v8
);
int
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"%
"
PRId64
"
"
,
v8
);
DASSERT
(
n
<
sizeof
(
buf
));
*
target
->
soi
=
n
;
strncpy
(
target
->
ptr
,
buf
,
(
n
>=
target
->
len
?
target
->
len
:
n
+
1
));
...
...
@@ -2702,7 +2702,7 @@ static SQLRETURN conv_tsdb_v8_to_c_char(sql_t *sql, c_target_t *target, TAOS_FIE
static
SQLRETURN
conv_tsdb_v8_to_c_binary
(
sql_t
*
sql
,
c_target_t
*
target
,
TAOS_FIELD
*
field
,
int64_t
v8
)
{
char
buf
[
64
];
int
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"%
ld
"
,
v8
);
int
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"%
"
PRId64
"
"
,
v8
);
DASSERT
(
n
<
sizeof
(
buf
));
*
target
->
soi
=
n
;
strncpy
(
target
->
ptr
,
buf
,
(
n
>
target
->
len
?
target
->
len
:
n
));
...
...
@@ -3053,7 +3053,7 @@ static SQLRETURN conv_tsdb_str_to_c_v8(sql_t *sql, c_target_t *target, TAOS_FIEL
}
char
buf
[
64
];
snprintf
(
buf
,
sizeof
(
buf
),
"%
ld
"
,
v
);
snprintf
(
buf
,
sizeof
(
buf
),
"%
"
PRId64
"
"
,
v
);
if
(
strcmp
(
buf
,
str
)
==
0
)
return
SQL_SUCCESS
;
...
...
@@ -3156,7 +3156,7 @@ const char* tsdb_int64_to_ts(int64_t src, int64_t *dst)
*
dst
=
src
;
char
buf
[
4096
];
int
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"%
ld
"
,
src
);
int
n
=
snprintf
(
buf
,
sizeof
(
buf
),
"%
"
PRId64
"
"
,
src
);
DASSERT
(
n
>=
0
);
DASSERT
(
n
<
sizeof
(
buf
));
...
...
@@ -3181,7 +3181,7 @@ const char* tsdb_int64_to_double(int64_t src, double *dst)
const
char
*
tsdb_int64_to_char
(
int64_t
src
,
char
*
dst
,
size_t
dlen
)
{
int
n
=
snprintf
(
dst
,
dlen
,
"%
ld
"
,
src
);
int
n
=
snprintf
(
dst
,
dlen
,
"%
"
PRId64
"
"
,
src
);
if
(
n
<
dlen
)
return
NULL
;
return
"22003"
;
}
...
...
@@ -3321,7 +3321,7 @@ const char* tsdb_chars_to_bit(const char *src, int8_t *dst)
{
int
bytes
=
0
;
int64_t
v
=
0
;
int
n
=
sscanf
(
src
,
"%
ld
%n"
,
&
v
,
&
bytes
);
int
n
=
sscanf
(
src
,
"%
"
PRId64
"
%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
"22018"
;
if
(
bytes
!=
strlen
(
src
))
{
...
...
@@ -3342,7 +3342,7 @@ const char* tsdb_chars_to_tinyint(const char *src, int8_t *dst)
{
int
bytes
=
0
;
int64_t
v
=
0
;
int
n
=
sscanf
(
src
,
"%
ld
%n"
,
&
v
,
&
bytes
);
int
n
=
sscanf
(
src
,
"%
"
PRId64
"
%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
"22018"
;
...
...
@@ -3364,7 +3364,7 @@ const char* tsdb_chars_to_smallint(const char *src, int16_t *dst)
{
int
bytes
=
0
;
int64_t
v
=
0
;
int
n
=
sscanf
(
src
,
"%
ld
%n"
,
&
v
,
&
bytes
);
int
n
=
sscanf
(
src
,
"%
"
PRId64
"
%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
"22018"
;
...
...
@@ -3386,7 +3386,7 @@ const char* tsdb_chars_to_int(const char *src, int32_t *dst)
{
int
bytes
=
0
;
int64_t
v
=
0
;
int
n
=
sscanf
(
src
,
"%
ld
%n"
,
&
v
,
&
bytes
);
int
n
=
sscanf
(
src
,
"%
"
PRId64
"
%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
"22018"
;
...
...
@@ -3408,7 +3408,7 @@ const char* tsdb_chars_to_bigint(const char *src, int64_t *dst)
{
int
bytes
=
0
;
int64_t
v
=
0
;
int
n
=
sscanf
(
src
,
"%
ld
%n"
,
&
v
,
&
bytes
);
int
n
=
sscanf
(
src
,
"%
"
PRId64
"
%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
"22018"
;
...
...
@@ -3430,7 +3430,7 @@ const char* tsdb_chars_to_ts(const char *src, int64_t *dst)
{
int
bytes
=
0
;
int64_t
v
=
0
;
int
n
=
sscanf
(
src
,
"%
ld
%n"
,
&
v
,
&
bytes
);
int
n
=
sscanf
(
src
,
"%
"
PRId64
"
%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
"22018"
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录