fix: add $cols to script support
This commit is contained in:
parent
80f77251b2
commit
1b71cd4b8d
|
@ -161,6 +161,7 @@ typedef struct _script_t {
|
||||||
bool killed;
|
bool killed;
|
||||||
void *taos;
|
void *taos;
|
||||||
char rows[12]; // number of rows data retrieved
|
char rows[12]; // number of rows data retrieved
|
||||||
|
char cols[12]; // number of columns data retrieved
|
||||||
char data[MAX_QUERY_ROW_NUM][MAX_QUERY_COL_NUM][MAX_QUERY_VALUE_LEN]; // query results
|
char data[MAX_QUERY_ROW_NUM][MAX_QUERY_COL_NUM][MAX_QUERY_VALUE_LEN]; // query results
|
||||||
char system_exit_code[12];
|
char system_exit_code[12];
|
||||||
char system_ret_content[MAX_SYSTEM_RESULT_LEN];
|
char system_ret_content[MAX_SYSTEM_RESULT_LEN];
|
||||||
|
|
|
@ -93,6 +93,8 @@ char *simGetVariable(SScript *script, char *varName, int32_t varLen) {
|
||||||
|
|
||||||
if (strncmp(varName, "rows", varLen) == 0) return script->rows;
|
if (strncmp(varName, "rows", varLen) == 0) return script->rows;
|
||||||
|
|
||||||
|
if (strncmp(varName, "cols", varLen) == 0) return script->cols;
|
||||||
|
|
||||||
if (strncmp(varName, "system_exit", varLen) == 0) return script->system_exit_code;
|
if (strncmp(varName, "system_exit", varLen) == 0) return script->system_exit_code;
|
||||||
|
|
||||||
if (strncmp(varName, "system_content", varLen) == 0) return script->system_ret_content;
|
if (strncmp(varName, "system_content", varLen) == 0) return script->system_ret_content;
|
||||||
|
@ -808,6 +810,7 @@ bool simExecuteNativeSqlCommand(SScript *script, char *rest, bool isSlow) {
|
||||||
|
|
||||||
taos_free_result(pSql);
|
taos_free_result(pSql);
|
||||||
sprintf(script->rows, "%d", numOfRows);
|
sprintf(script->rows, "%d", numOfRows);
|
||||||
|
sprintf(script->cols, "%d", num_fields);
|
||||||
|
|
||||||
script->linePos++;
|
script->linePos++;
|
||||||
return true;
|
return true;
|
||||||
|
@ -822,6 +825,7 @@ bool simExecuteSqlImpCmd(SScript *script, char *rest, bool isSlow) {
|
||||||
|
|
||||||
simDebug("script:%s, exec:%s", script->fileName, rest);
|
simDebug("script:%s, exec:%s", script->fileName, rest);
|
||||||
strcpy(script->rows, "-1");
|
strcpy(script->rows, "-1");
|
||||||
|
strcpy(script->cols, "-1");
|
||||||
for (int32_t row = 0; row < MAX_QUERY_ROW_NUM; ++row) {
|
for (int32_t row = 0; row < MAX_QUERY_ROW_NUM; ++row) {
|
||||||
for (int32_t col = 0; col < MAX_QUERY_COL_NUM; ++col) {
|
for (int32_t col = 0; col < MAX_QUERY_COL_NUM; ++col) {
|
||||||
strcpy(script->data[row][col], "null");
|
strcpy(script->data[row][col], "null");
|
||||||
|
@ -918,6 +922,7 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
|
||||||
|
|
||||||
simDebug("script:%s, exec:%s", script->fileName, rest);
|
simDebug("script:%s, exec:%s", script->fileName, rest);
|
||||||
strcpy(script->rows, "-1");
|
strcpy(script->rows, "-1");
|
||||||
|
strcpy(script->cols, "-1");
|
||||||
for (int32_t row = 0; row < MAX_QUERY_ROW_NUM; ++row) {
|
for (int32_t row = 0; row < MAX_QUERY_ROW_NUM; ++row) {
|
||||||
for (int32_t col = 0; col < MAX_QUERY_COL_NUM; ++col) {
|
for (int32_t col = 0; col < MAX_QUERY_COL_NUM; ++col) {
|
||||||
strcpy(script->data[row][col], "null");
|
strcpy(script->data[row][col], "null");
|
||||||
|
|
Loading…
Reference in New Issue