db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luiz Angelo Daros de Luca <lu...@ig.com.br>
Subject Re: PostgreSQl don't delete rows with BOOELAN type
Date Tue, 20 Jan 2004 22:18:01 GMT
The problem happened whenever I use an boolean value inside a Criteria 
object. Besides save(), any filtered select had the same problem.

I solved it by modifing the BDPostgres.java file. Is this a bug?

I still can insert, select like before.

    Luiz Angelo Daros de Luca

*************** public class DBPostgres extends DB

*** 180,185 ****

       */

      public String getBooleanString(Boolean b)

      {

!         return (b == null) ? "0" : (Boolean.TRUE.equals(b) ? "1" : "0");

      }

  }

--- 181,186 ----

       */

      public String getBooleanString(Boolean b)

      {

!         return (b == null) ? "'0'" : (Boolean.TRUE.equals(b) ? "'1'" : "'0'");

      }

  }


Bogdan Vatkov escreveu:

>Suggestion:
>You might try to use javaType="object" for the boolean field just to see how
>torque will handle it.
>
>regrads,
>Bogdan
>----- Original Message -----
>From: "Luiz Angelo Daros de Luca" <luizd@ig.com.br>
>To: "Apache Torque Users List" <torque-user@db.apache.org>
>Sent: Monday, January 19, 2004 21:22
>Subject: PostgreSQl don't delete rows with BOOELAN type
>
>
>  
>
>>Hello,
>>
>>    I have an table with a BOOLEAN type and when I ask torque to delete
>>it, it generates a buggy SQL query.
>>
>>
>>DELETE FROM XXX WHERE blField = 0
>>
>>The correct query in postgres would be
>>
>>DELETE FROM XXX WHERE blField = '0'
>>
>>or
>>
>>DELETE FROM XXX WHERE blField = false
>>
>>or even
>>
>>DELETE FROM XXX WHERE blField = 'false'
>>
>>I found out that org.apache.torque.adapter.DBPostgres return string "0"
>>for False/NULL and "1" for true
>>
>>Any ideas?
>>
>>Thanks
>>
>>    Luiz Angelo Daros de Luca
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>>For additional commands, e-mail: torque-user-help@db.apache.org
>>
>>    
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
>For additional commands, e-mail: torque-user-help@db.apache.org
>
>
>
>  
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message