You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When passing a database name in the form of a URI, this is interpreted as file, while it could also be an in-memory database. SQLite defines the URI scheme it uses here: https://www.sqlite.org/uri.html
So for example, this will give an error (since the file name :memory: usually can't be created on a filesystem) when trying to create a database:
new sqlite3.Database("file::memory:?cache=shared");
While it's supposed to create an in-memory database with shared cache.
Also if you want to use a named in-memory database (for use with multiple connections), you should be able to do this:
new sqlite3.Database("file:memdb1?mode=memory&cache=shared");
But this actually creates a file on the file system named file. On Windows there's even the particularity that this becomes a file with alternate data stream (since there's a : in the file name) and the data will be stored in the ADS. Very confusing at first.
Try: new sqlite3.Database("file::memory:?cache=shared"); this will give an error.
Try: new sqlite3.Database("file:memdb1?mode=memory&cache=shared");. This will create a file (on Windows) instead of opening the database in-memory.
Version
5.1.2
Node.js Version
v14.18.2
How did you install the library?
Windows, npm install, library is used through TypeORM
The text was updated successfully, but these errors were encountered:
Issue Summary
When passing a database name in the form of a URI, this is interpreted as file, while it could also be an in-memory database. SQLite defines the URI scheme it uses here: https://www.sqlite.org/uri.html
So for example, this will give an error (since the file name
:memory:
usually can't be created on a filesystem) when trying to create a database:While it's supposed to create an in-memory database with shared cache.
Also if you want to use a named in-memory database (for use with multiple connections), you should be able to do this:
But this actually creates a file on the file system named
file
. On Windows there's even the particularity that this becomes a file with alternate data stream (since there's a:
in the file name) and the data will be stored in the ADS. Very confusing at first.The line causing this problem is here: https://github.com/TryGhost/node-sqlite3/blob/master/lib/sqlite3.js#L31
Steps to Reproduce
Try:
new sqlite3.Database("file::memory:?cache=shared");
this will give an error.Try:
new sqlite3.Database("file:memdb1?mode=memory&cache=shared");
. This will create a file (on Windows) instead of opening the database in-memory.Version
5.1.2
Node.js Version
v14.18.2
How did you install the library?
Windows, npm install, library is used through TypeORM
The text was updated successfully, but these errors were encountered: