Because we had to make a choice. this is an implementation detail. At
the web2py level you use 'boolean' and True/False.

On Aug 18, 10:30 pm, Bruno Rocha <[email protected]> wrote:
> Why not "0 / 1"  ??
>
> 2010/8/18 mdipierro <[email protected]>
>
>
>
> > This answer is correct but to clarify to Narendran.... his query was
> > not wrong. The problem is that the data was not inserted via web2py
> > and therefore web2py may not be recognizing the column. Make sure the
> > column is a 'char' and contains 'T' or 'F'. This was a design choice
> > to because not all backends support boolean and because, even if they
> > do, that is how they implement it internally (1 byte).
>
> > On Aug 18, 5:30 pm, Russell <[email protected]> wrote:
> > > Use 'T' or 'F' rather than 'True' of 'False'.  Web2py saves boolean
> > > data as 'char' with length 1.
>
> > > On Aug 19, 1:49 am, Narendran <[email protected]> wrote:
>
> > > > Hi,
> > > > I added a new boolean field to a table. And I manually updated the
> > > > value of the field outside web2py. Now, I get zero rows for any
> > > > condition I put on that field. Please see the following shell output
> > > > for an idea:
>
> > > > In [7]:  offers = db(db.OFFER.IS_PRICE_COMPARED == False).select()
> > > >    ...:
>
> > > > In [8]: len(offers)
> > > > Out[8]: 0   #####<-- This is not expected. It should return all the
> > > > rows
>
> > > > In [9]:  offers = db(db.OFFER.IS_PRICE_COMPARED == True).select()
> > > >    ...:
>
> > > > In [10]: len(offers)
> > > > Out[10]: 0
>
> > > > In [11]:  offers = db().select(db.OFFER.IS_PRICE_COMPARED)
> > > >    ....:
>
> > > > In [12]: len(offers)
> > > > Out[12]: 668
>
> > > > In [13]: offers[0]
> > > > Out[13]: <Row {'IS_PRICE_COMPARED': False}> ######<-- Notice the value
> > > > being False here
>
> > > > In [14]: offers[1]
> > > > Out[14]: <Row {'IS_PRICE_COMPARED': False}>
>
> --
>
> http://rochacbruno.com.br

Reply via email to