<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >px_create_fp</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Paradox File Access" HREF="ref.paradox.html"><LINK REL="PREVIOUS" TITLE="px_close" HREF="function.px-close.html"><LINK REL="NEXT" TITLE="px_date2string" HREF="function.px-date2string.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.px-close.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.px-date2string.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.px-create-fp" ></A >px_create_fp</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN162343" ></A ><P > (PECL)</P >px_create_fp -- Create a new paradox database</DIV ><DIV CLASS="refsect1" ><A NAME="AEN162346" ></A ><H2 >Descrição</H2 >bool <B CLASS="methodname" >px_create_fp</B > ( resource pxdoc, resource file, array fielddesc )<BR ></BR ><P > Create a new paradox database file. The actual file has to be opened before with <A HREF="function.fopen.html" ><B CLASS="function" >fopen()</B ></A >. Make sure the file is writable. </P ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B >Calling this functions issues a warning about an empty tablename which can be safely ignored. Just set the tablename afterwards with <A HREF="function.px-set-parameter.html" ><B CLASS="function" >px_set_parameter()</B ></A >.</P ></BLOCKQUOTE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B >This function is highly experimental, due to insufficient documentation of the paradox file format. Database files created with this function can be opened by <A HREF="function.px-open-fp.html" ><B CLASS="function" >px_open_fp()</B ></A > and has been successfully opened by the Paradox software, but your milage may vary. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN162368" ></A ><H2 >Parâmetros</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >pxdoc</CODE ></DT ><DD ><P > Resource identifier of the paradox database as returned by <A HREF="function.px-new.html" ><B CLASS="function" >px_new()</B ></A >. </P ></DD ><DT ><CODE CLASS="parameter" >file</CODE ></DT ><DD ><P >File handle as returned by <A HREF="function.fopen.html" ><B CLASS="function" >fopen()</B ></A >. </P ></DD ><DT ><CODE CLASS="parameter" >fielddesc</CODE ></DT ><DD ><P > <CODE CLASS="option" >fielddesc</CODE > is an array containing one element for each field specification. A 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 <A HREF="ref.paradox.html#paradox.table-fieldtypes" >Constants for field types</A >. In the case of a character field or bcd field, you will have to provide a third element specifying the length respectively the precesion of the field. If your field specification contains blob fields, you will have to make sure to either make the field large enough for all field values to fit or specify a blob file with <A HREF="function.px-set-blob-file.html" ><B CLASS="function" >px_set_blob_file()</B ></A > for storing the blobs. If this is not done the field data is truncated. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN162392" ></A ><H2 >Valores de retornado</H2 ><P > Retorna <TT CLASS="constant" ><B >TRUE</B ></TT > em caso de sucesso ou <TT CLASS="constant" ><B >FALSE</B ></TT > em falhas. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN162397" ></A ><H2 >Exemplos</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN162400" ></A ><P ><B >Exemplo 1. Creating a Paradox database with two fields</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /></font><font color="#007700">if(!</font><font color="#0000BB">$pxdoc </font><font color="#007700">= </font><font color="#0000BB">px_new</font><font color="#007700">()) {<br /> </font><font color="#FF8000">/* Error handling */<br /></font><font color="#007700">}<br /></font><font color="#0000BB">$fp </font><font color="#007700">= </font><font color="#0000BB">fopen</font><font color="#007700">(</font><font color="#DD0000">"test.db"</font><font color="#007700">, </font><font color="#DD0000">"w+"</font><font color="#007700">);<br /></font><font color="#0000BB">$fields </font><font color="#007700">= array(array(</font><font color="#DD0000">"col1"</font><font color="#007700">, </font><font color="#DD0000">"S"</font><font color="#007700">), array(</font><font color="#DD0000">"col2"</font><font color="#007700">, </font><font color="#DD0000">"I"</font><font color="#007700">));<br />if(!</font><font color="#0000BB">px_create_fp</font><font color="#007700">(</font><font color="#0000BB">$pxdoc</font><font color="#007700">, </font><font color="#0000BB">$fp</font><font color="#007700">, </font><font color="#0000BB">$fields</font><font color="#007700">)) {<br /> </font><font color="#FF8000">/* Error handling */<br /></font><font color="#007700">}<br /></font><font color="#0000BB">px_set_parameter</font><font color="#007700">(</font><font color="#0000BB">$pxdoc</font><font color="#007700">, </font><font color="#DD0000">"tablename"</font><font color="#007700">, </font><font color="#DD0000">"testtable"</font><font color="#007700">);<br />for(</font><font color="#0000BB">$i</font><font color="#007700">=-</font><font color="#0000BB">50</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700"><</font><font color="#0000BB">50</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">++) {<br /> </font><font color="#0000BB">$rec </font><font color="#007700">= array(</font><font color="#0000BB">$i</font><font color="#007700">, -</font><font color="#0000BB">$i</font><font color="#007700">);<br /> </font><font color="#0000BB">px_put_record</font><font color="#007700">(</font><font color="#0000BB">$pxdoc</font><font color="#007700">, </font><font color="#0000BB">$rec</font><font color="#007700">);<br />} <br /></font><font color="#0000BB">px_close</font><font color="#007700">(</font><font color="#0000BB">$pxdoc</font><font color="#007700">);<br /></font><font color="#0000BB">px_delete</font><font color="#007700">(</font><font color="#0000BB">$pxdoc</font><font color="#007700">);<br /></font><font color="#0000BB">fclose</font><font color="#007700">(</font><font color="#0000BB">$fp</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN162403" ></A ><H2 >Veja também</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.px-new.html" ><B CLASS="function" >px_new()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.px-put-record.html" ><B CLASS="function" >px_put_record()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.fopen.html" ><B CLASS="function" >fopen()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.px-close.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.px-date2string.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >px_close</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.paradox.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >px_date2string</TD ></TR ></TABLE ></DIV ></BODY ></HTML >