本文整理汇总了PHP中data::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP data::delete方法的具体用法?PHP data::delete怎么用?PHP data::delete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data
的用法示例。
在下文中一共展示了data::delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentFromTable
public function createComponentFromTable($tableName)
{
$return = NULL;
$count = data::select('COUNT(*) AS TOTAL', $tableName, NULL, NULL, 1) or $return = false;
$count = $count->fetch();
if ($count['TOTAL'] == 0) {
data::insert($tableName, array('id'), array(1));
}
//TODO: Fix ID for primary key.
$result = data::select('*', $tableName, NULL, NULL, 1) or $return = false;
if ($return === false) {
return false;
}
$total = $result->columnCount();
$fields = array();
for ($x = 0; $x < $total; $x++) {
$meta = $result->getColumnMeta($x);
//var_export($meta); echo "------------------<br />\n";
$type = in_array('primary_key', $meta['flags']) ? 'id' : $this->getTypeFromMeta($meta, $tableName, $meta['name']);
array_push($fields, new Field($meta['name'], $type));
}
if ($count['TOTAL'] == 0) {
data::delete($tableName);
}
$newComponent = new cmp_interface($tableName, new fieldSet($fields));
$newComponent->name = $tableName;
return $newComponent;
}
示例2: delete
public function delete($id = NULL)
{
if ($id !== NULL) {
$this->filter("id = " . data::escapeString($id));
data::delete($this->tableName, $this->where, $this->order, $this->limit);
} else {
###LO DE MA
}
}
示例3: delete
public function delete($id = NULL)
{
if ($this->where != NULL or $this->order != NULL or $this->limit != NULL) {
$return = data::delete($this->table, $this->where, $this->order, $this->limit);
$this->clearQuery();
return $return;
} else {
if (id != NULL) {
return data::delete($this->table, $id);
} else {
return false;
}
}
}