Example #1
0
 /**
  * Builds and returns string with list of field names
  * 
  * @param Database_Query $oQuery
  * @return string
  */
 protected function buildFieldListString(Database_Query $oQuery)
 {
     $aFields = $oQuery->fields();
     if (empty($aFields)) {
         return '*';
     }
     $aFields = array();
     foreach ($oQuery->fields() as $aField) {
         // if array is not assoc we treat its values as field names
         if (is_null($aField[1])) {
             $aFields[] = $this->markDatabaseObject($aField[0]);
         } else {
             $aFields[] = sprintf('%s AS %s', $this->markDatabaseObject($aField[0]), $this->escapeString($aField[1]));
         }
     }
     // foreach
     return implode(', ', $aFields);
 }