20 defined(
'XOOPS_ROOT_PATH') or die('Restricted access');
41 function &getAll(
$criteria = null,
$fields = null, $asObject =
true, $id_as_key =
true)
44 if (!in_array($this->handler->keyName,
$fields)) {
45 $fields[] = $this->handler->keyName;
47 $select =
"`" . implode(
"`, `",
$fields) .
"`";
53 $sql =
"SELECT {$select} FROM `{$this->handler->table}`";
66 if (empty($orderSet)) {
72 while ($myrow = $this->handler->db->fetchArray(
$result)) {
73 $object =& $this->handler->create(
false);
74 $object->assignVars($myrow);
76 $ret[$myrow[$this->handler->keyName]] = $object;
83 $object =& $this->handler->create(
false);
84 while ($myrow = $this->handler->db->fetchArray(
$result)) {
85 $object->assignVars($myrow);
87 $ret[$myrow[$this->handler->keyName]] = $object->getValues(array_keys($myrow));
89 $ret[] = $object->getValues(array_keys($myrow));
107 function &getObjects(
$criteria = null, $id_as_key =
false, $as_object =
true)
109 $objects = $this->getAll(
$criteria, null, $as_object, $id_as_key);
128 $sql =
"SELECT `{$this->handler->keyName}`";
129 if (!empty($this->handler->identifierName)) {
130 $sql .=
", `{$this->handler->identifierName}`";
132 $sql .=
" FROM `{$this->handler->table}`";
147 while ($myrow = $this->handler->db->fetchArray(
$result)) {
149 $ret[$myrow[$this->handler->keyName]] = empty($this->handler->identifierName) ? 1 :
$myts->htmlSpecialChars($myrow[$this->handler->identifierName]);
163 $sql =
"SELECT `{$this->handler->keyName}` FROM `{$this->handler->table}`";
173 while ($myrow = $this->handler->db->fetchArray(
$result)) {
174 $ret[] = $myrow[$this->handler->keyName];
193 $GLOBALS[
'xoopsLogger']->addDeprecated(__CLASS__ .
'::' . __FUNCTION__ .
'() is deprecated, please use getAll instead.');
197 }
else if (!empty(
$limit)) {
214 function convertResultSet(
$result, $id_as_key =
false, $as_object =
true)
216 $GLOBALS[
'xoopsLogger']->addDeprecated(__CLASS__ .
'::' . __FUNCTION__ .
'() is deprecated.');
218 while ($myrow = $this->handler->db->fetchArray(
$result)) {
219 $obj =& $this->handler->create(
false);
220 $obj->assignVars($myrow);
226 $vars = $obj->getVars();
227 foreach (array_keys(
$vars) as
$i) {
228 $row[
$i] = $obj->getVar($i);
234 $ret[$myrow[$this->handler->keyName]] =& $obj;
237 $vars = $obj->getVars();
238 foreach (array_keys(
$vars) as
$i) {
239 $row[
$i] = $obj->getVar($i);
241 $ret[$myrow[$this->handler->keyName]] = $row;