You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by John Clash <sp...@seznam.cz> on 2008/08/10 22:29:54 UTC

Setting for removing newlines from SQL?

Hi,

I've came across an issue with the double-dash comments, as reported here:
https://issues.apache.org/jira/browse/IBATIS-203

In a short:

       <select>
                SELECT * FROM table
               -- Here is my comment.
                WHERE col = 5
        </select>

gets parsed into

        SELECT * FROM table -- Here is my comment. WHERE col = 5

Using other forms of comments reduces the code readability.

Is there any way to switch off removing the newlines in iBatis 2?

Thanks, Ondra 

-- 
View this message in context: http://www.nabble.com/Setting-for-removing-newlines-from-SQL--tp18916746p18916746.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Setting for removing newlines from SQL?

Posted by John Clash <sp...@seznam.cz>.
AFAIK, SYSTEM in XML is only "supposed" to be an URI, and does not necesarily
need to be some accessible HTTP URL - it may point to the document autor's
system and may not make sence in user's system. PUBLIC is what editors etc
should map to their DTD repository.

There's also some discussion which seems trustworthy:
http://bytes.com/forum/thread87407.html

So you can have:

   <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"~/ibatis/dtd/20.dtd">

where  "~/ibatis/dtd/20.dtd" is the SYSTEM part.
Whether or not the editors and clients rely on SYSTEM part instead of
PUBLIC, is other topic.
But for convenience, I would keep it be an URL :-)

Ondra




Clinton Begin wrote:
> 
> It is a namespace, but also happens to map to a physical location on the
> web, and thus there is the dependency.
> 
> What I think would be better is a relative path scheme for DTDs, which
> more
> often than not would just be the same path that the XML file is in, but
> would also allow developers to design their own structure.  At the very
> least would provide repository options other than an online resource that
> eventually becomes a single point of inflexibility (and in some cases
> failure).
> 

-- 
View this message in context: http://www.nabble.com/Setting-for-removing-newlines-from-SQL--tp18916746p18974535.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: Setting for removing newlines from SQL?

Posted by Clinton Begin <cl...@gmail.com>.
Yeah, you can do that with IDEA too.  But I think even tools like IDEA and
NetBeans aren only doing this for performance and offline support reasons...
it's a bandaid solution for an impractical technology.

It is a namespace, but also happens to map to a physical location on the
web, and thus there is the dependency.

What I think would be better is a relative path scheme for DTDs, which more
often than not would just be the same path that the XML file is in, but
would also allow developers to design their own structure.  At the very
least would provide repository options other than an online resource that
eventually becomes a single point of inflexibility (and in some cases
failure).

My point in summary:  iBATIS is not a web service, and thus it should not
depend on the web.

Clinton





On Mon, Aug 11, 2008 at 5:01 PM, John Clash <sp...@seznam.cz> wrote:

>
>
> Clinton Begin wrote:
> >
> > <side-rant>
> > DTD/Schema is annoying really.  [...] While our entity resolver does grab
> > it
> > from the JAR, tools and such will always need it on the web. [...]
> > </side-rant>
> >
>
>
> <side-tip>
> IMHO that's the fault of the tool developers - DTD PUBLIC / SYSTEM values
> are not URL to suggest where to download it from, rather it is an URI -
> unique identifier that can be used to distinguish different DTDs.
>
> I use NetBeans, which allow to set up DTDs and Schemas conveniently - see
> "Tools -> DTDs and XML Schemas". You can download the proper scheme and
> link
> the URI to a file in your filesystem.
> </side-tip>
>
> Ondra
> --
> View this message in context:
> http://www.nabble.com/Setting-for-removing-newlines-from-SQL--tp18916746p18935384.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>

Re: Setting for removing newlines from SQL?

Posted by John Clash <sp...@seznam.cz>.

Clinton Begin wrote:
> 
> <side-rant>
> DTD/Schema is annoying really.  [...] While our entity resolver does grab
> it
> from the JAR, tools and such will always need it on the web. [...]
> </side-rant>
> 


<side-tip>
IMHO that's the fault of the tool developers - DTD PUBLIC / SYSTEM values
are not URL to suggest where to download it from, rather it is an URI -
unique identifier that can be used to distinguish different DTDs.

I use NetBeans, which allow to set up DTDs and Schemas conveniently - see
"Tools -> DTDs and XML Schemas". You can download the proper scheme and link
the URI to a file in your filesystem.
</side-tip>

Ondra
-- 
View this message in context: http://www.nabble.com/Setting-for-removing-newlines-from-SQL--tp18916746p18935384.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.