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 Gilles Schlienger <s_...@yahoo.com> on 2008/06/25 23:36:57 UTC

Re : Remove/trim spaces from generated SQL requests

Thanks,
I actually don't really have any special space in the SQL.

Is the behaviour of seeing many spaces in the logs only happening in the logs or also when the SQL request executed against the database ?
If that's the case, I guess this can consume a lot of logs on the database side (binary logs etc...)

Would any one have any advice on this ? Is anyone doing something special in Eclipse or with Maven 2 maybe to remove blank spaces ?

Thanks again
Gilles


----- Message d'origine ----
De : Gwyn Evans <gw...@gmail.com>
À : user-java@ibatis.apache.org
Envoyé le : Mercredi, 25 Juin 2008, 17h55mn 58s
Objet : Re: Remove/trim spaces from generated SQL requests

Simplest way is surely to not to have the spaces in the sql in the first place?

/Gwyn


On Wed, Jun 25, 2008 at 9:56 AM, Gilles Schlienger <s_...@yahoo.com> wrote:

Hello,

I can see in the logs that the SQL requests generated by iBATIS (2.3.0.677) have a lot of spaces between some elements of the request.

I feel it might be keeping blanks from the XML sql_map file ...?
Would there be a way to "trim" these requests to have more readable logs please ?

Thanks a lot in advance
Regards
Gilles




     _____________________________________________________________________________
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr


      _____________________________________________________________________________ 
Envoyez avec Yahoo! Mail. Une boite mail plus intelligente http://mail.yahoo.fr

Re: Re : Remove/trim spaces from generated SQL requests

Posted by Larry Meadors <la...@gmail.com>.
It's the tabs/spaces used for indentation in the sql map file. We
remove the newlines, but not the whitespace.

Larry


On Thu, Jun 26, 2008 at 1:52 AM, Gwyn Evans <gw...@gmail.com> wrote:
> If I'm reading it correctly, the OP is concerned about the /logging/ output
> that can be seen if you enable the various jdbc logging categories, not the
> actual functionality.  We'd need to see some examples to be sure, but my
> guess is that they're seeing something like
>
> Executing Statement:    SELECT id, name          FROM table
> WHERE          val=?
>
> which will result from a sqlmap such as:
> <select ...>
>     SELECT id, name
>     FROM table
>     WHERE
>           val=?
> </select>
>
> If so, then remove the excess spaces & line-breaks, but really, without
> specific examples, it's just guessing...
>
> /Gwyn
>
> On Wed, Jun 25, 2008 at 11:37 PM, Eric T. Blue <er...@gmail.com> wrote:
>>
>> Gilles,
>>
>> Is your column datatype CHAR?  This may not be the issue, however you may
>> want to check out the differences between CHAR and VARCHAR2.  Ex:
>>
>> http://www.databasesandlife.com/char-vs-varchar-and-varchar2/
>>
>>
>> On Wed, Jun 25, 2008 at 2:36 PM, Gilles Schlienger <s_...@yahoo.com>
>> wrote:
>>>
>>> Thanks,
>>> I actually don't really have any special space in the SQL.
>>>
>>> Is the behaviour of seeing many spaces in the logs only happening in the
>>> logs or also when the SQL request executed against the database ?
>>> If that's the case, I guess this can consume a lot of logs on the
>>> database side (binary logs etc...)
>>>
>>> Would any one have any advice on this ? Is anyone doing something special
>>> in Eclipse or with Maven 2 maybe to remove blank spaces ?
>>>
>>> Thanks again
>>> Gilles
>>>
>>> ----- Message d'origine ----
>>> De : Gwyn Evans <gw...@gmail.com>
>>> À : user-java@ibatis.apache.org
>>> Envoyé le : Mercredi, 25 Juin 2008, 17h55mn 58s
>>> Objet : Re: Remove/trim spaces from generated SQL requests
>>>
>>> Simplest way is surely to not to have the spaces in the sql in the first
>>> place?
>>>
>>> /Gwyn
>>>
>>> On Wed, Jun 25, 2008 at 9:56 AM, Gilles Schlienger <s_...@yahoo.com>
>>> wrote:
>>>>
>>>> Hello,
>>>>
>>>> I can see in the logs that the SQL requests generated by iBATIS
>>>> (2.3.0.677) have a lot of spaces between some elements of the request.
>>>>
>>>> I feel it might be keeping blanks from the XML sql_map file ...?
>>>> Would there be a way to "trim" these requests to have more readable logs
>>>> please ?
>>>>
>>>> Thanks a lot in advance
>>>> Regards
>>>> Gilles
>>>>
>>>>
>>>>
>>>>
>>>>  _____________________________________________________________________________
>>>> Envoyez avec Yahoo! Mail. Une boite mail plus intelligente
>>>> http://mail.yahoo.fr
>>>
>>>
>>> ________________________________
>>> Envoyé avec Yahoo! Mail.
>>> Une boite mail plus intelligente.
>
>

Re: Re : Remove/trim spaces from generated SQL requests

Posted by Gwyn Evans <gw...@gmail.com>.
If I'm reading it correctly, the OP is concerned about the /logging/ output
that can be seen if you enable the various jdbc logging categories, not the
actual functionality.  We'd need to see some examples to be sure, but my
guess is that they're seeing something like

