Ah ok, DB2 (at least as of v7.1) has no problems with embedded newlines
in SQL. It does have problems when it doesn't see select/insert/delete
at the very beginning of the SQL. So probably an "ltrim" would suffice
for DB2 (unless you have a comment on the first line :( ).
Maybe best to leave it as it is for now, and document not to use "--"
for SQL comments.
Sven
Larry Meadors wrote:
Actually, iirc, we did this FOR db2.
Larry
On 12/20/05, Sven Boden <[EMAIL PROTECTED]> wrote:
Why have a JDBC standard when a lot of drivers react differently in the
little details?
DB2 and Oracle don't have problems with extra new lines :(
So it also doesn't make sense to keep the JIRA entry open.
Regards,
Sven
Clinton Begin wrote:
Acutally it's not just for logging....certain JDBC drivers complain
about newline characters in the SQL stream.
Otherwise, I'd be all for leaving them in.
Cheers,
Clinton
On 12/20/05, *Sven Boden (JIRA)* <ibatis-dev@incubator.apache.org
<mailto:ibatis-dev@incubator.apache.org>> wrote:
[
http://issues.apache.org/jira/browse/IBATIS-203?page=comments#action_12360956
]
Sven Boden commented on IBATIS-203:
-----------------------------------
The problem is in class
com.ibatis.sqlmap.engine.mapping.sql.SQLText in the method:
public void setText(String text) {
this.text = text.replace('\r', ' ').replace('\n', ' ');
this.isWhiteSpace = text.trim().length() == 0;
}
Removing the first line of the method would solve the problem.
However this is the same old "problem" again of using the SQL
query how it is specified in the XML file or "pretty printing" it.
Removing the first line would make the logging output a little
less nice.
Another solution would be to use the query as is (including
newlines), and only pretty printing the SQL statement when it's
actually required for logging purposes (this would also be a
little faster without logging on).
Regards,
Sven
> Sql comments inside sqlMap's select tag, throws exception
> ---------------------------------------------------------
>
> Key: IBATIS-203
> URL: http://issues.apache.org/jira/browse/IBATIS-203
> Project: iBatis for Java
> Type: Improvement
> Components: SQL Maps
> Versions: 2.1.5
> Environment: WinXP
> Reporter: Henrik Westman
>
> Using sql comments i.e. lines prepended with "--", causes an
exception.
> Seems like ibatis, parses the CDATA content of the select tag,
> into one long line without any newlines.
> ex.
> <select>
> <![CDATA[
> select * from myTable
> -- here is my comment
> where myCol = 5
> ]]>
> </select>
> gets parsed into
> select * from myTable -- here is my comment
where myCol = 5
> which is now invalid sql.
> Not being able to comment is annoying
> when you have very long SQL statements.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the
administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira