hbwf / mybatis

Automatically exported from code.google.com/p/mybatis
0 stars 0 forks source link

sql text newlines in mapping file when mybatis used with db2 #692

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of the MyBatis are you using?
mybatis3.1.1

Please describe the problem.  Unit tests are best!
I used mybatis with db2 8.1, there is problems when sql text appears newlines 
in mapping file.

What is the expected output? What do you see instead?

Can you provide stack trace, logs, error messages that are displayed?
logs says "illegal tokens"

Please provide any additional information below.
I modified org.apache.ibatis.builder.xml.dynamic.TextSqlNode's constructor as:

  public TextSqlNode(String text) {
    this.text = text.replaceAll("\r|\n", " "); 
  }
then I export new jar file put it into my project, it works well;

Original issue reported on code.google.com by whati...@gmail.com on 11 Oct 2012 at 9:03

GoogleCodeExporter commented 9 years ago
Sounds extrange because I use db2 without problems.

Anyway, try with a CDATA or cutting the sentence in a different place... 
MyBatis tries not to alter the SQL you wrote.

Original comment by eduardo.macarron on 27 Oct 2012 at 4:36

GoogleCodeExporter commented 9 years ago

Original comment by eduardo.macarron on 27 Oct 2012 at 4:36

GoogleCodeExporter commented 9 years ago
Thanks that!
Default newlines likes '\n' is not be recognized in db2.
I must input 'db2 -t' command before used db2 client access db2 server.
Thus, Mybatis has to send SQL text without newlines to db2 server. 

Original comment by whati...@gmail.com on 5 Nov 2012 at 8:27