X-Git-Url: http://mop.ddnsfree.com/gitweb/?a=blobdiff_plain;f=sql%2Fbuilder.sh;h=2f0e60c384d0af4591d1ca0e7a1174f9ea1ee6ab;hb=8bd0ea95b1b1df4fbb7e9cd0b599ec6869c87f0e;hp=4acc242f7555aa81d3fe7e8035da8882e1fa4ba0;hpb=e19ba01834625d96835b3adf385a1defc48f4166;p=brisk.git diff --git a/sql/builder.sh b/sql/builder.sh index 4acc242..2f0e60c 100755 --- a/sql/builder.sh +++ b/sql/builder.sh @@ -14,7 +14,9 @@ usage () { echo " rebuild" echo " psql" echo " piped" - echo " add " + echo " add [ [..]]" + echo " del [ [..]]" + echo " res [ [..]]" echo " dump [dumpfile]" echo " dumpall [dumpfile]" echo " all" @@ -100,7 +102,7 @@ test "$DBUSER" != "" && pg_args="$pg_args -U $DBUSER" test "$DBPORT" != "" && pg_args="$pg_args -p $DBPORT" test "$DBBASE" != "" && pg_args="$pg_args $DBBASE" -MATCH_DROP='^drop|^alter table.* drop ' +MATCH_DROP='^drop|^alter table.* drop |^delete ' case $CMD in "create") @@ -145,7 +147,13 @@ case $CMD in fi ;; "add") - cat "$1" | sqlexe + ( echo "-- MESG: add start" ; cat "$@" | egrep -iv "$MATCH_DROP" ; echo "-- MESG: add end" ; ) | sqlexe + ;; + "del") + ( echo "-- MESG: del start" ; cat "$@" | egrep -i "$MATCH_DROP" | tac ; echo "-- MESG: del end" ; ) | sqlexe + ;; + "res") + ( echo "-- MESG: res start" ; cat "$@" | egrep -i "$MATCH_DROP" | tac ; cat "$@" | egrep -iv "$MATCH_DROP" ; echo "-- MESG: del end" ; ) | sqlexe ;; "help"|"-h"|"--help") usage 0 @@ -155,4 +163,4 @@ case $CMD in ;; esac -exit 0 \ No newline at end of file +exit 0