manage connections
i think it would be nice if we can write commands in bzr style. for example, suppose that the tool is named xxx
xxx con.add my_con host:localhost port:3306 user:root pwd:root
(however, these are default values)
xxx con.open my_con (closes the last opened connection and open new connection)
xxx con.close
xxx con.delete my_con
execute commands
xxx cmd.exec "SELECT …"
xxx cmd.add my_query "SELECT…."
executes SELECT and prints output
xxx cmd.exec my_query
xxx cmd.drop my_query
execute files
xxx file.exec "unit.sql"
parses the file to find and replace macros. executes the modified file
xxx file.compile
doesnt exec file, just creates a copy with the macros replaced
macros
## DBUG (at the end of a line)
execute line only if —dbug flag is set
## DEFINE … (like in C)
## IFDEF, IF, ELIF, ENDIF
## ERROR message
Stops and outputs message
## INCLUDE parses a file and include the result
system macros
DBMS (mariadb or mysql)
VERSION
exec "SELECT version()" and parse the string to determine these macros
it is useful, so one can write in a file:
## IF VERSION >= 5.5 THEN
do_something that 5.3 can't do
## ENDIF
ALIAS
alias like bzr, saved in a conf file
http://doc.bazaar.canonical.com/bzr.1.0/en/user-guide/index.html#using-aliases
It would be GREAT if an alias can execute more than one command
so i can call
xxx load_unit
which executes:
xxx open maria51
xxx file.exec unit.sql
…
xxx open maria52
xxx file.exec unit.sql
xxx exec "CALL test_suite_run('stk_unit');"
xxx exec "SELECT test_suite_show((SELECT LAST_INSERT_ID()));"
…
xxx close maria 100
so in 1 command i could see all errors