1
0
mirror of https://github.com/kedarvj/mysqldumpsplitter.git synced 2025-08-21 23:56:08 +02:00

Version 3.0

Complete Rewrite.
Minor error handling changes.
This commit is contained in:
kedarvj
2015-03-02 17:45:54 +05:30
parent 2c28884a10
commit 4e696ae411

View File

@@ -74,14 +74,14 @@ parse_result()
## Parse Extract Operation ## Parse Extract Operation
case $EXTRACT in case $EXTRACT in
ALLDBS|ALLTABLES ) ;; ALLDBS|ALLTABLES|REGEXP ) ;;
DB|TABLE|REGEXP) DB|TABLE|REGEXP)
if [ "$OBJECT_NAME" = '' ]; then if [ "$OBJECT_NAME" = '' ]; then
echo "${txtred}ERROR: Expecting input for option --match_string.${txtrst}" echo "${txtred}ERROR: Expecting input for option --match_string.${txtrst}"
exit 1; exit 1;
fi; fi;
;; ;;
* ) echo "${txtred}ERROR:Wrong option for --extract.${txtrst}" * ) echo "${txtred}ERROR: Please specify correct option for --extract.${txtrst}"
usage; usage;
esac; esac;
@@ -174,18 +174,40 @@ dump_splitter()
esac esac
} }
missing_arg()
{
echo "${txtred}ERROR:Missing argument $1.${txtrst}"
exit 1;
}
# Accepts Parameters # Accepts Parameters
while [ "$1" != "" ]; do while [ "$1" != "" ]; do
case $1 in case $1 in
--source|-S ) shift --source|-S ) shift
if [ -z $1 ]; then
missing_arg --source
fi;
SOURCE_DUMP=$1 ;; SOURCE_DUMP=$1 ;;
--extract|-E ) shift --extract|-E ) shift
if [ -z $1 ]; then
missing_arg --extract
fi;
EXTRACT=$1 ;; EXTRACT=$1 ;;
--compression|-C ) shift --compression|-C ) shift
if [ -z $1 ]; then
missing_arg --source
fi;
COMPRESSION=$1 ;; COMPRESSION=$1 ;;
--output_dir|-O ) shift --output_dir|-O ) shift
if [ -z $1 ]; then
missing_arg --source
fi;
OUT_DIR=$1 ;; OUT_DIR=$1 ;;
--match_str|-M ) shift --match_str|-M ) shift
if [ -z $1 ]; then
missing_arg --match_str
fi;
OBJECT_NAME=$1 ;; OBJECT_NAME=$1 ;;
-h ) usage -h ) usage
exit ;; exit ;;
@@ -199,4 +221,3 @@ done
parse_result parse_result
dump_splitter dump_splitter
exit 0; exit 0;