Skip to content

Commit

Permalink
BREAKING CHANGE remove automatic extension from Android version
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Brody committed Jul 7, 2014
1 parent 9471c2f commit 3723cfc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ License for Android & WP versions: MIT or Apache 2.0

License for iOS version: MIT only

## WARNING: breaking change for Android version

The automatic "`.db`" database file extension is now removed for the Android version, for consistency with the iOS & WP versions. For an existing app, you may have to open an existing database like:

var db = window.sqlitePlugin.openDatabase({name: "myDatabase.db"});

## Status

- Please use the [Cordova-SQLitePlugin forum](http://groups.google.com/group/Cordova-SQLitePlugin) for community support
Expand All @@ -14,8 +20,8 @@ License for iOS version: MIT only
## Announcements

- WP8 version added by:
- @nadyaA (Nadezhda Atanasova) with proper DLL integration
- @Gillardo (Darren Gillard) with failure-safe transaction semantics working
- [@nadyaA (Nadezhda Atanasova)](https://github.com/nadyaA) with proper DLL integration
- [@Gillardo (Darren Gillard)](https://github.com/Gillardo) with failure-safe transaction semantics working
- Forum renamed to: [Cordova-SQLitePlugin forum](http://groups.google.com/group/Cordova-SQLitePlugin)
- New location: https://github.com/brodysoft/Cordova-SQLitePlugin
- iOS version can now be built with either ARC or MRC.
Expand Down Expand Up @@ -73,8 +79,8 @@ The idea is to emulate the HTML5 SQL API as closely as possible. The only major
## Opening a database

There are two options to open a database:
- Recommended: `var db = window.sqlitePlugin.openDatabase({name: "DB"});`
- Classical: `var db = window.sqlitePlugin.openDatabase("Database", "1.0", "Demo", -1);`
- Recommended: `var db = window.sqlitePlugin.openDatabase({name: "myDatabase"});`
- Classical: `var db = window.sqlitePlugin.openDatabase("myDatabase", "1.0", "Demo", -1);`

**IMPORTANT:** Please wait for the "deviceready" event, as in the following example:

Expand Down
4 changes: 2 additions & 2 deletions src/android/org/pgsqlite/SQLitePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ private void openDatabase(String dbname, String password) {
this.closeDatabase(dbname);
}

File dbfile = this.cordova.getActivity().getDatabasePath(dbname + ".db");
File dbfile = this.cordova.getActivity().getDatabasePath(dbname);

if (!dbfile.exists()) {
dbfile.getParentFile().mkdirs();
Expand Down Expand Up @@ -242,7 +242,7 @@ private boolean deleteDatabase(String dbname) {
this.closeDatabase(dbname);
}

File dbfile = this.cordova.getActivity().getDatabasePath(dbname + ".db");
File dbfile = this.cordova.getActivity().getDatabasePath(dbname);

Log.v("info", "delete sqlite db: " + dbfile.getAbsolutePath());

Expand Down

0 comments on commit 3723cfc

Please sign in to comment.