From: Dan C. <dc...@ph...> - 2004-03-24 16:43:20
|
Marc ALBER wrote: > Hello, > > Richard Tango-Lowy asked me to send this also to the AXMLS mailing list. > > I am using adodb-xmlschema to describe my database, but I wanted to use > two features from the adodb-datadict that I was unable to use with the > current version of axmls : the DEFTIMESTAMP and CONSTRAINT field options. Hi Marc, I have made a few modifications to the patch you submitted and committed the results to CVS. I apologise for the oversight in not properly supporting this syntax, everything should work correctly now. When using DEFDATE or DEFTIMESTAMP the preferred syntax is: <field name="created" type="T"> <NOTNULL/> <DEFTIMESTAMP/> </field> Thanks for the patch, Dan > I propose a simplified database schema to illustrate my patch, sample.xml : > > <?xml version="1.0"?> > <schema version="0.2"> > <table name="cart"> > <descr> > A simplified shopping cart. > </descr> > <field name="cart_id" type="I"> > <KEY/> > <AUTOINCREMENT/> > </field> > <field name="created" type="T"> > <NOTNULL/> > </field> > </table> > <table name="item"> > <field name="item_id" type="I"> > <KEY/> > <AUTOINCREMENT/> > </field> > <field name="name" type="C" size="50"/> > <field name="cart_id" type="I"> > <NOTNULL/> > </field> > </table> > </schema> > > I wanted to declare *DEFTIMESTAMP* for the *created* field in the cart > table and add a constraint on the *cart_id* field in the *item* table. > > The code parses an *opts* attribute in the field, but I think there is a > bug in the code near line 382. Is this attribute described in the dtd ? > The dtd shows a *constraint* element for the *field*, but I think the > code doesn't parse it. My patch implements the parsing of a *constraint* > element in a *field*. > > The following schema can be parsed with my pactched code (sample1.xml, > changes in bold) : > > <?xml version="1.0"?> > <schema version="0.2"> > <table name="cart"> > <descr> > A simplified shopping cart. > </descr> > <field name="cart_id" type="I"> > <KEY/> > <AUTOINCREMENT/> > </field> > <field name="created" type="T" *opts="DEFTIMESTAMP"*> > <NOTNULL/> > </field> > </table> > <table name="item"> > <field name="item_id" type="I"> > <KEY/> > <AUTOINCREMENT/> > </field> > <field name="name" type="C" size="50"/> > <field name="cart_id" type="I"> > *<constraint> > REFERENCES cart (cart_id) > </constraint>* > <NOTNULL/> > </field> > </table> > </schema> > Best regards, > > Marc ALBER |