Skip to content

Commit

Permalink
Quote Everything!
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Wrobel committed Oct 31, 2013
1 parent fd18356 commit 7e18401
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

## Command-Line usage (recommended)

1. `PGPASSWORD=yourpass pg_dump -h localhost --column-inserts --no-acl --no-owner --format p --data-only dbname -f pgfile.sql`
1. `PGPASSWORD=yourpass pg_dump -h localhost --column-inserts --quote-all-identifiers \`
`--no-acl --no-owner --format p --data-only dbname -f pgfile.sql`

Additional documentation for `pg_dump` [here](http://www.postgresql.org/docs/9.3/static/app-pgdump.html)

1. `php pg2mysql_cli.php pgfile.sql mysqlfile.sql [engine]`
* `pgfile.sql` will not be modified
* `mysqlfile.sql` will be overwritten if already exists
* engine is optional, defaults if not specified is InnoDB
* engine is optional, default if not specified is InnoDB

1. `mysql dbname < mysqlfile.sql`

Expand Down
5 changes: 2 additions & 3 deletions pg2mysql.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,9 +342,8 @@ function pg2mysql(&$input, $header=true)
if(strstr($line," PRIMARY KEY ") && substr($line,-3,-1)==");") {
//looks like we have a single line PRIMARY KEY definition, lets go ahead and add it
$output.=$pkey;
//the postgres and mysql syntax for this is (at least, in the example im looking at)
//identical, so we can just add it as is.
$output.=$line;
//MySQL and Postgres syntax are similar here, minus quoting differences
$output.=str_replace("\"","`",$line);
}
}

Expand Down

0 comments on commit 7e18401

Please sign in to comment.