/**
  * Get the SQL syntax for a key.
  *
  * @param   array	$columns  An array of SimpleXMLElement objects comprising the key.
  *
  * @return  string
  *
  * @since   11.1
  */
 protected function getKeySQL($columns)
 {
     // TODO Error checking on array and element types.
     $kNonUnique = (string) $columns[0]['Non_unique'];
     $kName = (string) $columns[0]['Key_name'];
     $kColumn = (string) $columns[0]['Column_name'];
     $kCollation = (string) $columns[0]['Collation'];
     $kNull = (string) $columns[0]['Null'];
     $kType = (string) $columns[0]['Index_type'];
     $kComment = (string) $columns[0]['Comment'];
     $prefix = '';
     if ($kName == 'PRIMARY') {
         $prefix = 'PRIMARY ';
     } else {
         if ($kNonUnique == 0) {
             $prefix = 'UNIQUE ';
         }
     }
     $nColumns = count($columns);
     $kColumns = array();
     if ($nColumns == 1) {
         $kColumns[] = $this->db->quoteName($kColumn);
     } else {
         foreach ($columns as $column) {
             $kColumns[] = (string) $column['Column_name'];
         }
     }
     $sql = $prefix . 'KEY ' . ($kName != 'PRIMARY' ? $this->db->quoteName($kName) : '') . ' (' . implode(',', $kColumns) . ')';
     return $sql;
 }
Beispiel #2
0
 /**
  * Load log types and prepare them as an array with options.
  *
  * <code>
  * $filters    = new CrowdFundingFilters(JFactory::getDbo());
  * $options = $filters->getLogTypes();
  * </code>
  *
  * @return array
  */
 public function getLogTypes()
 {
     $query = $this->db->getQuery(true);
     $query->select("a.type AS value, a.type AS text")->from($this->db->quoteName("#__crowdf_logs", "a"))->group("a.type");
     $this->db->setQuery($query);
     $types = $this->db->loadAssocList();
     if (!$types) {
         $types = array();
     }
     return $types;
 }