mirror of
https://github.com/moparisthebest/PhoneGap-SQLitePlugin-Android
synced 2024-11-24 01:22:17 -05:00
Get Android db path separately from SQLiteDatabase.openOrCreateDatabase()
This commit is contained in:
parent
102d732102
commit
c24726173f
@ -11,8 +11,12 @@ import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.lang.Number;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.apache.cordova.api.CordovaPlugin;
|
||||
import org.apache.cordova.api.CallbackContext;
|
||||
|
||||
@ -20,8 +24,6 @@ import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.sqlite.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
public class SQLitePlugin extends CordovaPlugin
|
||||
@ -150,8 +152,14 @@ public class SQLitePlugin extends CordovaPlugin
|
||||
*/
|
||||
private void openDatabase(String db, String version, String display_name, long size)
|
||||
{
|
||||
SQLiteDatabase myDb =
|
||||
this.cordova.getActivity().getApplicationContext().openOrCreateDatabase(db + ".db", Context.MODE_PRIVATE, null);
|
||||
//SQLiteDatabase myDb =
|
||||
// this.cordova.getActivity().getApplicationContext().openOrCreateDatabase(db + ".db", Context.MODE_PRIVATE, null);
|
||||
|
||||
File dbFile = this.cordova.getActivity().getDatabasePath(db + ".db");
|
||||
|
||||
Log.v("info", "Open sqlite db: " + dbFile.getAbsolutePath());
|
||||
|
||||
SQLiteDatabase myDb = SQLiteDatabase.openOrCreateDatabase(dbFile, null);
|
||||
|
||||
myDbMap.put(db, myDb);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user