bin/dump_stats in shiba-0.2.0 vs bin/dump_stats in shiba-0.2.2

- old
+ new

@@ -8,11 +8,11 @@ esac DATABASE=$1 if [ -z "$DATABASE" ] then - echo "usage: dump_stats -tables [table1,table2...] DATABASE [ ...mysql_args]" + echo "usage: dump_stats [-tables table1,table2...] DATABASE [ ...mysql_args]" >&2 exit 1 fi shift @@ -21,10 +21,16 @@ #done MYSQL_STATS=`mktemp` mysql $* -ABe "select * from information_schema.statistics where table_schema = '$DATABASE'" > $MYSQL_STATS +if ! [ -s $MYSQL_STATS ] +then + echo "no such database: $DATABASE" >&2 + exit 1 +fi + if [ "$TABLES" ] then filtered=`mktemp` head -n 1 $MYSQL_STATS >> $filtered for t in $TABLES @@ -33,6 +39,6 @@ done MYSQL_STATS=$filtered fi -bundle exec ruby -e "require 'shiba/index'; puts Shiba::Index.parse('$MYSQL_STATS').to_yaml" \ No newline at end of file +bundle exec ruby -e "require 'shiba/index'; puts Shiba::Index.parse('$MYSQL_STATS').to_yaml"