Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
bc2275d8
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看板
提交
bc2275d8
编写于
1月 17, 2021
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change
上级
4292121d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
82 addition
and
6 deletion
+82
-6
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
...src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
+80
-4
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
...src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
+2
-2
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
浏览文件 @
bc2275d8
...
@@ -551,16 +551,91 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
...
@@ -551,16 +551,91 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
return
null
;
return
null
;
ResultSet
databases
=
stmt
.
executeQuery
(
"show databases"
);
ResultSet
databases
=
stmt
.
executeQuery
(
"show databases"
);
String
dbname
=
null
;
while
(
databases
.
next
())
{
while
(
databases
.
next
())
{
String
dbname
=
databases
.
getString
(
"name"
);
dbname
=
databases
.
getString
(
"name"
);
if
(
dbname
.
equalsIgnoreCase
(
catalog
))
break
;
}
}
databases
.
close
();
databases
.
close
();
if
(
dbname
==
null
)
return
null
;
stmt
.
execute
(
"use "
+
catalog
);
stmt
.
execute
(
"use "
+
dbname
);
ResultSet
resultSet0
=
stmt
.
executeQuery
(
"show tables"
);
DatabaseMetaDataResultSet
resultSet
=
new
DatabaseMetaDataResultSet
();
DatabaseMetaDataResultSet
resultSet
=
new
DatabaseMetaDataResultSet
();
List
<
ColumnMetaData
>
columnMetaDataList
=
new
ArrayList
<>();
ColumnMetaData
col1
=
new
ColumnMetaData
();
col1
.
setColIndex
(
1
);
col1
.
setColName
(
"TABLE_CAT"
);
col1
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col1
);
ColumnMetaData
col2
=
new
ColumnMetaData
();
col2
.
setColIndex
(
2
);
col2
.
setColName
(
"TABLE_SCHEM"
);
col2
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col2
);
ColumnMetaData
col3
=
new
ColumnMetaData
();
col3
.
setColIndex
(
3
);
col3
.
setColName
(
"TABLE_NAME"
);
col3
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col3
);
ColumnMetaData
col4
=
new
ColumnMetaData
();
col4
.
setColIndex
(
4
);
col4
.
setColName
(
"TABLE_TYPE"
);
col4
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col4
);
ColumnMetaData
col5
=
new
ColumnMetaData
();
col5
.
setColIndex
(
5
);
col5
.
setColName
(
"REMARKS"
);
col5
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col5
);
ColumnMetaData
col6
=
new
ColumnMetaData
();
col6
.
setColIndex
(
6
);
col6
.
setColName
(
"TYPE_CAT"
);
col6
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col6
);
ColumnMetaData
col7
=
new
ColumnMetaData
();
col7
.
setColIndex
(
7
);
col7
.
setColName
(
"TYPE_SCHEM"
);
col7
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col7
);
ColumnMetaData
col8
=
new
ColumnMetaData
();
col8
.
setColIndex
(
8
);
col8
.
setColName
(
"TYPE_NAME"
);
col8
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col8
);
ColumnMetaData
col9
=
new
ColumnMetaData
();
col9
.
setColIndex
(
9
);
col9
.
setColName
(
"SELF_REFERENCING_COL_NAME"
);
col9
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col9
);
ColumnMetaData
col10
=
new
ColumnMetaData
();
col10
.
setColIndex
(
10
);
col10
.
setColName
(
"REF_GENERATION"
);
col10
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_NCHAR
);
columnMetaDataList
.
add
(
col10
);
resultSet
.
setColumnMetaDataList
(
columnMetaDataList
);
List
<
TSDBResultSetRowData
>
rowDataList
=
new
ArrayList
<>();
ResultSet
tables
=
stmt
.
executeQuery
(
"show tables"
);
while
(
tables
.
next
())
{
TSDBResultSetRowData
rowData
=
new
TSDBResultSetRowData
(
10
);
rowData
.
setString
(
3
,
tables
.
getString
(
"name"
));
rowData
.
setString
(
4
,
"TABLE"
);
rowData
.
setString
(
5
,
""
);
rowDataList
.
add
(
rowData
);
}
ResultSet
stables
=
stmt
.
executeQuery
(
"show stables"
);
while
(
stables
.
next
())
{
TSDBResultSetRowData
rowData
=
new
TSDBResultSetRowData
(
10
);
rowData
.
setString
(
3
,
tables
.
getString
(
"name"
));
rowData
.
setString
(
4
,
"TABLE"
);
rowData
.
setString
(
5
,
"STABLE"
);
rowDataList
.
add
(
rowData
);
}
resultSet
.
setRowDataList
(
rowDataList
);
return
resultSet
;
return
resultSet
;
}
}
}
}
...
@@ -606,6 +681,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
...
@@ -606,6 +681,7 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
}
}
public
ResultSet
getColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
public
ResultSet
getColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
// add by zyyang-taosdata
Statement
stmt
;
Statement
stmt
;
if
(
null
!=
conn
&&
!
conn
.
isClosed
())
{
if
(
null
!=
conn
&&
!
conn
.
isClosed
())
{
stmt
=
conn
.
createStatement
();
stmt
=
conn
.
createStatement
();
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
浏览文件 @
bc2275d8
...
@@ -28,7 +28,7 @@ public class TSDBResultSetRowData {
...
@@ -28,7 +28,7 @@ public class TSDBResultSetRowData {
}
}
public
TSDBResultSetRowData
()
{
public
TSDBResultSetRowData
()
{
this
.
data
=
new
ArrayList
<
Object
>();
this
.
data
=
new
ArrayList
<>();
this
.
setColSize
(
0
);
this
.
setColSize
(
0
);
}
}
...
@@ -39,7 +39,7 @@ public class TSDBResultSetRowData {
...
@@ -39,7 +39,7 @@ public class TSDBResultSetRowData {
if
(
this
.
colSize
==
0
)
{
if
(
this
.
colSize
==
0
)
{
return
;
return
;
}
}
this
.
data
=
new
ArrayList
<
Object
>(
colSize
);
this
.
data
=
new
ArrayList
<>(
colSize
);
this
.
data
.
addAll
(
Collections
.
nCopies
(
this
.
colSize
,
null
));
this
.
data
.
addAll
(
Collections
.
nCopies
(
this
.
colSize
,
null
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录