[pgsql-jp: 39428] Q) mysqlからの移植 insert でのエスケープ

User ken ken @ tydfam.jp
2008年 6月 18日 (水) 19:06:08 JST


 山田@町田市です。
 JBoss SeamのExample/wikiのDBをpostgreSQLに移行させようとしているのですが、下のようなエスケープが大量に付くテキストが一つあります。 これは、どのようにして移行させれば良いのでしょうか? (googleしてみましたが、copyでのエスケープの取扱いは見つかったのですが、insert文の中での処理はちょっと見つけられなかったので質問します。)

  ちょっと長くなってしまいますが、問題の部分をそのまま以下に入れました。

  宜しくお願いします。

========================================================================
INSERT INTO WIKI_DOCUMENT (NODE_ID, CONTENT, CONTENT_MACROS, ENABLE_COMMENT_FORM, ENABLE_COMMENTS, ENABLE_COMMENTS_ON_FEEDS, FOOTER, FOOTER_MACROS, HEADER, HEADER_MACROS, NAME_AS_TITLE) VALUES (7,'Most content on this website (blogs, blog comments, wiki pages, user profiles) is rendered using the [Seam Text=>http://docs.jboss.com/seam/latest/reference/en/html/text.html] engine. If you are creating content, it helps to know a few simple tricks.E'\n\n'++ Basic formatting\n\nYou can emphasize words using *emphasis*, _underline_, ~strikeout~ or ^superscript^.\n\n"You can emphasize words using\n*emphasis*, _underline_, ~strikeout~ or ^superscript^."E'\n\n'But if you really want to type a special character such as E'\\*' or E'\\+', you need to escape it with a E'\\\\'.E'\n\n'"But if you really want to type a special characterE'\n'such as E'\\*' or E'\\+', you need to escape it with a E'\\\\'."E'\n\n'Alternatively, you can use special characters freely inside |monospace text|.E'\n\n'"Alternatively, you can use special characters freely\ninside |monospace text|.E'"\n\n'++ Block formattingE'\n\n'Of course, you can also use E'\"'inline quotesE'\"'.E'\n\n\'"And block quotes.E'\'"E'\n\n'And split text across several paragraphs.E'\n\n'"Of course, you can also use E'\"'inline quotesE'\"'.E'\n\n\'"And block quotes.E'\'"E'\n\n'And split text across several paragraphs."E'\n\n'You can createE'\n\n'= unorderedlistsE'\n'= of stuffE'\n'= like thisE'\n\'norE'\n\n'# numbered listsE'\n'# of other things\n\n"You can create\n= unordered lists\n= of stuff\n= like this\n\nor\n\n# numbered lists\n# of other things"\n\n++ Code Blocks\n\nA third option for embedding text that uses special characters is to use a code block, delimited by "backticks". For example:\n\n<pre>\\"for (int i\\=0; i\\<100; i\\+\\+) {\n   log.info(\\\"Hello world!\\\");\n}\\"</pre>\n\n+ Here is a first-level heading\n\nHere is a normal paragraph.\n\n++ Here is a second-level heading\n\nAnd another paragraph.\n\n"+ Here is a first-level heading\n\nHere is a normal paragraph.\n\n++ Here is a second-level heading\n\nAnd another paragraph."\n\n++ Links\n\nThe wiki has powerful handling for links.\n\nHTML links to [=>http://hibernate.org] or attach the link to [some link text=>http://hibernate.org].\nMy [e-mail address=>mailto:foo @ bar.tld] will be automatically protected.\n\n"HTML links to [=>http://hibernate.org] or attach the\nlink to [some link text=>http://hibernate.org].\nMy [e-mail address=>mailto:foo @ bar.tld] will be\nautomatically protected."\n\nInternal wiki links simply use area and document/file names:\n\n= Link to  another document: \\[\\=\\>My Document\\] \n= Link to another document with link text: \\[A document\\=\\>My Document\\]\n= Link to another document in another area: \\[\\=\\>Another Area\\|My Document\\]\n= Link to an uploaded file or image: \\[\\=\\>My Upload\\]\n\nYou can even link to a [Hibernate JIRA issue=>hhh://2702], or a\n[Seam JIRA issue=>jbseam://1920].\n\n"You can even link to a [Hibernate JIRA issue=>hhh://2702],\nor a [Seam JIRA issue=>jbseam://1920]."\n\n++ Embedded HTML\n\nYou can even use <i>many</i> HTML tags directly, but <b>not</b> tags that would create a security vulnerability!\n\n"You can even use <i>many</i> HTML tags directly,\nbut <b>not</b> tags that would create a\nsecurity vulnerability!"',NULL,false,false,false,NULL,NULL,NULL,NULL,true);
=========================================================================


pgsql-jp メーリングリストの案内