Dynamic Web Pages: deutschsprachiger PHP Knotenpunkt seit 1999

Dynamic Web Pages : deutschsprachiges PHP-Handbuch : sqlite-popen _

<sqlite_open sqlite_prev>
Letzte Aktualisierung: Tue, 18 Nov 2014


(PHP 5)

sqlite_popen -- Opens a persistent handle to an SQLite database. Will create the database if it does not exist


resource sqlite_popen ( string filename [, int mode [, string &errmessage]] )

This function behaves identically to sqlite_open() except that is uses the persistent resource mechanism of PHP. For information about the meaning of the parameters, read the sqlite_open() manual page.

sqlite_popen() will first check to see if a persistent handle has already been opened for the given filename. If it finds one, it returns that handle to your script, otherwise it opens a fresh handle to the database.

The benefit of this approach is that you don't incurr 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).

Anmerkung: 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.

To avoid this situation, have your background processes open the same database file and perform their updates in a transaction.

See also sqlite_popen(), sqlite_close() and sqlite_query().

<sqlite_open sqlite_prev>
Letzte Aktualisierung: Tue, 18 Nov 2014

powered by Hetzner
top Alle Rechte vorbehalten. © Dynamic Web Pages 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 top

Werbung an/aus Werbung aus Werbung an