Re: Inflate a boolean

[prev] [thread] [next] [Date index for 2005/02/20]

From: Ofer Nave
Subject: Re: Inflate a boolean
Date: 22:24 on 20 Feb 2005
Tony Bowden wrote:

>On Sun, Feb 20, 2005 at 01:40:58PM -0800, Ofer Nave wrote:
>  
>
>>However, I think a.d.tim is right in that both of those are overly 
>>complex if all you want to do is filter data as it travels between the 
>>database and your CDBI object, without having to create an object 
>>wrapper around it.  Not every column justifies a new class.  :)
>>    
>>
>
>It doesn't have to be a specific new class. Just a new instance of a
>generic boolean class.
>
>  
>
That presumes you have a generic boolean class, and that you're working 
with boolean values.

I still think there should be a simple, fast way to filter/convert a 
column's value, maybe with an inline sub.  Defining a class (or 
depending on an appropriate preexisting one) doesn't fit the bill.

We've got 2 out of 3 cases covered:

1) 'has_a' was designed to support relationships by converting foreign 
key values into CDBI objects representing that record in the foreign 
table.  It is generic enough to handle conversions to non-database 
objects, like DateTime (which rocks), but again, it's all about objects, 
which is overkill for simple value filters.
2) Accessor overrides are even more generic, since you can do pretty 
much whatever you want, and it only requires defining a single function 
(not a class).  However, it does it's thing every time a value is 
accessed, which is inefficient if you can accomplish your goal by 
converting once upon load.
3) (the missing case) So if you just want to convert the value to 
another non-object value upon load... what do you do?  Is there a 
solution involving triggers that I'm overlooking?

>But, most of the time, if you really want "yes" and "no", store those
>in your database, not 1 and 0.
>  
>
That is entirely subjective, and most definitely poor design (in my 
opinion) in many cases.

-ofer

(message missing)

Inflate a boolean
adtim 09:08 on 20 Feb 2005

Re: Inflate a boolean
Ofer Nave 09:22 on 20 Feb 2005

Re: Inflate a boolean
Tony Bowden 09:44 on 20 Feb 2005

Re: Inflate a boolean
a.d.tim 10:35 on 20 Feb 2005

Re: Inflate a boolean
Tony Bowden 11:15 on 20 Feb 2005

Re[2]: Inflate a boolean
a.d.tim 12:37 on 20 Feb 2005

Re: Inflate a boolean
Perrin Harkins 21:15 on 20 Feb 2005

Re: Inflate a boolean
Ofer Nave 21:40 on 20 Feb 2005

Re: Inflate a boolean
Tony Bowden 22:07 on 20 Feb 2005

Re: Inflate a boolean
Ofer Nave 22:24 on 20 Feb 2005

Re: Inflate a boolean
Johan Lindstrom 22:47 on 20 Feb 2005

Re: Inflate a boolean
Tony Bowden 23:35 on 20 Feb 2005

Re: Inflate a boolean
Johan Lindstrom 00:20 on 21 Feb 2005

Re: Inflate a boolean
Tony Bowden 09:31 on 21 Feb 2005

Re: Inflate a boolean
=?ISO-8859-1?Q?Ask_Bj=F8rn_Hansen?= 21:25 on 21 Feb 2005

Generated at 12:48 on 22 Feb 2005 by mariachi v0.52