X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fmysql2sql;h=7e29c2e4f1ced3ede855624cf23cfcfafeb36418;hb=b064d54e2754cf66f8945411ec1dd14f07a86328;hp=3766c971ba0499fb49c9ef6d54273a7a314673a2;hpb=6f433a4531f0e301f3534de7f0278afbcf79d50e;p=sqlconvert.git diff --git a/scripts/mysql2sql b/scripts/mysql2sql index 3766c97..7e29c2e 100755 --- a/scripts/mysql2sql +++ b/scripts/mysql2sql @@ -31,7 +31,8 @@ def main(infile, encoding, outfile, output_encoding, use_pbar, quoting_style): if size is None: use_pbar = False - print("Converting: ", end='', file=sys.stderr) + if use_pbar: + print("Converting: ", end='', file=sys.stderr) sys.stderr.flush() if use_pbar: @@ -66,7 +67,7 @@ def main(infile, encoding, outfile, output_encoding, use_pbar, quoting_style): if use_pbar: pbar.erase() - print("done.") + print("done.") if __name__ == '__main__': parser = argparse.ArgumentParser(description='Convert MySQL to SQL') @@ -90,7 +91,7 @@ if __name__ == '__main__': parser.add_argument('output_file', nargs='?', help='output file name') args = parser.parse_args() - if int(args.mysql) + int(args.postgres) + int(args.sqlite) > 1: + if int(args.mysql) + int(args.pg) + int(args.sqlite) > 1: print("Error: options -m/-p/-s are mutually incompatible, " "use only one of them", file=sys.stderr) @@ -133,6 +134,7 @@ if __name__ == '__main__': if outfile == '-': outfile = sys.stdout + args.no_pbar = True else: try: outfile = open(outfile, 'wt', encoding=output_encoding) @@ -143,7 +145,7 @@ if __name__ == '__main__': if args.mysql: quoting_style = 'mysql' - elif args.postgres: + elif args.pg: quoting_style = 'postgres' else: quoting_style = 'sqlite'