How to delete SQLite database in memory using PHP PDO?

When I create a SQLite memory database - how do I delete it when I finish? Is it automatically freed when the script ends and closes the connection?

$pdo = new PDO('sqlite::memory:'); 
+6
source share
2 answers

Yes, what is happening.

+4
source

The most common way to make a SQLite database exist exclusively in memory is to open the database using a special file name: "memory:" ...... When this is done, the disk file will not be opened. Instead, a new database created exclusively in memory. The database ceases to exist as soon as the connection to the database is closed. Each: memory: the database is different from any other. So, opening two connections to the database filename ": memory:" will create two independent databases in memory. - SQLite

+10
source

Source: https://habr.com/ru/post/909015/


All Articles