IB2017 has asked for the wisdom of the Perl Monks concerning the following question:
Hello monks
I am trying to improve the error handling of my application that uses SQLite. I have noticed that the following script is not producing an error, no matter what $database is (empty, a non existing database name, etc.). However, if $database does not exist I would have expected to see an error. This forces me to first check for the existence of $database. Is this a feature?
use DBI; use strict; my $driver = "SQLite"; my $database = ""; my $dsn = "DBI:$driver:dbname=$database"; my $userid = ""; my $password = ""; my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) or die $DBI::errstr; print "Opened database successfully\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error DBI::SQLite file not existent
by haj (Vicar) on Aug 19, 2018 at 18:21 UTC | |
|
Re: Error DBI::SQLite file not existent
by thanos1983 (Parson) on Aug 20, 2018 at 07:52 UTC | |
|
Re: Error DBI::SQLite file not existent
by IB2017 (Pilgrim) on Aug 20, 2018 at 09:41 UTC |