SQLite3::__construct
(PHP 5 >= 5.3.0)
SQLite3::__construct — SQLite3 オブジェクトを作成し、SQLite 3 データベースをオープンする
説明
SQLite3::__construct
( string $filename
[, int $flags
[, string $encryption_key
]] )
SQLite3 オブジェクトを作成し、SQLite 3 データベースをオープンします。 暗号化込みでビルドされている場合は、キーの使用を試みます。
パラメータ
- filename
-
SQLite データベースへのパス。
- flags
-
SQLite データベースのオープン方法を指定するフラグ。 デフォルトでは SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE を使用してオープンします。
-
SQLITE3_OPEN_READONLY: データベースを読み込み専用でオープンする
-
SQLITE3_OPEN_READWRITE: データベースを読み書き共用でオープンする
-
SQLITE3_OPEN_CREATE: データベースが存在しない場合は作成する
-
- encryption_key
-
オプションの暗号キー。SQLite データベースの暗号化と復号に使用します。
返り値
成功した場合に SQLite3 オブジェクトを返します。
例
例1 SQLite3::__construct() の例
<?php
$db = new SQLite3('mysqlitedb.db');
$db->exec('CREATE TABLE foo (bar STRING)');
$db->exec("INSERT INTO foo (bar) VALUES ('This is a test')");
$result = $db->query('SELECT bar FROM foo');
var_dump($result->fetchArray());
?>
SQLite3::__construct
There are no user contributed notes for this page.
