fix type bug
This commit is contained in:
parent
923ba83b9a
commit
fb51235980
|
@ -311,7 +311,7 @@ int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
||||||
createInfo->path.z[createInfo->path.n] = 0;
|
createInfo->path.z[createInfo->path.n] = 0;
|
||||||
|
|
||||||
strdequote(createInfo->path.z);
|
strdequote(createInfo->path.z);
|
||||||
|
|
||||||
if (strlen(createInfo->path.z) >= PATH_MAX) {
|
if (strlen(createInfo->path.z) >= PATH_MAX) {
|
||||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg2);
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,9 @@ int32_t handleUserDefinedFunc(SSqlObj* pSql, struct SSqlInfo* pInfo) {
|
||||||
if (ret) {
|
if (ret) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
if (!isValidScript(buf, len)) {
|
//distinguish *.lua and *.so
|
||||||
|
int32_t pathLen = (int32_t)strlen(createInfo->path.z);
|
||||||
|
if ((pathLen > 3) && (0 == strncmp(createInfo->path.z + pathLen - 3, "lua", 3)) && !isValidScript(buf, len)) {
|
||||||
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
return invalidSqlErrMsg(tscGetErrorMsgPayload(pCmd), msg4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "ttype.h"
|
#include "ttype.h"
|
||||||
#include "tstrbuild.h"
|
#include "tstrbuild.h"
|
||||||
#include "queryLog.h"
|
#include "queryLog.h"
|
||||||
|
#include "ttokendef.h"
|
||||||
|
|
||||||
static ScriptEnvPool *pool = NULL;
|
static ScriptEnvPool *pool = NULL;
|
||||||
|
|
||||||
|
@ -226,9 +227,23 @@ void luaValueToTaosType(lua_State *lua, char *interBuf, int32_t *numOfOutput, in
|
||||||
break;
|
break;
|
||||||
case LUA_TNUMBER:
|
case LUA_TNUMBER:
|
||||||
{
|
{
|
||||||
float v = lua_tonumber(lua, -1);
|
if (oType == TSDB_DATA_TYPE_FLOAT) {
|
||||||
memcpy(interBuf, (char *)&v, oBytes);
|
float v = lua_tonumber(lua, -1);
|
||||||
sz = 1;
|
memcpy(interBuf, (char *)&v, oBytes);
|
||||||
|
sz = 1;
|
||||||
|
} else if (oType == TSDB_DATA_TYPE_DOUBLE) {
|
||||||
|
double v = lua_tonumber(lua, -1);
|
||||||
|
memcpy(interBuf, (char *)&v, oBytes);
|
||||||
|
sz = 1;
|
||||||
|
} else if (oType == TSDB_DATA_TYPE_BIGINT) {
|
||||||
|
int64_t v = lua_tonumber(lua, -1);
|
||||||
|
memcpy(interBuf, (char *)&v, oBytes);
|
||||||
|
sz = 1;
|
||||||
|
} else if (oType <= TSDB_DATA_TYPE_INT) {
|
||||||
|
int32_t v = lua_tonumber(lua, -1);
|
||||||
|
memcpy(interBuf, (char *)&v, oBytes);
|
||||||
|
sz = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case LUA_TTABLE:
|
case LUA_TTABLE:
|
||||||
|
|
Loading…
Reference in New Issue