Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
10b1d910
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看板
提交
10b1d910
编写于
1月 17, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-2776]<feature>: add stable infos in getTables method
上级
20d02799
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
25 deletion
+24
-25
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
...src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
+19
-15
src/connector/jdbc/src/test/java/com/taosdata/jdbc/StatementTest.java
...r/jdbc/src/test/java/com/taosdata/jdbc/StatementTest.java
+2
-7
tests/examples/JDBC/taosdemo/pom.xml
tests/examples/JDBC/taosdemo/pom.xml
+3
-3
tests/examples/JDBC/taosdemo/src/main/resources/lib/taos-jdbcdriver-2.0.15-dist.jar
...mo/src/main/resources/lib/taos-jdbcdriver-2.0.15-dist.jar
+0
-0
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
浏览文件 @
10b1d910
...
...
@@ -535,6 +535,12 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
return
null
;
}
/**
* @Param catalog : database名称,"" 表示不属于任何database的table,null表示不使用database来缩小范围
* @Param schemaPattern : schema名称,""表示
* @Param tableNamePattern : 表名满足tableNamePattern的表, null表示返回所有表
* @Param types : 表类型,null表示返回所有类型
*/
public
ResultSet
getTables
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
[]
types
)
throws
SQLException
{
if
(
conn
==
null
||
conn
.
isClosed
())
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
...
...
@@ -544,10 +550,18 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
if
(
catalog
==
null
||
catalog
.
isEmpty
())
return
null
;
stmt
.
executeUpdate
(
"use "
+
catalog
);
ResultSet
databases
=
stmt
.
executeQuery
(
"show databases"
);
while
(
databases
.
next
())
{
String
dbname
=
databases
.
getString
(
"name"
);
}
databases
.
close
();
stmt
.
execute
(
"use "
+
catalog
);
ResultSet
resultSet0
=
stmt
.
executeQuery
(
"show tables"
);
GetTablesResultSet
getTablesResultSet
=
new
GetTablesResultSet
(
resultSet0
,
catalog
,
schemaPattern
,
tableNamePattern
,
types
);
return
getTablesResultSet
;
DatabaseMetaDataResultSet
resultSet
=
new
DatabaseMetaDataResultSet
();
return
resultSet
;
}
}
...
...
@@ -591,11 +605,8 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
return
resultSet
;
}
public
ResultSet
getColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
/** add by zyyang **********/
Statement
stmt
=
null
;
public
ResultSet
getColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
Statement
stmt
;
if
(
null
!=
conn
&&
!
conn
.
isClosed
())
{
stmt
=
conn
.
createStatement
();
if
(
catalog
==
null
||
catalog
.
isEmpty
())
...
...
@@ -691,17 +702,10 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
}
resultSet
.
setRowDataList
(
rowDataList
);
// GetColumnsResultSet getColumnsResultSet = new GetColumnsResultSet(resultSet0, catalog, schemaPattern, tableNamePattern, columnNamePattern);
// return getColumnsResultSet;
// DatabaseMetaDataResultSet resultSet = new DatabaseMetaDataResultSet();
return
resultSet
;
}
else
{
throw
new
SQLException
(
TSDBConstants
.
FixErrMsg
(
TSDBConstants
.
JNI_CONNECTION_NULL
));
}
/*************************/
// return getEmptyResultSet();
}
private
int
getNullable
(
int
index
,
String
typeName
)
{
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/StatementTest.java
浏览文件 @
10b1d910
...
...
@@ -10,7 +10,7 @@ import java.util.Properties;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertTrue
;
public
class
StatementTest
extends
BaseTest
{
public
class
StatementTest
{
static
Connection
connection
=
null
;
static
Statement
statement
=
null
;
static
String
dbName
=
"test"
;
...
...
@@ -26,15 +26,13 @@ public class StatementTest extends BaseTest {
return
;
}
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_HOST
,
host
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_CHARSET
,
"UTF-8"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_LOCALE
,
"en_US.UTF-8"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_TIME_ZONE
,
"UTC-8"
);
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS://"
+
host
+
":0/"
,
properties
);
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS://"
+
host
+
":0/
?user=root&password=taosdata
"
,
properties
);
statement
=
connection
.
createStatement
();
statement
.
executeUpdate
(
"drop database if exists "
+
dbName
);
}
@Test
...
...
@@ -54,9 +52,6 @@ public class StatementTest extends BaseTest {
@Test
public
void
testUnsupport
()
{
// if(null == resSet) {
// return;
// }
TSDBStatement
tsdbStatement
=
(
TSDBStatement
)
statement
;
try
{
tsdbStatement
.
unwrap
(
null
);
...
...
tests/examples/JDBC/taosdemo/pom.xml
浏览文件 @
10b1d910
...
...
@@ -67,9 +67,9 @@
<dependency>
<groupId>
com.taosdata.jdbc
</groupId>
<artifactId>
taos-jdbcdriver
</artifactId>
<version>
2.0.1
5
</version>
<scope>
system
</scope
>
<systemPath>
${project.basedir}/src/main/resources/lib/taos-jdbcdriver-2.0.15-dist.jar
</systemPath
>
<version>
2.0.1
6
</version>
<!-- <scope>system</scope>--
>
<!-- <systemPath>${project.basedir}/src/main/resources/lib/taos-jdbcdriver-2.0.15-dist.jar</systemPath>--
>
</dependency>
<!-- fastjson -->
<dependency>
...
...
tests/examples/JDBC/taosdemo/src/main/resources/lib/taos-jdbcdriver-2.0.15-dist.jar
已删除
100644 → 0
浏览文件 @
20d02799
文件已删除
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录