/** * Retrieve associated peer * * @return rdbms.Peer */ public static function getPeer() { return \rdbms\Peer::forName(self::class); }
/** * Gets a field's value by the field's name * * @param string field name * @throws lang.IllegalArgumentException in case the field does not exist */ public function get($field) { if (!isset(Peer::forInstance($this)->types[$field])) { throw new \lang\IllegalArgumentException('Field "' . $field . '" does not exist for DataSet ' . nameof($this)); } return $this->{$field}; }
/** * Retrieve associated peer * * @return rdbms.Peer */ public static function getPeer() { return \rdbms\Peer::forName(__CLASS__); }
/** * Returns the fragment SQL * * @param rdbms.DBConnection conn * @param rdbms.Peer peer * @return string */ public function asSql(DBConnection $conn, Peer $peer) { $lhs = $this->lhs instanceof SQLFragment ? $this->lhs : $peer->column($this->lhs); return $conn->prepare('%c ' . str_replace('?', $lhs->getType(), $this->op), $lhs, $this->value); }
/** * Returns the fragment SQL * * @param rdbms.DBConnection conn * @param rdbms.Peer peer * @return string * @throws rdbms.SQLStateException */ public function asSql(\rdbms\DBConnection $conn, \rdbms\Peer $peer) { $lhs = $this->lhs instanceof \rdbms\SQLFragment ? $this->lhs : $peer->column($this->lhs); return $conn->prepare('%c between ' . $lhs->getType() . ' and ' . $lhs->getType(), $lhs, $this->lo, $this->hi); }