Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 3976

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!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="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"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.px-close.html"
ACCESSKEY="P"
>上一页</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"
>下一页</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="AEN167263"
></A
><P
>    (PECL)</P
>px_create_fp&nbsp;--&nbsp;Create a new paradox database</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN167266"
></A
><H2
>说明</H2
>bool <B
CLASS="methodname"
>px_create_fp</B
> ( resource pxdoc, resource file, array fielddesc )<BR
></BR
><P
>&#13;   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
>注意: </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
>注意: </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="AEN167288"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>pxdoc</CODE
></DT
><DD
><P
>&#13;       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
>&#13;       <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="AEN167312"
></A
><H2
>返回值</H2
><P
>&#13;   如果成功则返回 <TT
CLASS="constant"
><B
>TRUE</B
></TT
>,失败则返回 <TT
CLASS="constant"
><B
>FALSE</B
></TT
>。
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN167317"
></A
><H2
>范例</H2
><P
>&#13;   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN167320"
></A
><P
><B
>例 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">&lt;?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 />&nbsp;&nbsp;</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 />&nbsp;&nbsp;</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">&lt;</font><font color="#0000BB">50</font><font color="#007700">; </font><font color="#0000BB">$i</font><font color="#007700">++) {<br />&nbsp;&nbsp;</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 />&nbsp;&nbsp;</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 />}&nbsp;&nbsp;&nbsp;<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">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN167323"
></A
><H2
>参见</H2
><P
>&#13;   <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"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.px-date2string.html"
ACCESSKEY="N"
>下一页</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"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>px_date2string</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>