Beispiel #1
0
 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;
 }
Beispiel #2
0
 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);
 }
Beispiel #3
0
 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);
 }
Beispiel #4
0
 private function __getJoinQuery(Sabel_Db_Statement $stmt, $on)
 {
     return $stmt->quoteIdentifier($on["id"]) . " = " . $stmt->quoteIdentifier(strtolower($this->childName)) . "." . $stmt->quoteIdentifier($on["fkey"]);
 }
Beispiel #5
0
 /**
  * @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);
     }
 }