Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 5878

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Opens a persistent handle to an SQLite database and create the database if it does not exist</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-open.html">sqlite_open</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-prev.html">sqlite_prev</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.sqlite-popen" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">sqlite_popen</h1>
  <p class="verinfo">(PHP 5 &lt; 5.4.0, PECL sqlite &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">sqlite_popen</span> &mdash; <span class="dc-title">
   Opens a persistent handle to an SQLite database and create the database if it does not exist
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.sqlite-popen-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">resource</span> <span class="methodname"><strong>sqlite_popen</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$mode</code><span class="initializer"> = 0666</span></span>
   [, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$error_message</code></span>
  ]] )</div>

  <p class="simpara">
   This function behaves identically to  <span class="function"><a href="function.sqlite-open.html" class="function">sqlite_open()</a></span>
   except that is uses the persistent resource mechanism of PHP.
   For information about the meaning of the parameters, read the
    <span class="function"><a href="function.sqlite-open.html" class="function">sqlite_open()</a></span> manual page.
  </p>
  <p class="para">
    <span class="function"><strong>sqlite_popen()</strong></span> will first check to see if a persistent
   handle has already been opened for the given
   <em><code class="parameter">filename</code></em>.  If it finds one, it returns that handle
   to your script, otherwise it opens a fresh handle to the database.
  </p>
  <p class="para">
   The benefit of this approach is that you don&#039;t incur the performance
   cost of re-reading the database and index schema on each page hit served
   by persistent web server SAPI&#039;s (any SAPI except for regular CGI or CLI).
  </p>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <span class="simpara">
    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.
   </span>
   <span class="simpara">
    To avoid this situation, have your background processes open the same
    database file and perform their updates in a transaction.
   </span>
  </p></blockquote>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.sqlite-popen-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">filename</code></em></span>
     <dd>

      <p class="para">
       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>

    <dt>

     <span class="term"><em><code class="parameter">mode</code></em></span>
     <dd>

      <p class="para">
       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
       <em>0666</em> and this is the recommended value.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">error_message</code></em></span>
     <dd>

      <p class="para">
       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>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.sqlite-popen-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns a resource (database handle) on success, <strong><code>FALSE</code></strong> on error.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.sqlite-popen-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.sqlite-open.html" class="function" rel="rdfs-seeAlso">sqlite_open()</a> - Opens an SQLite database and create the database if it does not exist</span></li>
    <li class="member"> <span class="function"><a href="function.sqlite-close.html" class="function" rel="rdfs-seeAlso">sqlite_close()</a> - Closes an open SQLite database</span></li>
    <li class="member"> <span class="function"><a href="function.sqlite-factory.html" class="function" rel="rdfs-seeAlso">sqlite_factory()</a> - Opens an SQLite database and returns an SQLiteDatabase object</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.sqlite-open.html">sqlite_open</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.sqlite-prev.html">sqlite_prev</a></div>
 <div class="up"><a href="ref.sqlite.html">SQLite Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>