change
This commit is contained in:
commit
20f8aeba6b
|
@ -466,6 +466,10 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, SSqlCmd *pCmd, int1
|
||||||
|
|
||||||
int32_t cnt = 0;
|
int32_t cnt = 0;
|
||||||
int32_t j = 0;
|
int32_t j = 0;
|
||||||
|
if (sToken.n >= TSDB_MAX_BYTES_PER_ROW) {
|
||||||
|
return tscSQLSyntaxErrMsg(pCmd->payload, "too long string", sToken.z);
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32_t k = 1; k < sToken.n - 1; ++k) {
|
for (uint32_t k = 1; k < sToken.n - 1; ++k) {
|
||||||
if (sToken.z[k] == '\\' || (sToken.z[k] == delim && sToken.z[k + 1] == delim)) {
|
if (sToken.z[k] == '\\' || (sToken.z[k] == delim && sToken.z[k + 1] == delim)) {
|
||||||
tmpTokenBuf[j] = sToken.z[k + 1];
|
tmpTokenBuf[j] = sToken.z[k + 1];
|
||||||
|
@ -705,7 +709,7 @@ static int32_t doParseInsertStatement(SSqlCmd* pCmd, char **str, STableDataBlock
|
||||||
}
|
}
|
||||||
|
|
||||||
code = TSDB_CODE_TSC_INVALID_SQL;
|
code = TSDB_CODE_TSC_INVALID_SQL;
|
||||||
char tmpTokenBuf[16*1024] = {0}; // used for deleting Escape character: \\, \', \"
|
char tmpTokenBuf[TSDB_MAX_BYTES_PER_ROW] = {0}; // used for deleting Escape character: \\, \', \"
|
||||||
|
|
||||||
int32_t numOfRows = 0;
|
int32_t numOfRows = 0;
|
||||||
code = tsParseValues(str, dataBuf, maxNumOfRows, pCmd, &numOfRows, tmpTokenBuf);
|
code = tsParseValues(str, dataBuf, maxNumOfRows, pCmd, &numOfRows, tmpTokenBuf);
|
||||||
|
|
|
@ -314,7 +314,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (pInfo->type == TSDB_SQL_DROP_DNODE) {
|
} else if (pInfo->type == TSDB_SQL_DROP_DNODE) {
|
||||||
pzName->n = strdequote(pzName->z);
|
if (pzName->type == TK_STRING) {
|
||||||
|
pzName->n = strdequote(pzName->z);
|
||||||
|
}
|
||||||
strncpy(pCmd->payload, pzName->z, pzName->n);
|
strncpy(pCmd->payload, pzName->z, pzName->n);
|
||||||
} else { // drop user/account
|
} else { // drop user/account
|
||||||
if (pzName->n >= TSDB_USER_LEN) {
|
if (pzName->n >= TSDB_USER_LEN) {
|
||||||
|
@ -392,7 +394,9 @@ int32_t tscToSQLCmd(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SStrToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0);
|
SStrToken* id = taosArrayGet(pInfo->pMiscInfo->a, 0);
|
||||||
id->n = strdequote(id->z);
|
if (id->type == TK_STRING) {
|
||||||
|
id->n = strdequote(id->z);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6674,9 +6678,8 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
|
||||||
const char* msg5 = "sql too long"; // todo ADD support
|
const char* msg5 = "sql too long"; // todo ADD support
|
||||||
const char* msg6 = "from missing in subclause";
|
const char* msg6 = "from missing in subclause";
|
||||||
const char* msg7 = "time interval is required";
|
const char* msg7 = "time interval is required";
|
||||||
const char* msg8 = "query column is required";
|
const char* msg8 = "the first column should be primary timestamp column";
|
||||||
const char* msg9 = "the first column must be timestamp type";
|
|
||||||
|
|
||||||
SSqlCmd* pCmd = &pSql->cmd;
|
SSqlCmd* pCmd = &pSql->cmd;
|
||||||
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
|
SQueryInfo* pQueryInfo = tscGetQueryInfoDetail(pCmd, 0);
|
||||||
assert(pQueryInfo->numOfTables == 1);
|
assert(pQueryInfo->numOfTables == 1);
|
||||||
|
@ -6747,7 +6750,7 @@ int32_t doCheckForStream(SSqlObj* pSql, SSqlInfo* pInfo) {
|
||||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg8);
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg8);
|
||||||
}
|
}
|
||||||
if( pSqlExpr->colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX) {
|
if( pSqlExpr->colInfo.colId != PRIMARYKEY_TIMESTAMP_COL_INDEX) {
|
||||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg9);
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg8);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (pQueryInfo->interval.interval == 0) {
|
if (pQueryInfo->interval.interval == 0) {
|
||||||
|
|
|
@ -340,8 +340,12 @@ static void tscSetRetryTimer(SSqlStream *pStream, SSqlObj *pSql, int64_t timer)
|
||||||
if (pStream->isProject) {
|
if (pStream->isProject) {
|
||||||
int64_t now = taosGetTimestamp(pStream->precision);
|
int64_t now = taosGetTimestamp(pStream->precision);
|
||||||
int64_t etime = now > pStream->etime ? pStream->etime : now;
|
int64_t etime = now > pStream->etime ? pStream->etime : now;
|
||||||
|
int64_t maxRetent = tsMaxRetentWindow * 1000;
|
||||||
if (pStream->etime < now && now - pStream->etime > tsMaxRetentWindow) {
|
if(pStream->precision == TSDB_TIME_PRECISION_MICRO) {
|
||||||
|
maxRetent *= 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pStream->etime < now && now - pStream->etime > maxRetent) {
|
||||||
/*
|
/*
|
||||||
* current time window will be closed, since it too early to exceed the maxRetentWindow value
|
* current time window will be closed, since it too early to exceed the maxRetentWindow value
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -5,6 +5,8 @@ import org.junit.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.*;
|
import java.sql.*;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
public class TSDBPreparedStatementTest {
|
public class TSDBPreparedStatementTest {
|
||||||
|
|
||||||
|
@ -302,7 +304,7 @@ public class TSDBPreparedStatementTest {
|
||||||
stmt.execute("create database dbtest");
|
stmt.execute("create database dbtest");
|
||||||
Assert.assertThrows(SQLException.class, () -> stmt.execute("create database dbtest"));
|
Assert.assertThrows(SQLException.class, () -> stmt.execute("create database dbtest"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setBoolean() throws SQLException {
|
public void setBoolean() throws SQLException {
|
||||||
// given
|
// given
|
||||||
|
|
|
@ -177,7 +177,8 @@ public class TSDBResultSetTest {
|
||||||
rs.getAsciiStream("f1");
|
rs.getAsciiStream("f1");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = SQLFeatureNotSupportedException.class)
|
@SuppressWarnings("deprecation")
|
||||||
|
@Test(expected = SQLFeatureNotSupportedException.class)
|
||||||
public void getUnicodeStream() throws SQLException {
|
public void getUnicodeStream() throws SQLException {
|
||||||
rs.getUnicodeStream("f1");
|
rs.getUnicodeStream("f1");
|
||||||
}
|
}
|
||||||
|
|
|
@ -625,6 +625,10 @@ static int64_t g_totalChildTables = 0;
|
||||||
static SQueryMetaInfo g_queryInfo;
|
static SQueryMetaInfo g_queryInfo;
|
||||||
static FILE * g_fpOfInsertResult = NULL;
|
static FILE * g_fpOfInsertResult = NULL;
|
||||||
|
|
||||||
|
#if _MSC_VER <= 1900
|
||||||
|
#define __func__ __FUNCTION__
|
||||||
|
#endif
|
||||||
|
|
||||||
#define debugPrint(fmt, ...) \
|
#define debugPrint(fmt, ...) \
|
||||||
do { if (g_args.debug_print || g_args.verbose_print) \
|
do { if (g_args.debug_print || g_args.verbose_print) \
|
||||||
fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0)
|
fprintf(stderr, "DEBG: "fmt, __VA_ARGS__); } while(0)
|
||||||
|
|
Loading…
Reference in New Issue