Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
1eec11e9
T
TDengine
项目概览
慢慢CG
/
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看板
提交
1eec11e9
编写于
10月 27, 2020
作者:
F
freemine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
first version of runnable win odbc driver
上级
9be73e7b
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
123 addition
and
62 deletion
+123
-62
src/connector/odbc/CMakeLists.txt
src/connector/odbc/CMakeLists.txt
+8
-0
src/connector/odbc/src/CMakeLists.txt
src/connector/odbc/src/CMakeLists.txt
+16
-8
src/connector/odbc/src/todbc.c
src/connector/odbc/src/todbc.c
+4
-6
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
+0
-3
src/connector/odbc/src/todbc_conv.h
src/connector/odbc/src/todbc_conv.h
+3
-4
src/connector/odbc/src/todbc_flex.h
src/connector/odbc/src/todbc_flex.h
+4
-12
src/connector/odbc/src/todbc_log.h
src/connector/odbc/src/todbc_log.h
+1
-7
src/connector/odbc/src/todbc_scanner.l
src/connector/odbc/src/todbc_scanner.l
+2
-4
src/connector/odbc/src/todbc_util.c
src/connector/odbc/src/todbc_util.c
+3
-4
src/connector/odbc/src/todbc_util.h
src/connector/odbc/src/todbc_util.h
+3
-4
src/connector/odbc/tests/CMakeLists.txt
src/connector/odbc/tests/CMakeLists.txt
+1
-1
src/connector/odbc/tests/main.c
src/connector/odbc/tests/main.c
+13
-9
src/os/inc/osWindows.h
src/os/inc/osWindows.h
+1
-0
未找到文件。
src/connector/odbc/CMakeLists.txt
浏览文件 @
1eec11e9
...
...
@@ -29,6 +29,14 @@ IF (TD_LINUX_64)
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"
)
...
...
src/connector/odbc/src/CMakeLists.txt
浏览文件 @
1eec11e9
...
...
@@ -16,8 +16,7 @@ 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
()
...
...
@@ -32,11 +31,20 @@ IF (TD_WINDOWS_64)
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
# generate dynamic library (*.so)
ADD_LIBRARY
(
todbc SHARED
${
SRC
}
${
todbc_flex_scanner_src
}
)
SET_TARGET_PROPERTIES
(
todbc PROPERTIES CLEAN_DIRECT_OUTPUT 1
)
SET_TARGET_PROPERTIES
(
todbc PROPERTIES VERSION
${
TD_VER_NUMBER
}
SOVERSION 1
)
# 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_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
浏览文件 @
1eec11e9
...
...
@@ -17,19 +17,17 @@
#define _XOPEN_SOURCE
#define _DEFAULT_SOURCE
#include "todbc_log.h"
#include "todbc_flex.h"
#include "taos.h"
#include "os.h"
#include "taoserror.h"
#include "todbc_util.h"
#include "todbc_conv.h"
#include <sql.h>
#include <sqlext.h>
#include <time.h>
#define GET_REF(obj) atomic_load_64(&obj->refcount)
#define INC_REF(obj) atomic_add_fetch_64(&obj->refcount, 1)
#define DEC_REF(obj) atomic_sub_fetch_64(&obj->refcount, 1)
...
...
@@ -1919,7 +1917,7 @@ static SQLRETURN doSQLGetDiagField(SQLSMALLINT HandleType, SQLHANDLE Handle,
SQLSMALLINT
*
StringLength
)
{
// if this function is not exported, isql will never call SQLGetDiagRec
return
SQL_
ERROR
;
return
SQL_
SUCCESS
;
}
SQLRETURN
SQL_API
SQLGetDiagField
(
SQLSMALLINT
HandleType
,
SQLHANDLE
Handle
,
...
...
src/connector/odbc/src/todbc.def
0 → 100644
浏览文件 @
1eec11e9
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
浏览文件 @
1eec11e9
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
浏览文件 @
1eec11e9
INSTALLDRIVER "TAOS ODBC|Driver=todbc.dll|FileUsage=0|ConnectFunctions=YYN"
src/connector/odbc/src/todbc_conv.c
浏览文件 @
1eec11e9
...
...
@@ -14,9 +14,6 @@
*/
#include "todbc_conv.h"
#include "todbc_util.h"
#include "os.h"
#include <errno.h>
#include <limits.h>
...
...
src/connector/odbc/src/todbc_conv.h
浏览文件 @
1eec11e9
...
...
@@ -16,10 +16,9 @@
#ifndef _todbc_conv_h_
#define _todbc_conv_h_
#include "todbc_flex_workaround.h"
#include <stddef.h>
#include "iconv.h"
#include "os.h"
#include <iconv.h>
#include <sql.h>
typedef
enum
{
...
...
src/connector/odbc/src/todbc_flex
_workaround
.h
→
src/connector/odbc/src/todbc_flex.h
浏览文件 @
1eec11e9
...
...
@@ -13,18 +13,10 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _
todbc_flex_workaround_h
_
#define _
todbc_flex_workaround_h
_
#ifndef _
TODBC_FLEX_H
_
#define _
TODBC_FLEX_H
_
#ifdef _MSC_VER
#include <winsock2.h>
#include <windows.h>
#endif
#ifndef INT8_MIN
#include <stdint.h>
#endif
#include <sql.h>
#include <sqlext.h>
int
todbc_parse_conn_string
(
const
char
*
conn
,
char
**
dsn
,
char
**
uid
,
char
**
pwd
,
char
**
host
);
#endif // _
todbc_flex_workaround_h
_
#endif // _
TODBC_FLEX_H
_
src/connector/odbc/src/todbc_log.h
浏览文件 @
1eec11e9
...
...
@@ -16,13 +16,7 @@
#ifndef _todbc_log_h_
#define _todbc_log_h_
#ifdef _MSC_VER
#include "msvcLibgen.h"
#else
#include <libgen.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "os.h"
#define D(fmt, ...) \
fprintf(stderr, \
...
...
src/connector/odbc/src/todbc_scanner.l
浏览文件 @
1eec11e9
%{
#include "todbc_util.h"
#include "todbc_flex.h"
#include <stdio.h>
#ifdef _MSC_VER
...
...
@@ -105,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
浏览文件 @
1eec11e9
...
...
@@ -14,11 +14,10 @@
*/
#include "todbc_util.h"
#include "todbc_log.h"
#include <iconv.h>
#include <sqlext.h>
#include "iconv.h"
#include <stdlib.h>
#include <string.h>
const
char
*
sql_sql_type
(
int
type
)
{
switch
(
type
)
{
...
...
src/connector/odbc/src/todbc_util.h
浏览文件 @
1eec11e9
...
...
@@ -16,9 +16,10 @@
#ifndef _TODBC_UTIL_H_
#define _TODBC_UTIL_H_
#include "todbc_flex_workaround.h"
#include "todbc_log.h"
#include "os.h"
#include <sql.h>
#include <sqltypes.h>
const
char
*
sql_sql_type
(
int
type
);
const
char
*
sql_c_type
(
int
type
);
...
...
@@ -26,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
浏览文件 @
1eec11e9
...
...
@@ -9,5 +9,5 @@ ENDIF ()
IF
(
TD_WINDOWS_64
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
tcodbc main.c
)
# TARGET_LINK_LIBRARIES(tcodbc odbc
)
TARGET_LINK_LIBRARIES
(
tcodbc odbc32 os
)
ENDIF
()
src/connector/odbc/tests/main.c
浏览文件 @
1eec11e9
#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); \
...
...
@@ -425,7 +424,7 @@ int test_sqls_in_stmt(SQLHENV env, SQLHDBC conn, SQLHSTMT stmt, const char *sqls
ssize_t
n
=
0
;
#ifdef _MSC_VER
n
=
taosGetline
Imp
(
&
line
,
&
len
,
f
);
n
=
taosGetline
(
&
line
,
&
len
,
f
);
#else
n
=
getline
(
&
line
,
&
len
,
f
);
#endif
...
...
@@ -503,7 +502,12 @@ int main(int argc, char *argv[]) {
const
char
*
connstr
=
(
argc
>
4
)
?
argv
[
4
]
:
NULL
;
const
char
*
sqls
=
(
argc
>
5
)
?
argv
[
5
]
:
NULL
;
if
(
1
)
{
dsn
=
NULL
;
uid
=
NULL
;
pwd
=
NULL
;
connstr
=
argv
[
1
];
sqls
=
argv
[
2
];
if
(
0
)
{
CHK_TEST
(
test_env
());
CHK_TEST
(
test1
(
dsn
,
uid
,
pwd
));
...
...
src/os/inc/osWindows.h
浏览文件 @
1eec11e9
...
...
@@ -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"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录