public function getRegions($fields = null, $order = null, $count = null) { $sql = "SELECT uuid FROM regions"; // order if ($order) { $order = explode(',', $order); $orderFields = array(); foreach ($order as $o) { $field = trim(str_replace(array('ASC', 'DESC'), array('', ''), $o)); $orderFields[] = $o; } if (count($orderFields) > 0) { $sql .= " ORDER BY " . implode(',', $orderFields); } } // how many results if ($count && $count > 0) { $sql .= " LIMIT {$count}"; } $idList = $this->db->fetchCol($sql); $results = array(); foreach ($idList as $id) { if ($r = $this->getRegion($id, $fields)) { $results[] = $r; } } return $results; }
public function delete($id) { $this->db->delete('auth', "UUID='{$id}'"); $this->db->delete('useraccounts', "PrincipalID='{$id}'"); $this->db->delete('griduser', "UserID='{$id}'"); $this->db->delete('inventoryfolders', "agentID='{$id}'"); }
/** * @param array * @return null */ function init_db_with_config($config) { $this->_db_name = $config[Lib_Db::CONFIG_FIELD_DB]; $this->_db = Lib_Db::db($config); }
public function __construct(Lib_Db $db, array $bannerParams) { $where = ''; foreach ($bannerParams as $key => $value) { $where .= $key .'=\'' . $db->escape($value) . '\' AND '; } $select = 'SELECT headers, code, rank, valid_from, valid_until FROM qu_pap_cachedbanners WHERE '.rtrim($where, 'AND ').' AND (valid_until > \''.date(self::DATETIME_FORMAT).'\' OR valid_until IS NULL) AND (valid_from < \''.date(self::DATETIME_FORMAT).'\' or valid_from IS NULL)'; $this->res = $db->query($select); if($this->res){ $this->count = mysql_num_rows($this->res); } }
public function delete($uuid) { $this->db->delete('prims', "UUID=\"{$uuid}\""); $this->db->delete('primshapes', "UUID=\"{$uuid}\""); }