tags:

views:

108

answers:

2

I've heard that SQLite can do this (to avoid synchronicity issues in heavy traffic scenarios) is this true? If so how would I do this with PDO in PHP?

+3  A: 

Would you be looking for the ATTACH and DETACH sqlite commands? You can call these with a query to any SQLite PDO object.

The commands allow you to attach a separate database file to the current session. An example would be:

$connection->query('ATTACH DATABASE blog_entries.sqlite AS BlogEntries;');

You can then refer to the tables located in the attached database by their name (eg: SELECT * FROM entries) if there is no duplicate tables. If there is a conflict then they need to be namespaced with the database alias (eg: SELECT * FROM BlogEntries.entries)

Reference: SQLite Manual

Elliot Anderson
A: 

You can open a DB in memory (I believe the DSN for PDO is sqlite:memory:) and attach the different databases.

Alix Axel