svn: /phpdoc/en/trunk/reference/mongo/ mongocursor/timeout.xml mongocursortimeoutexception.xml versions.xml

From: Date: Fri, 08 Jan 2010 19:51:00 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/ mongocursor/timeout.xml mongocursortimeoutexception.xml versions.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-5794@lists.php.net to get a copy of this message
kristina Fri, 08 Jan 2010 19:51:00 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=293290 Log: added timeout exception & more timeout doc Changed paths: U phpdoc/en/trunk/reference/mongo/mongocursor/timeout.xml A phpdoc/en/trunk/reference/mongo/mongocursortimeoutexception.xml U phpdoc/en/trunk/reference/mongo/versions.xml Modified: phpdoc/en/trunk/reference/mongo/mongocursor/timeout.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongocursor/timeout.xml 2010-01-08 19:14:06 UTC (rev 293289) +++ phpdoc/en/trunk/reference/mongo/mongocursor/timeout.xml 2010-01-08 19:51:00 UTC (rev 293290) @@ -13,6 +13,42 @@ <modifier>public</modifier> <type>MongoCursor</type><methodname>MongoCursor::timeout</methodname> <methodparam><type>int</type><parameter>ms</parameter></methodparam> </methodsynopsis> + <para> + A timeout can be set at any time and will affect subsequent queries on the + cursor, including fetching more results from the database. For example, to + wait forever for an initial response but timeout after 100 ms for subsequent + results, one could say: + <programlisting role="php"> +<![CDATA[ +<?php + +$cursor = $collection->find(); + +// $cursor->hasNext() executes the query. No timeout has been set, so the +// program will wait as long as necessary for a response. + +while ($cursor->hasNext()) { + $cursor->timeout(100); + + // now the timeout has been set, so if the cursor needs to get more results + // from the database, it will only wait 100 ms for the database's reply + + try { + print_r($cursor->getNext()); + } + catch(MongoCursorTimeoutException $e) { + echo "query took too long!"; + } +} + +?> +]]> + </programlisting> + </para> + <para> + A timeout of 0 (or a negative number) will wait forever so it can be used to + reset the cursor if a timeout is no longer needed. + </para> </refsect1> <refsect1 role="parameters"> Added: phpdoc/en/trunk/reference/mongo/mongocursortimeoutexception.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongocursortimeoutexception.xml (rev 0) +++ phpdoc/en/trunk/reference/mongo/mongocursortimeoutexception.xml 2010-01-08 19:51:00 UTC (rev 293290) @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="utf-8"?> + +<!-- $Revision$ --> +<phpdoc:classref xml:id="class.mongocursortimeoutexception" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"> + + <title>The MongoCursorTimeoutException class</title> + <titleabbrev>MongoCursorTimeoutException</titleabbrev> + + <partintro> + + <!-- {{{ MongoCursorTimeoutException intro --> + <section xml:id="mongocursortimeoutexception.intro"> + &reftitle.intro; + <para> + Caused by a query timing out. At the moment, the only way a query will not + wait indefinitely for a database response is if + <function>MongoCursor::timeout</function> is called on the cursor. + </para> + </section> + <!-- }}} --> + + <section xml:id="mongocursortimeoutexception.synopsis"> + &reftitle.classsynopsis; + + <!-- {{{ Synopsis --> + <classsynopsis> + <ooclass><classname>MongoCursorTimeoutException</classname></ooclass> + + <!-- {{{ Class synopsis --> + <classsynopsisinfo> + <ooclass> + <modifier>extends</modifier> + <classname>MongoCursorException</classname> + </ooclass> + </classsynopsisinfo> + <!-- }}} --> + + </classsynopsis> + <!-- }}} --> + + </section> + + </partintro> + +</phpdoc:classref> + +<!-- 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:"~/.phpdoc/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 +--> Property changes on: phpdoc/en/trunk/reference/mongo/mongocursortimeoutexception.xml ___________________________________________________________________ Added: svn:keywords + Id Rev Revision Date LastChangedDate LastChangedRevision Author LastChangedBy HeadURL URL Modified: phpdoc/en/trunk/reference/mongo/versions.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/versions.xml 2010-01-08 19:14:06 UTC (rev 293289) +++ phpdoc/en/trunk/reference/mongo/versions.xml 2010-01-08 19:51:00 UTC (rev 293290) @@ -10,6 +10,7 @@ <!-- Mongo --> <function name='mongo::__construct' from='PECL mongo &gt;=0.9.0'/> <function name='mongo::__tostring' from='PECL mongo &gt;=0.9.0'/> + <function name='mongo::__get' from='PECL mongo &gt;=1.0.2'/> <function name='mongo::connect' from='PECL mongo &gt;=0.9.0'/> <function name='mongo::pairConnect' from='PECL mongo &gt;=0.9.0'/> <function name='mongo::persistConnect' from='PECL mongo &gt;=0.9.0'/> @@ -22,6 +23,7 @@ <!-- MongoDB --> <function name='mongodb::__construct' from='PECL mongo &gt;=0.9.0'/> <function name='mongodb::__tostring' from='PECL mongo &gt;=0.9.0'/> + <function name='mongodb::__get' from='PECL mongo &gt;=1.0.2'/> <function name='mongodb::createcollection' from='PECL mongo &gt;=0.9.0'/> <function name='mongodb::drop' from='PECL mongo &gt;=0.9.0'/> <function name='mongodb::dropcollection' from='PECL mongo &gt;=0.9.0'/> @@ -43,6 +45,7 @@ <!-- MongoCollection --> <function name='mongocollection::__construct' from='PECL mongo &gt;=0.9.0'/> <function name='mongocollection::__tostring' from='PECL mongo &gt;=0.9.0'/> + <function name='mongocollection::__get' from='PECL mongo &gt;=1.0.2'/> <function name='mongocollection::getname' from='PECL mongo &gt;=0.9.0'/> <function name='mongocollection::count' from='PECL mongo &gt;=0.9.0'/> <function name='mongocollection::deleteindex' from='PECL mongo &gt;=0.9.0'/>

« previous php.doc.cvs (#5794) next »