/** * Obtains number of elements of asociated query * * @author Fernando Ontiveros Lira <*****@*****.**> * @access public * @return int */ function TotalCount() { global $HTTP_GET_VARS; global $HTTP_SESSION_VARS; $stQry = $this->_source; if ($this->WhereClause != "") { $stQry .= " WHERE " . $this->WhereClause; } if ($this->_ordered == true) { $stOrderBy = isset($HTTP_GET_VARS[$this->orderprefix . 'order']) ? $HTTP_GET_VARS[$this->orderprefix . 'order'] : ''; if ($stOrderBy == "") { if ($this->DefaultOrder != "") { $stQry .= " ORDER BY " . $this->DefaultOrder; } } else { $stQry .= " ORDER BY " . $stOrderBy; } } else { if ($this->DefaultOrder != "") { $stQry .= " ORDER BY " . $this->DefaultOrder; } } $dbses = new DBSession($this->_dbc); $dbses->UseDB(DB_NAME); $dset = $dbses->Execute($stQry); return $dset->Count(); }
function LoadOptions($stQry, $dbc) { $stQry = str_replace("''''", "''", $stQry); //cuando la conexion es normal... se intenta realizar el query $dses = new DBSession(); $dses->SetTo($dbc); $dses->UseDB(DB_NAME); $dset = $dses->Execute($stQry, false, 3); $data = $dset->ReadAbsolute(); while ($data) { $key = $data[0]; $val = $data[1]; $result[$key] = $val; $data = $dset->ReadAbsolute(); } return $result; }