On 10/15/2015 04:09 PM, Alberto Luaces wrote:
Maybe the saner approach with sqlite could be to check first the
existence of the database file, before trying to connect to it.
You could do that yourself by changing the default open flags, as
described in
https://metacpan.org/pod/DBD::SQLite#Database-Name-Is-A-File-Name
rabbit@Ahasver:~$ ls -l /tmp/foo
ls: cannot access /tmp/foo: No such file or directory
rabbit@Ahasver:~$ perl -MDBD::SQLite -MDBI -e
'DBI->connect("dbi:SQLite:/tmp/foo", undef, undef, { sqlite_open_flags
=> DBD::SQLite::OPEN_READWRITE } )'
DBI connect('/tmp/foo','',...) failed: unable to open database file at
-e line 1.
rabbit@Ahasver:~$ perl -MDBD::SQLite -MDBI -e
'DBI->connect("dbi:SQLite:/tmp/foo", undef, undef, { } )'
rabbit@Ahasver:~$ ls -l /tmp/foo
-rw-r--r-- 1 rabbit rabbit 0 Oct 17 13:15 /tmp/foo
rabbit@Ahasver:~$ perl -MDBD::SQLite -MDBI -e
'DBI->connect("dbi:SQLite:/tmp/foo", undef, undef, { sqlite_open_flags
=> DBD::SQLite::OPEN_READWRITE } )'
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk