From: Anton Ageev Date: Wed, 10 Dec 2008 05:30:35 +0000 (+0300) Subject: Remove \0 from string data. Replace '0000-00-00 00:00' date/datetime to '1970-01... X-Git-Url: http://git.neszt.hu/?a=commitdiff_plain;h=691d651679046189be7e9662bb180af2906b65ac;p=mysql2postgres Remove \0 from string data. Replace '0000-00-00 00:00' date/datetime to '1970-01-01 00:00'. --- diff --git a/mysql2psql b/mysql2psql index 9dba587..58ceb60 100755 --- a/mysql2psql +++ b/mysql2psql @@ -446,7 +446,7 @@ class PostgresDbWriter < PostgresWriter next end if row[index].is_a?(Mysql::Time) - row[index] = row[index].to_s + row[index] = row[index].to_s.gsub('0000-00-00 00:00', '1970-01-01 00:00') next end @@ -459,7 +459,7 @@ class PostgresDbWriter < PostgresWriter if column_type(column) == "bytea" row[index] = PGconn.quote(row[index]) else - row[index] = row[index].gsub(/\\/, '\\\\\\').gsub(/\n/,'\n').gsub(/\t/,'\t').gsub(/\r/,'\r') + row[index] = row[index].gsub(/\\/, '\\\\\\').gsub(/\n/,'\n').gsub(/\t/,'\t').gsub(/\r/,'\r').gsub(/\0/, '') end end end