Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
4d554b67
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看板
提交
4d554b67
编写于
9月 29, 2020
作者:
S
Shengliang Guan
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'origin/develop' into feature/os
上级
61e27f7a
50af70aa
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
828 addition
and
653 deletion
+828
-653
src/connector/jdbc/pom.xml
src/connector/jdbc/pom.xml
+1
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/DatabaseMetaDataResultSet.java
...ain/java/com/taosdata/jdbc/DatabaseMetaDataResultSet.java
+17
-7
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
...src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
+810
-646
未找到文件。
src/connector/jdbc/pom.xml
浏览文件 @
4d554b67
...
...
@@ -55,6 +55,7 @@
<version>
4.13
</version>
<scope>
test
</scope>
</dependency>
</dependencies>
<build>
<plugins>
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/DatabaseMetaDataResultSet.java
浏览文件 @
4d554b67
...
...
@@ -67,14 +67,23 @@ public class DatabaseMetaDataResultSet implements ResultSet {
@Override
public
boolean
next
()
throws
SQLException
{
// boolean ret = false;
// if (rowDataList.size() > 0) {
// ret = rowDataList.iterator().hasNext();
// if (ret) {
// rowCursor = rowDataList.iterator().next();
// cursorRowNumber++;
// }
// }
// return ret;
/**** add by zyyang 2020-09-29 ****************/
boolean
ret
=
false
;
if
(
rowDataList
.
size
()
>
0
)
{
ret
=
rowDataList
.
iterator
().
hasNext
();
if
(
ret
)
{
rowCursor
=
rowDataList
.
iterator
().
next
();
cursorRowNumber
++;
}
if
(!
rowDataList
.
isEmpty
()
&&
cursorRowNumber
<
rowDataList
.
size
())
{
rowCursor
=
rowDataList
.
get
(
cursorRowNumber
++);
ret
=
true
;
}
return
ret
;
}
...
...
@@ -91,7 +100,8 @@ public class DatabaseMetaDataResultSet implements ResultSet {
@Override
public
String
getString
(
int
columnIndex
)
throws
SQLException
{
columnIndex
--;
return
rowCursor
.
getString
(
columnIndex
,
columnMetaDataList
.
get
(
columnIndex
).
getColType
());
int
colType
=
columnMetaDataList
.
get
(
columnIndex
).
getColType
();
return
rowCursor
.
getString
(
columnIndex
,
colType
);
}
@Override
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDatabaseMetaData.java
浏览文件 @
4d554b67
...
...
@@ -586,7 +586,171 @@ public class TSDBDatabaseMetaData implements java.sql.DatabaseMetaData {
public
ResultSet
getColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
return
getEmptyResultSet
();
/** add by zyyang **********/
Statement
stmt
=
null
;
if
(
null
!=
conn
&&
!
conn
.
isClosed
())
{
stmt
=
conn
.
createStatement
();
if
(
catalog
==
null
||
catalog
.
length
()
<
1
)
{
catalog
=
conn
.
getCatalog
();
}
stmt
.
executeUpdate
(
"use "
+
catalog
);
DatabaseMetaDataResultSet
resultSet
=
new
DatabaseMetaDataResultSet
();
// set up ColumnMetaDataList
List
<
ColumnMetaData
>
columnMetaDataList
=
new
ArrayList
<>(
24
);
columnMetaDataList
.
add
(
null
);
columnMetaDataList
.
add
(
null
);
// add TABLE_NAME
ColumnMetaData
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
3
);
colMetaData
.
setColName
(
"TABLE_NAME"
);
colMetaData
.
setColSize
(
193
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_BINARY
);
columnMetaDataList
.
add
(
colMetaData
);
// add COLUMN_NAME
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
4
);
colMetaData
.
setColName
(
"COLUMN_NAME"
);
colMetaData
.
setColSize
(
65
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_BINARY
);
columnMetaDataList
.
add
(
colMetaData
);
// add DATA_TYPE
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
5
);
colMetaData
.
setColName
(
"DATA_TYPE"
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_INT
);
columnMetaDataList
.
add
(
colMetaData
);
// add TYPE_NAME
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
6
);
colMetaData
.
setColName
(
"TYPE_NAME"
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_BINARY
);
columnMetaDataList
.
add
(
colMetaData
);
// add COLUMN_SIZE
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
7
);
colMetaData
.
setColName
(
"COLUMN_SIZE"
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_INT
);
columnMetaDataList
.
add
(
colMetaData
);
// add BUFFER_LENGTH ,not used
columnMetaDataList
.
add
(
null
);
// add DECIMAL_DIGITS
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
9
);
colMetaData
.
setColName
(
"DECIMAL_DIGITS"
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_INT
);
columnMetaDataList
.
add
(
colMetaData
);
// add NUM_PREC_RADIX
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
10
);
colMetaData
.
setColName
(
"NUM_PREC_RADIX"
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_INT
);
columnMetaDataList
.
add
(
colMetaData
);
// add NULLABLE
colMetaData
=
new
ColumnMetaData
();
colMetaData
.
setColIndex
(
11
);
colMetaData
.
setColName
(
"NULLABLE"
);
colMetaData
.
setColType
(
TSDBConstants
.
TSDB_DATA_TYPE_INT
);
columnMetaDataList
.
add
(
colMetaData
);
resultSet
.
setColumnMetaDataList
(
columnMetaDataList
);
// set up rowDataList
ResultSet
resultSet0
=
stmt
.
executeQuery
(
"describe "
+
tableNamePattern
);
List
<
TSDBResultSetRowData
>
rowDataList
=
new
ArrayList
<>();
int
index
=
0
;
while
(
resultSet0
.
next
())
{
TSDBResultSetRowData
rowData
=
new
TSDBResultSetRowData
(
24
);
// set TABLE_NAME
rowData
.
setString
(
2
,
tableNamePattern
);
// set COLUMN_NAME
rowData
.
setString
(
3
,
resultSet0
.
getString
(
1
));
// set DATA_TYPE
String
typeName
=
resultSet0
.
getString
(
2
);
rowData
.
setInt
(
4
,
getDataType
(
typeName
));
// set TYPE_NAME
rowData
.
setString
(
5
,
typeName
);
// set COLUMN_SIZE
int
length
=
resultSet0
.
getInt
(
3
);
rowData
.
setInt
(
6
,
getColumnSize
(
typeName
,
length
));
// set DECIMAL_DIGITS
rowData
.
setInt
(
8
,
getDecimalDigits
(
typeName
));
// set NUM_PREC_RADIX
rowData
.
setInt
(
9
,
10
);
// set NULLABLE
rowData
.
setInt
(
10
,
getNullable
(
index
,
typeName
));
rowDataList
.
add
(
rowData
);
index
++;
}
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
)
{
if
(
index
==
0
&&
"TIMESTAMP"
.
equals
(
typeName
))
return
DatabaseMetaData
.
columnNoNulls
;
return
DatabaseMetaData
.
columnNullable
;
}
private
int
getColumnSize
(
String
typeName
,
int
length
)
{
switch
(
typeName
)
{
case
"TIMESTAMP"
:
return
23
;
default
:
return
0
;
}
}
private
int
getDecimalDigits
(
String
typeName
)
{
switch
(
typeName
)
{
case
"FLOAT"
:
return
5
;
case
"DOUBLE"
:
return
9
;
default
:
return
0
;
}
}
private
int
getDataType
(
String
typeName
)
{
switch
(
typeName
)
{
case
"TIMESTAMP"
:
return
Types
.
TIMESTAMP
;
case
"INT"
:
return
Types
.
INTEGER
;
case
"BIGINT"
:
return
Types
.
BIGINT
;
case
"FLOAT"
:
return
Types
.
FLOAT
;
case
"DOUBLE"
:
return
Types
.
DOUBLE
;
case
"BINARY"
:
return
Types
.
BINARY
;
case
"SMALLINT"
:
return
Types
.
SMALLINT
;
case
"TINYINT"
:
return
Types
.
TINYINT
;
case
"BOOL"
:
return
Types
.
BOOLEAN
;
case
"NCHAR"
:
return
Types
.
NCHAR
;
default
:
return
Types
.
NULL
;
}
}
public
ResultSet
getColumnPrivileges
(
String
catalog
,
String
schema
,
String
table
,
String
columnNamePattern
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录