~percona-core/percona-xtrabackup/2.1

« back to all changes in this revision

Viewing changes to test/inc/common.sh

  • Committer: Alexey Kopytov
  • Date: 2013-08-20 05:49:17 UTC
  • mfrom: (657.2.2 2.1)
  • Revision ID: akopytov@gmail.com-20130820054917-63jqdcwv305ick7t
MergedĀ lp:~akopytov/percona-xtrabackup/bug1213036-2.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
721
721
    fi
722
722
}
723
723
 
 
724
##############################################################################
 
725
# Execute a multi-row INSERT into a specified table.
 
726
#
 
727
# Arguments:
 
728
#
 
729
#   $1 -- table specification
 
730
#
 
731
#   all subsequent arguments represent tuples to insert in the form:
 
732
#   (value1, ..., valueN)
 
733
#
 
734
# Notes:
 
735
#
 
736
#   1. Bash special characters in the arguments must be quoted to screen them
 
737
#      from interpreting by Bash, i.e. \(1,...,\'a'\)
 
738
#
 
739
#   2. you can use Bash brace expansion to generate multiple tuples, e.g.:
 
740
#      \({1..1000},\'a'\) will generate 1000 tuples (1,'a'), ..., (1000, 'a')
 
741
##############################################################################
 
742
function multi_row_insert()
 
743
{
 
744
    local table=$1
 
745
    shift
 
746
 
 
747
    vlog "Inserting $# rows into $table..."
 
748
    (IFS=,; echo "INSERT INTO $table VALUES $*") | \
 
749
        $MYSQL $MYSQL_ARGS
 
750
    vlog "Done."
 
751
}
 
752
 
724
753
# To avoid unbound variable error when no server have been started
725
754
SRV_MYSQLD_IDS=