hello
I have a simple question, and i must say I'm quite surprised it seems to be an issue. I am using the new datatypes for the first time and i find it a problem to create a constraint on a boolean field.

I have a field like this:
                <field>
                        <gui>
                                <guiname xml:lang="nl">tonen</guiname>
                        </gui>
                        <editor>
                                <positions>
                                        <input>3</input>
                                        <list>3</list>
                                        <search>3</search>
                                </positions>
                        </editor>
                        <dt:datatype xmlns="http://www.dynasol.nl/xmlns/mmbase-shorthand"; 
base="boolean">
                <dt:default value="true"/>
            </dt:datatype>
                        <db>
                                <name>tonen</name>
                                <type key="false" notnull="false" size="50" 
state="persistent">BOOLEAN</type>
                        </db>
                </field>

this translate to a bit field in my (mysql) database:

mysql> desc mm_artikel;
+--------------+-------------+------+-----+---------+-------+
| Field        | Type        | Null | Key | Default | Extra |
+--------------+-------------+------+-----+---------+-------+
| number       | int(11)     | NO   | PRI |         |       |
| otype        | int(11)     | NO   | MUL |         |       |
| owner        | varchar(12) | NO   |     |         |       |
| naam         | text        | NO   |     |         |       |
| intro        | text        | YES  |     | NULL    |       |
| tonen        | bit(1)      | YES  |     | NULL    |       |
| aanmaakdatum | datetime    | YES  |     | NULL    |       |
| door         | text        | YES  |     | NULL    |       |
+--------------+-------------+------+-----+---------+-------+


so far so good, but when i create a constraint using this field, ik get errors:

 NodeList nl = cloud.getList(null, "object,posrel,pagina",
                "pagina.number",
                "object.number=" + pageNode.getNumber() + " AND pagina.tonen = 
1",
                "posrel.pos",
                "up", "destination", false);

 sqlConstraint = object.number=112 AND pagina.tonen = 1
     exception: Invalid value for BOOLEAN field: 1.0, of type java.lang.Double

i also tried:

AND pagina.tonen
AND pagina.tonen = true

but nothing works (or, it works, but in legacy mode, and an exception is thrown each time.


I havn't tried creating a Query object, because I am too lazy to do that. I think it should work like this...

can anybody help me?

regards,

Ernst

8 rows in set (0.00 sec)


_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers

Reply via email to