examples, storeBytes

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@282729 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Kristina Chodorow 2009-06-24 19:14:05 +00:00
parent 2f23be37bf
commit 70e1a619a3
6 changed files with 168 additions and 5 deletions

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="mongocollection.createdbref" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCollection::createDBRef</refname>
@ -39,6 +39,40 @@
Returns a database reference array.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoCollection::createDBRef</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$songs = $db->selectCollection('songs');
$playlists = $db->selectCollection('playlists');
// create a reference to a song
$manamana = $songs->findOne(array('title' => 'Ma na ma na'));
$refToSong = $songs->createDBRef($manamana);
// add the reference to my playlist
$playlists->update(array('username' => 'me'), array('$push' => array('songlist' => $refToSong)));
?>
]]>
</programlisting>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>MongoCollection::getDBRef</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="mongocollection.getdbref" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoCollection::getDBRef</refname>
@ -39,6 +39,39 @@
Returns the database document pointed to by the reference.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoCollection::createDBRef</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$playlists = $db->selectCollection('playlists');
$myList = $playlists->findOne(array('username' => 'me'));
// fetch each song in the playlist
foreach ($myList['songlist'] as $songRef) {
$song = $playlists->getDBRef($songRef);
echo $song['title'] . "\n";
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Dazed and Confused
Ma na ma na
Bohemian Rhapsody
]]>
</screen>
</example>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.2 $ -->
<!-- $Revision: 1.3 $ -->
<refentry xml:id="mongodbref.create" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDBRef::create</refname>
@ -50,6 +50,17 @@
Returns the reference.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>MongoDB::createDBRef</methodname></member>
<member><methodname>MongoCollection::createDBRef</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<refentry xml:id="mongodbref.get" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDBRef::get</refname>
@ -50,6 +50,17 @@
Returns the object or &null;.
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><methodname>MongoDB::getDBRef</methodname></member>
<member><methodname>MongoCollection::getDBRef</methodname></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<refentry xml:id="mongogridfs.storebytes" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoGridFS::storeBytes</refname>
<refpurpose>Chunkifies and stores bytes in the database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>public</modifier> <type>boolean</type><methodname>MongoGridFS::storeBytes</methodname>
<methodparam><type>string</type><parameter>bytes</parameter></methodparam>
<methodparam choice="opt"><type>array</type><parameter>extra</parameter><initializer>array()</initializer></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term>
<parameter>bytes</parameter>
</term>
<listitem>
<para>
A string of bytes to store.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>extra</parameter>
</term>
<listitem>
<para>
Other metadata to add to the file saved.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns if the bytes were saved.
</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
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
-->

View file

@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<!-- $Revision: 1.9 $ -->
<!-- $Revision: 1.10 $ -->
<!--
Do NOT translate this file
-->
@ -86,6 +86,7 @@
<function name='mongogridfs::findone' from='PECL mongo &gt;=0.9.0'/>
<function name='mongogridfs::storefile' from='PECL mongo &gt;=0.9.0'/>
<function name='mongogridfs::storeupload' from='PECL mongo &gt;=0.9.0'/>
<function name='mongogridfs::storebytes' from='PECL mongo &gt;=0.9.2'/>
<!-- MongoGridFSFile -->
<function name='mongogridfsfile::__construct' from='PECL mongo &gt;=0.9.0'/>
<function name='mongogridfsfile::getbytes' from='PECL mongo &gt;=0.9.0'/>