php-doc-en/reference/chdb/functions/chdb-create.xml
Jakub Vrana 67dc0bc036 Fix protos
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@308221 c90b9560-bf6c-de11-be94-00142212c4b1
2011-02-10 20:22:08 +00:00

123 lines
3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="function.chdb-create" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>chdb_create</refname>
<refpurpose>Creates a chdb file</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>chdb_create</methodname>
<methodparam><type>string</type><parameter>pathname</parameter></methodparam>
<methodparam><type>array</type><parameter>data</parameter></methodparam>
</methodsynopsis>
<para>
<function>chdb_create</function> creates a chdb file containing the
specified key-value pairs.
</para>
<note>
<para>
chdb files are not portable across little-endian and big-endian
environments. Except for that, they are portable across different
architectures. Also compatibility across different versions of chdb is not
guaranteed.
</para>
</note>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>pathname</parameter></term>
<listitem>
<para>
The name of the file to create.
</para>
<para>
If a file with the same name already exists, it is overwritten.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>data</parameter></term>
<listitem>
<para>
An array containing the key-value pairs to store in the chdb file.
</para>
<para>
Keys and values are converted to strings before being written to the file,
as chdb only support the string type. Note that binary strings are
supported as well, both as keys and values.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<para>
Throws an exception in case the chdb file hasn't been successfully created.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>chdb_create</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$data = array(
'key1' => 'value1',
'key2' => 'value2',
// ...
);
chdb_create('data.chdb', $data);
?>
]]>
</programlisting>
<para>
The above example will generate a chdb file named
<literal>data.chdb</literal> and containing the key-value pairs defined in
<varname>$data</varname>.
</para>
</example>
</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
-->