Hi,
I am trying to access a mysql bit field in my catalyst app. Here is the table info:
SQL:
create table foo{
...
mybitField bit(1) NOT NULL default b'0'
}
My mapped table:
...
mybitField
{
data_type => "BIT",
default_value => "b'0'",
is_nullable => 0,
size => undef,
}
...
Now in my controller, I do a simple
$c->stash->{foos}=[$c->model('DB::foo')->all];
and in my template, I have tried the following:
[% FOREACH foo IN foos -%]
<tr>
[%- IF int(foo.mybitField) %]
<td>The field is True</td>
[%- ELSE %]
<td>The field is False</td>
[% END %]
</tr>
[% END -%]
I also tried just
[%- IF foo.mybitField %]
but that did not work either. Any other way apart from changing the database field type itself?