Executing Statement:    SELECT id, name          FROM table
WHERE          val=?

which will result from a sqlmap such as:
<select ...>
    SELECT id, name
    FROM table
    WHERE
          val=?
</select>

If so, then remove the excess spaces & line-breaks, but really, without
specific examples, it's just guessing...

/Gwyn

On Wed, Jun 25, 2008 at 11:37 PM, Eric T. Blue <er...@gmail.com> wrote:

> Gilles,
>
> Is your column datatype CHAR?  This may not be the issue, however you may
> want to check out the differences between CHAR and VARCHAR2.  Ex:
>
> http://www.databasesandlife.com/char-vs-varchar-and-varchar2/
>
>
>
> On Wed, Jun 25, 2008 at 2:36 PM, Gilles Schlienger <s_...@yahoo.com>
> wrote:
>
>> Thanks,
>> I actually don't really have any special space in the SQL.
>>
>> Is the behaviour of seeing many spaces in the logs only happening in the
>> logs or also when the SQL request executed against the database ?
>> If that's the case, I guess this can consume a lot of logs on the database
>> side (binary logs etc...)
>>
>> Would any one have any advice on this ? Is anyone doing something special
>> in Eclipse or with Maven 2 maybe to remove blank spaces ?
>>
>> Thanks again
>> Gilles
>>
>> ----- Message d'origine ----
>> De : Gwyn Evans <gw...@gmail.com>
>> À : user-java@ibatis.apache.org
>> Envoyé le : Mercredi, 25 Juin 2008, 17h55mn 58s
>> Objet : Re: Remove/trim spaces from generated SQL requests
>>
>>
>> Simplest way is surely to not to have the spaces in the sql in the first
>> place?
>>
>> /Gwyn
>>
>> On Wed, Jun 25, 2008 at 9:56 AM, Gilles Schlienger <s_...@yahoo.com>
>> wrote:
>>
>>> Hello,
>>>
>>> I can see in the logs that the SQL requests generated by iBATIS
>>> (2.3.0.677) have a lot of spaces between some elements of the request.
>>>
>>> I feel it might be keeping blanks from the XML sql_map file ...?
>>> Would there be a way to "trim" these requests to have more readable logs
>>> please ?
>>>
>>> Thanks a lot in advance
>>> Regards
>>> Gilles
>>>
>>>
>>>
>>>
>>>  _____________________________________________________________________________
>>> Envoyez avec Yahoo! Mail. Une boite mail plus intelligente
>>> http://mail.yahoo.fr
>>>
>>
>>
>> ------------------------------
>> Envoyé avec Yahoo! Mail<http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html>
>> .
>> Une boite mail plus intelligente.
>>
>
>

Re: Re : Remove/trim spaces from generated SQL requests

Posted by "Eric T. Blue" <er...@gmail.com>.
Gilles,

Is your column datatype CHAR?  This may not be the issue, however you may
want to check out the differences between CHAR and VARCHAR2.  Ex:

http://www.databasesandlife.com/char-vs-varchar-and-varchar2/


On Wed, Jun 25, 2008 at 2:36 PM, Gilles Schlienger <s_...@yahoo.com>
wrote:

> Thanks,
> I actually don't really have any special space in the SQL.
>
> Is the behaviour of seeing many spaces in the logs only happening in the
> logs or also when the SQL request executed against the database ?
> If that's the case, I guess this can consume a lot of logs on the database
> side (binary logs etc...)
>
> Would any one have any advice on this ? Is anyone doing something special
> in Eclipse or with Maven 2 maybe to remove blank spaces ?
>
> Thanks again
> Gilles
>
> ----- Message d'origine ----
> De : Gwyn Evans <gw...@gmail.com>
> À : user-java@ibatis.apache.org
> Envoyé le : Mercredi, 25 Juin 2008, 17h55mn 58s
> Objet : Re: Remove/trim spaces from generated SQL requests
>
>
> Simplest way is surely to not to have the spaces in the sql in the first
> place?
>
> /Gwyn
>
> On Wed, Jun 25, 2008 at 9:56 AM, Gilles Schlienger <s_...@yahoo.com>
> wrote:
>
>> Hello,
>>
>> I can see in the logs that the SQL requests generated by iBATIS
>> (2.3.0.677) have a lot of spaces between some elements of the request.
>>
>> I feel it might be keeping blanks from the XML sql_map file ...?
>> Would there be a way to "trim" these requests to have more readable logs
>> please ?
>>
>> Thanks a lot in advance
>> Regards
>> Gilles
>>
>>
>>
>>
>>  _____________________________________________________________________________
>> Envoyez avec Yahoo! Mail. Une boite mail plus intelligente
>> http://mail.yahoo.fr
>>
>
>
> ------------------------------
> Envoyé avec Yahoo! Mail<http://us.rd.yahoo.com/mailuk/taglines/isp/control/*http://us.rd.yahoo.com/evt=52423/*http://fr.docs.yahoo.com/mail/overview/index.html>
> .
> Une boite mail plus intelligente.
>