rhaco: データベース操作(delete)
rhacoでのdeleteの仕方を書き忘れていました。INSERT, SELECT, UPDATEができればDELETEはかんたんだお。
project.xml
<project rhacover="1.6.1" version="0.0.1" name="rhaco_test" xmlns="http://rhaco.org" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://rhaco.org http://m.rhaco.org/xsd/project_1_6_x.xsd"> <database name="rhaco"> <table name="items" admin="true"> <column name="id" type="serial" /> <column name="name" type="string" require="true" /> <column name="email" type="email" unique="true" require="true" /> <column name="body" type="string" unique="true" require="true" /> <column name="created" type="timestamp" default="sysdate" /> </table> </database> </project>
index.php
require('__init__.php'); Rhaco::import('database.DbUtil'); Rhaco::import('model.Items'); $db = new DbUtil(Items::connection()); $items = new Items(); $criteria = new Criteria(Q::eq($db->columnName(), 'Your Name')); $db->insert($items, $criteria);