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

search for in the

PDO::sqliteCreateAggregate> <SQLite (PDO)
[edit] Last updated: Fri, 23 Mar 2012

view this page in

PDO_SQLITE DSN

(PECL PDO_SQLITE >= 0.2.0)

PDO_SQLITE DSNSQLite veritabanı bağlantısı

Açıklama

PDO_SQLITE Veri Kaynağı Adı (DSN) şu öğelerden oluşur:

DSN öneki (SQLite 3)

DSN öneki sqlite: dizgesidir.

  • Disk üzerindeki bir veritabanına erişmek için DSN önekinin ardına mutlak dosya yolunu ekleyin.

  • Bellekte bir veritabanı oluşturmak için DSN önekinin ardına :memory: dizgesini ekleyin.

DSN öneki (SQLite 2)

PHP 5.1'deki SQLite eklentisi SQLite 2 veribanlarını oluşturmak ve erişmek için bir PDO sürücüsü desteği de sağlar. Böylece daha önceki PHP sürümlerinin SQLite eklentisi ile oluşturduğunuz veritabanlarına da erişebilirsiniz.

Bilginize:

Sqlite2 PDO sürücüsünü PHP 5.1.x sürümlerinde sadece PDO'yu ve ext/sqlite'ı birlikte etkin kıldığınızda kullanabilirsiniz. PECL üzerinden kurulum mümkün değildir.

SQLite 2 veritabanlarına bağlanmak için DSN öneki sqlite2: dizgesidir.

  • Disk üzerindeki bir veritabanına erişmek için DSN önekinin ardına mutlak dosya yolunu ekleyin.

  • Bellekte bir veritabanı oluşturmak için DSN önekinin ardına :memory: dizgesini ekleyin.

Örnekler

Örnek 1 - PDO_SQLITE DSN örnekleri

Aşağıdaki örneklerde SQLite veritabanlarına bağlanmak için PDO_SQLITE DSN kullanımları gösterilmiştir:

sqlite:/opt/databases/mydb.sq3
sqlite::memory:
sqlite2:/opt/databases/mydb.sq2
sqlite2::memory:



PDO::sqliteCreateAggregate> <SQLite (PDO)
[edit] Last updated: Fri, 23 Mar 2012
 
add a note add a note User Contributed Notes PDO_SQLITE DSN
frederic dot glorieux at diple dot net 10-Aug-2011 09:20
In memory sqlite has some limitations. The memory space could be the request, the session, but no way seems documented to share a base in memory among users.

For a request, open your base with the code
$pdo = new PDO( 'sqlite::memory:');
and your base will disapear on next request.

For session persistency
<?php
$pdo
= new PDO(
   
'sqlite::memory:',
   
null,
   
null,
    array(
PDO::ATTR_PERSISTENT => true)
);
?>
FST777 20-Apr-2008 11:27
@ Fatmoon
That is correct. SQLite sometimes uses additional files in the same folder while writing to the DB. These files can sometimes be seen and usually contain the name of your DB and the word 'journal' in their filename.
Security wise, it might be a good idea to store the SQLite databases in a seperate folder to shield the rest from user www.
Fatmoon 20-Apr-2008 01:42
It seems that the directory that contains your sqlite database must be writeable by the web server. Making just the file writeable won't work.
rick 30-Oct-2006 03:51
Don't forget "extension=php_pdo_sqlite.dll" has to be enabled in php.ini (if you use xampp is will be disabled by default) .

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