$sth = $dbh->prepare($sql); $sth->execute(); $count = $sth->fetchColumn(); print "values: {$count}\n"; if ('delete' == $action) { print "values\n"; $i = 0; $sql = "SELECT value.id from value,item WHERE item.collection_id = {$c->id} and value.item_id = item.id"; $sth = $dbh->prepare($sql); $sth->execute(); while ($id = $sth->fetchColumn()) { $i++; $v = new Dase_DBO_Value($db); $v->load($id); print "{$i} of {$count} deleting -- {$v->value_text}\n"; $v->delete(); } } if ('count' == $action) { $sql = "SELECT count(v.id) from defined_value v, attribute a\n\t\tWHERE v.attribute_id = a.id \n\t\tAND\ta.collection_id = {$c->id}\n\t\t"; $sth = $dbh->prepare($sql); $sth->execute(); $count = $sth->fetchColumn(); print "defined: {$count}\n"; } elseif ('delete' == $action) { print "defined values\n"; $sql = "SELECT v.id from defined_value v, attribute a\n\t\tWHERE v.attribute_id = a.id \n\t\tAND\ta.collection_id = {$c->id}\n\t\t"; $sth = $dbh->prepare($sql); $sth->execute(); while ($id = $sth->fetchColumn()) { $defined = new Dase_DBO_DefinedValue($db);
function removeMetadata($value_id, $eid, $index = true) { $v = new Dase_DBO_Value($this->db); $v->load($value_id); $att = $v->getAttribute(); $v->delete(); if ($index) { $this->updated = date(DATE_ATOM); $this->update(); $this->buildSearchIndex(); } }