Merge pull request #23618 from taosdata/fix/3.0/TS-4233

fix shellRunSingleCommandImp
This commit is contained in:
dapan1121 2023-11-14 13:49:41 +08:00 committed by GitHub
commit a47c7c1b65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 16 deletions

View File

@ -120,6 +120,10 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 2 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 3 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 4 ,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/slimit.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts-4233.py
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts-4233.py -Q 2
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts-4233.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts-4233.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreDnode.py -N 5 -M 3 -i False ,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreDnode.py -N 5 -M 3 -i False
,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreVnode.py -N 5 -M 3 -i False ,,y,system-test,./pytest.sh python3 ./test.py -f 3-enterprise/restore/restoreVnode.py -N 5 -M 3 -i False

View File

@ -0,0 +1,46 @@
import taos
from util.log import *
from util.sql import *
from util.cases import *
from util.dnodes import *
from util.common import *
class TDTestCase:
def init(self, conn, logSql, replicaVar=1):
self.replicaVar = int(replicaVar)
tdLog.debug(f"start to excute {__file__}")
tdSql.init(conn.cursor(), True)
def checksql(self, sql):
result = os.popen("taos -s '%s'" %sql)
res = result.read()
print(res)
if ("Query OK" in res):
tdLog.info(f"checkEqual success")
else :
tdLog.exit(f"checkEqual error")
def check(self):
conn = taos.connect()
sql = "select 'a;b' as x"
tdSql.query(f"%s" %sql)
tdSql.checkRows(1)
self.checksql('select "a;b" as x\G')
self.checksql('select "a;b" as x >> /tmp/res.txt')
return
def run(self):
tdSql.prepare()
self.check()
def stop(self):
tdSql.close()
tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())

View File

@ -199,22 +199,17 @@ void shellRunSingleCommandImp(char *command) {
bool printMode = false; bool printMode = false;
if ((sptr = strstr(command, ">>")) != NULL) { if ((sptr = strstr(command, ">>")) != NULL) {
cptr = strstr(command, ";");
if (cptr != NULL) {
*cptr = '\0';
}
fname = sptr + 2; fname = sptr + 2;
while (*fname == ' ') fname++; while (*fname == ' ') fname++;
*sptr = '\0'; *sptr = '\0';
}
if ((sptr = strstr(command, "\\G")) != NULL) { cptr = strstr(fname, ";");
cptr = strstr(command, ";");
if (cptr != NULL) { if (cptr != NULL) {
*cptr = '\0'; *cptr = '\0';
} }
}
if ((sptr = strstr(command, "\\G")) != NULL) {
*sptr = '\0'; *sptr = '\0';
printMode = true; // When output to a file, the switch does not work. printMode = true; // When output to a file, the switch does not work.
} }

View File

@ -236,22 +236,17 @@ void shellRunSingleCommandWebsocketImp(char *command) {
bool printMode = false; bool printMode = false;
if ((sptr = strstr(command, ">>")) != NULL) { if ((sptr = strstr(command, ">>")) != NULL) {
cptr = strstr(command, ";");
if (cptr != NULL) {
*cptr = '\0';
}
fname = sptr + 2; fname = sptr + 2;
while (*fname == ' ') fname++; while (*fname == ' ') fname++;
*sptr = '\0'; *sptr = '\0';
}
if ((sptr = strstr(command, "\\G")) != NULL) { cptr = strstr(fname, ";");
cptr = strstr(command, ";");
if (cptr != NULL) { if (cptr != NULL) {
*cptr = '\0'; *cptr = '\0';
} }
}
if ((sptr = strstr(command, "\\G")) != NULL) {
*sptr = '\0'; *sptr = '\0';
printMode = true; // When output to a file, the switch does not work. printMode = true; // When output to a file, the switch does not work.
} }