|
|
PHP (angielski akronim rekurencyjny, którego rozwinięcie to PHP Hypertext Preprocessor), pierwotnie nazwany Personal
Home Page - skryptowy język programowania, służący przede wszystkim do tworzenia dynamicznych stron WWW i wykonywany w
tym przypadku po stronie serwera, z możliwością zagnieżdżania w HTML (bądź XHTML). PHP jest podobny w założeniach do
dużo starszego mechanizmu SSI (Server Side Includes), jednak jest w stosunku do SSI nieporównanie bardziej rozbudowany.
Udostępniany jest na zasadach licencji open-source. Jego składnia bazuje na językach C, Java i Perl.
SQL (ang. Structured Query Language) to strukturalny język zapytań używany do tworzenia, modyfikowania baz danych oraz
do umieszczania i pobierania danych z baz danych.
Język SQL jest językiem deklaratywnym. Decyzję o sposobie przechowywania i pobrania danych pozostawia się systemowi
zarządzania bazą danych DBMS.
Jest to język programowania opracowany w latach siedemdziesiątych w firmie IBM. Stał się on standardem w komunikacji z
serwerami relacyjnych baz danych. Wiele współczesnych systemów relacyjnych baz danych używa do komunikacji z
użytkownikiem SQL, dlatego mówi się, że korzystanie z relacyjnych baz danych, to korzystanie z SQL-a.
Apache jest otwartym serwerem HTTP dostępnym dla wielu systemów operacyjnych (m.in. UNIX, GNU/Linux, BSD,
Microsoft Windows). Po angielsku słowo Apache wymawia się epaczi, co brzmi tak samo jak a patchy (server), co było
określeniem tego serwera we wczesnym stadium jego rozwoju w 1995 roku, kiedy był on głównie zbiorem poprawek (patch)
nałożonych na serwer HTTP o nazwie NCSA.
Apache jest najszerzej stosowanym serwerem HTTP w Internecie. W maju 2003 jego udział wśród serwerów wynosił 62%. W
połączeniu z interpreterem języka skryptowego PHP i bazą danych MySQL, Apache stanowi jedno z najczęściej spotykanych
środowisk w firmach oferujących miejsce na serwerach sieciowych.
|
sqlite_open
(PHP 5) sqlite_open -- Opens a SQLite database and create
the database if it does not exist
Opisresource sqlite_open (
string filename [, int mode [, string &error_message]]
)
Object oriented style (constructor): class SQLiteDatabase {
__construct ( string filename [, int
mode [, string &error_message]] )
}
Opens a SQLite database or creates the database if it does
not exist.
Parametry
- filename
-
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.
- mode
-
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 0666 and
this is the recommended value.
- error_message
-
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.
Zwracane wartości
Returns a resource (database handle) on success, FALSE on error.
Przykłady
Przykład 1. sqlite_open() example
<?php if ($db = sqlite_open('mysqlitedb', 0666, $sqliteerror)) {
sqlite_query($db, 'CREATE TABLE foo (bar varchar(10))');
sqlite_query($db, "INSERT INTO foo VALUES ('fnord')");
$result = sqlite_query($db, 'select bar from foo');
var_dump(sqlite_fetch_array($result));
} else {
die($sqliteerror);
} ?> |
|
Notatki
Podpowiedź: On Unix platforms, SQLite is
sensitive to scripts that use the fork() system call. If
you do have such a script, it is recommended that you close
the handle prior to forking and then re-open it in the
child and/or parent. For more information on this issue,
see The C language interface to the SQLite library
in the section entitled Multi-Threading And SQLite.
Podpowiedź: It is not recommended to work with
SQLite databases mounted on NFS partitions. Since NFS is
notoriously bad when it comes to locking you may find that
you cannot even open the database at all, and if it
succeeds, the locking behaviour may be undefined.
Notatka: Starting with SQLite library version
2.8.2, you can specify :memory:
as the filename to create a
database that lives only in the memory of the computer.
This is useful mostly for temporary processing, as the
in-memory database will be destroyed when the process ends.
It can also be useful when coupled with the ATTACH DATABASE SQL statement to load other
databases and move and query data between them.
|