Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
93b76b1b
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
93b76b1b
编写于
8月 11, 2021
作者:
W
wpan
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'master' into hotfix/TD-5960
上级
37b43a40
2987b861
变更
24
显示空白变更内容
内联
并排
Showing
24 changed file
with
248 addition
and
127 deletion
+248
-127
Jenkinsfile
Jenkinsfile
+10
-10
src/client/src/tscSubquery.c
src/client/src/tscSubquery.c
+2
-2
src/connector/jdbc/pom.xml
src/connector/jdbc/pom.xml
+0
-1
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
...ctor/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
+7
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
...ector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
+2
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
...dbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
+5
-0
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java
...dbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java
+0
-1
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
...dbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
+8
-2
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
.../src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
+26
-33
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java
...main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java
+1
-14
src/connector/jdbc/src/test/java/com/taosdata/jdbc/SubscribeTest.java
...r/jdbc/src/test/java/com/taosdata/jdbc/SubscribeTest.java
+2
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/AuthenticationTest.java
...test/java/com/taosdata/jdbc/cases/AuthenticationTest.java
+44
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BatchInsertTest.java
...rc/test/java/com/taosdata/jdbc/cases/BatchInsertTest.java
+2
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ImportTest.java
...dbc/src/test/java/com/taosdata/jdbc/cases/ImportTest.java
+2
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java
...om/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java
+37
-4
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
...aosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
+2
-4
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/QueryDataTest.java
.../src/test/java/com/taosdata/jdbc/cases/QueryDataTest.java
+2
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java
...est/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java
+33
-35
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/SelectTest.java
...dbc/src/test/java/com/taosdata/jdbc/cases/SelectTest.java
+2
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java
...dbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java
+2
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
.../java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
+0
-21
src/query/src/qFill.c
src/query/src/qFill.c
+12
-0
tests/pytest/fulltest.sh
tests/pytest/fulltest.sh
+1
-0
tests/pytest/functions/function_interp.py
tests/pytest/functions/function_interp.py
+46
-0
未找到文件。
Jenkinsfile
浏览文件 @
93b76b1b
...
...
@@ -168,7 +168,7 @@ pipeline {
steps
{
pre_test
()
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
sh
'''
date
cd ${WKC}/tests
...
...
@@ -183,7 +183,7 @@ pipeline {
steps
{
pre_test
()
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
sh
'''
date
cd ${WKC}/tests
...
...
@@ -195,7 +195,7 @@ pipeline {
stage
(
'python_3_s6'
)
{
agent
{
label
'p3'
}
steps
{
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
@@ -208,7 +208,7 @@ pipeline {
stage
(
'test_b1_s2'
)
{
agent
{
label
'b1'
}
steps
{
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
cd ${WKC}/tests
...
...
@@ -245,7 +245,7 @@ pipeline {
./handle_taosd_val_log.sh
'''
}
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
sh
'''
date
cd ${WKC}/tests
...
...
@@ -269,7 +269,7 @@ pipeline {
./handle_val_log.sh
'''
}
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
sh
'''
date
cd ${WKC}/tests
...
...
@@ -286,7 +286,7 @@ pipeline {
stage
(
'test_b4_s7'
)
{
agent
{
label
'b4'
}
steps
{
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
@@ -305,7 +305,7 @@ pipeline {
stage
(
'test_b5_s8'
)
{
agent
{
label
'b5'
}
steps
{
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
@@ -318,7 +318,7 @@ pipeline {
stage
(
'test_b6_s9'
)
{
agent
{
label
'b6'
}
steps
{
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
@@ -331,7 +331,7 @@ pipeline {
stage
(
'test_b7_s10'
)
{
agent
{
label
'b7'
}
steps
{
timeout
(
time:
4
5
,
unit:
'MINUTES'
){
timeout
(
time:
5
5
,
unit:
'MINUTES'
){
pre_test
()
sh
'''
date
...
...
src/client/src/tscSubquery.c
浏览文件 @
93b76b1b
...
...
@@ -2395,8 +2395,8 @@ int32_t tscHandleFirstRoundStableQuery(SSqlObj *pSql) {
SColumn
*
x
=
taosArrayGetP
(
pNewQueryInfo
->
colList
,
index1
);
tscColumnCopy
(
x
,
pCol
);
}
else
{
S
Column
*
p
=
tscColumnClone
(
pCol
)
;
t
aosArrayPush
(
pNewQueryInfo
->
colList
,
&
p
);
S
Schema
ss
=
{.
type
=
(
uint8_t
)
pCol
->
info
.
type
,
.
bytes
=
pCol
->
info
.
bytes
,
.
colId
=
(
int16_t
)
pCol
->
columnIndex
}
;
t
scColumnListInsert
(
pNewQueryInfo
->
colList
,
pCol
->
columnIndex
,
pCol
->
tableUid
,
&
ss
);
}
}
}
...
...
src/connector/jdbc/pom.xml
浏览文件 @
93b76b1b
...
...
@@ -113,7 +113,6 @@
</includes>
<excludes>
<exclude>
**/AppMemoryLeakTest.java
</exclude>
<exclude>
**/AuthenticationTest.java
</exclude>
<exclude>
**/ConnectMultiTaosdByRestfulWithDifferentTokenTest.java
</exclude>
<exclude>
**/DatetimeBefore1970Test.java
</exclude>
<exclude>
**/FailOverTest.java
</exclude>
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBDriver.java
浏览文件 @
93b76b1b
...
...
@@ -14,6 +14,8 @@
*****************************************************************************/
package
com.taosdata.jdbc
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.sql.*
;
import
java.util.*
;
import
java.util.logging.Logger
;
...
...
@@ -127,6 +129,11 @@ public class TSDBDriver extends AbstractDriver {
return
null
;
}
if
(!
props
.
containsKey
(
TSDBDriver
.
PROPERTY_KEY_USER
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_USER_IS_REQUIRED
);
if
(!
props
.
containsKey
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_PASSWORD_IS_REQUIRED
);
try
{
TSDBJNIConnector
.
init
((
String
)
props
.
get
(
PROPERTY_KEY_CONFIG_DIR
),
(
String
)
props
.
get
(
PROPERTY_KEY_LOCALE
),
(
String
)
props
.
get
(
PROPERTY_KEY_CHARSET
),
(
String
)
props
.
get
(
PROPERTY_KEY_TIME_ZONE
));
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBError.java
浏览文件 @
93b76b1b
...
...
@@ -33,6 +33,8 @@ public class TSDBError {
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_NUMERIC_VALUE_OUT_OF_RANGE
,
"numeric value out of range"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_UNKNOWN_TAOS_TYPE
,
"unknown taos type in tdengine"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_UNKNOWN_TIMESTAMP_PRECISION
,
"unknown timestamp precision"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_USER_IS_REQUIRED
,
"user is required"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_PASSWORD_IS_REQUIRED
,
"password is required"
);
TSDBErrorMap
.
put
(
TSDBErrorNumbers
.
ERROR_UNKNOWN
,
"unknown error"
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBErrorNumbers.java
浏览文件 @
93b76b1b
...
...
@@ -29,6 +29,9 @@ public class TSDBErrorNumbers {
public
static
final
int
ERROR_UNKNOWN_TIMESTAMP_PRECISION
=
0x2316
;
// unknown timestamp precision
public
static
final
int
ERROR_RESTFul_Client_Protocol_Exception
=
0x2317
;
public
static
final
int
ERROR_RESTFul_Client_IOException
=
0x2318
;
public
static
final
int
ERROR_USER_IS_REQUIRED
=
0x2319
;
// user is required
public
static
final
int
ERROR_PASSWORD_IS_REQUIRED
=
0x231a
;
// password is required
public
static
final
int
ERROR_UNKNOWN
=
0x2350
;
//unknown error
...
...
@@ -67,6 +70,8 @@ public class TSDBErrorNumbers {
errorNumbers
.
add
(
ERROR_UNKNOWN_TAOS_TYPE
);
errorNumbers
.
add
(
ERROR_UNKNOWN_TIMESTAMP_PRECISION
);
errorNumbers
.
add
(
ERROR_RESTFul_Client_IOException
);
errorNumbers
.
add
(
ERROR_USER_IS_REQUIRED
);
errorNumbers
.
add
(
ERROR_PASSWORD_IS_REQUIRED
);
errorNumbers
.
add
(
ERROR_RESTFul_Client_Protocol_Exception
);
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBJNIConnector.java
浏览文件 @
93b76b1b
...
...
@@ -36,7 +36,6 @@ public class TSDBJNIConnector {
static
{
System
.
loadLibrary
(
"taos"
);
System
.
out
.
println
(
"java.library.path:"
+
System
.
getProperty
(
"java.library.path"
));
}
public
boolean
isClosed
()
{
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulDriver.java
浏览文件 @
93b76b1b
...
...
@@ -7,6 +7,7 @@ import com.taosdata.jdbc.utils.HttpClientPoolUtil;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.nio.charset.StandardCharsets
;
import
java.sql.*
;
import
java.util.Properties
;
import
java.util.logging.Logger
;
...
...
@@ -40,8 +41,13 @@ public class RestfulDriver extends AbstractDriver {
String
loginUrl
=
"http://"
+
host
+
":"
+
port
+
"/rest/login/"
+
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
)
+
"/"
+
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
)
+
""
;
try
{
String
user
=
URLEncoder
.
encode
(
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
),
"UTF-8"
);
String
password
=
URLEncoder
.
encode
(
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
),
"UTF-8"
);
if
(!
props
.
containsKey
(
TSDBDriver
.
PROPERTY_KEY_USER
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_USER_IS_REQUIRED
);
if
(!
props
.
containsKey
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_PASSWORD_IS_REQUIRED
);
String
user
=
URLEncoder
.
encode
(
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
),
StandardCharsets
.
UTF_8
.
displayName
());
String
password
=
URLEncoder
.
encode
(
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
),
StandardCharsets
.
UTF_8
.
displayName
());
loginUrl
=
"http://"
+
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_HOST
)
+
":"
+
props
.
getProperty
(
TSDBDriver
.
PROPERTY_KEY_PORT
)
+
"/rest/login/"
+
user
+
"/"
+
password
+
""
;
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/rs/RestfulStatement.java
浏览文件 @
93b76b1b
...
...
@@ -7,6 +7,7 @@ import com.taosdata.jdbc.AbstractStatement;
import
com.taosdata.jdbc.TSDBDriver
;
import
com.taosdata.jdbc.TSDBError
;
import
com.taosdata.jdbc.TSDBErrorNumbers
;
import
com.taosdata.jdbc.enums.TimestampFormat
;
import
com.taosdata.jdbc.utils.HttpClientPoolUtil
;
import
com.taosdata.jdbc.utils.SqlSyntaxValidator
;
...
...
@@ -45,9 +46,7 @@ public class RestfulStatement extends AbstractStatement {
if
(!
SqlSyntaxValidator
.
isValidForExecuteUpdate
(
sql
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_FOR_EXECUTE_UPDATE
,
"not a valid sql for executeUpdate: "
+
sql
);
final
String
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sql"
;
return
executeOneUpdate
(
url
,
sql
);
return
executeOneUpdate
(
sql
);
}
@Override
...
...
@@ -62,34 +61,25 @@ public class RestfulStatement extends AbstractStatement {
public
boolean
execute
(
String
sql
)
throws
SQLException
{
if
(
isClosed
())
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_STATEMENT_CLOSED
);
if
(!
SqlSyntaxValidator
.
isValidForExecute
(
sql
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_FOR_EXECUTE
,
"not a valid sql for execute: "
+
sql
);
//如果执行了use操作应该将当前Statement的catalog设置为新的database
boolean
result
=
true
;
String
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sql"
;
if
(
conn
.
getClientInfo
(
TSDBDriver
.
PROPERTY_KEY_TIMESTAMP_FORMAT
).
equals
(
"TIMESTAMP"
))
{
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sqlt"
;
}
if
(
conn
.
getClientInfo
(
TSDBDriver
.
PROPERTY_KEY_TIMESTAMP_FORMAT
).
equals
(
"UTC"
))
{
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sqlutc"
;
}
if
(
SqlSyntaxValidator
.
isUseSql
(
sql
))
{
HttpClientPoolUtil
.
execute
(
url
,
sql
,
this
.
conn
.
getToken
());
HttpClientPoolUtil
.
execute
(
getUrl
()
,
sql
,
this
.
conn
.
getToken
());
this
.
database
=
sql
.
trim
().
replace
(
"use"
,
""
).
trim
();
this
.
conn
.
setCatalog
(
this
.
database
);
result
=
false
;
}
else
if
(
SqlSyntaxValidator
.
isDatabaseUnspecifiedQuery
(
sql
))
{
executeOneQuery
(
sql
);
}
else
if
(
SqlSyntaxValidator
.
isDatabaseUnspecifiedUpdate
(
sql
))
{
executeOneUpdate
(
url
,
sql
);
executeOneUpdate
(
sql
);
result
=
false
;
}
else
{
if
(
SqlSyntaxValidator
.
isValidForExecuteQuery
(
sql
))
{
executeQuery
(
sql
);
execute
One
Query
(
sql
);
}
else
{
executeUpdate
(
sql
);
execute
One
Update
(
sql
);
result
=
false
;
}
}
...
...
@@ -97,19 +87,25 @@ public class RestfulStatement extends AbstractStatement {
return
result
;
}
private
ResultSet
executeOneQuery
(
String
sql
)
throws
SQLException
{
if
(!
SqlSyntaxValidator
.
isValidForExecuteQuery
(
sql
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_FOR_EXECUTE_QUERY
,
"not a valid sql for executeQuery: "
+
sql
);
// row data
String
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sql"
;
String
timestampFormat
=
conn
.
getClientInfo
(
TSDBDriver
.
PROPERTY_KEY_TIMESTAMP_FORMAT
);
if
(
"TIMESTAMP"
.
equalsIgnoreCase
(
timestampFormat
))
private
String
getUrl
()
throws
SQLException
{
TimestampFormat
timestampFormat
=
TimestampFormat
.
valueOf
(
conn
.
getClientInfo
(
TSDBDriver
.
PROPERTY_KEY_TIMESTAMP_FORMAT
).
trim
().
toUpperCase
());
String
url
;
switch
(
timestampFormat
)
{
case
TIMESTAMP:
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sqlt"
;
if
(
"UTC"
.
equalsIgnoreCase
(
timestampFormat
))
break
;
case
UTC:
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sqlutc"
;
break
;
default
:
url
=
"http://"
+
conn
.
getHost
()
+
":"
+
conn
.
getPort
()
+
"/rest/sql"
;
}
return
url
;
}
String
result
=
HttpClientPoolUtil
.
execute
(
url
,
sql
,
this
.
conn
.
getToken
());
private
ResultSet
executeOneQuery
(
String
sql
)
throws
SQLException
{
// row data
String
result
=
HttpClientPoolUtil
.
execute
(
getUrl
(),
sql
,
this
.
conn
.
getToken
());
JSONObject
resultJson
=
JSON
.
parseObject
(
result
);
if
(
resultJson
.
getString
(
"status"
).
equals
(
"error"
))
{
throw
TSDBError
.
createSQLException
(
resultJson
.
getInteger
(
"code"
),
resultJson
.
getString
(
"desc"
));
...
...
@@ -119,11 +115,8 @@ public class RestfulStatement extends AbstractStatement {
return
resultSet
;
}
private
int
executeOneUpdate
(
String
url
,
String
sql
)
throws
SQLException
{
if
(!
SqlSyntaxValidator
.
isValidForExecuteUpdate
(
sql
))
throw
TSDBError
.
createSQLException
(
TSDBErrorNumbers
.
ERROR_INVALID_FOR_EXECUTE_UPDATE
,
"not a valid sql for executeUpdate: "
+
sql
);
String
result
=
HttpClientPoolUtil
.
execute
(
url
,
sql
,
this
.
conn
.
getToken
());
private
int
executeOneUpdate
(
String
sql
)
throws
SQLException
{
String
result
=
HttpClientPoolUtil
.
execute
(
getUrl
(),
sql
,
this
.
conn
.
getToken
());
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
if
(
jsonObject
.
getString
(
"status"
).
equals
(
"error"
))
{
throw
TSDBError
.
createSQLException
(
jsonObject
.
getInteger
(
"code"
),
jsonObject
.
getString
(
"desc"
));
...
...
@@ -134,7 +127,7 @@ public class RestfulStatement extends AbstractStatement {
}
private
int
getAffectedRows
(
JSONObject
jsonObject
)
throws
SQLException
{
// create ... SQLs should return 0 , and Restful result
is
this:
// create ... SQLs should return 0 , and Restful result
like
this:
// {"status": "succ", "head": ["affected_rows"], "data": [[0]], "rows": 1}
JSONArray
head
=
jsonObject
.
getJSONArray
(
"head"
);
if
(
head
.
size
()
!=
1
||
!
"affected_rows"
.
equals
(
head
.
getString
(
0
)))
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/utils/SqlSyntaxValidator.java
浏览文件 @
93b76b1b
...
...
@@ -16,8 +16,7 @@ package com.taosdata.jdbc.utils;
public
class
SqlSyntaxValidator
{
private
static
final
String
[]
SQL
=
{
"select"
,
"insert"
,
"import"
,
"create"
,
"use"
,
"alter"
,
"drop"
,
"set"
,
"show"
,
"describe"
,
"reset"
};
private
static
final
String
[]
updateSQL
=
{
"insert"
,
"import"
,
"create"
,
"use"
,
"alter"
,
"drop"
,
"set"
};
private
static
final
String
[]
updateSQL
=
{
"insert"
,
"import"
,
"create"
,
"use"
,
"alter"
,
"drop"
,
"set"
,
"reset"
};
private
static
final
String
[]
querySQL
=
{
"select"
,
"show"
,
"describe"
};
private
static
final
String
[]
databaseUnspecifiedShow
=
{
"databases"
,
"dnodes"
,
"mnodes"
,
"variables"
};
...
...
@@ -38,14 +37,6 @@ public class SqlSyntaxValidator {
return
false
;
}
public
static
boolean
isValidForExecute
(
String
sql
)
{
for
(
String
prefix
:
SQL
)
{
if
(
sql
.
trim
().
toLowerCase
().
startsWith
(
prefix
))
return
true
;
}
return
false
;
}
public
static
boolean
isDatabaseUnspecifiedQuery
(
String
sql
)
{
for
(
String
databaseObj
:
databaseUnspecifiedShow
)
{
if
(
sql
.
trim
().
toLowerCase
().
matches
(
"show\\s+"
+
databaseObj
+
".*"
))
...
...
@@ -63,9 +54,5 @@ public class SqlSyntaxValidator {
return
sql
.
trim
().
toLowerCase
().
startsWith
(
"use"
);
}
public
static
boolean
isSelectSql
(
String
sql
)
{
return
sql
.
trim
().
toLowerCase
().
startsWith
(
"select"
);
}
}
src/connector/jdbc/src/test/java/com/taosdata/jdbc/SubscribeTest.java
浏览文件 @
93b76b1b
...
...
@@ -69,6 +69,8 @@ public class SubscribeTest {
@Before
public
void
createDatabase
()
throws
SQLException
{
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
,
"root"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
,
"taosdata"
);
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"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/AuthenticationTest.java
浏览文件 @
93b76b1b
package
com.taosdata.jdbc.cases
;
import
com.taosdata.jdbc.TSDBErrorNumbers
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Ignore
;
import
org.junit.Test
;
import
java.sql.*
;
...
...
@@ -12,6 +15,47 @@ public class AuthenticationTest {
private
static
final
String
password
=
"taos?data"
;
private
Connection
conn
;
@Test
public
void
connectWithoutUserByJni
()
{
try
{
DriverManager
.
getConnection
(
"jdbc:TAOS://"
+
host
+
":0/?"
);
}
catch
(
SQLException
e
)
{
Assert
.
assertEquals
(
TSDBErrorNumbers
.
ERROR_USER_IS_REQUIRED
,
e
.
getErrorCode
());
Assert
.
assertEquals
(
"ERROR (2319): user is required"
,
e
.
getMessage
());
}
}
@Test
public
void
connectWithoutUserByRestful
()
{
try
{
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://"
+
host
+
":6041/?"
);
}
catch
(
SQLException
e
)
{
Assert
.
assertEquals
(
TSDBErrorNumbers
.
ERROR_USER_IS_REQUIRED
,
e
.
getErrorCode
());
Assert
.
assertEquals
(
"ERROR (2319): user is required"
,
e
.
getMessage
());
}
}
@Test
public
void
connectWithoutPasswordByJni
()
{
try
{
DriverManager
.
getConnection
(
"jdbc:TAOS://"
+
host
+
":0/?user=root"
);
}
catch
(
SQLException
e
)
{
Assert
.
assertEquals
(
TSDBErrorNumbers
.
ERROR_PASSWORD_IS_REQUIRED
,
e
.
getErrorCode
());
Assert
.
assertEquals
(
"ERROR (231a): password is required"
,
e
.
getMessage
());
}
}
@Test
public
void
connectWithoutPasswordByRestful
()
{
try
{
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://"
+
host
+
":6041/?user=root"
);
}
catch
(
SQLException
e
)
{
Assert
.
assertEquals
(
TSDBErrorNumbers
.
ERROR_PASSWORD_IS_REQUIRED
,
e
.
getErrorCode
());
Assert
.
assertEquals
(
"ERROR (231a): password is required"
,
e
.
getMessage
());
}
}
@Ignore
@Test
public
void
test
()
{
// change password
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/BatchInsertTest.java
浏览文件 @
93b76b1b
...
...
@@ -29,6 +29,8 @@ public class BatchInsertTest {
public
void
before
()
{
try
{
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
,
"root"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
,
"taosdata"
);
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"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ImportTest.java
浏览文件 @
93b76b1b
...
...
@@ -21,6 +21,8 @@ public class ImportTest {
public
static
void
before
()
{
try
{
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
,
"root"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
,
"taosdata"
);
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"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterJniTest.java
浏览文件 @
93b76b1b
...
...
@@ -270,6 +270,41 @@ public class InsertSpecialCharacterJniTest {
}
}
@Ignore
@Test
public
void
testSingleQuotaEscape
()
throws
SQLException
{
final
long
now
=
System
.
currentTimeMillis
();
final
String
sql
=
"insert into t? using ? tags(?) values(?, ?, ?) t? using "
+
tbname2
+
" tags(?) values(?,?,?) "
;
try
(
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
sql
))
{
// t1
pstmt
.
setInt
(
1
,
1
);
pstmt
.
setString
(
2
,
tbname2
);
pstmt
.
setString
(
3
,
special_character_str_5
);
pstmt
.
setTimestamp
(
4
,
new
Timestamp
(
now
));
pstmt
.
setBytes
(
5
,
special_character_str_5
.
getBytes
());
// t2
pstmt
.
setInt
(
7
,
2
);
pstmt
.
setString
(
8
,
special_character_str_5
);
pstmt
.
setTimestamp
(
9
,
new
Timestamp
(
now
));
pstmt
.
setString
(
11
,
special_character_str_5
);
int
ret
=
pstmt
.
executeUpdate
();
Assert
.
assertEquals
(
2
,
ret
);
}
String
query
=
"select * from ?.t? where ? < ? and ts >= ? and f1 is not null"
;
try
(
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
query
))
{
pstmt
.
setString
(
1
,
dbName
);
pstmt
.
setInt
(
2
,
1
);
pstmt
.
setString
(
3
,
"ts"
);
pstmt
.
setTimestamp
(
4
,
new
Timestamp
(
System
.
currentTimeMillis
()));
pstmt
.
setTimestamp
(
5
,
new
Timestamp
(
0
));
ResultSet
rs
=
pstmt
.
executeQuery
();
Assert
.
assertNotNull
(
rs
);
}
}
@Test
public
void
testCase10
()
throws
SQLException
{
final
long
now
=
System
.
currentTimeMillis
();
...
...
@@ -293,13 +328,12 @@ public class InsertSpecialCharacterJniTest {
Assert
.
assertEquals
(
2
,
ret
);
}
//query t1
String
query
=
"select * from ?.t? where ts < ? and ts >= ? and
?
is not null"
;
String
query
=
"select * from ?.t? where ts < ? and ts >= ? and
f1
is not null"
;
try
(
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
query
))
{
pstmt
.
setString
(
1
,
dbName
);
pstmt
.
setInt
(
2
,
1
);
pstmt
.
setTimestamp
(
3
,
new
Timestamp
(
System
.
currentTimeMillis
()));
pstmt
.
setTimestamp
(
4
,
new
Timestamp
(
0
));
pstmt
.
setString
(
5
,
"f1"
);
ResultSet
rs
=
pstmt
.
executeQuery
();
rs
.
next
();
...
...
@@ -311,12 +345,11 @@ public class InsertSpecialCharacterJniTest {
Assert
.
assertNull
(
f2
);
}
// query t2
query
=
"select * from t? where ts < ? and ts >= ? and
?
is not null"
;
query
=
"select * from t? where ts < ? and ts >= ? and
f2
is not null"
;
try
(
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
query
))
{
pstmt
.
setInt
(
1
,
2
);
pstmt
.
setTimestamp
(
2
,
new
Timestamp
(
System
.
currentTimeMillis
()));
pstmt
.
setTimestamp
(
3
,
new
Timestamp
(
0
));
pstmt
.
setString
(
4
,
"f2"
);
ResultSet
rs
=
pstmt
.
executeQuery
();
rs
.
next
();
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/InsertSpecialCharacterRestfulTest.java
浏览文件 @
93b76b1b
...
...
@@ -293,13 +293,12 @@ public class InsertSpecialCharacterRestfulTest {
Assert
.
assertEquals
(
2
,
ret
);
}
//query t1
String
query
=
"select * from ?.t? where ts < ? and ts >= ? and
?
is not null"
;
String
query
=
"select * from ?.t? where ts < ? and ts >= ? and
f1
is not null"
;
try
(
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
query
))
{
pstmt
.
setString
(
1
,
dbName
);
pstmt
.
setInt
(
2
,
1
);
pstmt
.
setTimestamp
(
3
,
new
Timestamp
(
System
.
currentTimeMillis
()));
pstmt
.
setTimestamp
(
4
,
new
Timestamp
(
0
));
pstmt
.
setString
(
5
,
"f1"
);
ResultSet
rs
=
pstmt
.
executeQuery
();
rs
.
next
();
...
...
@@ -311,12 +310,11 @@ public class InsertSpecialCharacterRestfulTest {
Assert
.
assertNull
(
f2
);
}
// query t2
query
=
"select * from t? where ts < ? and ts >= ? and
?
is not null"
;
query
=
"select * from t? where ts < ? and ts >= ? and
f2
is not null"
;
try
(
PreparedStatement
pstmt
=
conn
.
prepareStatement
(
query
))
{
pstmt
.
setInt
(
1
,
2
);
pstmt
.
setTimestamp
(
2
,
new
Timestamp
(
System
.
currentTimeMillis
()));
pstmt
.
setTimestamp
(
3
,
new
Timestamp
(
0
));
pstmt
.
setString
(
4
,
"f2"
);
ResultSet
rs
=
pstmt
.
executeQuery
();
rs
.
next
();
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/QueryDataTest.java
浏览文件 @
93b76b1b
...
...
@@ -22,6 +22,8 @@ public class QueryDataTest {
public
void
createDatabase
()
{
try
{
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
,
"root"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
,
"taosdata"
);
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"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/ResetQueryCacheTest.java
浏览文件 @
93b76b1b
package
com.taosdata.jdbc.cases
;
import
com.taosdata.jdbc.TSDBDriver
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
import
java.sql.*
;
import
java.util.Properties
;
import
java.sql.Connection
;
import
java.sql.DriverManager
;
import
java.sql.SQLException
;
import
java.sql.Statement
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
static
org
.
junit
.
Assert
.
assertFalse
;
public
class
ResetQueryCacheTest
{
static
Connection
connection
;
static
Statement
statement
;
static
String
host
=
"127.0.0.1"
;
@Before
public
void
init
()
{
try
{
Properties
properties
=
new
Properties
();
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
);
statement
=
connection
.
createStatement
();
}
catch
(
SQLException
e
)
{
return
;
}
@Test
public
void
jni
()
throws
SQLException
{
// given
Connection
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS://127.0.0.1:0/?user=root&password=taosdata&timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8"
);
Statement
statement
=
connection
.
createStatement
();
// when
boolean
execute
=
statement
.
execute
(
"reset query cache"
);
// then
assertFalse
(
execute
);
assertEquals
(
0
,
statement
.
getUpdateCount
());
statement
.
close
();
connection
.
close
();
}
@Test
public
void
testResetQueryCache
()
throws
SQLException
{
String
resetSql
=
"reset query cache"
;
statement
.
execute
(
resetSql
);
}
public
void
restful
()
throws
SQLException
{
// given
Connection
connection
=
DriverManager
.
getConnection
(
"jdbc:TAOS-RS://127.0.0.1:6041/?user=root&password=taosdata&timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8"
);
Statement
statement
=
connection
.
createStatement
();
// when
boolean
execute
=
statement
.
execute
(
"reset query cache"
);
// then
assertFalse
(
execute
);
assertEquals
(
0
,
statement
.
getUpdateCount
());
@After
public
void
close
()
{
try
{
if
(
statement
!=
null
)
statement
.
close
();
if
(
connection
!=
null
)
connection
.
close
();
}
catch
(
SQLException
e
)
{
e
.
printStackTrace
();
}
}
}
\ No newline at end of file
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/SelectTest.java
浏览文件 @
93b76b1b
...
...
@@ -20,6 +20,8 @@ public class SelectTest {
public
void
createDatabaseAndTable
()
{
try
{
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
,
"root"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
,
"taosdata"
);
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"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/StableTest.java
浏览文件 @
93b76b1b
...
...
@@ -24,6 +24,8 @@ public class StableTest {
public
static
void
createDatabase
()
{
try
{
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_USER
,
"root"
);
properties
.
setProperty
(
TSDBDriver
.
PROPERTY_KEY_PASSWORD
,
"taosdata"
);
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"
);
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/utils/SqlSyntaxValidatorTest.java
已删除
100644 → 0
浏览文件 @
37b43a40
package
com.taosdata.jdbc.utils
;
import
org.junit.Assert
;
import
org.junit.Test
;
public
class
SqlSyntaxValidatorTest
{
@Test
public
void
isSelectSQL
()
{
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isSelectSql
(
"select * from test.weather"
));
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isSelectSql
(
" select * from test.weather"
));
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isSelectSql
(
" select * from test.weather "
));
Assert
.
assertFalse
(
SqlSyntaxValidator
.
isSelectSql
(
"insert into test.weather values(now, 1.1, 2)"
));
}
@Test
public
void
isUseSQL
()
{
Assert
.
assertTrue
(
SqlSyntaxValidator
.
isUseSql
(
"use database test"
));
}
}
\ No newline at end of file
src/query/src/qFill.c
浏览文件 @
93b76b1b
...
...
@@ -206,6 +206,12 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR
}
else
{
assert
(
pFillInfo
->
currentKey
==
ts
);
initBeforeAfterDataBuf
(
pFillInfo
,
prev
);
if
(
pFillInfo
->
type
==
TSDB_FILL_NEXT
&&
(
pFillInfo
->
index
+
1
)
<
pFillInfo
->
numOfRows
)
{
initBeforeAfterDataBuf
(
pFillInfo
,
next
);
++
pFillInfo
->
index
;
copyCurrentRowIntoBuf
(
pFillInfo
,
srcData
,
*
next
);
--
pFillInfo
->
index
;
}
// assign rows to dst buffer
for
(
int32_t
i
=
0
;
i
<
pFillInfo
->
numOfCols
;
++
i
)
{
...
...
@@ -227,6 +233,12 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR
}
else
if
(
pFillInfo
->
type
==
TSDB_FILL_LINEAR
)
{
assignVal
(
output
,
src
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
memcpy
(
*
prev
+
pCol
->
col
.
offset
,
src
,
pCol
->
col
.
bytes
);
}
else
if
(
pFillInfo
->
type
==
TSDB_FILL_NEXT
)
{
if
(
*
next
)
{
assignVal
(
output
,
*
next
+
pCol
->
col
.
offset
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
}
else
{
setNull
(
output
,
pCol
->
col
.
type
,
pCol
->
col
.
bytes
);
}
}
else
{
assignVal
(
output
,
(
char
*
)
&
pCol
->
fillVal
.
i
,
pCol
->
col
.
bytes
,
pCol
->
col
.
type
);
}
...
...
tests/pytest/fulltest.sh
浏览文件 @
93b76b1b
...
...
@@ -338,6 +338,7 @@ python3 ./test.py -f functions/function_twa.py -r 1
python3 ./test.py
-f
functions/function_twa_test2.py
python3 ./test.py
-f
functions/function_stddev_td2555.py
python3 ./test.py
-f
functions/showOfflineThresholdIs864000.py
python3 ./test.py
-f
functions/function_interp.py
python3 ./test.py
-f
insert/metadataUpdate.py
python3 ./test.py
-f
query/last_cache.py
python3 ./test.py
-f
query/last_row_cache.py
...
...
tests/pytest/functions/function_interp.py
0 → 100644
浏览文件 @
93b76b1b
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
sys
import
taos
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
import
numpy
as
np
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
())
self
.
rowNum
=
10
self
.
ts
=
1537146000000
def
run
(
self
):
tdSql
.
prepare
()
tdSql
.
execute
(
"create table t(ts timestamp, k int)"
)
tdSql
.
execute
(
"insert into t values('2021-1-1 1:1:1', 12);"
)
tdSql
.
query
(
"select interp(*) from t where ts='2021-1-1 1:1:1'"
)
tdSql
.
checkRows
(
1
)
tdSql
.
checkData
(
0
,
1
,
12
)
tdSql
.
error
(
"select interp(*) from t where ts >'2021-1-1 1:1:1' and ts < now interval(1s) fill(next)"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录