Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.8.6

Request #9181 Boolean Y in XML not working
Submitted: 2006-10-27 14:19 UTC
From: m2calabr at dunamisdesign dot net Assigned: ifeghali
Status: Closed Package: MDB2_Schema (version 0.7.0)
PHP Version: 5.0.4 OS: n/a (linux)
Roadmaps: (Not assigned)    

 [2006-10-27 14:19 UTC] m2calabr at dunamisdesign dot net (Michael Calabrese)
Description: ------------ You have just added null (<null/>), I would suggest added true and false as well e.g. <true/> and <false/>. That way the you can the driver can translate it to the correct value that is needed true,t,1,Y false,f,0,N That way you do not have to guess what the backend needs when you are setting the value. Thanks


 [2006-10-27 15:41 UTC] ifeghali (Igor Feghali)
The method MDB2_Schema_Validate::isBoolean() is intended to do that. Please take a look at it and tell me if its enough for you.
 [2006-10-27 16:03 UTC] m2calabr at dunamisdesign dot net
Yep that should, now I need to replicate the bug that prompted to submit this. Quick version is: run 0.6.0 had <value>Y</value> for a boolean , loaded 0.7.0 booleans loaded as 0 (mysql). This broke my DB. Changed to <value>1</value>, all is well again. Give me a couple hours, and I will recheck, to see if it was an operator error, OK I just checked, v 0.6.0 OK v 0.7.0 Y --- does not work I am guess the implementation of a boolean was changed for mySQL. If you want me to post my example DB xml please let me know.
 [2006-10-28 03:25 UTC] ifeghali (Igor Feghali)
Yes please post your XML and the most relevant part of the script you are running.
 [2006-10-28 03:49 UTC] m2calabr at dunamisdesign dot net
The code I am using to load the XML is the demodata.php which I got from the LiveUser project. The boolean isactive comes up as 0 in the mySQL DB. Before running demodata.php I do: mysqladmin drop liveuser mysqladmin create liveruser php demodata.php -d mysql://u:p@localhost/liveuser -f apmenu-data.xml I have clipped the rest of the tables and sequences. XML segment: -------------------------- <?xml version="1.0" encoding="ISO-8859-1" ?> <database> <name><variable>database</variable></name> <create><variable>create</variable></create> <table> <name>liveuser_users</name> <declaration> <field> <name>authuserid</name> <type>text</type> <length>32</length> </field> <field> <name>handle</name> <type>text</type> <length>32</length> </field> <field> <name>passwd</name> <type>text</type> <length>32</length> </field> <field> <name>owner_user_id</name> <type>integer</type> </field> <field> <name>owner_group_id</name><type>integer</type> </field> <field> <name>lastlogin</name> <type>timestamp</type> </field> <field> <name>isactive</name> <type>boolean</type> </field> <field> <name>expiredate</name> <type>timestamp</type> <comments>If this date is passed then the user can not log into the system.</comments> </field> <index> <name>authuserid</name> <unique>1</unique> <field> <name>authuserid</name> <sorting>ascending</sorting> </field> </index> </declaration> <initialization> <insert> <field> <name>authuserid</name> <value>c4ca4238a0b923820dcc509a6f75849b</value></field> <field> <name>handle</name> <value>boss</value> </field> <field> <name>passwd</name> <value>test</value> </field> <field> <name>owner_user_id</name> <value><null/></value> </field> <field> <name>owner_group_id</name> <value>1</value> </field> <field> <name>lastlogin</name> <value><null/></value> </field> <field> <name>isactive</name> <value>Y</value> </field> <field> <name>expiredate</name> <value><null/></value> </field> </insert> <insert> <field> <name>authuserid</name> <value>c81e728d9d4c2f636f067f89cc14862c</value></field> <field> <name>handle</name> <value>operator</value> </field> <field> <name>passwd</name> <value>test</value> </field> <field> <name>owner_user_id</name> <value>1</value> </field> <field> <name>owner_group_id</name> <value><null/></value> </field> <field> <name>lastlogin</name> <value><null/></value> </field> <field> <name>isactive</name> <value>Y</value> </field> <field> <name>expiredate</name> <value><null/></value> </field> </insert> </initialization> </table> </database>
 [2006-10-28 14:05 UTC] ifeghali (Igor Feghali)
The problem here is that we are not validating data from initialization section anymore. As the new XML syntax allows complex data like expressions, validation is now a bit trick. Stay tuned I'm working on it.
 [2006-10-28 19:06 UTC] ifeghali (Igor Feghali)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.