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; } }
$data["quota"] = strval($row / 100); $data["weight"] = sqrt($row); $data["access_date"] = MetabaseToday(); $data["access_time"] = MetabaseTime(); $data["approved"] = MetabaseNow(); if ($prepared_query = MetabasePrepareQuery($database, "INSERT INTO users (user_name,user_password,subscribed,user_id,quota,weight,access_date,access_time,approved) VALUES (?,?,?,?,?,?,?,?,?)")) { if (!InsertTestValues($database, $prepared_query, $data)) { $success = 0; } MetabaseFreePreparedQuery($database, $prepared_query); if ($success) { if (!($result = MetabaseQuery($database, "SELECT user_name,user_password,subscribed,user_id,quota,weight,access_date,access_time,approved FROM users"))) { $success = 0; } else { $fields = array("user_name", "user_password", "subscribed", "user_id", "quota", "weight", "access_date", "access_time", "approved"); if (($columns = MetabaseNumberOfColumns($database, $result)) == count($fields)) { if ($success = MetabaseGetColumnNames($database, $result, $column_names)) { if ($columns == count($column_names)) { for ($column = 0; $column < $columns; $column++) { if ($column_names[$fields[$column]] != $column) { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: the query result column \"" . $fields[$column] . "\" was returned in position " . $column_names[$fields[$column]] . " unlike {$column} as expected{$eol}"; } } } else { $pass = 0; echo "FAILED!{$eol}"; $failed++; echo "Test {$test}: the query result returned a number of " . count($column_names) . " column names unlike {$columns} as expected{$eol}";