} if (!empty($errors)) { oai_exit(); } // Load the handler if (is_array($METADATAFORMATS[$metadataPrefix]) && isset($METADATAFORMATS[$metadataPrefix]['myhandler'])) { $inc_record = $METADATAFORMATS[$metadataPrefix]['myhandler']; include $inc_record; } else { $errors[] = oai_error('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix); } if (!empty($errors)) { oai_exit(); } if (empty($errors)) { $query = selectallQuery($metadataPrefix) . $extquery . " ORDER BY " . $SQL['identifier'] . " ASC "; // workaround for mysql if (isset($deliveredrecords)) { $query .= " LIMIT " . MAXRECORDS . " OFFSET {$deliveredrecords} "; } debug_message("Query: {$query}"); $res = $db->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL)); $r = $res->execute(); if ($r === false) { if (SHOW_QUERY_ERROR) { echo __FILE__ . ',' . __LINE__ . "<br />"; echo "Query: {$query}<br />\n"; print_r($db->errorInfo()); exit; } else { $errors[] = oai_error('noRecordsMatch');
} if (!empty($errors)) { oai_exit(); } // Load the handler if (is_array($METADATAFORMATS[$metadataPrefix]) && isset($METADATAFORMATS[$metadataPrefix]['myhandler'])) { $inc_record = $METADATAFORMATS[$metadataPrefix]['myhandler']; include $inc_record; } else { $errors[] = oai_error('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix); } if (!empty($errors)) { oai_exit(); } if (empty($errors)) { $query = selectallQuery($metadataPrefix) . $extquery; debug_message("Query: {$query}"); $res = $db->prepare($query, array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL)); $r = $res->execute(); if ($r === false) { if (SHOW_QUERY_ERROR) { echo __FILE__ . ',' . __LINE__ . "<br />"; echo "Query: {$query}<br />\n"; print_r($db->errorInfo()); exit; } else { $errors[] = oai_error('noRecordsMatch'); } } else { $r = $res->setFetchMode(PDO::FETCH_ASSOC); if ($r === false) {
$errors .= oai_error('badArgument', $key, $val); } } if (!isset($args['identifier'])) { $errors .= oai_error('missingArgument', 'identifier'); } if (!isset($args['metadataPrefix'])) { $errors .= oai_error('missingArgument', 'metadataPrefix'); } // remove the OAI part to get the identifier if (empty($errors)) { $id = str_replace($oaiprefix, '', $identifier); if ($id == '') { $errors .= oai_error('idDoesNotExist', '', $identifier); } $query = selectallQuery($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); } } elseif (!$res->numRows()) { $errors .= oai_error('idDoesNotExist', '', $identifier); } } // break and clean up on error if ($errors != '') {
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 = selectallQuery('') . $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());
* * Local variables <B>$metadataPrefix</B> and <B>$identifier</B> need to be provided through global array variable <B>$args</B> * by their indexes 'metadataPrefix' and 'identifier'. * The reset of information will be extracted from database based those two parameters. */ debug_message("\nI am debuging" . __FILE__); $metadataPrefix = $args['metadataPrefix']; // myhandler is a php file which will be included to generate metadata node. // $inc_record = $METADATAFORMATS[$metadataPrefix]['myhandler']; if (is_array($METADATAFORMATS[$metadataPrefix]) && isset($METADATAFORMATS[$metadataPrefix]['myhandler'])) { $inc_record = $METADATAFORMATS[$metadataPrefix]['myhandler']; } else { $errors[] = oai_error('cannotDisseminateFormat', 'metadataPrefix', $metadataPrefix); } $identifier = $args['identifier']; $query = selectallQuery($metadataPrefix, $identifier); debug_message("Query: {$query}"); $res = $db->query($query); if ($res === false) { if (SHOW_QUERY_ERROR) { echo __FILE__ . ',' . __LINE__ . "<br />"; echo "Query: {$query}<br />\n"; die($db->errorInfo()); } else { $errors[] = oai_error('idDoesNotExist', '', $identifier); } } elseif (!$res->rowCount()) { // based on PHP manual, it might only work for some DBs $errors[] = oai_error('idDoesNotExist', '', $identifier); } if (!empty($errors)) {