Răsfoiți Sursa

cmd_db: remove use of CMD_BASE for mysql cli commands

Daniel-Constantin Mierla 5 ani în urmă
părinte
comite
43567e3b21
1 a modificat fișierele cu 4 adăugiri și 8 ștergeri
  1. 4 8
      kamcli/commands/cmd_db.py

+ 4 - 8
kamcli/commands/cmd_db.py

@@ -101,8 +101,7 @@ def db_query(ctx, oformat, ostyle, query):
 def db_connect(ctx):
     dbtype = ctx.gconfig.get("db", "type")
     if dbtype.lower() == "mysql":
-        CMD_BASE = "mysql -h {0} -u {1} -p{2} "
-        scmd = (CMD_BASE + "{3}").format(
+        scmd = ("mysql -h {0} -u {1} -p{2} {3}").format(
             ctx.gconfig.get("db", "host"),
             ctx.gconfig.get("db", "rwuser"),
             ctx.gconfig.get("db", "rwpassword"),
@@ -127,8 +126,7 @@ def db_connect(ctx):
 def db_clirun(ctx, query):
     dbtype = ctx.gconfig.get("db", "type")
     if dbtype == "mysql":
-        CMD_BASE = "mysql -h {0} -u {1} -p{2} "
-        scmd = (CMD_BASE + '-e "{3} ;" {4}').format(
+        scmd = ('mysql -h {0} -u {1} -p{2} -e "{3} ;" {4}').format(
             ctx.gconfig.get("db", "host"),
             ctx.gconfig.get("db", "rwuser"),
             ctx.gconfig.get("db", "rwpassword"),
@@ -155,8 +153,7 @@ def db_clirun(ctx, query):
 def db_clishow(ctx, table):
     dbtype = ctx.gconfig.get("db", "type")
     if dbtype == "mysql":
-        CMD_BASE = "mysql -h {0} -u {1} -p{2} "
-        scmd = (CMD_BASE + '-e "select * from {3} ;" {4}').format(
+        scmd = ('mysql -h {0} -u {1} -p{2} -e "select * from {3} ;" {4}').format(
             ctx.gconfig.get("db", "host"),
             ctx.gconfig.get("db", "rwuser"),
             ctx.gconfig.get("db", "rwpassword"),
@@ -183,8 +180,7 @@ def db_clishow(ctx, table):
 def db_clishowg(ctx, table):
     dbtype = ctx.gconfig.get("db", "type")
     if dbtype == "mysql":
-        CMD_BASE = "mysql -h {0} -u {1} -p{2} "
-        scmd = (CMD_BASE + r'-e "select * from {3} \G" {4}').format(
+        scmd = (r'mysql -h {0} -u {1} -p{2} -e "select * from {3} \G" {4}').format(
             ctx.gconfig.get("db", "host"),
             ctx.gconfig.get("db", "rwuser"),
             ctx.gconfig.get("db", "rwpassword"),