public function getProjection(Sabel_Db_Statement $stmt) { $projection = array(); $name = $this->hasAlias() ? strtolower($this->aliasName) : $this->getName(false); foreach ($this->columns as $column) { $as = "{$name}.{$column}"; if (strlen($as) > 30) { $as = Sabel_Db_Join_ColumnHash::toHash($as); } $p = $stmt->quoteIdentifier($name) . "." . $stmt->quoteIdentifier($column); $projection[] = $p . " AS " . $stmt->quoteIdentifier($as); } return $projection; }
public function getJoinQuery(Sabel_Db_Statement $stmt, $joinType) { $name = $stmt->quoteIdentifier($this->tblName); $keys = $this->joinKey; $query = array(" {$joinType} JOIN {$name} "); if ($this->hasAlias()) { $name = $stmt->quoteIdentifier(strtolower($this->aliasName)); $query[] = $name . " "; } $query[] = "ON {$name}." . $stmt->quoteIdentifier($keys["id"]) . " = " . $stmt->quoteIdentifier(strtolower($this->childName)) . "." . $stmt->quoteIdentifier($keys["fkey"]); foreach ($this->objects as $object) { $query[] = $object->getJoinQuery($stmt, $joinType); } return implode("", $query); }
public function getJoinQuery(Sabel_Db_Statement $stmt, $joinType) { $name = $stmt->quoteIdentifier(XOOPS_DB_PREFIX . "_" . $this->tblName); $keys = $this->joinKey; $query = array(" {$joinType} JOIN {$name} "); if ($this->hasAlias()) { $name = $stmt->quoteIdentifier(strtolower($this->aliasName)); $query[] = $name . " "; } else { $name = $stmt->quoteIdentifier($this->tblName); $query[] = $name . " "; } $query[] = "ON {$name}." . $stmt->quoteIdentifier($keys["id"]) . " = " . $stmt->quoteIdentifier(strtolower($this->childName)) . "." . $stmt->quoteIdentifier($keys["fkey"]); return implode("", $query); }
private function __getJoinQuery(Sabel_Db_Statement $stmt, $on) { return $stmt->quoteIdentifier($on["id"]) . " = " . $stmt->quoteIdentifier(strtolower($this->childName)) . "." . $stmt->quoteIdentifier($on["fkey"]); }
/** * @param Sabel_Db_Statement $stmt * * @return string */ protected function getQuotedColumn($stmt) { if (strpos($this->column, ".") === false) { return $stmt->quoteIdentifier($this->column); } else { list($tbl, $col) = explode(".", $this->column); return $stmt->quoteIdentifier($tbl) . "." . $stmt->quoteIdentifier($col); } }