github.com/pingcap/ticdc@v0.0.0-20220526033649-485a10ef2652/tests/_utils/run_sql (about)

     1  #!/bin/sh
     2  # parameter 1: sql
     3  # parameter 2: database host
     4  # parameter 3: database port
     5  # parameter 4: other mysql client settings
     6  
     7  set -e
     8  
     9  sql=${1}
    10  
    11  host=127.0.0.1
    12  if [ $# -gt 1 ]; then
    13      shift
    14      host=${1}
    15  fi
    16  
    17  port=4000
    18  if [ $# -gt 1 ]; then
    19      shift
    20      port=${1}
    21  fi
    22  
    23  if [ $# -gt 1 ]; then
    24      shift
    25      other=${*}
    26  fi
    27  
    28  echo "[$(date)] Executing SQL: ${sql}" > "$OUT_DIR/sql_res.$TEST_NAME.txt"
    29  mysql -uroot -h${host} -P${port} ${other} --default-character-set utf8mb4 -E -e "${sql}" > "$OUT_DIR/sql_res.$TEST_NAME.txt"