mtxr / vscode-sqltools

Database management for VSCode
https://vscode-sqltools.mteixeira.dev?utm_source=github&utm_medium=homepage-link
MIT License
1.48k stars 297 forks source link

SQLIte integration: How to Load a SQLIte Extension on a per database basis? #377

Open asitemade4u opened 5 years ago

asitemade4u commented 5 years ago

Context: I am using Spatialite on SQLIte and its requirement is that a library be loaded for each database. As I work on Ubuntu, the path of the library is /usr/local/lib/mod_spatialite.so If I do not load the library, the extension sends an error about VirtualElementary, which is precisely related to Spatialite [see detail here]

My idea: in self contained SQLite GUIs, such as the SQLite Studio or DB Browser, there is a setting that allows to load a library by providing its pathway, either for all databases or on a per-database basis. It would be great to implement this kind of function in the extension,.

Alternative: the other solution would be to automatically execute a SQL query every time a database is connected, then an instruction such as SELECT load_extension('mod_spatialite')

Details: Ubuntu 18.10, Node 8.11.3, last version of VS Code

mtxr commented 4 years ago

For future reference: https://github.com/mapbox/node-sqlite3/wiki/Extensions