does your database really story boolean columns as "true" or "false"??

any database i've seen stores them as a 0 or a 1 and they are integers

On Fri, Mar 13, 2009 at 12:42 PM, naaano <[email protected]> wrote:

>
> it didn't work before because it was:
> ["#{column.search_sql} = ?", value.to_i]
>
> and "true".to_i fails.
> check:
> http://github.com/activescaffold/active_scaffold/commit/979f9034f51e98079cd1cd276ad79a27e5c30103
>
> On Mar 13, 10:52 am, Kenny Ortmann <[email protected]> wrote:
> > I don't think the actual problem was in the search select drop downs.
> >
> > Once you pass 0 or 1
> > ["#{column.search_sql} = ?", value.to_s] it would evaluate to "column =
> '1'"
> > or "column = '0'"
> > true or false
> > ["#{column.search_sql} = ?", value.to_s] it would evaluate to "column =
> > 'true'" or "column = 'false'" <-- won't work in oracle
> >
> > but as Sergio said, rails-2.2 and master branches have
> > ["#{column.search_sql} = ?", column.column.type_cast(value)]
> >
> > I would hope if you do
> > ["#{column.search_sql} = ?", column.column.type_cast(value)]
> > with 'true' or 'false' that it will convert it to 1 or 0, if it doesn't
> > convert it to 1 or 0 then it won't work with oracle.
> >
> > I don't know how type_cast works though.
> >
> > On Fri, Mar 13, 2009 at 5:04 AM, Sergio Cambra .:: entreCables - Symbol
> > Servicios Informáticos S.L. ::. <[email protected]> wrote:
> >
> >
> >
> > > El Thursday 12 March 2009 18:56:30 naaano escribió:
> > > > Acording to SQL ISO standard, boolean types are "CRUDed" as:
> > > > TRUE - FALSE
> > > > However, Mysql doesn't have real support for boolean types, instead
> > > > using a patched way of tinyint.
> > > > Not surprising that most users use this database engine, the code
> > > > developed to interact with databases is first made with Mysql in
> > > > mind.
> > > > So, AS doesn't have problems with this since most of it is handled
> via
> > > > ActiveRecord, but there's some harcoded SQL in it. Particulary, this
> > > > mistakes reflect on 2 parts/files:
> >
> > > > 1.- the search_ui (search_column_helpers.rb: line
> > > > 106:active_scaffold_search_boolean)
> > > > 2.- the finder constructor (finder.rb: condition_for_column, line 39)
> >
> > > > However, Mysql supports SQL ISO standard for this, so, switching the
> > > > code to SQL standard makes it work for all database engines:
> >
> > > > in search_column_helpers.rb, lines 109 and 110:
> > > >  select_options << [as_(:true), true]
> > > >  select_options << [as_(:false), false]
> >
> > > I have fixed it, thanks.
> >
> > > > in finder.rb, line 39:
> > > > ["#{column.search_sql} = ?", value.to_s]
> >
> > > In rails-2.2 and master branches is:
> > > ["#{column.search_sql} = ?", column.column.type_cast(value)]
> > > I think it should be work for postgresql
> > > What rails and AS version are you using?
> >
> > > --
> > > Sergio Cambra .:: entreCables S.L. ::.
> > > Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
> > > T) 902 021 404 F) 976 52 98 07 E) [email protected]
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

  • AS... naaano
    • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
      • ... Kenny Ortmann
        • ... naaano
          • ... Kenny Ortmann
        • ... sergio
          • ... Kenny Ortmann
      • ... naaano

Reply via email to