I forgot to mention that the last example:
$g_dbh = DBI->connect("dbi:SQLite:dbname=/db.db?cache=shared", "", "", { RaiseError => 1 }) or die $DBI::errstr;
DBD::SQLite::db prepare failed: no such table: events at ..//analytics.pm line 548.
creates the file:
$ ls -l /db.db\?cache\=shared
-rw-r--r-- 1 0 Jul 29 16:05 ../db.db?cache=shared
Which would indeed point towards URI processing not being enabled here.
I've tried enabling URI explicitly, but no joy:
use DBD::SQLite;
$g_dbh = DBI->connect("dbi:SQLite:dbname=/db.db?cache=shared", "", "", { RaiseError => 1, sqlite_open_flags => DBD::SQLite::SQLITE_OPEN_URI }) or die $DBI::errstr;
Bareword "DBD::SQLite::SQLITE_OPEN_URI" not allowed while "strict subs" in use at ..//analytics.pm line 75.
(The same with DBD::SQLite::OPEN_READONLY gets through syntax-wise.)
On Monday, July 29, 2013 at 16:17 , Jan Dusek wrote:
Show quoted text> Thanks a lot for such fast response!
>
> However the upgrade seems to have broken something in the URI syntax:
>
> $g_dbh = DBI->connect("dbi:SQLite:dbname=file:/db.db?cache=shared", "", "", { RaiseError => 1 }) or die $DBI::errstr;
> DBI connect('dbname=file:/db.db?cache=shared','',...) failed: unable to open database file at ..//analytics.pm line 75.
>
> $g_dbh = DBI->connect("dbi:SQLite:dbname=file:/db.db", "", "", { RaiseError => 1 }) or die $DBI::errstr;
> DBI connect('dbname=file:/db.db','',...) failed: unable to open database file at ..//analytics.pm line 75.
>
> This has worked with the previous version.
>
>
> If I remove the 'file:', it gets better:
>
> $g_dbh = DBI->connect("dbi:SQLite:dbname=/db.db", "", "", { RaiseError => 1 }) or die $DBI::errstr;
>
> But then when I now try to open the database as shared, it fails accessing the content correctly (do I need to enable the URI processing somehow?):
>
> $g_dbh = DBI->connect("dbi:SQLite:dbname=/db.db?cache=shared", "", "", { RaiseError => 1 }) or die $DBI::errstr;
> DBD::SQLite::db prepare failed: no such table: events at ..//analytics.pm line 548.
>
>
>
>
> On Sunday, July 28, 2013 at 16:26 , Kenichi Ishigaki via RT wrote:
> > <URL:
https://rt.cpan.org/Ticket/Display.html?id=87297 >
> >
> > Hi. Implemented in a branch with two tests.
> >
> >
https://github.com/DBD-SQLite/DBD-SQLite/tree/uri_filename
> >
> > On Thu Jul 25 21:13:10 2013, jacobs@koiru.com (mailto:jacobs@koiru.com) wrote:
> > > Hello,
> > >
> > > Could DBD::SQLite be enhanced so that URI filename capability can be
> > > enabled during runtime?
> > >
> > > I'm working with in-memory databases in SQLite and I need to use a
> > > query string in the connection URI (e.g.
> > > 'dbi:SQLite:dbname=file:memdb?mode=memory&cache=shared').
> > >
> > > However at the moment I don't think there's a good way to do this via
> > > DBD::SQLite due to the URI filename capability being disabled by
> > > default (see:
http://www.sqlite.org/uri.html chapter 2.0 Backwards
> > > Compatibility). The only way I found this could be done is to
> > > recompile the SQLite using SQLITE_USE_URI compile-time option, but
> > > this is not a very portable approach.
> > >
> > > Enabling this during runtime should be achievable by using either of
> > > the following C functions (quoting from
> > >
http://www.sqlite.org/uri.html):
> > >
> > > * The sqlite3_config (SQLITE_CONFIG_URI, 1); configuration option is
> > > set at application start-time.
> > > * The SQLITE_OPEN_URI bit is OR-ed in with the set bits passed in as
> > > the 3rd parameter to the sqlite3_open_v2() interface.
> > >
> > > Thanks for your time,
> > > --Jan
> >
>