Sophie

Sophie

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

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
>sqlite_popen</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="SQLite Functions"
HREF="ref.sqlite.html"><LINK
REL="PREVIOUS"
TITLE="sqlite_open"
HREF="function.sqlite-open.html"><LINK
REL="NEXT"
TITLE="sqlite_prev"
HREF="function.sqlite-prev.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.sqlite-open.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.sqlite-prev.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.sqlite-popen"
></A
>sqlite_popen</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN217642"
></A
><P
>    (PHP 5)</P
>sqlite_popen&nbsp;--&nbsp;
   Opens a persistent handle to an SQLite database and create the database if it does not exist
  </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN217645"
></A
><H2
>说明</H2
>resource <B
CLASS="methodname"
>sqlite_popen</B
> ( string filename [, int mode [, string &#38;error_message]] )<BR
></BR
><P
>&#13;   This function behaves identically to <A
HREF="function.sqlite-open.html"
><B
CLASS="function"
>sqlite_open()</B
></A
>
   except that is uses the persistent resource mechanism of PHP.
   For information about the meaning of the parameters, read the
   <A
HREF="function.sqlite-open.html"
><B
CLASS="function"
>sqlite_open()</B
></A
> manual page.
  </P
><P
>&#13;   <B
CLASS="function"
>sqlite_popen()</B
> will first check to see if a persistent
   handle has already been opened for the given
   <CODE
CLASS="parameter"
>filename</CODE
>.  If it finds one, it returns that handle
   to your script, otherwise it opens a fresh handle to the database.
  </P
><P
>&#13;   The benefit of this approach is that you don't incur the performance
   cost of re-reading the database and index schema on each page hit served
   by persistent web server SAPI's (any SAPI except for regular CGI or CLI).
  </P
><DIV
CLASS="note"
><BLOCKQUOTE
CLASS="note"
><P
><B
>注意: </B
>
    If you use persistent handles and have the database updated by a
    background process (perhaps via a crontab), and that process re-creates
    the database by overwriting it (either by unlinking and rebuilding, or
    moving the updated version to replace the current version),
    you may experience undefined behaviour when a persistent handle on the
    old version of the database is recycled.
   </P
><P
>&#13;    To avoid this situation, have your background processes open the same
    database file and perform their updates in a transaction.
   </P
></BLOCKQUOTE
></DIV
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN217669"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>filename</CODE
></DT
><DD
><P
>&#13;       The filename of the SQLite database.  If the file does not exist, SQLite
       will attempt to create it.  PHP must have write permissions to the file
       if data is inserted, the database schema is modified or to create the
       database if it does not exist.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>mode</CODE
></DT
><DD
><P
>&#13;       The mode of the file. Intended to be used to open the database in
       read-only mode.  Presently, this parameter is ignored by the sqlite
       library.  The default value for mode is the octal value
       <TT
CLASS="literal"
>0666</TT
> and this is the recommended value.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>error_message</CODE
></DT
><DD
><P
>&#13;       Passed by reference and is set to hold a descriptive error message
       explaining why the database could not be opened if there was an error.
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN217689"
></A
><H2
>返回值</H2
><P
>&#13;   Returns a resource (database handle) on success, <TT
CLASS="constant"
><B
>FALSE</B
></TT
> on error.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN217693"
></A
><H2
>参见</H2
><P
>&#13;   <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="function.sqlite-open.html"
><B
CLASS="function"
>sqlite_open()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.sqlite-close.html"
><B
CLASS="function"
>sqlite_close()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.sqlite-factory.html"
><B
CLASS="function"
>sqlite_factory()</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.sqlite-open.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.sqlite-prev.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>sqlite_open</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.sqlite.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>sqlite_prev</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>