Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
XKZJ_WCL
TDengine
提交
1a32f1bb
T
TDengine
项目概览
XKZJ_WCL
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1a32f1bb
编写于
10月 20, 2020
作者:
F
freemine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
temporary commit
上级
196106ad
变更
7
展开全部
隐藏空白更改
内联
并排
Showing
7 changed file
with
662 addition
and
495 deletion
+662
-495
src/connector/odbc/src/todbc.c
src/connector/odbc/src/todbc.c
+184
-482
src/connector/odbc/src/todbc_conv.c
src/connector/odbc/src/todbc_conv.c
+363
-0
src/connector/odbc/src/todbc_conv.h
src/connector/odbc/src/todbc_conv.h
+69
-0
src/connector/odbc/src/todbc_util.c
src/connector/odbc/src/todbc_util.c
+16
-0
src/connector/odbc/src/todbc_util.h
src/connector/odbc/src/todbc_util.h
+4
-0
src/connector/odbc/tests/odbc.py
src/connector/odbc/tests/odbc.py
+10
-0
src/inc/taoserror.h
src/inc/taoserror.h
+16
-13
未找到文件。
src/connector/odbc/src/todbc.c
浏览文件 @
1a32f1bb
此差异已折叠。
点击以展开。
src/connector/odbc/src/todbc_conv.c
0 → 100644
浏览文件 @
1a32f1bb
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "todbc_conv.h"
#include "todbc_util.h"
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
// src: int
TSDB_CONV_CODE
tsdb_int64_to_bit
(
int
todb
,
int64_t
src
,
int8_t
*
dst
)
{
*
dst
=
(
int8_t
)
src
;
if
(
src
==
0
||
src
==
1
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_int64_to_tinyint
(
int
todb
,
int64_t
src
,
int8_t
*
dst
)
{
*
dst
=
(
int8_t
)
src
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_int64_to_smallint
(
int
todb
,
int64_t
src
,
int16_t
*
dst
)
{
*
dst
=
(
int16_t
)
src
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_int64_to_int
(
int
todb
,
int64_t
src
,
int32_t
*
dst
)
{
*
dst
=
(
int32_t
)
src
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_int64_to_bigint
(
int
todb
,
int64_t
src
,
int64_t
*
dst
)
{
*
dst
=
src
;
return
TSDB_CONV_OK
;
}
TSDB_CONV_CODE
tsdb_int64_to_ts
(
int
todb
,
int64_t
src
,
int64_t
*
dst
)
{
*
dst
=
src
;
time_t
t
=
(
time_t
)(
src
/
1000
);
struct
tm
tm
=
{
0
};
if
(
localtime_r
(
&
t
,
&
tm
))
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_int64_to_float
(
int
todb
,
int64_t
src
,
float
*
dst
)
{
*
dst
=
(
float
)
src
;
int64_t
v
=
(
int64_t
)
*
dst
;
if
(
v
==
src
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_int64_to_double
(
int
todb
,
int64_t
src
,
double
*
dst
)
{
*
dst
=
(
double
)
src
;
int64_t
v
=
(
int64_t
)
*
dst
;
if
(
v
==
src
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_int64_to_char
(
int
todb
,
int64_t
src
,
char
*
dst
,
size_t
dlen
)
{
int
n
=
snprintf
(
dst
,
dlen
,
"%"
PRId64
""
,
src
);
if
(
n
<
dlen
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_TRUNC
;
}
// src: double
TSDB_CONV_CODE
tsdb_double_to_bit
(
int
todb
,
double
src
,
int8_t
*
dst
)
{
*
dst
=
(
int8_t
)
src
;
if
(
src
<
0
||
src
>=
2
)
return
TSDB_CONV_OOR
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
int64_t
v
=
(
int64_t
)
src
;
if
(
v
==
*
dst
)
return
TSDB_CONV_TRUNC_FRACTION
;
return
TSDB_CONV_TRUNC
;
}
TSDB_CONV_CODE
tsdb_double_to_tinyint
(
int
todb
,
double
src
,
int8_t
*
dst
)
{
*
dst
=
(
int8_t
)
src
;
if
(
src
<
SCHAR_MIN
||
src
>
SCHAR_MAX
)
return
TSDB_CONV_OOR
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
int64_t
v
=
(
int64_t
)
src
;
if
(
v
==
*
dst
)
return
TSDB_CONV_TRUNC_FRACTION
;
return
TSDB_CONV_TRUNC
;
}
TSDB_CONV_CODE
tsdb_double_to_smallint
(
int
todb
,
double
src
,
int16_t
*
dst
)
{
*
dst
=
(
int16_t
)
src
;
if
(
src
<
SHRT_MIN
||
src
>
SHRT_MAX
)
return
TSDB_CONV_OOR
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
int64_t
v
=
(
int64_t
)
src
;
if
(
v
==
*
dst
)
return
TSDB_CONV_TRUNC_FRACTION
;
return
TSDB_CONV_TRUNC
;
}
TSDB_CONV_CODE
tsdb_double_to_int
(
int
todb
,
double
src
,
int32_t
*
dst
)
{
*
dst
=
(
int32_t
)
src
;
if
(
src
<
LONG_MIN
||
src
>
LONG_MAX
)
return
TSDB_CONV_OOR
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
int64_t
v
=
(
int64_t
)
src
;
if
(
v
==
*
dst
)
return
TSDB_CONV_TRUNC_FRACTION
;
return
TSDB_CONV_TRUNC
;
}
TSDB_CONV_CODE
tsdb_double_to_bigint
(
int
todb
,
double
src
,
int64_t
*
dst
)
{
*
dst
=
(
int64_t
)
src
;
if
(
src
<
LLONG_MIN
||
src
>
LLONG_MAX
)
return
TSDB_CONV_OOR
;
if
(
src
==
*
dst
)
return
TSDB_CONV_OK
;
int64_t
v
=
(
int64_t
)
src
;
if
(
v
==
*
dst
)
return
TSDB_CONV_TRUNC_FRACTION
;
return
TSDB_CONV_TRUNC
;
}
TSDB_CONV_CODE
tsdb_double_to_ts
(
int
todb
,
double
src
,
int64_t
*
dst
)
{
TSDB_CONV_CODE
code
=
tsdb_double_to_bigint
(
todb
,
src
,
dst
);
if
(
code
==
TSDB_CONV_OK
||
code
==
TSDB_CONV_TRUNC_FRACTION
)
{
int64_t
v
=
(
int64_t
)
src
;
time_t
t
=
(
time_t
)(
v
/
1000
);
struct
tm
tm
=
{
0
};
if
(
localtime_r
(
&
t
,
&
tm
))
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
return
code
;
}
// src: chars
TSDB_CONV_CODE
tsdb_chars_to_bit
(
int
todb
,
const
char
*
src
,
int8_t
*
dst
)
{
if
(
strcmp
(
src
,
"0"
)
==
0
)
{
*
dst
=
0
;
return
TSDB_CONV_OK
;
}
if
(
strcmp
(
src
,
"1"
)
==
0
)
{
*
dst
=
1
;
return
TSDB_CONV_OK
;
}
double
v
;
int
bytes
;
int
n
=
sscanf
(
src
,
"%lg%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
TSDB_CONV_CHAR_NOT_NUM
;
if
(
bytes
!=
strlen
(
src
))
return
TSDB_CONV_CHAR_NOT_NUM
;
if
(
v
<
0
||
v
>=
2
)
return
TSDB_CONV_OOR
;
return
TSDB_CONV_TRUNC_FRACTION
;
}
TSDB_CONV_CODE
tsdb_chars_to_tinyint
(
int
todb
,
const
char
*
src
,
int8_t
*
dst
)
{
int64_t
v
;
TSDB_CONV_CODE
code
=
tsdb_chars_to_bigint
(
todb
,
src
,
&
v
);
if
(
code
!=
TSDB_CONV_OK
)
return
code
;
*
dst
=
(
int8_t
)
v
;
if
(
v
==*
dst
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_chars_to_smallint
(
int
todb
,
const
char
*
src
,
int16_t
*
dst
)
{
int64_t
v
;
TSDB_CONV_CODE
code
=
tsdb_chars_to_bigint
(
todb
,
src
,
&
v
);
if
(
code
!=
TSDB_CONV_OK
)
return
code
;
*
dst
=
(
int16_t
)
v
;
if
(
v
==*
dst
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_chars_to_int
(
int
todb
,
const
char
*
src
,
int32_t
*
dst
)
{
int64_t
v
;
TSDB_CONV_CODE
code
=
tsdb_chars_to_bigint
(
todb
,
src
,
&
v
);
if
(
code
!=
TSDB_CONV_OK
)
return
code
;
*
dst
=
(
int32_t
)
v
;
if
(
v
==*
dst
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_chars_to_bigint
(
int
todb
,
const
char
*
src
,
int64_t
*
dst
)
{
int
bytes
;
int
n
=
sscanf
(
src
,
"%"
PRId64
"%n"
,
dst
,
&
bytes
);
if
(
n
!=
1
)
return
TSDB_CONV_CHAR_NOT_NUM
;
if
(
bytes
==
strlen
(
src
))
{
return
TSDB_CONV_OK
;
}
double
v
;
n
=
sscanf
(
src
,
"%lg%n"
,
&
v
,
&
bytes
);
if
(
n
!=
1
)
return
TSDB_CONV_CHAR_NOT_NUM
;
if
(
bytes
==
strlen
(
src
))
{
return
TSDB_CONV_TRUNC_FRACTION
;
}
return
TSDB_CONV_OK
;
}
TSDB_CONV_CODE
tsdb_chars_to_ts
(
int
todb
,
const
char
*
src
,
int64_t
*
dst
)
{
int64_t
v
;
TSDB_CONV_CODE
code
=
tsdb_chars_to_bigint
(
todb
,
src
,
&
v
);
if
(
code
!=
TSDB_CONV_OK
)
return
code
;
*
dst
=
v
;
if
(
v
==*
dst
)
{
time_t
t
=
(
time_t
)(
v
/
1000
);
struct
tm
tm
=
{
0
};
if
(
localtime_r
(
&
t
,
&
tm
))
return
TSDB_CONV_OK
;
}
return
TSDB_CONV_OOR
;
}
TSDB_CONV_CODE
tsdb_chars_to_float
(
int
todb
,
const
char
*
src
,
float
*
dst
)
{
int
bytes
;
int
n
=
sscanf
(
src
,
"%g%n"
,
dst
,
&
bytes
);
if
(
n
==
1
&&
bytes
==
strlen
(
src
))
{
return
TSDB_CONV_OK
;
}
return
TSDB_CONV_CHAR_NOT_NUM
;
}
TSDB_CONV_CODE
tsdb_chars_to_double
(
int
todb
,
const
char
*
src
,
double
*
dst
)
{
int
bytes
;
int
n
=
sscanf
(
src
,
"%lg%n"
,
dst
,
&
bytes
);
if
(
n
==
1
&&
bytes
==
strlen
(
src
))
{
return
TSDB_CONV_OK
;
}
return
TSDB_CONV_CHAR_NOT_NUM
;
}
TSDB_CONV_CODE
tsdb_chars_to_char
(
int
todb
,
const
char
*
src
,
char
*
dst
,
size_t
dlen
)
{
int
n
=
snprintf
(
dst
,
dlen
,
"%s"
,
src
);
if
(
n
<
dlen
)
return
TSDB_CONV_OK
;
return
TSDB_CONV_TRUNC
;
}
// src: wchars
TSDB_CONV_CODE
tsdb_wchars_to_bit
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int8_t
*
dst
)
{
char
buf
[
4096
];
char
*
p
=
buf
;
size_t
plen
=
sizeof
(
buf
);
if
(
slen
*
2
+
1
>=
sizeof
(
buf
))
{
plen
=
slen
*
2
+
1
;
p
=
(
char
*
)
malloc
(
plen
);
if
(
!
p
)
return
TSDB_CONV_OOM
;
}
size_t
n
=
wchars_to_chars2
((
const
SQLWCHAR
*
)
src
,
slen
,
(
SQLCHAR
*
)
p
,
plen
);
TSDB_CONV_CODE
code
=
TSDB_CONV_OK
;
do
{
if
(
n
<
0
)
{
code
=
TSDB_CONV_CHAR_NOT_NUM
;
break
;
}
if
(
n
>=
plen
)
{
code
=
TSDB_CONV_CHAR_NOT_NUM
;
break
;
}
p
[
n
]
=
'\0'
;
code
=
tsdb_chars_to_bit
(
todb
,
p
,
dst
);
}
while
(
0
);
if
(
p
!=
buf
)
{
free
(
p
);
}
return
code
;
}
TSDB_CONV_CODE
tsdb_wchars_to_tinyint
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int8_t
*
dst
)
{
char
buf
[
4096
];
char
*
p
=
buf
;
size_t
plen
=
sizeof
(
buf
);
if
(
slen
*
2
+
1
>=
sizeof
(
buf
))
{
plen
=
slen
*
2
+
1
;
p
=
(
char
*
)
malloc
(
plen
);
if
(
!
p
)
return
TSDB_CONV_OOM
;
}
size_t
n
=
wchars_to_chars2
((
const
SQLWCHAR
*
)
src
,
slen
,
(
SQLCHAR
*
)
p
,
plen
);
TSDB_CONV_CODE
code
=
TSDB_CONV_OK
;
do
{
if
(
n
<
0
)
{
code
=
TSDB_CONV_CHAR_NOT_NUM
;
break
;
}
if
(
n
>=
sizeof
(
buf
))
{
code
=
TSDB_CONV_CHAR_NOT_NUM
;
break
;
}
buf
[
n
]
=
'\0'
;
code
=
tsdb_chars_to_tinyint
(
todb
,
buf
,
dst
);
}
while
(
0
);
if
(
p
!=
buf
)
{
free
(
p
);
}
return
code
;
}
src/connector/odbc/src/todbc_conv.h
0 → 100644
浏览文件 @
1a32f1bb
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _todbc_conv_h_
#define _todbc_conv_h_
#include <inttypes.h>
#include <stddef.h>
typedef
enum
{
TSDB_CONV_OK
=
0
,
TSDB_CONV_OOM
,
TSDB_CONV_OOR
,
TSDB_CONV_TRUNC_FRACTION
,
TSDB_CONV_TRUNC
,
TSDB_CONV_CHAR_NOT_NUM
,
}
TSDB_CONV_CODE
;
TSDB_CONV_CODE
tsdb_int64_to_bit
(
int
todb
,
int64_t
src
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_tinyint
(
int
todb
,
int64_t
src
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_smallint
(
int
todb
,
int64_t
src
,
int16_t
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_int
(
int
todb
,
int64_t
src
,
int32_t
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_bigint
(
int
todb
,
int64_t
src
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_ts
(
int
todb
,
int64_t
src
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_float
(
int
todb
,
int64_t
src
,
float
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_double
(
int
todb
,
int64_t
src
,
double
*
dst
);
TSDB_CONV_CODE
tsdb_int64_to_char
(
int
todb
,
int64_t
src
,
char
*
dst
,
size_t
dlen
);
TSDB_CONV_CODE
tsdb_double_to_bit
(
int
todb
,
double
src
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_double_to_tinyint
(
int
todb
,
double
src
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_double_to_smallint
(
int
todb
,
double
src
,
int16_t
*
dst
);
TSDB_CONV_CODE
tsdb_double_to_int
(
int
todb
,
double
src
,
int32_t
*
dst
);
TSDB_CONV_CODE
tsdb_double_to_bigint
(
int
todb
,
double
src
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_double_to_ts
(
int
todb
,
double
src
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_bit
(
int
todb
,
const
char
*
src
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_tinyint
(
int
todb
,
const
char
*
src
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_smallint
(
int
todb
,
const
char
*
src
,
int16_t
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_int
(
int
todb
,
const
char
*
src
,
int32_t
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_bigint
(
int
todb
,
const
char
*
src
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_ts
(
int
todb
,
const
char
*
src
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_float
(
int
todb
,
const
char
*
src
,
float
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_double
(
int
todb
,
const
char
*
src
,
double
*
dst
);
TSDB_CONV_CODE
tsdb_chars_to_char
(
int
todb
,
const
char
*
src
,
char
*
dst
,
size_t
dlen
);
TSDB_CONV_CODE
tsdb_wchars_to_bit
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_tinyint
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int8_t
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_smallint
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int16_t
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_int
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int32_t
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_bigint
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_ts
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
int64_t
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_float
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
float
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_double
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
double
*
dst
);
TSDB_CONV_CODE
tsdb_wchars_to_char
(
int
todb
,
const
unsigned
char
*
src
,
size_t
slen
,
char
*
dst
,
size_t
dlen
);
#endif // _todbc_conv_h_
src/connector/odbc/src/todbc_util.c
浏览文件 @
1a32f1bb
...
...
@@ -236,3 +236,19 @@ SQLCHAR* wchars_to_chars(const SQLWCHAR *wchars, size_t chs, size_t *bytes)
return
dst
;
}
size_t
wchars_to_chars2
(
const
SQLWCHAR
*
src
,
size_t
slen
,
SQLCHAR
*
dst
,
size_t
dlen
)
{
size_t
consumed
=
0
,
generated
=
0
;
int
n
=
string_conv
(
"UCS-2LE"
,
"UTF-8"
,
(
const
unsigned
char
*
)
src
,
slen
,
dst
,
dlen
,
&
consumed
,
&
generated
);
if
(
n
)
return
-
1
;
return
generated
;
}
size_t
chars_to_wchars2
(
const
SQLCHAR
*
src
,
size_t
slen
,
SQLWCHAR
*
dst
,
size_t
dlen
)
{
size_t
consumed
=
0
,
generated
=
0
;
int
n
=
string_conv
(
"UTF-8"
,
"UCS-2LE"
,
(
const
unsigned
char
*
)
src
,
slen
,
(
unsigned
char
*
)
dst
,
dlen
,
&
consumed
,
&
generated
);
if
(
n
)
return
-
1
;
return
generated
;
}
src/connector/odbc/src/todbc_util.h
浏览文件 @
1a32f1bb
...
...
@@ -60,4 +60,8 @@ unsigned char* utf8_to_ucs4le(const char *utf8, size_t *chars);
char
*
ucs4le_to_utf8
(
const
unsigned
char
*
ucs4le
,
size_t
slen
,
size_t
*
chars
);
SQLCHAR
*
wchars_to_chars
(
const
SQLWCHAR
*
wchars
,
size_t
chs
,
size_t
*
bytes
);
size_t
wchars_to_chars2
(
const
SQLWCHAR
*
src
,
size_t
slen
,
SQLCHAR
*
dst
,
size_t
dlen
);
size_t
chars_to_wchars2
(
const
SQLCHAR
*
src
,
size_t
slen
,
SQLWCHAR
*
dst
,
size_t
dlen
);
#endif // _TODBC_UTIL_H_
src/connector/odbc/tests/odbc.py
浏览文件 @
1a32f1bb
...
...
@@ -118,3 +118,13 @@ while row:
row
=
cursor
.
fetchone
()
cursor
.
close
()
cursor
=
cnxn
.
cursor
()
cursor
.
execute
(
"create table db.f (ts timestamp, v1 bool)"
)
cursor
.
close
()
params
=
[
(
'2020-10-20 00:00:00'
,
'acb'
)
]
cursor
=
cnxn
.
cursor
()
cursor
.
fast_executemany
=
True
cursor
.
executemany
(
"insert into db.f values (?, ?)"
,
params
)
cursor
.
close
()
src/inc/taoserror.h
浏览文件 @
1a32f1bb
...
...
@@ -355,20 +355,23 @@ TAOS_DEFINE_ERROR(TSDB_CODE_HTTP_OP_VALUE_NULL, 0, 0x11A5, "value not
TAOS_DEFINE_ERROR
(
TSDB_CODE_HTTP_OP_VALUE_TYPE
,
0
,
0x11A6
,
"value type should be boolean, number or string"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_OOM
,
0
,
0x2101
,
"out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_OOM
,
0
,
0x2100
,
"out of memory"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_CHAR_NOT_NUM
,
0
,
0x2101
,
"convertion not a valid literal input"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_UNDEF
,
0
,
0x2102
,
"convertion undefined"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_TRUNC
,
0
,
0x2103
,
"convertion truncated"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_NOT_SUPPORT
,
0
,
0x2104
,
"convertion not supported"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_OUT_OF_RANGE
,
0
,
0x2105
,
"out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_NOT_SUPPORT
,
0
,
0x2106
,
"not supported yet"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_INVALID_HANDLE
,
0
,
0x2107
,
"invalid handle"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_NO_RESULT
,
0
,
0x2108
,
"no result set"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_NO_FIELDS
,
0
,
0x2109
,
"no fields returned"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_INVALID_CURSOR
,
0
,
0x2110
,
"invalid cursor"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_STATEMENT_NOT_READY
,
0
,
0x2111
,
"statement not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONNECTION_BUSY
,
0
,
0x2112
,
"connection still busy"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_BAD_CONNSTR
,
0
,
0x2113
,
"bad connection string"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_BAD_ARG
,
0
,
0x2114
,
"bad argument"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_TRUNC_FRAC
,
0
,
0x2103
,
"convertion fractional truncated"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_TRUNC
,
0
,
0x2104
,
"convertion truncated"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_NOT_SUPPORT
,
0
,
0x2105
,
"convertion not supported"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONV_OOR
,
0
,
0x2106
,
"convertion numeric value out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_OUT_OF_RANGE
,
0
,
0x2107
,
"out of range"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_NOT_SUPPORT
,
0
,
0x2108
,
"not supported yet"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_INVALID_HANDLE
,
0
,
0x2109
,
"invalid handle"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_NO_RESULT
,
0
,
0x210a
,
"no result set"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_NO_FIELDS
,
0
,
0x210b
,
"no fields returned"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_INVALID_CURSOR
,
0
,
0x210c
,
"invalid cursor"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_STATEMENT_NOT_READY
,
0
,
0x210d
,
"statement not ready"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_CONNECTION_BUSY
,
0
,
0x210e
,
"connection still busy"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_BAD_CONNSTR
,
0
,
0x210f
,
"bad connection string"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_ODBC_BAD_ARG
,
0
,
0x2110
,
"bad argument"
)
#ifdef TAOS_ERROR_C
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录