X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=docs%2Fmysql2sql.rst;h=e51ea60404c435b1f5d639dbed8534244a2ee535;hb=a745f0f7a38739e6b5274060bfd38abd4ba4638b;hp=9c1892d62a7054d88bf410624e5fb5144f25b1e9;hpb=3f7475849c0b2a9cc505381f5e3750404d626877;p=sqlconvert.git diff --git a/docs/mysql2sql.rst b/docs/mysql2sql.rst index 9c1892d..e51ea60 100644 --- a/docs/mysql2sql.rst +++ b/docs/mysql2sql.rst @@ -2,11 +2,14 @@ mysql2sql ========= This is mysql2sql, a mysql to sql converter. It is primary intended to -convert mysqldump (especially with extended INSERT syntax) to standard -SQL to load at least to PostgreSQL or SQLite. +convert mysqldump (especially with extended INSERT syntax) to standard SQL +to load at least to PostgreSQL or SQLite. -The program is in its initial phase and currently cannot do much. It only -removes /\*! directives \*/ and passes everything else unmodified. +The program removes /\*! directives \*/, unquotes names quoted with +backticks, quote non-lowercase names with double quotes, unescapes strings +and escapes them to a different quoting style, and splits extended INSERTs +into a series of plain INSERTs separated by newlines. Everything else is +passed unmodified. .. highlight:: none @@ -19,7 +22,7 @@ mysql2sql Usage:: - mysql2sql [-e encoding] [-E output_encoding] [infile] [[-o] outfile] + mysql2sql [-e encoding] [-E output_encoding] [-m/-p/-s] [infile] [[-o] outfile] Options:: @@ -29,12 +32,23 @@ Options:: separate output encoding, default is the same as `-e` except for console; for console output charset from the current locale is used + -m, --mysql MySQL/MariaDB quoting style + -p, --pg, --postgres PostgreSQL quoting style + -s, --sqlite Generic SQL/SQLite quoting style (default) -P, --no-pbar Inhibit progress bar infile Input file, stdin if absent or '-' -o, --outfile outfile Output file, stdout if absent or '-' -If stderr is connected to the console the program displays a text mode progress -bar. Option `-P/--no-pbar` inhibits it. +Options `-m/-p/-s` change quoting style. `-m` sets MySQL quoting style; +it's added to use the program in the following scenario: convert MySQL +dumps with extended INSERTs to SQL with plain INSERTS suitable to be fed +back to MySQL. `-p` sets PostgreSQL quoting style; it's like MySQL with +additional `E''-style quoting +`_. +`-s` sets generic SQL/SQLite quoting style; this is the default. + +If stderr is connected to the console the program displays a text mode +progress bar. Option `-P/--no-pbar` inhibits it. Option `-o` is useful when infile is absent (input is redirected), for example::