/** * * @return \SplFixedArray */ public function fetchAllByPrimary($keys) { if (empty($keys)) { return new \SplFixedArray(0); } return $this->select()->where($this->_db->quoteIdentifier($this->_primary[0], true) . ' in (' . $this->_db->quoteArray($keys) . ')')->fetchAll(); }
/** * Constructs where statement for retrieving row(s). * * @param bool $useDirty * @return array */ protected function _getWhereQuery($useDirty = true) { $where = array(); $primaryKey = $this->_getPrimaryKey($useDirty); //$info = static::info(); //$metadata = $info[self::METADATA]; FIXME 这个暂时无解 // retrieve recently updated row using primary keys $where = array(); foreach ($primaryKey as $column => $value) { $tableName = static::$_db->quoteIdentifier(static::$_name, true); //$type = $metadata[$column]['DATA_TYPE']; $columnName = static::$_db->quoteIdentifier($column, true); $where[] = static::$_db->quoteInto("{$tableName}.{$columnName} = ?", $value); //, $type FIXME 这个暂时无解 } return $where; }