Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
e74d20ec
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看板
提交
e74d20ec
编写于
11月 18, 2020
作者:
Z
zyyang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change name
上级
af51dce4
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
908 addition
and
21 deletion
+908
-21
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulConnection.java
...src/main/java/com/taosdata/jdbc/rs/RestfulConnection.java
+5
-4
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java
...in/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java
+886
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
...dbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
+3
-3
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
.../src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
+3
-3
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSetMetaData.java
...n/java/com/taosdata/jdbc/rs/RestfulResultSetMetaData.java
+2
-2
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
.../src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
+6
-6
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
...src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
+3
-3
未找到文件。
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/
Taos
RestfulConnection.java
→
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulConnection.java
浏览文件 @
e74d20ec
...
...
@@ -7,7 +7,7 @@ import java.util.Map;
import
java.util.Properties
;
import
java.util.concurrent.Executor
;
public
class
Taos
RestfulConnection
implements
Connection
{
public
class
RestfulConnection
implements
Connection
{
private
final
String
host
;
private
final
int
port
;
...
...
@@ -16,7 +16,7 @@ public class TaosRestfulConnection implements Connection {
private
final
String
url
;
public
Taos
RestfulConnection
(
String
host
,
String
port
,
Properties
props
,
String
database
,
String
url
)
{
public
RestfulConnection
(
String
host
,
String
port
,
Properties
props
,
String
database
,
String
url
)
{
this
.
host
=
host
;
this
.
port
=
Integer
.
parseInt
(
port
);
this
.
props
=
props
;
...
...
@@ -28,7 +28,7 @@ public class TaosRestfulConnection implements Connection {
public
Statement
createStatement
()
throws
SQLException
{
if
(
isClosed
())
throw
new
SQLException
(
TSDBConstants
.
WrapErrMsg
(
"restful TDengine connection is closed."
));
return
new
Taos
RestfulStatement
(
this
,
this
.
database
);
return
new
RestfulStatement
(
this
,
this
.
database
);
}
@Override
...
...
@@ -78,7 +78,8 @@ public class TaosRestfulConnection implements Connection {
@Override
public
DatabaseMetaData
getMetaData
()
throws
SQLException
{
return
null
;
//TODO: RestfulDatabaseMetaData is not implemented
return
new
RestfulDatabaseMetaData
();
}
@Override
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDatabaseMetaData.java
0 → 100644
浏览文件 @
e74d20ec
package
com.taosdata.jdbc.rs
;
import
java.sql.*
;
public
class
RestfulDatabaseMetaData
implements
DatabaseMetaData
{
@Override
public
boolean
allProceduresAreCallable
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
allTablesAreSelectable
()
throws
SQLException
{
return
false
;
}
@Override
public
String
getURL
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getUserName
()
throws
SQLException
{
return
null
;
}
@Override
public
boolean
isReadOnly
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
nullsAreSortedHigh
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
nullsAreSortedLow
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
nullsAreSortedAtStart
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
nullsAreSortedAtEnd
()
throws
SQLException
{
return
false
;
}
@Override
public
String
getDatabaseProductName
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getDatabaseProductVersion
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getDriverName
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getDriverVersion
()
throws
SQLException
{
return
null
;
}
@Override
public
int
getDriverMajorVersion
()
{
return
0
;
}
@Override
public
int
getDriverMinorVersion
()
{
return
0
;
}
@Override
public
boolean
usesLocalFiles
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
usesLocalFilePerTable
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsMixedCaseIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
storesUpperCaseIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
storesLowerCaseIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
storesMixedCaseIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsMixedCaseQuotedIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
storesUpperCaseQuotedIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
storesLowerCaseQuotedIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
storesMixedCaseQuotedIdentifiers
()
throws
SQLException
{
return
false
;
}
@Override
public
String
getIdentifierQuoteString
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getSQLKeywords
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getNumericFunctions
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getStringFunctions
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getSystemFunctions
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getTimeDateFunctions
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getSearchStringEscape
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getExtraNameCharacters
()
throws
SQLException
{
return
null
;
}
@Override
public
boolean
supportsAlterTableWithAddColumn
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsAlterTableWithDropColumn
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsColumnAliasing
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
nullPlusNonNullIsNull
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsConvert
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsConvert
(
int
fromType
,
int
toType
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsTableCorrelationNames
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsDifferentTableCorrelationNames
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsExpressionsInOrderBy
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsOrderByUnrelated
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsGroupBy
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsGroupByUnrelated
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsGroupByBeyondSelect
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsLikeEscapeClause
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsMultipleResultSets
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsMultipleTransactions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsNonNullableColumns
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsMinimumSQLGrammar
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsCoreSQLGrammar
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsExtendedSQLGrammar
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsANSI92EntryLevelSQL
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsANSI92IntermediateSQL
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsANSI92FullSQL
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsIntegrityEnhancementFacility
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsOuterJoins
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsFullOuterJoins
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsLimitedOuterJoins
()
throws
SQLException
{
return
false
;
}
@Override
public
String
getSchemaTerm
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getProcedureTerm
()
throws
SQLException
{
return
null
;
}
@Override
public
String
getCatalogTerm
()
throws
SQLException
{
return
null
;
}
@Override
public
boolean
isCatalogAtStart
()
throws
SQLException
{
return
false
;
}
@Override
public
String
getCatalogSeparator
()
throws
SQLException
{
return
null
;
}
@Override
public
boolean
supportsSchemasInDataManipulation
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSchemasInProcedureCalls
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSchemasInTableDefinitions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSchemasInIndexDefinitions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSchemasInPrivilegeDefinitions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsCatalogsInDataManipulation
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsCatalogsInProcedureCalls
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsCatalogsInTableDefinitions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsCatalogsInIndexDefinitions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsCatalogsInPrivilegeDefinitions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsPositionedDelete
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsPositionedUpdate
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSelectForUpdate
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsStoredProcedures
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSubqueriesInComparisons
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSubqueriesInExists
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSubqueriesInIns
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsSubqueriesInQuantifieds
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsCorrelatedSubqueries
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsUnion
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsUnionAll
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsOpenCursorsAcrossCommit
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsOpenCursorsAcrossRollback
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsOpenStatementsAcrossCommit
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsOpenStatementsAcrossRollback
()
throws
SQLException
{
return
false
;
}
@Override
public
int
getMaxBinaryLiteralLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxCharLiteralLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxColumnNameLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxColumnsInGroupBy
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxColumnsInIndex
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxColumnsInOrderBy
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxColumnsInSelect
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxColumnsInTable
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxConnections
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxCursorNameLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxIndexLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxSchemaNameLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxProcedureNameLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxCatalogNameLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxRowSize
()
throws
SQLException
{
return
0
;
}
@Override
public
boolean
doesMaxRowSizeIncludeBlobs
()
throws
SQLException
{
return
false
;
}
@Override
public
int
getMaxStatementLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxStatements
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxTableNameLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxTablesInSelect
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getMaxUserNameLength
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getDefaultTransactionIsolation
()
throws
SQLException
{
return
0
;
}
@Override
public
boolean
supportsTransactions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsTransactionIsolationLevel
(
int
level
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsDataDefinitionAndDataManipulationTransactions
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsDataManipulationTransactionsOnly
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
dataDefinitionCausesTransactionCommit
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
dataDefinitionIgnoredInTransactions
()
throws
SQLException
{
return
false
;
}
@Override
public
ResultSet
getProcedures
(
String
catalog
,
String
schemaPattern
,
String
procedureNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getProcedureColumns
(
String
catalog
,
String
schemaPattern
,
String
procedureNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getTables
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
[]
types
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getSchemas
()
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getCatalogs
()
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getTableTypes
()
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getColumnPrivileges
(
String
catalog
,
String
schema
,
String
table
,
String
columnNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getTablePrivileges
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getBestRowIdentifier
(
String
catalog
,
String
schema
,
String
table
,
int
scope
,
boolean
nullable
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getVersionColumns
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getPrimaryKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getImportedKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getExportedKeys
(
String
catalog
,
String
schema
,
String
table
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getCrossReference
(
String
parentCatalog
,
String
parentSchema
,
String
parentTable
,
String
foreignCatalog
,
String
foreignSchema
,
String
foreignTable
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getTypeInfo
()
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getIndexInfo
(
String
catalog
,
String
schema
,
String
table
,
boolean
unique
,
boolean
approximate
)
throws
SQLException
{
return
null
;
}
@Override
public
boolean
supportsResultSetType
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsResultSetConcurrency
(
int
type
,
int
concurrency
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
ownUpdatesAreVisible
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
ownDeletesAreVisible
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
ownInsertsAreVisible
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
othersUpdatesAreVisible
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
othersDeletesAreVisible
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
othersInsertsAreVisible
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
updatesAreDetected
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
deletesAreDetected
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
insertsAreDetected
(
int
type
)
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsBatchUpdates
()
throws
SQLException
{
return
false
;
}
@Override
public
ResultSet
getUDTs
(
String
catalog
,
String
schemaPattern
,
String
typeNamePattern
,
int
[]
types
)
throws
SQLException
{
return
null
;
}
@Override
public
Connection
getConnection
()
throws
SQLException
{
return
null
;
}
@Override
public
boolean
supportsSavepoints
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsNamedParameters
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsMultipleOpenResults
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsGetGeneratedKeys
()
throws
SQLException
{
return
false
;
}
@Override
public
ResultSet
getSuperTypes
(
String
catalog
,
String
schemaPattern
,
String
typeNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getSuperTables
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getAttributes
(
String
catalog
,
String
schemaPattern
,
String
typeNamePattern
,
String
attributeNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
boolean
supportsResultSetHoldability
(
int
holdability
)
throws
SQLException
{
return
false
;
}
@Override
public
int
getResultSetHoldability
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getDatabaseMajorVersion
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getDatabaseMinorVersion
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getJDBCMajorVersion
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getJDBCMinorVersion
()
throws
SQLException
{
return
0
;
}
@Override
public
int
getSQLStateType
()
throws
SQLException
{
return
0
;
}
@Override
public
boolean
locatorsUpdateCopy
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
supportsStatementPooling
()
throws
SQLException
{
return
false
;
}
@Override
public
RowIdLifetime
getRowIdLifetime
()
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getSchemas
(
String
catalog
,
String
schemaPattern
)
throws
SQLException
{
return
null
;
}
@Override
public
boolean
supportsStoredFunctionsUsingCallSyntax
()
throws
SQLException
{
return
false
;
}
@Override
public
boolean
autoCommitFailureClosesAllResultSets
()
throws
SQLException
{
return
false
;
}
@Override
public
ResultSet
getClientInfoProperties
()
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getFunctions
(
String
catalog
,
String
schemaPattern
,
String
functionNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getFunctionColumns
(
String
catalog
,
String
schemaPattern
,
String
functionNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
ResultSet
getPseudoColumns
(
String
catalog
,
String
schemaPattern
,
String
tableNamePattern
,
String
columnNamePattern
)
throws
SQLException
{
return
null
;
}
@Override
public
boolean
generatedKeyAlwaysReturned
()
throws
SQLException
{
return
false
;
}
@Override
public
<
T
>
T
unwrap
(
Class
<
T
>
iface
)
throws
SQLException
{
return
null
;
}
@Override
public
boolean
isWrapperFor
(
Class
<?>
iface
)
throws
SQLException
{
return
false
;
}
}
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/
Taos
RestfulDriver.java
→
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
浏览文件 @
e74d20ec
...
...
@@ -11,13 +11,13 @@ import java.sql.*;
import
java.util.Properties
;
import
java.util.logging.Logger
;
public
class
Taos
RestfulDriver
extends
AbstractTaosDriver
{
public
class
RestfulDriver
extends
AbstractTaosDriver
{
private
static
final
String
URL_PREFIX
=
"jdbc:TAOS-RS://"
;
static
{
try
{
DriverManager
.
registerDriver
(
new
Taos
RestfulDriver
());
DriverManager
.
registerDriver
(
new
RestfulDriver
());
}
catch
(
SQLException
e
)
{
throw
new
RuntimeException
(
TSDBConstants
.
WrapErrMsg
(
"can not register Restful JDBC driver"
),
e
);
}
...
...
@@ -48,7 +48,7 @@ public class TaosRestfulDriver extends AbstractTaosDriver {
throw
new
SQLException
(
jsonResult
.
getString
(
"desc"
));
}
return
new
Taos
RestfulConnection
(
host
,
port
,
props
,
database
,
url
);
return
new
RestfulConnection
(
host
,
port
,
props
,
database
,
url
);
}
@Override
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/
Taos
RestfulResultSet.java
→
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSet.java
浏览文件 @
e74d20ec
...
...
@@ -13,13 +13,13 @@ import java.util.Arrays;
import
java.util.Calendar
;
import
java.util.Map
;
public
class
Taos
RestfulResultSet
implements
ResultSet
{
public
class
RestfulResultSet
implements
ResultSet
{
private
boolean
isClosed
=
false
;
private
int
pos
=
-
1
;
private
ArrayList
<
ArrayList
<
String
>>
data
;
private
ArrayList
<
String
>
fields
;
public
Taos
RestfulResultSet
(
String
str
,
String
fieldData
)
{
public
RestfulResultSet
(
String
str
,
String
fieldData
)
{
data
=
new
ArrayList
<>();
str
=
str
.
substring
(
2
,
str
.
length
()
-
2
);
ArrayList
<
String
>
strTemp
=
new
ArrayList
<>(
Arrays
.
asList
(
str
.
split
(
"],\\["
)));
...
...
@@ -262,7 +262,7 @@ public class TaosRestfulResultSet implements ResultSet {
@Override
public
ResultSetMetaData
getMetaData
()
throws
SQLException
{
return
new
Taos
RestfulResultSetMetaData
(
fields
);
return
new
RestfulResultSetMetaData
(
fields
);
}
@Override
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/
Taos
RestfulResultSetMetaData.java
→
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulResultSetMetaData.java
浏览文件 @
e74d20ec
...
...
@@ -4,11 +4,11 @@ import java.sql.ResultSetMetaData;
import
java.sql.SQLException
;
import
java.util.List
;
public
class
Taos
RestfulResultSetMetaData
implements
ResultSetMetaData
{
public
class
RestfulResultSetMetaData
implements
ResultSetMetaData
{
private
List
<
String
>
fields
;
public
Taos
RestfulResultSetMetaData
(
List
<
String
>
fields
)
{
public
RestfulResultSetMetaData
(
List
<
String
>
fields
)
{
this
.
fields
=
fields
;
}
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/
Taos
RestfulStatement.java
→
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
浏览文件 @
e74d20ec
...
...
@@ -9,12 +9,12 @@ import java.sql.*;
import
java.util.Arrays
;
import
java.util.List
;
public
class
Taos
RestfulStatement
implements
Statement
{
public
class
RestfulStatement
implements
Statement
{
private
final
String
catalog
;
private
final
Taos
RestfulConnection
conn
;
private
final
RestfulConnection
conn
;
public
TaosRestfulStatement
(
Taos
RestfulConnection
c
,
String
catalog
)
{
public
RestfulStatement
(
RestfulConnection
c
,
String
catalog
)
{
this
.
conn
=
c
;
this
.
catalog
=
catalog
;
}
...
...
@@ -46,12 +46,12 @@ public class TaosRestfulStatement implements Statement {
}
String
dataStr
=
jsonObject
.
getString
(
"data"
);
if
(
"use"
.
equalsIgnoreCase
(
fields
.
split
(
" "
)[
0
]))
{
return
new
Taos
RestfulResultSet
(
dataStr
,
""
);
return
new
RestfulResultSet
(
dataStr
,
""
);
}
JSONObject
jsonField
=
JSON
.
parseObject
(
fields
);
if
(
jsonField
==
null
)
{
return
new
Taos
RestfulResultSet
(
dataStr
,
""
);
return
new
RestfulResultSet
(
dataStr
,
""
);
}
if
(
jsonField
.
getString
(
"status"
).
equals
(
"error"
))
{
throw
new
SQLException
(
TSDBConstants
.
WrapErrMsg
(
"SQL execution error: "
+
...
...
@@ -60,7 +60,7 @@ public class TaosRestfulStatement implements Statement {
}
String
fieldData
=
jsonField
.
getString
(
"data"
);
return
new
Taos
RestfulResultSet
(
dataStr
,
fieldData
);
return
new
RestfulResultSet
(
dataStr
,
fieldData
);
}
@Override
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/
Taos
RestfulDriverTest.java
→
src/connector/jdbc/src/test/java/com/taosdata/jdbc/rs/RestfulDriverTest.java
浏览文件 @
e74d20ec
...
...
@@ -5,12 +5,12 @@ import org.junit.Test;
import
java.sql.*
;
public
class
Taos
RestfulDriverTest
{
public
class
RestfulDriverTest
{
@Test
public
void
testCase001
()
{
try
{
Class
.
forName
(
"com.taosdata.jdbc.rs.
Taos
RestfulDriver"
);
Class
.
forName
(
"com.taosdata.jdbc.rs.RestfulDriver"
);
Connection
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://master:6041/?user=root&password=taosdata"
);
Statement
statement
=
connection
.
createStatement
();
ResultSet
resultSet
=
statement
.
executeQuery
(
"select * from log.log"
);
...
...
@@ -32,7 +32,7 @@ public class TaosRestfulDriverTest {
@Test
public
void
testAcceptUrl
()
throws
SQLException
{
Driver
driver
=
new
Taos
RestfulDriver
();
Driver
driver
=
new
RestfulDriver
();
boolean
isAccept
=
driver
.
acceptsURL
(
"jdbc:TAOS-RS://master:6041"
);
Assert
.
assertTrue
(
isAccept
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录