added basic MongoInt32 and MongoInt64 docs

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@303011 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kristina Chodorow 2010-09-02 18:41:54 +00:00
parent 74a8cf789c
commit 72c4b4b64c
9 changed files with 443 additions and 33 deletions

View file

@ -15,6 +15,16 @@
</row>
</thead>
<tbody>
<row>
<entry><link linkend="ini.mongo.native-long">mongo.native_long</link></entry>
<entry>false<link linkend="ini.mongo.native-long">*</link></entry>
<entry>PHP_INI_ALL</entry>
</row>
<row>
<entry><link linkend="ini.mongo.long-as-object">mongo.long_as_object</link></entry>
<entry>false</entry>
<entry>PHP_INI_ALL</entry>
</row>
<row>
<entry><link linkend="ini.mongo.default-host">mongo.default_host</link></entry>
<entry>"localhost"</entry>
@ -60,6 +70,60 @@
<para>
<variablelist>
<varlistentry xml:id="ini.mongo.native-long">
<term>
<parameter>mongo.native-long</parameter>
<type>int</type>
</term>
<listitem>
<para>
<emphasis>
The default behavior for this will be changed to &true; in 1.1.0, so make
sure to set this variable to the value you want (probably &true;) so that
the driver's behavior doesn't suddenly change when you upgrade.
</emphasis>
</para>
<para>
On 64-bit platforms, the <literal>mongo.native_long</literal> setting
allows for 64-bit integers to be stored in MongoDB. If it is not set, only
32-bits of the integer will be saved. The MongoDB data type that is used
in this case is the BSON LONG, instead of the BSON INT that is used if
this setting is turned off.
</para>
<para>
The setting also changes the way how BSON LONGs behave when they are read
back from MongoDB. Without <literal>mongo.native_long</literal> enabled,
the driver would convert every BSON LONG to a PHP double which can result
in a loss of precision.
</para>
<para>
On 32-bit platforms, the <literal>mongo.native_log</literal> setting
changes nothing for storing integers in MongoDB: the integer is stored
as a BSON INT as before. However, when the setting is enabled and a
BSON LONG is read from MongoDB a
<classname>MongoCursorException</classname> is thrown alerting you that
the data could not be read back without losing precision.
</para>
<para>
On 32-bit systems especially, it is recommended that you combine this with
enabling <literal>mongo.long_as_object</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.mongo.long-as-object">
<term>
<parameter>mongo.long_as_object</parameter>
<type>string</type>
</term>
<listitem>
<para>
Return a BSON_LONG as an instance of <classname>MongoInt64</classname>
(instead of a primitive type).
</para>
</listitem>
</varlistentry>
<varlistentry xml:id="ini.mongo.default-host">
<term>
<parameter>mongo.default_host</parameter>

View file

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongoint32" 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 MongoInt32 class</title>
<titleabbrev>MongoInt32</titleabbrev>
<partintro>
<!-- {{{ MongoInt32 intro -->
<section xml:id="mongobindata.intro">
&reftitle.intro;
<para>
The class can be used to save 32-bit integers to the database on a 64-bit
system.
</para>
</section>
<!-- }}} -->
<section xml:id="mongobindata.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoInt32</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoInt32</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongoint32')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.mongo.entities.mongoint32;
</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
-->

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongoint32.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoInt32::__construct</refname>
<refpurpose>Creates a new 32-bit integer.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>MongoInt32::__construct</methodname>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Creates a new 32-bit number with the given value.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term>
<parameter>value</parameter>
</term>
<listitem>
<para>
A number.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new integer.
</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:"~/.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
-->

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongoint32.tostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoInt32::__toString</refname>
<refpurpose>Returns the string representation of this 32-bit integer.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>MongoInt32::__toString</methodname>
<void />
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the string representation of this integer.
</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:"~/.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
-->

View file

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongoint64" 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 MongoInt64 class</title>
<titleabbrev>MongoInt64</titleabbrev>
<partintro>
<!-- {{{ MongoInt64 intro -->
<section xml:id="mongobindata.intro">
&reftitle.intro;
<para>
The class can be used to save 64-bit integers to the database on a 32-bit
system.
</para>
</section>
<!-- }}} -->
<section xml:id="mongobindata.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoInt64</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoInt64</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongoint64')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
&reference.mongo.entities.mongoint64;
</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
-->

View file

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongoint64.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoInt64::__construct</refname>
<refpurpose>Creates a new 64-bit integer.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>MongoInt64::__construct</methodname>
<methodparam><type>string</type><parameter>value</parameter></methodparam>
</methodsynopsis>
<para>
Creates a new 64-bit number with the given value.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term>
<parameter>value</parameter>
</term>
<listitem>
<para>
A number.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a new integer.
</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:"~/.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
-->

View file

@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongoint64.tostring" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoInt64::__toString</refname>
<refpurpose>Returns the string representation of this 64-bit integer.</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <methodname>MongoInt64::__toString</methodname>
<void />
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
&no.function.parameters;
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns the string representation of this integer.
</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:"~/.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
-->

View file

@ -273,39 +273,7 @@ Fatal error: Nesting level too deep - recursive dependency?
</row>
<row>
<entry><classname>MongoTimestamp</classname></entry>
<entry>Sharding timestamp</entry>
<entry>8</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</section>
<section>
<title>Unsupported Types</title>
<para>Types supported by Mongo, but not the PHP driver:</para>
<para>
<informaltable>
<tgroup cols="3">
<thead>
<row>
<entry>Type</entry>
<entry>Description</entry>
<entry>Size in MongoDB (bytes)</entry>
</row>
</thead>
<tbody>
<row>
<entry>long</entry>
<entry>
As PHP does not support 8 byte integers, longs fetched from the database
are converted to doubles. Integers will always be saved to the database
as 4 byte ints (even on machines that support 8 byte ints) and doubles
will be saved as 8 bytes doubles, so there is no way to save a long to
the database with the PHP driver.
</entry>
<entry>Replication timestamp</entry>
<entry>8</entry>
</row>
</tbody>

View file

@ -140,6 +140,12 @@
<function name='mongodbref::create' from='PECL mongo &gt;= 0.9.0'/>
<function name='mongodbref::isref' from='PECL mongo &gt;= 0.9.0'/>
<function name='mongodbref::get' from='PECL mongo &gt;= 0.9.0'/>
<!-- MongoInt32 -->
<function name='mongoint32::__construct' from='PECL mongo &gt;= 1.0.9'/>
<function name='mongoint32::__tostring' from='PECL mongo &gt;= 1.0.9'/>
<!-- MongoInt64 -->
<function name='mongoint64::__construct' from='PECL mongo &gt;= 1.0.9'/>
<function name='mongoint64::__tostring' from='PECL mongo &gt;= 1.0.9'/>
</versions>
<!-- Keep this comment at the end of the file