W
W
WayMax2018-08-10 09:56:45
PHP
WayMax, 2018-08-10 09:56:45

How to prevent db file from being created when opened via PHP PDO?

$db = new PDO("sqlite:file1.db");
If there is no file1.db, PHP PDO will create an empty file. Except as an option:

if(!file_exists ("file1.db"))
{
    return;
}
$db = new PDO("sqlite:file1.db");
is there no other way to prevent the creation of an empty db file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2018-08-10
@WayMax

The constructor almost immediately calls sqlite_open, which says:
That is, no, there is no regular way, it seems at the level of the library itself. Or at least the way it is used from PDO.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question