Return-Path: Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 26960 invoked from network); 29 Apr 2003 23:33:55 -0000 Received: from floyd.blarg.net (HELO mail.blarg.net) (206.124.128.8) by daedalus.apache.org with SMTP; 29 Apr 2003 23:33:55 -0000 Received: from [10.0.0.61] (sttldslgw12poolD81.sttl.uswest.net [63.229.7.81]) by mail.blarg.net (Postfix) with ESMTP id 962BF38237 for ; Tue, 29 Apr 2003 16:33:54 -0700 (PDT) Subject: Re: Postgres aapter bug From: "James A. Hillyerd" To: Turbine Torque Developers List In-Reply-To: <3EAEFA84.50307@bitcount.com> References: <3EADE4EB.9030003@bitcount.com> <1051639422.27300.19.camel@raleigh> <3EAEFA84.50307@bitcount.com> Content-Type: text/plain Organization: WhyNotOwn.com Message-Id: <1051659320.27293.36.camel@raleigh> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.4 Date: 29 Apr 2003 16:35:20 -0700 Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Matt, That's just super. ;) I don't use booleanchar for anything, so I can't verify for sure what torque stores, but this was the snippet I found doing the Y/N (Peer.vm): public static ObjectKey doInsert(Criteria criteria, Connection con) throws TorqueException { #foreach ($col in $table.Columns) #set ( $cup=$col.Name.toUpperCase() ) #if($col.isBooleanInt()) // check for conversion from boolean to int if (criteria.containsKey($cup)) { Object possibleBoolean = criteria.get($cup); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add($cup, 1); } else { criteria.add($cup, 0); } } } #elseif ($col.isBooleanChar()) // check for conversion from boolean to Y/N if (criteria.containsKey($cup)) { Object possibleBoolean = criteria.get($cup); if (possibleBoolean instanceof Boolean) { if (((Boolean) possibleBoolean).booleanValue()) { criteria.add($cup, "Y"); } else { criteria.add($cup, "N"); } } } #end #end Anyone with more in depth knowledge want to comment on this? -james On Tue, 2003-04-29 at 15:19, Matt Finn wrote: > Well, > I guess im not really sure whether the booleanchar will work at all, > then.. In the village source the Value class defines isTrue as follows: > > /** > * @return true if (true || t | yes | 1) > */ > private boolean isTrue(String value) > { > return (value.equalsIgnoreCase ("true") || > value.equalsIgnoreCase ("t") || > value.equalsIgnoreCase ("yes") || > value.equals ("1")); > } > > It doesn't check for Y/N. This is what torque uses to grab the boolean > value from the db.. So I guess if torque used T/F or 0/1 for booleanchar > vals, all would be in good harmony along with the '0'/'1' fix in postgres. > > -matt > > > James A. Hillyerd wrote: > > Hi Matt, > > > > I like your idea. Seems like postgres will let you select against all > > three of those column types with a '0' or '1', I was expecting it to > > barf on the int2. > > > > I think we may run into problems with inserts though, since Torque uses > > 'Y' and 'N' for booleanchar values. > > > > -james > > > > On Mon, 2003-04-28 at 19:35, Matt Finn wrote: > > > >>Hi, > >> > >>I have also been afflicted with that problem. > >>How about using single quotes for booleans ('0' and '1')? This works > >>fine with 7.2 and 7.3 postgres across all three types, although I > >>haven't tested any earlier versions. > >> > >>postgres=# create table test (one boolean, two char, three int2); > >>CREATE TABLE > >>postgres=# insert into test (one,two,three) values ('0','0','0'); > >>INSERT 43810 1 > >>postgres=# insert into test (one,two,three) values ('1','1','1'); > >>INSERT 43811 1 > >>postgres=# select * from test; > >> one | two | three > >>-----+-----+------- > >> 0 | f | 0 > >> 1 | t | 1 > >>(2 rows) > >> > >>postgres=# > >> > >> > >>-matt > >> > >> > >> > >> > >>--------------------------------------------------------------------- > >>To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org > >>For additional commands, e-mail: torque-dev-help@db.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org > For additional commands, e-mail: torque-dev-help@db.apache.org -- James A. Hillyerd WhyNotOwn.com - http://www.whynotown.com/