downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

SQLite3::createAggregate> <SQLite3::close
[edit] Last updated: Fri, 17 May 2013

view this page in

SQLite3::__construct

(PHP 5 >= 5.3.0)

SQLite3::__construct Instanciar un objeto de la clase SQLite3 y abrir una base de datos de SQLite 3

Descripción

public SQLite3::__construct ( string $filename [, int $flags [, string $encryption_key ]] )

Instancia un objeto de la clase SQLite3 y abre una conexión a una base de datos de SQLite. Si la construcción incluye encriptación, se intentará usar la clave.

Parámetros

filename

La ruta a la base de datos de SQLite, o :memory: para usar la base de datos que está en memoria.

flags

Banderas opcionales para determinar cómo abrir la base de datos SQLite. Por omisión, el método open utiliza SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE.

  • SQLITE3_OPEN_READONLY: Abrir la base de datos para sólo lectura.

  • SQLITE3_OPEN_READWRITE: Abrir la base de datos para lectura y escritura.

  • SQLITE3_OPEN_CREATE: Crear la base de datos si no existe.

encryption_key

Una clave de encriptación opcional usada cuando se encripta o desencripta una base de datos de SQLite.

Valores devueltos

Devuelve un objeto SQLite3 en caso de éxito.

Errores/Excepciones

Lanza una Exception cuando falla.

Ejemplos

Ejemplo #1 Ejemplo de SQLite3::__construct()

<?php
$bd 
= new SQLite3('mibdsqlite.db');

$bd->exec('CREATE TABLE foo (bar STRING)');
$bd->exec("INSERT INTO foo (bar) VALUES ('Esto es una prueba')");

$resultado $bd->query('SELECT bar FROM foo');
var_dump($resultado->fetchArray());
?>



add a note add a note User Contributed Notes SQLite3::__construct - [2 notes]
up
0
bohwaz
2 years ago
$encryption_key and all encryption features will be enabled only if the SQLite encryption module is installed. It's a proprietary, costly module. So if it's not present, supplying an encryption key will have absolutely no effect.
up
0
Anonymous
1 year ago
Construct will fail if \ backslash is used in the database path,
use / forward slash instead for directory separators.

 
show source | credits | sitemap | contact | advertising | mirror sites