Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8b146842
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看板
提交
8b146842
编写于
10月 27, 2020
作者:
F
freemine
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'odbc-win' into odbc
上级
4e402502
03056bca
变更
20
展开全部
显示空白变更内容
内联
并排
Showing
20 changed file
with
334 addition
and
144 deletion
+334
-144
src/connector/odbc/CMakeLists.txt
src/connector/odbc/CMakeLists.txt
+19
-0
src/connector/odbc/src/CMakeLists.txt
src/connector/odbc/src/CMakeLists.txt
+28
-2
src/connector/odbc/src/todbc.c
src/connector/odbc/src/todbc.c
+78
-80
src/connector/odbc/src/todbc.def
src/connector/odbc/src/todbc.def
+28
-0
src/connector/odbc/src/todbc.rc.in
src/connector/odbc/src/todbc.rc.in
+31
-0
src/connector/odbc/src/todbc.rsp
src/connector/odbc/src/todbc.rsp
+5
-0
src/connector/odbc/src/todbc_conv.c
src/connector/odbc/src/todbc_conv.c
+1
-3
src/connector/odbc/src/todbc_conv.h
src/connector/odbc/src/todbc_conv.h
+3
-5
src/connector/odbc/src/todbc_flex.h
src/connector/odbc/src/todbc_flex.h
+22
-0
src/connector/odbc/src/todbc_log.h
src/connector/odbc/src/todbc_log.h
+1
-3
src/connector/odbc/src/todbc_scanner.l
src/connector/odbc/src/todbc_scanner.l
+9
-4
src/connector/odbc/src/todbc_util.c
src/connector/odbc/src/todbc_util.c
+8
-12
src/connector/odbc/src/todbc_util.h
src/connector/odbc/src/todbc_util.h
+2
-4
src/connector/odbc/tests/CMakeLists.txt
src/connector/odbc/tests/CMakeLists.txt
+6
-0
src/connector/odbc/tests/main.c
src/connector/odbc/tests/main.c
+41
-27
src/connector/odbc/tests/simples.stmts
src/connector/odbc/tests/simples.stmts
+44
-0
src/inc/taoserror.h
src/inc/taoserror.h
+2
-2
src/os/inc/osTime.h
src/os/inc/osTime.h
+2
-2
src/os/inc/osWindows.h
src/os/inc/osWindows.h
+1
-0
src/os/src/windows/wSysinfo.c
src/os/src/windows/wSysinfo.c
+3
-0
未找到文件。
src/connector/odbc/CMakeLists.txt
浏览文件 @
8b146842
...
...
@@ -17,6 +17,8 @@ IF (TD_LINUX_64)
if
(
NOT FLEX_FOUND
)
message
(
FATAL_ERROR
"you need to install flex first"
)
else
()
SET
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS_DEBUG
}
-Wconversion"
)
SET
(
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS_RELEASE
}
-Wconversion"
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
tests
)
endif
()
...
...
@@ -26,3 +28,20 @@ IF (TD_LINUX_64)
ENDIF
()
ENDIF
()
IF
(
TD_WINDOWS_64
)
find_package
(
ODBC
)
if
(
NOT ODBC_FOUND
)
message
(
FATAL_ERROR
"you need to install ODBC first"
)
else
()
message
(
STATUS
"ODBC_INCLUDE_DIRS:
${
ODBC_INCLUDE_DIRS
}
"
)
message
(
STATUS
"ODBC_LIBRARIES:
${
ODBC_LIBRARIES
}
"
)
message
(
STATUS
"ODBC_CONFIG:
${
ODBC_CONFIG
}
"
)
endif
()
find_package
(
FLEX
)
if
(
NOT FLEX_FOUND
)
message
(
FATAL_ERROR
"you need to install flex first"
)
else
()
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
tests
)
endif
()
ENDIF
()
src/connector/odbc/src/CMakeLists.txt
浏览文件 @
8b146842
...
...
@@ -16,9 +16,35 @@ IF (TD_LINUX_64)
SET_TARGET_PROPERTIES
(
todbc PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
SET_TARGET_PROPERTIES
(
todbc PROPERTIES VERSION
${
TD_VER_NUMBER
}
SOVERSION 1
)
TARGET_LINK_LIBRARIES
(
todbc taos
)
target_include_directories
(
todbc PUBLIC
.
)
target_include_directories
(
todbc PUBLIC .
)
install
(
CODE
"execute_process(COMMAND
${
CMAKE_CURRENT_SOURCE_DIR
}
/install.sh
${
CMAKE_BINARY_DIR
}
)"
)
ENDIF
()
IF
(
TD_WINDOWS_64
)
FLEX_TARGET
(
todbcFlexScanner
todbc_scanner.l
${
CMAKE_CURRENT_BINARY_DIR
}
/todbc_scanner.c
)
set
(
todbc_flex_scanner_src
${
FLEX_todbcFlexScanner_OUTPUTS
}
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
# generate dynamic library (*.dll)
ADD_LIBRARY
(
todbc SHARED
${
SRC
}
${
todbc_flex_scanner_src
}
${
CMAKE_CURRENT_BINARY_DIR
}
/todbc.rc
todbc.def
)
TARGET_LINK_LIBRARIES
(
todbc taos_static
)
target_include_directories
(
todbc PUBLIC .
)
target_compile_definitions
(
todbc PRIVATE
"todbc_EXPORT"
)
CONFIGURE_FILE
(
"todbc.rc.in"
"
${
CMAKE_CURRENT_BINARY_DIR
}
/todbc.rc"
)
SET_TARGET_PROPERTIES
(
todbc PROPERTIES LINK_FLAGS
/DEF:todbc.def
)
SET
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS_DEBUG
}
/GL"
)
SET
(
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS_RELEASE
}
/GL"
)
ENDIF
()
src/connector/odbc/src/todbc.c
浏览文件 @
8b146842
此差异已折叠。
点击以展开。
src/connector/odbc/src/todbc.def
0 → 100644
浏览文件 @
8b146842
EXPORTS
SQLAllocEnv
SQLFreeEnv
SQLAllocConnect
SQLFreeConnect
SQLConnect
SQLDisconnect
SQLAllocStmt
SQLAllocHandle
SQLFreeStmt
SQLExecDirect
SQLExecDirectW
SQLNumResultCols
SQLRowCount
SQLColAttribute
SQLGetData
SQLFetch
SQLPrepare
SQLExecute
SQLGetDiagField
SQLGetDiagRec
SQLBindParameter
SQLDriverConnect
SQLSetConnectAttr
SQLDescribeCol
SQLNumParams
SQLSetStmtAttr
src/connector/odbc/src/todbc.rc.in
0 → 100644
浏览文件 @
8b146842
1 VERSIONINFO
FILEVERSION ${TD_VER_NUMBER}
PRODUCTVERSION ${TD_VER_NUMBER}
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x0L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "ODBC Driver for TDengine"
VALUE "FileVersion", "${TD_VER_NUMBER}"
VALUE "InternalName", "todbc.dll(${TD_VER_CPUTYPE})"
VALUE "LegalCopyright", "Copyright (C) 2020 TAOS Data"
VALUE "OriginalFilename", ""
VALUE "ProductName", "todbc.dll(${TD_VER_CPUTYPE})"
VALUE "ProductVersion", "${TD_VER_NUMBER}"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
\ No newline at end of file
src/connector/odbc/src/todbc.rsp
0 → 100644
浏览文件 @
8b146842
INSTALLDRIVER "TAOS ODBC|Driver=todbc.dll|FileUsage=0|ConnectFunctions=YYN"
src/connector/odbc/src/todbc_conv.c
浏览文件 @
8b146842
...
...
@@ -15,8 +15,6 @@
#include "todbc_conv.h"
#include "todbc_util.h"
#include <errno.h>
#include <limits.h>
#include <stdio.h>
...
...
@@ -74,7 +72,7 @@ TSDB_CONV_CODE tsdb_iconv_conv(iconv_t cnv, const unsigned char *src, size_t *sl
size_t
sl
=
*
slen
;
size_t
dl
=
*
dlen
;
in
t
n
=
iconv
(
cnv
,
&
s
,
&
sl
,
&
d
,
&
dl
);
size_
t
n
=
iconv
(
cnv
,
&
s
,
&
sl
,
&
d
,
&
dl
);
int
e
=
errno
;
if
(
dl
)
*
d
=
'\0'
;
// what if all consumed?
...
...
src/connector/odbc/src/todbc_conv.h
浏览文件 @
8b146842
...
...
@@ -16,11 +16,9 @@
#ifndef _todbc_conv_h_
#define _todbc_conv_h_
#include <inttypes.h>
#include <sqltypes.h>
#include <stddef.h>
#include "iconv.h"
#include "os.h"
#include <iconv.h>
#include <sql.h>
typedef
enum
{
...
...
src/connector/odbc/src/todbc_flex.h
0 → 100644
浏览文件 @
8b146842
/*
* 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_FLEX_H_
#define _TODBC_FLEX_H_
int
todbc_parse_conn_string
(
const
char
*
conn
,
char
**
dsn
,
char
**
uid
,
char
**
pwd
,
char
**
host
);
#endif // _TODBC_FLEX_H_
src/connector/odbc/src/todbc_log.h
浏览文件 @
8b146842
...
...
@@ -16,9 +16,7 @@
#ifndef _todbc_log_h_
#define _todbc_log_h_
#include <libgen.h>
#include <stdio.h>
#include <stdlib.h>
#include "os.h"
#define D(fmt, ...) \
fprintf(stderr, \
...
...
src/connector/odbc/src/todbc_scanner.l
浏览文件 @
8b146842
%{
#include "todbc_util.h"
#include "todbc_flex.h"
#include <stdio.h>
#ifdef _MSC_VER
#define strncasecmp _strnicmp
#define strcasecmp _stricmp
#endif
typedef struct params_s params_t;
struct params_s {
char *key;
...
...
@@ -68,6 +72,8 @@ do { \
%option prefix="todbc_yy"
%option extra-type="struct params_s *"
%option nounistd
%option never-interactive
%option reentrant
%option noyywrap
%option noinput nounput
...
...
@@ -98,8 +104,7 @@ do { \
<EQ>[{] { CHG_STATE(BRACE1); }
<EQ>.|\n { return -1; }
<BRACE1>[[:space:]]+ { }
<BRACE1>[^{}\n[:space:]]+ { set_val(); CHG_STATE(BRACE2); }
<BRACE1>[^{}\n]+ { set_val(); CHG_STATE(BRACE2); }
<BRACE1>.|\n { return -1; }
<BRACE2>[[:space:]]+ { }
...
...
src/connector/odbc/src/todbc_util.c
浏览文件 @
8b146842
...
...
@@ -14,14 +14,10 @@
*/
#include "todbc_util.h"
#include "iconv.h"
#include <sql.h>
#include <sqltypes.h>
#include "todbc_log.h"
#include <iconv.h>
#include <sqlext.h>
#include <stdlib.h>
#include <string.h>
const
char
*
sql_sql_type
(
int
type
)
{
switch
(
type
)
{
...
...
@@ -125,7 +121,7 @@ int string_conv(const char *fromcode, const char *tocode,
iconv_t
conv
=
iconv_open
(
tocode
,
fromcode
);
if
(
!
conv
)
return
-
1
;
in
t
r
=
0
;
size_
t
r
=
0
;
do
{
char
*
s
=
(
char
*
)
src
;
char
*
d
=
(
char
*
)
dst
;
...
...
@@ -141,7 +137,7 @@ int string_conv(const char *fromcode, const char *tocode,
}
while
(
0
);
iconv_close
(
conv
);
return
r
;
return
(
int
)
r
;
}
int
utf8_chars
(
const
char
*
src
)
...
...
@@ -161,7 +157,7 @@ int utf8_chars(const char *src)
size_t
chars
=
(
sizeof
(
buf
)
-
dlen
)
/
2
;
iconv_close
(
conv
);
return
chars
;
return
(
int
)
chars
;
}
unsigned
char
*
utf8_to_ucs4le
(
const
char
*
utf8
,
size_t
*
chars
)
...
...
@@ -240,7 +236,7 @@ size_t wchars_to_chars2(const SQLWCHAR *src, size_t slen, SQLCHAR *dst, size_t d
{
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
;
if
(
n
)
return
(
size_t
)
-
1
;
return
generated
;
}
...
...
@@ -248,7 +244,7 @@ size_t chars_to_wchars2(const SQLCHAR *src, size_t slen, SQLWCHAR *dst, size_t d
{
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
;
if
(
n
)
return
(
size_t
)
-
1
;
return
generated
;
}
src/connector/odbc/src/todbc_util.h
浏览文件 @
8b146842
...
...
@@ -16,10 +16,10 @@
#ifndef _TODBC_UTIL_H_
#define _TODBC_UTIL_H_
#include "
todbc_log
.h"
#include "
os
.h"
#include <stddef.h>
#include <sql.h>
#include <sqltypes.h>
const
char
*
sql_sql_type
(
int
type
);
const
char
*
sql_c_type
(
int
type
);
...
...
@@ -27,8 +27,6 @@ const char* sql_c_type(int type);
int
is_valid_sql_c_type
(
int
type
);
int
is_valid_sql_sql_type
(
int
type
);
int
todbc_parse_conn_string
(
const
char
*
conn
,
char
**
dsn
,
char
**
uid
,
char
**
pwd
,
char
**
host
);
int
string_conv
(
const
char
*
fromcode
,
const
char
*
tocode
,
const
unsigned
char
*
src
,
size_t
sbytes
,
unsigned
char
*
dst
,
size_t
dbytes
,
...
...
src/connector/odbc/tests/CMakeLists.txt
浏览文件 @
8b146842
...
...
@@ -5,3 +5,9 @@ IF (TD_LINUX)
ADD_EXECUTABLE
(
tcodbc main.c
)
TARGET_LINK_LIBRARIES
(
tcodbc odbc
)
ENDIF
()
IF
(
TD_WINDOWS_64
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
tcodbc main.c
)
TARGET_LINK_LIBRARIES
(
tcodbc odbc32 os
)
ENDIF
()
src/connector/odbc/tests/main.c
浏览文件 @
8b146842
#include <libgen.h>
#include "../src/todbc_log.h"
#ifdef _MSC_VER
#include <winsock2.h>
#include <windows.h>
#include "os.h"
#endif
#include <sql.h>
#include <sqlext.h>
#include <stdio.h>
#include <string.h>
#include "os.h"
#include "../src/todbc_log.h"
// static const char *dsn = "TAOS_DSN";
// static const char *uid = "root";
// static const char *pwd = "taosdata";
#define CHK_TEST(statement) \
do { \
D("testing: %s", #statement); \
...
...
@@ -72,9 +71,9 @@ static int open_connect(const char *dsn, const char *uid, const char *pwd, SQLHE
CHK_RESULT
(
r
,
SQL_HANDLE_ENV
,
env
,
""
);
if
(
r
!=
SQL_SUCCESS
)
break
;
do
{
r
=
SQLConnect
(
conn
,
(
SQLCHAR
*
)
dsn
,
strlen
(
dsn
),
(
SQLCHAR
*
)
uid
,
strlen
(
uid
),
(
SQLCHAR
*
)
pwd
,
strlen
(
pwd
));
r
=
SQLConnect
(
conn
,
(
SQLCHAR
*
)
dsn
,
(
SQLSMALLINT
)
strlen
(
dsn
),
(
SQLCHAR
*
)
uid
,
(
SQLSMALLINT
)
strlen
(
uid
),
(
SQLCHAR
*
)
pwd
,
(
SQLSMALLINT
)
strlen
(
pwd
));
CHK_RESULT
(
r
,
SQL_HANDLE_DBC
,
conn
,
""
);
if
(
r
==
SQL_SUCCESS
)
{
*
pEnv
=
env
;
...
...
@@ -105,7 +104,7 @@ static int open_driver_connect(const char *connstr, SQLHENV *pEnv, SQLHDBC *pCon
SQLHDBC
ConnectionHandle
=
conn
;
SQLHWND
WindowHandle
=
NULL
;
SQLCHAR
*
InConnectionString
=
(
SQLCHAR
*
)
connstr
;
SQLSMALLINT
StringLength1
=
strlen
(
connstr
);
SQLSMALLINT
StringLength1
=
(
SQLSMALLINT
)
strlen
(
connstr
);
SQLCHAR
*
OutConnectionString
=
buf
;
SQLSMALLINT
BufferLength
=
sizeof
(
buf
);
SQLSMALLINT
*
StringLength2Ptr
=
&
blen
;
...
...
@@ -144,7 +143,7 @@ static int do_statement(SQLHSTMT stmt, const char *statement) {
CHK_RESULT
(
r
,
SQL_HANDLE_STMT
,
stmt
,
""
);
for
(
size_t
i
=
0
;
i
<
cols
;
++
i
)
{
SQLLEN
soi
=
0
;
r
=
SQLGetData
(
stmt
,
i
+
1
,
SQL_C_CHAR
,
buf
,
sizeof
(
buf
),
&
soi
);
r
=
SQLGetData
(
stmt
,
(
SQLUSMALLINT
)(
i
+
1
)
,
SQL_C_CHAR
,
buf
,
sizeof
(
buf
),
&
soi
);
CHK_RESULT
(
r
,
SQL_HANDLE_STMT
,
stmt
,
""
);
if
(
r
)
{
if
(
r
!=
SQL_SUCCESS_WITH_INFO
)
{
...
...
@@ -185,10 +184,10 @@ static int do_insert(SQLHSTMT stmt, data_t data) {
SQLLEN
lblob
;
const
char
*
statement
=
"insert into t values (?, ?, ?, ?, ?, ?, ?, ?, ?,?)"
;
int
ignored
=
0
;
#define ignored 0
do
{
r
=
SQLPrepare
(
stmt
,
(
SQLCHAR
*
)
statement
,
strlen
(
statement
));
r
=
SQLPrepare
(
stmt
,
(
SQLCHAR
*
)
statement
,
(
SQLINTEGER
)
strlen
(
statement
));
CHK_RESULT
(
r
,
SQL_HANDLE_STMT
,
stmt
,
"statement: %s"
,
statement
);
if
(
r
)
break
;
...
...
@@ -243,28 +242,30 @@ static int do_insert(SQLHSTMT stmt, data_t data) {
// r = SQLExecute(stmt);
// if (r) break;
}
while
(
0
);
#undef ignored
return
r
;
}
static
int
test1
(
const
char
*
dsn
,
const
char
*
uid
,
const
char
*
pwd
)
{
SQLRETURN
r
=
SQL_SUCCESS
;
SQLHENV
env
=
{
0
};
SQLHDBC
conn
=
{
0
};
int
n
=
open_connect
(
dsn
,
uid
,
pwd
,
&
env
,
&
conn
);
if
(
n
)
return
1
;
int
ok
=
0
;
do
{
SQLRETURN
r
=
SQL_SUCCESS
;
SQLHSTMT
stmt
=
{
0
};
r
=
SQLAllocHandle
(
SQL_HANDLE_STMT
,
conn
,
&
stmt
);
if
(
r
!=
SQL_SUCCESS
)
break
;
do
{
if
(
do_statement
(
stmt
,
"drop database if exists db"
))
{
r
=
SQL_ERROR
;
break
;
}
for
(
size_t
i
=
0
;
i
<
sizeof
(
pre_stmts
)
/
sizeof
(
pre_stmts
[
0
]);
++
i
)
{
r
=
do_statement
(
stmt
,
pre_stmts
[
i
]);
if
(
r
!=
SQL_SUCCESS
)
break
;
n
=
do_statement
(
stmt
,
pre_stmts
[
i
]);
if
(
n
)
break
;
}
do
{
data_t
data
=
{
0
};
...
...
@@ -274,7 +275,7 @@ static int test1(const char *dsn, const char *uid, const char *pwd) {
data
.
v2
=
32767
;
data
.
v4
=
2147483647
;
data
.
v8
=
9223372036854775807
;
data
.
f4
=
123
.
456
;
data
.
f4
=
123
.
456
f
;
data
.
f8
=
9999999
.
999999
;
memset
(
data
.
bin
,
0
,
sizeof
(
data
.
bin
));
memset
(
data
.
blob
,
0
,
sizeof
(
data
.
blob
));
...
...
@@ -285,8 +286,8 @@ static int test1(const char *dsn, const char *uid, const char *pwd) {
r
=
SQLAllocHandle
(
SQL_HANDLE_STMT
,
conn
,
&
stmt
);
if
(
r
!=
SQL_SUCCESS
)
break
;
do
{
r
=
do_insert
(
stmt
,
data
);
if
(
r
!=
SQL_SUCCESS
)
break
;
n
=
do_insert
(
stmt
,
data
);
if
(
n
)
break
;
}
while
(
0
);
SQLFreeHandle
(
SQL_HANDLE_STMT
,
stmt
);
...
...
@@ -297,12 +298,15 @@ static int test1(const char *dsn, const char *uid, const char *pwd) {
// if (r!=SQL_SUCCESS) break;
// } while (0);
// SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ok
=
1
;
}
while
(
0
);
if
(
r
!=
SQL_SUCCESS
)
break
;
if
(
!
ok
)
break
;
ok
=
0
;
for
(
size_t
i
=
0
;
i
<
sizeof
(
pro_stmts
)
/
sizeof
(
pro_stmts
[
0
]);
++
i
)
{
r
=
do_statement
(
stmt
,
pro_stmts
[
i
]);
if
(
r
!=
SQL_SUCCESS
)
break
;
n
=
do_statement
(
stmt
,
pro_stmts
[
i
]);
if
(
n
)
break
;
}
ok
=
1
;
}
while
(
0
);
SQLFreeHandle
(
SQL_HANDLE_STMT
,
stmt
);
}
while
(
0
);
...
...
@@ -310,7 +314,7 @@ static int test1(const char *dsn, const char *uid, const char *pwd) {
SQLFreeConnect
(
conn
);
SQLFreeEnv
(
env
);
return
r
?
1
:
0
;
return
ok
?
0
:
1
;
}
int
test_statements
(
const
char
*
dsn
,
const
char
*
uid
,
const
char
*
pwd
,
const
char
**
statements
)
{
...
...
@@ -418,7 +422,12 @@ int test_sqls_in_stmt(SQLHENV env, SQLHDBC conn, SQLHSTMT stmt, const char *sqls
char
*
line
=
NULL
;
size_t
len
=
0
;
ssize_t
n
=
getline
(
&
line
,
&
len
,
f
);
ssize_t
n
=
0
;
#ifdef _MSC_VER
n
=
taosGetline
(
&
line
,
&
len
,
f
);
#else
n
=
getline
(
&
line
,
&
len
,
f
);
#endif
if
(
n
==-
1
)
break
;
const
char
*
p
=
NULL
;
...
...
@@ -493,6 +502,11 @@ int main(int argc, char *argv[]) {
const
char
*
connstr
=
(
argc
>
4
)
?
argv
[
4
]
:
NULL
;
const
char
*
sqls
=
(
argc
>
5
)
?
argv
[
5
]
:
NULL
;
dsn
=
NULL
;
uid
=
NULL
;
pwd
=
NULL
;
connstr
=
argv
[
1
];
sqls
=
argv
[
2
];
if
(
0
)
{
CHK_TEST
(
test_env
());
...
...
src/connector/odbc/tests/simples.stmts
0 → 100644
浏览文件 @
8b146842
P:drop database if exists m;
P:create database m;
P:use m;
P:create table t (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob binary(1), name nchar(1));
P:insert into t (ts, b) values('2020-10-10 00:00:00', 0);
P:insert into t (ts, b) values('2020-10-10 00:00:00.001', 1);
P:insert into t (ts, b) values('2020-10-10 00:00:00.002', 10);
P:select * from t;
P:drop table t;
P:create table t (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob binary(1), name nchar(1));
P:insert into t (ts, v1) values('2020-10-10 00:00:00', 0);
P:insert into t (ts, v1) values('2020-10-10 00:00:00.001', 1);
P:insert into t (ts, v1) values('2020-10-10 00:00:00.002', 10);
P:select * from t;
P:drop table t;
P:create table t (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob binary(1), name nchar(1));
P:insert into t (ts, name) values('2020-10-10 00:00:00', 0);
P:insert into t (ts, name) values('2020-10-10 00:00:00.001', 1);
P:insert into t (ts, name) values('2020-10-10 00:00:00.002', '人');
P:insert into t (ts, name) values('2020-10-10 00:00:00.003', 'a');
P:select * from t;
P:drop table t;
P:create table t (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob binary(3), name nchar(1));
P:insert into t (ts, blob) values('2020-10-10 00:00:00', 0);
P:insert into t (ts, blob) values('2020-10-10 00:00:00.001', 1);
P:insert into t (ts, blob) values('2020-10-10 00:00:00.002', 'a');
P:insert into t (ts, blob) values('2020-10-10 00:00:00.003', 'b');
P:insert into t (ts, blob) values('2020-10-10 00:00:00.004', '人');
P:select * from t;
P:drop table t;
P:create table t (ts timestamp, b bool, v1 tinyint, v2 smallint, v4 int, v8 bigint, f4 float, f8 double, blob binary(3), name nchar(1));
N:insert into t (ts, blob) values('2020-10-10 00:00:00', '1234');
N:insert into t (ts, blob) values('2020-10-10 00:00:00.001', '0000');
N:insert into t (ts, blob) values('2020-10-10 00:00:00.002', '人a');
P:insert into t (ts, blob) values('2020-10-10 00:00:00.003', 'a');
P:insert into t (ts, blob) values('2020-10-10 00:00:00.004', 'b');
P:insert into t (ts, blob) values('2020-10-10 00:00:00.005', '人');
P:select * from t;
src/inc/taoserror.h
浏览文件 @
8b146842
...
...
@@ -24,9 +24,9 @@ extern "C" {
#include <stdbool.h>
#ifdef TAOS_ERROR_C
#define TAOS_DEFINE_ERROR(name, mod, code, msg) {.val = (
0x80000000 | ((mod)<<16) | (code
)), .str=(msg)},
#define TAOS_DEFINE_ERROR(name, mod, code, msg) {.val = (
int32_t)((0x80000000 | ((mod)<<16) | (code)
)), .str=(msg)},
#else
#define TAOS_DEFINE_ERROR(name, mod, code, msg) static const int32_t name = (
0x80000000 | ((mod)<<16) | (code
));
#define TAOS_DEFINE_ERROR(name, mod, code, msg) static const int32_t name = (
int32_t)((0x80000000 | ((mod)<<16) | (code)
));
#endif
#define TAOS_SYSTEM_ERROR(code) (0x80ff0000 | (code))
...
...
src/os/inc/osTime.h
浏览文件 @
8b146842
...
...
@@ -38,14 +38,14 @@ int32_t taosGetTimestampSec();
static
FORCE_INLINE
int64_t
taosGetTimestampMs
()
{
struct
timeval
systemTime
;
gettimeofday
(
&
systemTime
,
NULL
);
return
(
int64_t
)
systemTime
.
tv_sec
*
1000L
+
(
u
int64_t
)
systemTime
.
tv_usec
/
1000
;
return
(
int64_t
)
systemTime
.
tv_sec
*
1000L
+
(
int64_t
)
systemTime
.
tv_usec
/
1000
;
}
//@return timestamp in microsecond
static
FORCE_INLINE
int64_t
taosGetTimestampUs
()
{
struct
timeval
systemTime
;
gettimeofday
(
&
systemTime
,
NULL
);
return
(
int64_t
)
systemTime
.
tv_sec
*
1000000L
+
(
u
int64_t
)
systemTime
.
tv_usec
;
return
(
int64_t
)
systemTime
.
tv_sec
*
1000000L
+
(
int64_t
)
systemTime
.
tv_usec
;
}
/*
...
...
src/os/inc/osWindows.h
浏览文件 @
8b146842
...
...
@@ -43,6 +43,7 @@
#include "msvcProcess.h"
#include "msvcDirect.h"
#include "msvcFcntl.h"
#include "msvcLibgen.h"
#include "msvcStdio.h"
#include "sys/msvcStat.h"
#include "sys/msvcTypes.h"
...
...
src/os/src/windows/wSysinfo.c
浏览文件 @
8b146842
...
...
@@ -31,7 +31,10 @@
#pragma comment(lib, "Mswsock.lib ")
#endif
#pragma warning(push)
#pragma warning(disable:4091)
#include <DbgHelp.h>
#pragma warning(pop)
static
void
taosGetSystemTimezone
()
{
// get and set default timezone
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录