Beispiel #1
0
Datei: Field.php Projekt: jasny/Q
 /**
  * Return the name of a field.
  *
  * @param int $flags  A DB::FIELDNAME_% constant and DB::WITH_ALIAS and DB::QUOTE_% options as binary set 
  * @return string
  */
 public function getName($flags = DB::FIELDNAME_FULL)
 {
     switch ($flags & 0xf) {
         case DB::FIELDNAME_NAME:
             return $flags & QUOTE_LOOSE || $flags & QUOTE_STRICT ? $this->parent->getConnection()->quoteIdentifier($this['name'], $flags) : $this['name'];
         case DB::FIELDNAME_FULL:
             return $flags & QUOTE_LOOSE || $flags & QUOTE_STRICT ? $this->parent->getConnection()->makeIdentifier($this['table'], $this['name'], $flags) : (isset($this['table']) ? $this['table'] . '.' . $this['name'] : $this['name']);
         case DB::FIELDNAME_COLUMN:
             return $this->parent->getConnection()->makeIdentifier($this['table'], $this['name_db'], $flags & DB::WITH_ALIAS && $this['name'] != $this['name_db'] ? $this['name'] : null, $flags);
         case DB::FIELDNAME_DB:
             return $this->parent->getConnection()->makeIdentifier($this['table_db'], $this['name_db'], $flags & DB::WITH_ALIAS && $this['name'] != $this['name_db'] ? $this['name'] : null);
     }
 }