Yes! Its Working!

ifeghali's picture

The SQL generator is implemented (and ready for the function/expression recurssion, currently not supported by the parser) and working.

Using the example.php shipped with MDB2_Schema the following XML (non relevant part omitted)

<initialization>
 <insert>
  <field>
   <name>foo</name>
   <value>2</value>
  </field>
  <field>
   <name>birthday</name>
   <function>
    <name>now</name>
   </function>
  </field>
  <field>
   <name>foolish</name>
   <expression>
    <value>3</value>
    <operator>PLUS</operator>
    <column>foo</column>
   </expression>
  </field>
 </insert>
 <update>
  <field>
   <name>foo</name>
   <value>10</value>
  </field>
  <where>
   <expression>
    <column>foo</column>
    <operator>EQUAL</operator>
    <value>2</value>
   </expression>
  </where>
 </update>
 <delete>
  <where>
   <expression>
    <column>foolish</column>
    <operator>LESS THAN</operator>
    <value>15</value>
   </expression>
  </where>
 </delete>
</initialization>

would produce:


query(1): INSERT INTO Example (foo,birthday,foolish) VALUES (2,now(),(3+foo))
query(1): UPDATE Example SET foo=10 WHERE (foo=2)
query(1): DELETE FROM Example WHERE (foolish<15)

You can read the full XML syntax for MDB2 schema here.

ifeghali – Thu, 2006 – 08 – 17 01:11