I am confused on this patch.  The BOOLEANCHAR type expects a CHAR type
for the db column, which will contain either Y or N.  It does not vary
by database.

the asBooleanObj has been added to Village's Value object.

john mcnally

On Mon, 2002-04-15 at 20:38, James A. Hillyerd wrote:
> When using Torque HEAD with PostgreSQL, BOOLEANCHAR doesn't work.  The
> attached patch fixes it by comparing the the value.asString() result
> with both "Y" (original code) and "true" (what Village returns for
> PostgreSQL).
> 
> PostgreSQL handles Boolean values natively, they're not really a
> character.  But BIT is broken in Torque when using objects instead of
> primitives.  This is because Torque tries to call "asBooleanObj()" on a
> Village Value object.  Unfortunately the Value class does not provide an
> asBooleanObj() method, just asBoolean() (which returns a primitive).
> 
> We might be able to get around this by using a combination of
> asBoolean() and isNull() to build a Boolean object.
> 
> Comments?
> 
> -james
> 
> -- 
> []  James A. Hillyerd <[EMAIL PROTECTED]> - Java Software Engineer
> []  PGP 1024D/D31BC40D F87B 7906 C0DA 32E8 B8F6 DE23 FBF6 4712 D31B C40D
> ----
> 

> Index: Peer.vm
> ===================================================================
> RCS file: /home/cvspublic/jakarta-turbine-torque/src/templates/om/Peer.vm,v
> retrieving revision 1.25
> diff -u -r1.25 Peer.vm
> --- Peer.vm   9 Apr 2002 15:59:44 -0000       1.25
> +++ Peer.vm   16 Apr 2002 02:54:32 -0000
> @@ -319,10 +319,13 @@
>          {
>          #set ( $n=0 )
>          #set ( $boolean = "boolean" )
> +        #set ( $String = "String" )
>          #foreach ($col in $table.Columns)
>              #if ($col.isBooleanChar())
> -            $boolean b = "Y".equals(row.getValue(offset+$n).$col.VillageMethod);
> +            $String bString = row.getValue(offset+$n).$col.VillageMethod;
> +            $boolean b = ("Y".equals(bString) || "true".equals(bString));
>              #set ( $boolean = "" )
> +            #set ( $String = "" )
>                  #if ($col.isUsePrimitive())
>              obj.set${col.JavaName}(b);
>                  #else
> 
> ----
> 

> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>



--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to