mirror of
https://github.com/moparisthebest/PhoneGap-SQLitePlugin-Android
synced 2025-02-16 06:50:14 -05:00
Fix #36 Android database now in correct location
This commit is contained in:
parent
20b81048c3
commit
be3d64e7c7
@ -23,8 +23,8 @@ public class SQLitePlugin extends Plugin {
|
|||||||
|
|
||||||
// Data Definition Language
|
// Data Definition Language
|
||||||
SQLiteDatabase myDb = null; // Database object
|
SQLiteDatabase myDb = null; // Database object
|
||||||
String path = null; // Database path
|
//String path = null; // Database path
|
||||||
String dbName = null; // Database name
|
//String dbName = null; // Database name
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
@ -175,18 +175,28 @@ public class SQLitePlugin extends Plugin {
|
|||||||
this.myDb.close();
|
this.myDb.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
// If no database path, generate from application package
|
// If no database path, generate from application package
|
||||||
if (this.path == null) {
|
if (this.path == null) {
|
||||||
/**
|
|
||||||
Package pack = this.ctx.getClass().getPackage();
|
Package pack = this.ctx.getClass().getPackage();
|
||||||
String appPackage = pack.getName();
|
String appPackage = pack.getName();
|
||||||
this.setStorage(appPackage, false);
|
this.setStorage(appPackage, false);
|
||||||
**/
|
// GONE:
|
||||||
this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
|
//this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
|
||||||
}
|
}
|
||||||
|
**/
|
||||||
|
|
||||||
this.dbName = this.path + db;
|
//this.dbName = this.path + db;
|
||||||
this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
|
|
||||||
|
//this.dbName = this.ctx.getDatabasePath(db);
|
||||||
|
//this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
|
||||||
|
|
||||||
|
//this.myDb = this.ctx.openOrCreateDatabase(db + ".db", Context.MODE_PRIVATE, null);
|
||||||
|
|
||||||
|
//File dp = this.ctx.getDatabasePath(db);
|
||||||
|
//this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
|
||||||
|
|
||||||
|
this.myDb = this.cordova.getActivity().getApplicationContext().openOrCreateDatabase(db + ".db", Context.MODE_PRIVATE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeSqlBatch(String[] queryarr, String[][] paramsarr, String[] queryIDs, String tx_id) {
|
public void executeSqlBatch(String[] queryarr, String[][] paramsarr, String[] queryIDs, String tx_id) {
|
||||||
|
Loading…
Reference in New Issue
Block a user