mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-27 14:28:56 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78496 c90b9560-bf6c-de11-be94-00142212c4b1
96 lines
3.5 KiB
XML
96 lines
3.5 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<!-- splitted from ./en/functions/yaz.xml, last change in rev 1.8 -->
|
|
<refentry id="function.yaz-scan">
|
|
<refnamediv>
|
|
<refname>yaz_scan</refname>
|
|
<refpurpose>Prepares for a scan</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>int</type><methodname>yaz_scan</methodname>
|
|
<methodparam><type>int</type><parameter>id</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>type</parameter></methodparam>
|
|
<methodparam><type>string</type><parameter>startterm</parameter></methodparam>
|
|
<methodparam choice="opt"><type>array</type><parameter>flags</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
This function prepares for a Z39.50 Scan Request. Argument
|
|
<parameter>id</parameter> specifies target ID. Starting term
|
|
point for the scan is given by <parameter>startterm</parameter>.
|
|
The form in which is the starting term is specified is given by
|
|
<parameter>type</parameter>. Currently type <literal>rpn</literal>
|
|
is supported. The optional <parameter>flags</parameter>
|
|
specifies additional information to control the behaviour of the
|
|
scan request. Three indexes are currently read from the flags:
|
|
<literal>number</literal> (number of terms requested),
|
|
<literal>position</literal> (preferred position of term) and
|
|
<literal>stepSize</literal> (preferred step size).
|
|
To actually tranfer the Scan Request to the target and receive the
|
|
Scan Response, <function>yaz_wait</function> must be called. Upon
|
|
completion of <function>yaz_wait</function> call
|
|
<function>yaz_error</function> and
|
|
<function>yaz_scan_result</function> to handle the response.
|
|
</para>
|
|
<para>
|
|
The syntax of <parameter>startterm</parameter> is similar to the
|
|
RPN query as described in <function>yaz_search</function>. The
|
|
startterm consists of zero or more <literal>@attr</literal>-operator
|
|
specifications, then followed by exactly one token.
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title>PHP function that scans titles</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
function scan_titles($id, $starterm) {
|
|
yaz_scan($id,"rpn", "@attr 1=4 " . $starterm);
|
|
yaz_wait();
|
|
$errno = yaz_errno($id);
|
|
if ($errno == 0) {
|
|
$ar = yaz_scan_result($id,&$options);
|
|
echo 'Scan ok; ';
|
|
$ar = yaz_scan_result($id, &$options);
|
|
while(list($key,$val)=each($options)) {
|
|
echo "$key = $val ";
|
|
}
|
|
echo '<br><table><tr><td>';
|
|
while(list($key,list($k, $term, $tcount))=each($ar)) {
|
|
if (empty($k)) continue;
|
|
echo "<tr><td>$term</td><td>";
|
|
echo $tcount;
|
|
echo "</td></tr>";
|
|
}
|
|
echo '</table>';
|
|
} else {
|
|
echo "Scan failed. Error: " . yaz_error($id) . "<br>";
|
|
}
|
|
}
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|