php-doc-en/reference/paradox/functions/px-create-fp.xml
Jakub Vrana a6ddc90d6b Fix parameters
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@188821 c90b9560-bf6c-de11-be94-00142212c4b1
2005-06-20 08:12:16 +00:00

111 lines
3.3 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.3 $ -->
<!-- splitted from ./en/functions/paradox.xml, last change in rev -->
<refentry id="function.px-create-fp">
<refnamediv>
<refname>px_create_fp</refname>
<refpurpose>Create a new paradox database</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>bool</type><methodname>px_create_fp</methodname>
<methodparam><type>resource</type><parameter>pxdoc</parameter></methodparam>
<methodparam><type>resource</type><parameter>file</parameter></methodparam>
<methodparam><type>array</type><parameter>fielddesc</parameter></methodparam>
</methodsynopsis>
<para>
Create a new paradox database file. The actual file has to be opened before
with <function>fopen</function>. Make sure the file is writable. The first
parameter is the return value of <function>px_new</function>.
<option>fielddesc</option> is an array containing one element for each
field containing its specification. Each field specification is an array
itself with either two or three elements.The first element is always a
string value used as the name of the field. It may not be larger than ten
characters. The second element contains the field type which is one of the
constants listed in the table
<link linkend="paradox.table-fieldtypes">Constants for field types</link>.
In the case of a character field, you will have to provide a third element
specifying the length of the field.
</para>
<note>
<para>This function is highly experimental, due to insufficient
documentation of the paradox file format. Database files created with this
function can be opened by <function>px_open_fp</function> and has been
successfully opened by the Paradox software, but your milage may vary.
</para>
</note>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
&return.success;
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Creating a Paradox database with two fields</title>
<programlisting role="php">
<![CDATA[
<?php
if(!$pxdoc = px_new()) {
/* Error handling */
}
$fp = fopen("test.db", "w+");
$fields = array(array("col1", "S"), array("col2", "I"));
if(!px_create_fp($pxdoc, $fp, $fields)) {
/* Error handling */
}
px_set_tablename($pxdoc, "testtable");
for($i=-50; $i<50; $i++) {
$rec = array($i, -$i);
px_put_record($pxdoc, $rec);
}
px_close($pxdoc);
px_delete($pxdoc);
fclose($fp);
?>
]]>
</programlisting>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>px_new</function></member>
<member><function>px_put_record</function></member>
<member><function>fopen</function></member>
</simplelist>
</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
-->