function _before_update(QDB_ActiveRecord_Abstract $obj) { $cond = new QDB_Cond(); foreach ($this->_meta->idname as $idname) { $cond->orCond("[{$idname}] <> ?", $obj->{$idname}); } $this->_checkUniqueness($obj, $cond, true); }
/** * 直接创建一个 QDB_Cond 对象 * * @param string|array|QDB_Expr|QDB_Cond $cond * @param array $cond_args * * @return QDB_Cond */ static function createByArgs($cond, array $cond_args = null) { if (!is_array($cond_args)) { $cond_args = array(); } $c = new QDB_Cond(); if (!empty($cond)) { array_unshift($cond_args, $cond); $c->appendDirect($cond_args); } return $c; }
/** * 添加查询条件的内容方法 * * @param string|array|QDB_Expr|QDB_Cond $cond * @param array $args * @param int $part_type * @param bool $bool true = AND, false = OR * * @return QDB_Select */ protected function _addConditions($cond, array $args, $part_type, $bool) { if (!$cond instanceof QDB_Cond) { if (empty($cond)) { return $this; } $cond = QDB_Cond::createCronDirect($cond, $args); } if (is_null($this->_parts[$part_type])) { $this->_parts[$part_type] = new QDB_Cond(); } if ($bool) { $this->_parts[$part_type]->andCond($cond); } else { $this->_parts[$part_type]->orCond($cond); } return $this; }