function SearchCompleteValues(&$form, $text, &$found) { $error = ''; $found = array(); if (strlen($complete_expression = MetabaseBeginsWith($this->connection, $text)) == 0) { return 'it was not possible to build the complete query expression: ' . MetabaseError($this->connection); } if (!strcmp($complete_values_query = str_replace('{BEGINSWITH}', $complete_expression, $this->complete_values_query), $this->complete_values_query)) { return 'the complete values query does not contain the {BEGINSWITH} mark to insert the complete expression'; } if (strlen($text) && $this->complete_values_limit) { MetabaseSetSelectedRowRange($this->connection, 0, $this->complete_values_limit); } if ($r = MetabaseQuery($this->connection, $complete_values_query)) { for ($l = 0; !MetabaseEndOfResult($this->connection, $r); $l++) { if (!MetabaseFetchResultArray($this->connection, $r, $d, $l)) { $error = 'Could not retrieve the complete values: ' . MetabaseError($this->connection); break; } $found[$d[0]] = $this->FormatCompleteValue($d); } MetabaseFreeResult($this->connection, $r); } else { $error = 'Complete values query execution failed: ' . MetabaseError($this->connection); } return $error; }
function GetGroups(&$g) { if (strlen($this->groups_query) == 0) { return "it was not specified a valid query to retrieve all the options groups"; } $g = array(); if (isset($this->default_option)) { $g[] = $this->default_option; } $error = ""; if ($r = MetabaseQuery($this->connection, $this->groups_query)) { for ($l = 0; !MetabaseEndOfResult($this->connection, $r); $l++) { if (!MetabaseFetchResultArray($this->connection, $r, $d, $l)) { $error = "Could not retrieve the options group: " . MetabaseError($this->connection); break; } $g[] = $d[0]; } if (count($g) == 0 && strlen($error) == 0) { $error = "there are no group options"; } MetabaseFreeResult($this->connection, $r); } else { $error = "Groups query execution failed: " . MetabaseError($this->connection); } if (strlen($error)) { unset($g); } return $error; }
function getNext($resultType = ANYDB_PREDEFINED_VALUE) { if ($resultType == ANYDB_PREDEFINED_VALUE) { $resultType = $this->prefResType; } $n = MetabaseNumberOfColumns($this->db, $this->result); if ($this->_count >= $this->numRows()) { return null; } $success = MetabaseFetchResultArray($this->db, $this->result, $row, $this->_count); if ($success == 1) { $this->_count++; switch ($resultType) { case ANYDB_RES_ASSOC: return $this->_getAssociativeEntries($row); break; default: case ANYDB_RES_NUM: return $row; break; case ANYDB_RES_BOTH: return array_merge($row, $this->_getAssociativeEntries($row)); break; } } else { return null; } }