pull conflicts solved
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Thu, 10 Mar 2011 22:34:31 +0000 (23:34 +0100)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Thu, 10 Mar 2011 22:34:31 +0000 (23:34 +0100)
1  2 
sql/builder.sh

diff --combined sql/builder.sh
@@@ -3,22 -3,16 +3,22 @@@
  #
  #  all this part is from mopshop and we will use it to construct the brisk database
  #
 -DBHOST=127.0.0.1
 -DBUSER=brisk
 -DBBASE=brisk
 -DBPASS=briskpass
 -PFX="bsk_"
 +
 +if [ -f $HOME/.db.conf ]; then
 +    source $HOME/.db.conf
 +else
 +    DBHOST=127.0.0.1
 +    DBUSER=brisk
 +    DBBASE=brisk
 +    DBPASS=briskpass
 +    PFX="bsk_"
 +fi
  
  if [ -f $HOME/.brisk_install ]; then
 -   . $HOME/.brisk_install
 +    source $HOME/.brisk_install
  fi
  
 +
  sqlexe () {
      local sht
      sht=$1
@@@ -44,6 -38,9 +44,6 @@@ one_or_all() 
  # MAIN
  #
  sht=0
 -if [ -f $HOME/.db.conf ]; then
 -    source $HOME/.db.conf
 -fi
  
  if [ "$1" = "-s" ]; then
      shift
@@@ -62,24 -59,26 +62,26 @@@ elif [ "$1" = "build" ]; the
      ( echo "-- MESG: build start" ; one_or_all $2 | grep -iv '^drop' ; echo "-- MESG: build end" ;   ) | sqlexe $sht
  elif [ "$1" = "rebuild" ]; then
      ( echo "-- MESG: clean start" ; one_or_all $2 | grep -i '^drop' | tac ; echo "-- MESG: clean end" ; \
 -      echo "-- MESG: build start" ; one_or_all $2 | grep -iv '^drop' ; echo "-- MESG: build end" ;   ) \
 +        echo "-- MESG: build start" ; one_or_all $2 | grep -iv '^drop' ; echo "-- MESG: build end" ;   ) \
          | sqlexe $sht
  elif [ "$1" = "psql" ]; then
-     psql -h $DBHOST -U $DBUSER $DBBASE
+    psql -h $DBHOST -U $DBUSER $DBBASE $@
+ elif [ "$1" = "piped" ]; then
+    psql -h $DBHOST -U $DBUSER $DBBASE -t -q -A -F '|' $@
  elif [ "$1" = "dump" ]; then
 -   if [ $# -eq 1 ]; then
 -      pg_dump -a --inserts -h $DBHOST -U $DBUSER $DBBASE
 -   else
 -      pg_dump -a --inserts -h $DBHOST -U $DBUSER $DBBASE > $2
 -   fi
 +    if [ $# -eq 1 ]; then
 +        pg_dump -a --inserts -h $DBHOST -U $DBUSER $DBBASE
 +    else
 +        pg_dump -a --inserts -h $DBHOST -U $DBUSER $DBBASE > $2
 +    fi
  elif [ "$1" = "dumpall" ]; then
 -   if [ $# -eq 1 ]; then
 -      pg_dump -h $DBHOST -U $DBUSER $DBBASE
 -   else
 -      pg_dump -h $DBHOST -U $DBUSER $DBBASE > $2
 -   fi
 +    if [ $# -eq 1 ]; then
 +        pg_dump -h $DBHOST -U $DBUSER $DBBASE
 +    else
 +        pg_dump -h $DBHOST -U $DBUSER $DBBASE > $2
 +    fi
  elif [ "$1" = "add" ]; then
 -   cat "$2" | psql -h $DBHOST -U $DBUSER $DBBASE
 +    cat "$2" | psql -h $DBHOST -U $DBUSER $DBBASE
  else
      echo " USAGE"
      echo "   ./builder create"
@@@ -88,6 -87,7 +90,7 @@@
      echo "   ./builder build"
      echo "   ./builder rebuild"
      echo "   ./builder psql"
+     echo "   ./builder piped"
      echo "   ./builder add <filesql>"
      echo "   ./builder dump [dumpfile]"
      echo "   ./builder dumpall [dumpfile]"