示例#1
0
# all option
parser.add_option("-a", "--all", action="store_true", dest="do_all",
                  default=False, help="show all usage including empty "
                  "databases")


# Add verbosity mode
add_verbosity(parser, True)

# Now we process the rest of the arguments.
opt, args = parser.parse_args()

# Fail if format specified is invalid
try:
    opt.format = check_format_option(opt.format).upper()
except UtilError, e:
    parser.error(e.errmsg)

from mysql.utilities.common.server import connect_servers

# Parse source connection values
try:
    source_values = parse_connection(opt.server)
except:
    parser.error("Source connection values invalid or cannot be parsed.")

try:
    conn_options = {
        'version'   : "5.1.30",
    }
示例#2
0
                  "--all",
                  action="store_true",
                  dest="do_all",
                  default=False,
                  help="show all usage including empty "
                  "databases")

# Add verbosity mode
add_verbosity(parser, True)

# Now we process the rest of the arguments.
opt, args = parser.parse_args()

# Fail if format specified is invalid
try:
    opt.format = check_format_option(opt.format).upper()
except UtilError, e:
    parser.error(e.errmsg)

from mysql.utilities.common.server import connect_servers

# Parse source connection values
try:
    source_values = parse_connection(opt.server)
except:
    parser.error("Source connection values invalid or cannot be parsed.")

try:
    conn_options = {
        'version': "5.1.30",
    }
示例#3
0
        print "WARNING: Cannot parse exclude list. " + \
              "Proceeding without exclusions."

try:
    skips = check_skip_options(opt.skip_objects)
except UtilError, e:
    print "ERROR: %s" % e.errmsg
    exit(1)

# Fail if no arguments
if len(args) == 0:
    parser.error("You must specify at least one database to export.")

# Fail if format specified is invalid
try:
    opt.format = check_format_option(opt.format, True, True).upper()
except UtilError, e:
    parser.error(e.errmsg)

_PERMITTED_DISPLAY_TYPES = ("NAMES", "BRIEF", "FULL")

if opt.display.upper() not in _PERMITTED_DISPLAY_TYPES:
    print "# WARNING : '%s' is not a valid display mode. Using default." % \
          opt.display
    opt.display = "BRIEF"
else:
    opt.display = opt.display.upper()

_PERMITTED_EXPORTS = ("DATA", "DEFINITIONS", "BOTH", "D", "F", "B")

if opt.export.upper() not in _PERMITTED_EXPORTS:
示例#4
0
# Warn if quiet and verbosity are both specified
check_verbosity(opt)

try:
    skips = check_skip_options(opt.skip_objects)
except UtilError, e:
    print "ERROR: %s" % e.errmsg
    exit(1)

# Fail if no arguments
if len(args) == 0:
    parser.error("You must specify at least one file to import.")

# Fail if format specified is invalid
try:
    opt.format = check_format_option(opt.format, True, True).upper()
except UtilError, e:
    parser.error(e.errmsg)

_PERMITTED_EXPORTS = ("DATA", "DEFINITIONS", "BOTH", "D", "F", "B")

if opt.import_type.upper() not in _PERMITTED_EXPORTS:
    print "# WARNING : '%s' is not a valid import mode. Using default." % \
          opt.import_type
    opt.import_type = "DEFINITIONS"
else:
    opt.import_type = opt.import_type.upper()

# Convert to full word for easier coding in command module
if opt.import_type == "D":
    opt.import_type = "DATA"