storesafe / cordova-sqlite-storage

A Cordova/PhoneGap plugin to open and use sqlite databases on Android, iOS and Windows with HTML5/Web SQL API
Other
2.15k stars 715 forks source link

[ATTACH and JOIN] on two [or more] different database(s)? #245

Open ozexpert opened 9 years ago

ozexpert commented 9 years ago

Is it possible to join with different database? Seems not, but asking..

nolanlawson commented 9 years ago

With two different databases? No. Only tables within the same database.

ozexpert commented 9 years ago

In sqlite, you could use ATTACH http://stackoverflow.com/questions/6824717/sqlite-how-do-you-join-tables-from-different-databases

brodycj commented 9 years ago

In sqlite, you could use ATTACH http://stackoverflow.com/questions/6824717/sqlite-how-do-you-join-tables-from-different-databases

Thanks @ozexpert for the reference. To be honest, I have never had a chance to test this case. Also not sure if this will be consistent across all supported platforms: Android, iOS, Windows Universal [both desktop and phone] 8.1, Windows Phone 7.x/8.0, and Amazon Fire-OS (derivative of Android).

I just updated README.md to reflect the current status. I am planning to add a test for this case when I get a chance (and run it against all supported platforms).

kristfal commented 8 years ago

Any movement on this one? If not, I need this anyway and will start hacking on it soon, let me know if you want any PRs if if find a suitable approach.

Btw, using the common variant of this plugin due to lackingpre-populated support in this repo.

brodycj commented 8 years ago

@kristfal I do not expect to work on this anytime soon. If I am not mistaken, you have to give the exact path of the database to attach to in the ATTACH database, which would be implementation-dependent. In addition, a database may be stored in multiple locations in the iOS version.

In case I do integrate the ATTACH functionality, my idea is to add a new operation (such as attach) which would ATTACH the full path of a given database file name AS the desired "schema-name". You may also want to DETACH the database "schema-name" when you are finished with it.

If you are able to get this working for Android and iOS and want to submit a PR, preferably with at least one test case, I would be happy to include it assuming I do not see any serious issues.

brodycj commented 8 years ago

I would also be happy to implement the ATTACH functionality within the next 1-2 weeks in case someone wants to purchase 5 days of priority feature support (2 days development, 1 day 2 days testing/documentation, and 1 day for a warranty support retainer good for 90 days). My current rate is US $600 per day (US $75 per hour), for a total cost of US $3000 (excluding VAT for EU residents).

I would probably deliver this feature on the cordova-sqlite-ext version. Please contact me at info@litehelpers.net or brodybits@litehelpers.net in case you are interested. Thanks for your consideration.