Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e56abac7
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看板
提交
e56abac7
编写于
2月 20, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change
上级
0f9ad76f
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
1005 addition
and
18 deletion
+1005
-18
src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractDatabaseMetaData.java
...main/java/com/taosdata/jdbc/AbstractDatabaseMetaData.java
+1
-3
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
...ctor/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
+7
-7
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java
...in/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java
+13
-8
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaDataTest.java
...ava/com/taosdata/jdbc/rs/RestfulDatabaseMetaDataTest.java
+984
-0
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/AbstractDatabaseMetaData.java
浏览文件 @
e56abac7
...
...
@@ -981,9 +981,7 @@ public abstract class AbstractDatabaseMetaData implements DatabaseMetaData, Wrap
return
getEmptyResultSet
();
}
public
Connection
getConnection
()
throws
SQLException
{
return
null
;
}
public
abstract
Connection
getConnection
()
throws
SQLException
;
public
boolean
supportsSavepoints
()
throws
SQLException
{
return
false
;
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
浏览文件 @
e56abac7
...
...
@@ -90,7 +90,7 @@ public class TSDBDriver extends AbstractDriver {
* fetch data from native function in a batch model
*/
public
static
final
String
PROPERTY_KEY_BATCH_LOAD
=
"batchfetch"
;
private
TSDBDatabaseMetaData
dbMetaData
=
null
;
static
{
...
...
@@ -179,18 +179,18 @@ public class TSDBDriver extends AbstractDriver {
while
(
queryParams
.
hasMoreElements
())
{
String
oneToken
=
queryParams
.
nextToken
();
String
[]
pair
=
oneToken
.
split
(
"="
);
if
((
pair
[
0
]
!=
null
&&
pair
[
0
].
trim
().
length
()
>
0
)
&&
(
pair
[
1
]
!=
null
&&
pair
[
1
].
trim
().
length
()
>
0
))
{
urlProps
.
setProperty
(
pair
[
0
].
trim
(),
pair
[
1
].
trim
());
}
}
}
// parse Product Name
String
dbProductName
=
url
.
substring
(
0
,
beginningOfSlashes
);
dbProductName
=
dbProductName
.
substring
(
dbProductName
.
indexOf
(
":"
)
+
1
);
dbProductName
=
dbProductName
.
substring
(
0
,
dbProductName
.
indexOf
(
":"
));
// parse database name
url
=
url
.
substring
(
beginningOfSlashes
+
2
);
int
indexOfSlash
=
url
.
indexOf
(
"/"
);
...
...
@@ -200,7 +200,7 @@ public class TSDBDriver extends AbstractDriver {
}
url
=
url
.
substring
(
0
,
indexOfSlash
);
}
// parse port
int
indexOfColon
=
url
.
indexOf
(
":"
);
if
(
indexOfColon
!=
-
1
)
{
...
...
@@ -209,11 +209,11 @@ public class TSDBDriver extends AbstractDriver {
}
url
=
url
.
substring
(
0
,
indexOfColon
);
}
if
(
url
!=
null
&&
url
.
length
()
>
0
&&
url
.
trim
().
length
()
>
0
)
{
urlProps
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_HOST
,
url
);
}
this
.
dbMetaData
=
new
TSDBDatabaseMetaData
(
urlForMeta
,
urlProps
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
));
return
urlProps
;
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java
浏览文件 @
e56abac7
package
com.taosdata.jdbc.rs
;
import
com.taosdata.jdbc.AbstractDatabaseMetaData
;
import
com.taosdata.jdbc.TSDBConstants
;
import
com.taosdata.jdbc.TSDBError
;
import
com.taosdata.jdbc.TSDBErrorNumbers
;
import
java.sql.Connection
;
import
java.sql.ResultSet
;
...
...
@@ -34,11 +35,10 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData {
return
RestfulDriver
.
class
.
getName
();
}
@Override
public
ResultSet
getTables
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
[]
types
)
throws
SQLException
{
if
(
connection
==
null
||
connection
.
isClosed
())
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
)
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
}
return
super
.
getTables
(
catalog
,
schemaPattern
,
tableNamePattern
,
types
,
connection
);
}
...
...
@@ -46,14 +46,14 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData {
@Override
public
ResultSet
getCatalogs
()
throws
SQLException
{
if
(
connection
==
null
||
connection
.
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
)
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
return
super
.
getCatalogs
(
connection
);
}
@Override
public
ResultSet
getTableTypes
()
throws
SQLException
{
if
(
connection
==
null
||
connection
.
isClosed
())
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
)
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
}
return
super
.
getTableTypes
();
}
...
...
@@ -61,21 +61,26 @@ public class RestfulDatabaseMetaData extends AbstractDatabaseMetaData {
@Override
public
ResultSet
getColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
if
(
connection
==
null
||
connection
.
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
)
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
return
super
.
getColumns
(
catalog
,
schemaPattern
,
tableNamePattern
,
columnNamePattern
,
connection
);
}
@Override
public
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
if
(
connection
==
null
||
connection
.
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
)
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
return
super
.
getPrimaryKeys
(
catalog
,
schema
,
table
,
connection
);
}
@Override
public
Connection
getConnection
()
throws
SQLException
{
return
this
.
connection
;
}
@Override
public
ResultSet
getSuperTables
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
)
throws
SQLException
{
if
(
connection
==
null
||
connection
.
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
)
);
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_CONNECTION_CLOSED
);
return
super
.
getSuperTables
(
catalog
,
schemaPattern
,
tableNamePattern
,
connection
);
}
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaDataTest.java
0 → 100644
浏览文件 @
e56abac7
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录