if (!checkDateFormat($until)) {
            $errors .= oai_error('badGranularity', 'until', $until);
        }
        $extquery .= untilQuery($until);
    }
    if (isset($args['set'])) {
        // 	    if (is_array($SETS)) {
        $extquery .= setQuery($set);
        // 	    } else {
        // 			$errors .= oai_error('noSetHierarchy');
        // 			oai_exit();
        // 		}
    }
}
if (empty($errors)) {
    $query = idQuery() . $extquery;
    $res = $db->query($query);
    if (DB::isError($res)) {
        if ($SHOW_QUERY_ERROR) {
            echo __FILE__ . ',' . __LINE . "<br />";
            echo "Query: {$query}<br />\n";
            die($db->errorNative());
        } else {
            $errors .= oai_error('noRecordsMatch');
        }
    } else {
        $num_rows = $res->numRows();
        if (DB::isError($num_rows)) {
            if ($SHOW_QUERY_ERROR) {
                echo __FILE__ . ',' . __LINE . "<br />";
                die($db->errorNative());
            // only to be compatible with VT explorer
            if (is_array($METADATAFORMATS[$val]) && isset($METADATAFORMATS[$val]['myhandler'])) {
                $metadataPrefix = $val;
                $inc_record = $METADATAFORMATS[$val]['myhandler'];
            } else {
                $errors .= oai_error('cannotDisseminateFormat', $key, $val);
            }
            break;
        default:
            $errors .= oai_error('badArgument', $key, $val);
    }
}
if (isset($args['identifier'])) {
    // remove the OAI part to get the identifier
    $id = str_replace($oaiprefix, '', $identifier);
    $query = idQuery($id);
    $res = $db->query($query);
    if (DB::isError($res)) {
        if ($SHOW_QUERY_ERROR) {
            echo __FILE__ . ',' . __LINE . "<br />";
            echo "Query: {$query}<br />\n";
            die($db->errorNative());
        } else {
            $errors .= oai_error('idDoesNotExist', 'identifier', $identifier);
        }
    } elseif (!$res->numRows()) {
        $errors .= oai_error('idDoesNotExist', 'identifier', $identifier);
    }
}
//break and clean up on error
if ($errors != '') {