Module: sip-router
Branch: master
Commit: c5fac4809aac489163bcd9c4fbf6636092000f85
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c5fac48…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Nov 20 23:41:04 2012 +0100
kamctl: new command 'db showg'
- uses \G at end of sql query, resulting in line-formated output (at
least for mysql)
---
utils/kamctl/kamctl | 9 +++++++++
utils/kamctl/kamctl.sqlbase | 1 +
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/utils/kamctl/kamctl b/utils/kamctl/kamctl
index f29c543..3fecd6c 100755
--- a/utils/kamctl/kamctl
+++ b/utils/kamctl/kamctl
@@ -983,6 +983,15 @@ db_ops() {
QUERY="select * FROM $1;"
$DBROCMD "$QUERY"
;;
+ showg)
+ shift
+ if [ $# -ne 1 ] ; then
+ merr "missing table parameter"
+ exit 1
+ fi
+ QUERY="select * FROM $1\\G;"
+ $DBROCMD "$QUERY"
+ ;;
*)
usage_db_ops
exit 1
diff --git a/utils/kamctl/kamctl.sqlbase b/utils/kamctl/kamctl.sqlbase
index b1615b9..7354517 100644
--- a/utils/kamctl/kamctl.sqlbase
+++ b/utils/kamctl/kamctl.sqlbase
@@ -60,6 +60,7 @@ cat <<EOF
db rorun <id> ....................... execute read-only SQL query from
\$id variable
db show <table> ..................... display table content
+ db showg <table> .................... display formatted table content
EOF
}
USAGE_FUNCTIONS="$USAGE_FUNCTIONS usage_db_ops"