Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Spatialite Extensions #526

Closed
hallahan opened this issue Oct 18, 2015 · 7 comments
Closed

Add Spatialite Extensions #526

hallahan opened this issue Oct 18, 2015 · 7 comments

Comments

@hallahan
Copy link

Has anybody considered packaging up SQLite with Spatialite in the gyp build? How hard would this be?

@springmeyer
Copy link
Contributor

It should be doable if you compile libspatialite as a dynamic library and link it against the same version of libsqlite3 that is bundled. See https://github.com/mapbox/node-sqlite3/blob/ad7596709ba80ee3f3b60cbdb663bafa1ebaa2f9/test/extension.test.js for an example of how to load the extension.

@hallahan
Copy link
Author

Would this work the same with a .so? I'd need this working on Linux as well as OS X. Thanks Dane!

@springmeyer
Copy link
Contributor

Would this work the same with a .so?

Yes, should. Ideally we could re-enable that test to be run on travis again and to detect the platform in order to choose dylib vs so. Interested in trying to get that test running again?

To avoid the pitfall/crash I mention in dabc937 we could potentially build the libspatialite.dylib|so dynamically on travis and pull it in for the tests as needed (rather than hardcoding the /usr/... path which never worked.

@hallahan
Copy link
Author

Sure. I'm having an issue with the current mocha test setup. I'm just doing a simple install via npm install. Then I run make test, and for each test, I get

1 failing

  1) each "before all" hook:
     Error: SQLITE_CANTOPEN: unable to open database file
      at Error (native)

Perhaps I am installing incorrectly? I'm not exactly clear with the source install instructions.

@shenzhuxi
Copy link

I found that mod_spatialite can be loaded but can't be used.
The behaviour is very similar to better-sqlite3, WiseLibs/better-sqlite3#520 (comment).
After loadExtension, it will fail at "InitSpatialMetaData". I guess https://github.com/mapbox/node-sqlite3/blob/593c9d498be2510d286349134537e3bf89401c4a/test/extension.test.js only did the the load test.

I wonder if anyone has really USE spatialite successfully here.

@daniellockyer
Copy link
Member

I'm going to close this for now but please feel free to open a new issue if there's a request or bug here 🙂

@shenzhuxi
Copy link

shenzhuxi commented Mar 18, 2024

better-sqlite3 fixed it by removing SQLITE_OMIT_GET_TABLE in the compile-time options.

https://github.com/WiseLibs/better-sqlite3/pull/1137/files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants