Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
cc496e12
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看板
提交
cc496e12
编写于
10月 28, 2020
作者:
F
freemine
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add todbcinst to help user install/uninstall taos odbc driver
上级
8b146842
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
180 addition
and
6 deletion
+180
-6
cmake/install.inc
cmake/install.inc
+9
-5
src/connector/odbc/CMakeLists.txt
src/connector/odbc/CMakeLists.txt
+2
-0
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
+8
-0
src/connector/odbc/tools/CMakeLists.txt
src/connector/odbc/tools/CMakeLists.txt
+11
-0
src/connector/odbc/tools/main.c
src/connector/odbc/tools/main.c
+149
-0
未找到文件。
cmake/install.inc
浏览文件 @
cc496e12
...
@@ -9,7 +9,7 @@ ELSEIF (TD_WINDOWS)
...
@@ -9,7 +9,7 @@ ELSEIF (TD_WINDOWS)
ELSE
()
ELSE
()
SET
(
CMAKE_INSTALL_PREFIX
C
:/
TDengine
)
SET
(
CMAKE_INSTALL_PREFIX
C
:/
TDengine
)
ENDIF
()
ENDIF
()
INSTALL
(
DIRECTORY
$
{
TD_COMMUNITY_DIR
}
/
src
/
connector
/
go
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_COMMUNITY_DIR
}
/
src
/
connector
/
go
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_COMMUNITY_DIR
}
/
src
/
connector
/
nodejs
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_COMMUNITY_DIR
}
/
src
/
connector
/
nodejs
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_COMMUNITY_DIR
}
/
src
/
connector
/
python
DESTINATION
connector
)
INSTALL
(
DIRECTORY
$
{
TD_COMMUNITY_DIR
}
/
src
/
connector
/
python
DESTINATION
connector
)
...
@@ -19,13 +19,17 @@ ELSEIF (TD_WINDOWS)
...
@@ -19,13 +19,17 @@ ELSEIF (TD_WINDOWS)
INSTALL
(
FILES
$
{
TD_COMMUNITY_DIR
}
/
src
/
inc
/
taoserror
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
TD_COMMUNITY_DIR
}
/
src
/
inc
/
taoserror
.
h
DESTINATION
include
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
exp
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
exp
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
dll
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
taos
.
dll
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
todbc
.
lib
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
todbc
.
exp
DESTINATION
driver
)
INSTALL
(
FILES
$
{
LIBRARY_OUTPUT_PATH
}
/
todbc
.
dll
DESTINATION
driver
)
IF
(
TD_POWER
)
IF
(
TD_POWER
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
power
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
power
.
exe
DESTINATION
.
)
ELSE
()
ELSE
()
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taos
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taos
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taosdemo
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
taosdemo
.
exe
DESTINATION
.
)
INSTALL
(
FILES
$
{
EXECUTABLE_OUTPUT_PATH
}
/
todbcinst
.
exe
DESTINATION
.
)
ENDIF
()
ENDIF
()
#INSTALL(TARGETS taos RUNTIME DESTINATION driver)
#INSTALL(TARGETS taos RUNTIME DESTINATION driver)
...
...
src/connector/odbc/CMakeLists.txt
浏览文件 @
cc496e12
...
@@ -20,6 +20,7 @@ IF (TD_LINUX_64)
...
@@ -20,6 +20,7 @@ IF (TD_LINUX_64)
SET
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS_DEBUG
}
-Wconversion"
)
SET
(
CMAKE_C_FLAGS_DEBUG
"
${
CMAKE_C_FLAGS_DEBUG
}
-Wconversion"
)
SET
(
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS_RELEASE
}
-Wconversion"
)
SET
(
CMAKE_C_FLAGS_RELEASE
"
${
CMAKE_C_FLAGS_RELEASE
}
-Wconversion"
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
tools
)
ADD_SUBDIRECTORY
(
tests
)
ADD_SUBDIRECTORY
(
tests
)
endif
()
endif
()
endif
()
endif
()
...
@@ -42,6 +43,7 @@ IF (TD_WINDOWS_64)
...
@@ -42,6 +43,7 @@ IF (TD_WINDOWS_64)
message
(
FATAL_ERROR
"you need to install flex first"
)
message
(
FATAL_ERROR
"you need to install flex first"
)
else
()
else
()
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
src
)
ADD_SUBDIRECTORY
(
tools
)
ADD_SUBDIRECTORY
(
tests
)
ADD_SUBDIRECTORY
(
tests
)
endif
()
endif
()
ENDIF
()
ENDIF
()
src/connector/odbc/tests/CMakeLists.txt
浏览文件 @
cc496e12
...
@@ -9,5 +9,5 @@ ENDIF ()
...
@@ -9,5 +9,5 @@ ENDIF ()
IF
(
TD_WINDOWS_64
)
IF
(
TD_WINDOWS_64
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
AUX_SOURCE_DIRECTORY
(
. SRC
)
ADD_EXECUTABLE
(
tcodbc main.c
)
ADD_EXECUTABLE
(
tcodbc main.c
)
TARGET_LINK_LIBRARIES
(
tcodbc odbc32 os
)
TARGET_LINK_LIBRARIES
(
tcodbc odbc32 o
dbccp32 user32 legacy_stdio_definitions o
s
)
ENDIF
()
ENDIF
()
src/connector/odbc/tests/main.c
浏览文件 @
cc496e12
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
#endif
#endif
#include <sql.h>
#include <sql.h>
#include <sqlext.h>
#include <sqlext.h>
#include <odbcinst.h>
#include <stdio.h>
#include <stdio.h>
#include <string.h>
#include <string.h>
...
@@ -496,6 +497,13 @@ int main(int argc, char *argv[]) {
...
@@ -496,6 +497,13 @@ int main(int argc, char *argv[]) {
return
0
;
return
0
;
}
}
if
(
argc
==
2
&&
strcmp
(
argv
[
1
],
"uninstall"
)
==
0
)
{
DWORD
usage
=
0
;
BOOL
ok
=
SQLRemoveDriver
(
"TAOS ODBC"
,
TRUE
,
&
usage
);
D
(
"ok/usage: %d/%d"
,
ok
,
usage
);
return
ok
?
0
:
1
;
}
const
char
*
dsn
=
(
argc
>
1
)
?
argv
[
1
]
:
NULL
;
const
char
*
dsn
=
(
argc
>
1
)
?
argv
[
1
]
:
NULL
;
const
char
*
uid
=
(
argc
>
2
)
?
argv
[
2
]
:
NULL
;
const
char
*
uid
=
(
argc
>
2
)
?
argv
[
2
]
:
NULL
;
const
char
*
pwd
=
(
argc
>
3
)
?
argv
[
3
]
:
NULL
;
const
char
*
pwd
=
(
argc
>
3
)
?
argv
[
3
]
:
NULL
;
...
...
src/connector/odbc/tools/CMakeLists.txt
0 → 100644
浏览文件 @
cc496e12
PROJECT
(
TDengine
)
IF
(
TD_LINUX
)
ADD_EXECUTABLE
(
todbcinst main.c
)
TARGET_LINK_LIBRARIES
(
todbcinst odbc
)
ENDIF
()
IF
(
TD_WINDOWS_64
)
ADD_EXECUTABLE
(
todbcinst main.c
)
TARGET_LINK_LIBRARIES
(
todbcinst odbc32 odbccp32 user32 legacy_stdio_definitions os
)
ENDIF
()
src/connector/odbc/tools/main.c
0 → 100644
浏览文件 @
cc496e12
#include "../src/todbc_log.h"
#ifdef _MSC_VER
#include <winsock2.h>
#include <windows.h>
#include "os.h"
#endif
#include <odbcinst.h>
#include <stdio.h>
#include <string.h>
static
void
usage
(
const
char
*
arg0
);
static
int
do_install
(
int
i
,
int
argc
,
char
*
argv
[]);
static
int
do_uninstall
(
int
i
,
int
argc
,
char
*
argv
[]);
int
main
(
int
argc
,
char
*
argv
[])
{
for
(
int
i
=
1
;
i
<
argc
;
i
++
)
{
const
char
*
arg
=
argv
[
i
];
if
(
strcmp
(
arg
,
"-h"
)
==
0
)
{
usage
(
argv
[
0
]);
return
0
;
}
else
if
(
strcmp
(
arg
,
"-i"
)
==
0
)
{
i
=
do_install
(
i
+
1
,
argc
,
argv
);
if
(
i
>
0
)
continue
;
return
i
==
0
?
0
:
1
;
}
else
if
(
strcmp
(
arg
,
"-u"
)
==
0
)
{
i
=
do_uninstall
(
i
+
1
,
argc
,
argv
);
if
(
i
>
0
)
continue
;
return
i
==
0
?
0
:
1
;
}
else
{
fprintf
(
stderr
,
"unknown argument: [%s]
\n
"
,
arg
);
return
1
;
}
}
}
static
void
usage
(
const
char
*
arg0
)
{
fprintf
(
stderr
,
"%s -h | -i -n [TaosDriverName] -p [TaosDriverPath] | -u [-f] [TaosDriverName]
\n
"
,
arg0
);
return
;
}
static
int
do_install
(
int
i
,
int
argc
,
char
*
argv
[])
{
int
forceful
=
0
;
const
char
*
driverName
=
NULL
;
const
char
*
driverFile
=
"todbc.dll"
;
const
char
*
driverPath
=
NULL
;
for
(;
i
<
argc
;
++
i
)
{
const
char
*
arg
=
argv
[
i
];
if
(
strcmp
(
arg
,
"-n"
)
==
0
)
{
i
+=
1
;
if
(
i
>=
argc
)
{
fprintf
(
stderr
,
"expecting TaosDriverName, but got nothing
\n
"
);
return
-
1
;
}
arg
=
argv
[
i
];
if
(
strstr
(
arg
,
"TAOS"
)
!=
arg
)
{
fprintf
(
stderr
,
"TaosDriverName shall begin with 'TAOS': [%s]
\n
"
,
arg
);
return
-
1
;
}
driverName
=
arg
;
}
else
if
(
strcmp
(
arg
,
"-p"
)
==
0
)
{
i
+=
1
;
if
(
i
>=
argc
)
{
fprintf
(
stderr
,
"expecting TaosDriverPath, but got nothing
\n
"
);
return
-
1
;
}
driverPath
=
argv
[
i
];
}
else
{
fprintf
(
stderr
,
"unknown argument: [%s]
\n
"
,
arg
);
return
-
1
;
}
}
if
(
!
driverName
)
{
fprintf
(
stderr
,
"TaosDriverName not specified
\n
"
);
return
-
1
;
}
if
(
!
driverPath
)
{
fprintf
(
stderr
,
"TaosDriverPath not specified
\n
"
);
return
-
1
;
}
char
buf
[
8192
];
snprintf
(
buf
,
sizeof
(
buf
),
"%s%cDriver=%s%cFileUage=0%cConnectFunctions=YYN%c"
,
driverName
,
0
,
driverFile
,
0
,
0
,
0
);
BOOL
ok
=
TRUE
;
DWORD
usageCount
=
1
;
char
installed
[
PATH_MAX
+
1
];
WORD
len
=
0
;
ok
=
SQLInstallDriverEx
(
buf
,
driverPath
,
installed
,
sizeof
(
installed
),
&
len
,
ODBC_INSTALL_INQUIRY
,
&
usageCount
);
if
(
!
ok
)
{
fprintf
(
stderr
,
"failed to query TaosDriverName: [%s]
\n
"
,
driverName
);
return
-
1
;
}
if
(
stricmp
(
driverPath
,
installed
))
{
fprintf
(
stderr
,
"previously installed TaosDriver [%s] has different target path [%s]
\n
"
"it shall be uninstalled before you can install it to different path [%s]
\n
"
,
driverName
,
installed
,
driverPath
);
return
-
1
;
}
ok
=
SQLInstallDriverEx
(
buf
,
driverPath
,
installed
,
sizeof
(
installed
),
&
len
,
ODBC_INSTALL_COMPLETE
,
&
usageCount
);
if
(
!
ok
)
{
fprintf
(
stderr
,
"failed to install TaosDriverName: [%s][%s]
\n
"
,
driverName
,
driverPath
);
return
-
1
;
}
return
argc
;
}
static
int
do_uninstall
(
int
i
,
int
argc
,
char
*
argv
[])
{
int
forceful
=
0
;
const
char
*
driverName
=
NULL
;
for
(;
i
<
argc
;
++
i
)
{
const
char
*
arg
=
argv
[
i
];
if
(
strcmp
(
arg
,
"-f"
)
==
0
)
{
forceful
=
1
;
}
else
if
(
strcmp
(
arg
,
"-n"
)
==
0
)
{
i
+=
1
;
if
(
i
>=
argc
)
{
fprintf
(
stderr
,
"expecting TaosDriverName, but got nothing
\n
"
);
return
-
1
;
}
arg
=
argv
[
i
];
if
(
strstr
(
arg
,
"TAOS"
)
!=
arg
)
{
fprintf
(
stderr
,
"TaosDriverName shall begin with 'TAOS': [%s]
\n
"
,
arg
);
return
-
1
;
}
driverName
=
arg
;
}
else
{
fprintf
(
stderr
,
"unknown argument: [%s]
\n
"
,
arg
);
return
-
1
;
}
}
if
(
!
driverName
)
{
fprintf
(
stderr
,
"TaosDriverName not specified
\n
"
);
return
-
1
;
}
BOOL
ok
=
TRUE
;
DWORD
usageCount
=
1
;
do
{
ok
=
SQLRemoveDriver
(
driverName
,
FALSE
,
&
usageCount
);
if
(
!
ok
)
{
fprintf
(
stderr
,
"failed to remove driver [%s]
\n
"
,
driverName
);
return
-
1
;
}
if
(
!
forceful
)
return
argc
;
}
while
(
usageCount
>
0
);
return
argc
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录