You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cordova.apache.org by "Samik R (JIRA)" <ji...@apache.org> on 2012/08/03 20:43:02 UTC
[jira] [Created] (CB-1191) Load/create a database in SD card
Samik R created CB-1191:
---------------------------
Summary: Load/create a database in SD card
Key: CB-1191
URL: https://issues.apache.org/jira/browse/CB-1191
Project: Apache Cordova
Issue Type: Improvement
Reporter: Samik R
I would like to be able to access or create an SQLite database on SD card in android/WP7 or in the persistent storage in iOS. Currently I am working in Android, so I will limit the comments to Android for now.
Looking at the android code for openDatabase call in Storage.java, I see that if the path of the DB is null, it is set to app-path. But there is no way to set the path of the DB or pass it in the call. It seems like an easy fix: we need a call to set the path to a string, or accept a FileEntry object as the database in the same openDatabase call.
Here is the relevant part of the code:
<<
public void openDatabase(String db, String version, String display_name,
long size) {
// If database is open, then close it
if (this.myDb != null) {
this.myDb.close();
}
// If no database path, generate from application package
if (this.path == null) {
this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
}
this.dbName = this.path + File.pathSeparator + db + ".db";
this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
}
>>
Please let me know if I am missing something. I am new to this stuff.
Thanks and regards.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CB-1191) Load/create a database in SD card
Posted by "Joe Bowser (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-1191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joe Bowser resolved CB-1191.
----------------------------
Resolution: Won't Fix
This is possible on Android, but I think that this would be best done as a Cordova plugin. It's not really something that should be added to the core.
> Load/create a database in SD card
> ---------------------------------
>
> Key: CB-1191
> URL: https://issues.apache.org/jira/browse/CB-1191
> Project: Apache Cordova
> Issue Type: Improvement
> Components: Android, WP7
> Reporter: Samik R
> Labels: android, ios, sqlite
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> I would like to be able to access or create an SQLite database on SD card in android/WP7 or in the persistent storage in iOS. Currently I am working in Android, so I will limit the comments to Android for now.
> Looking at the android code for openDatabase call in Storage.java, I see that if the path of the DB is null, it is set to app-path. But there is no way to set the path of the DB or pass it in the call. It seems like an easy fix: we need a call to set the path to a string, or accept a FileEntry object as the database in the same openDatabase call.
> Here is the relevant part of the code:
> (Accessed from https://github.com/apache/incubator-cordova-android
> as file: apache-incubator-cordova-android-2.0.0-16-g81ab0a4.zip)
> <<
> public void openDatabase(String db, String version, String display_name,
> long size) {
> // If database is open, then close it
> if (this.myDb != null) {
> this.myDb.close();
> }
> // If no database path, generate from application package
> if (this.path == null) {
> this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
> }
> this.dbName = this.path + File.pathSeparator + db + ".db";
> this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
> }
> >>
> Please let me know if I am missing something. I am new to this stuff.
> Thanks and regards.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-1191) Load/create a database in SD card
Posted by "Samik R (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-1191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Samik R updated CB-1191:
------------------------
Description:
I would like to be able to access or create an SQLite database on SD card in android/WP7 or in the persistent storage in iOS. Currently I am working in Android, so I will limit the comments to Android for now.
Looking at the android code for openDatabase call in Storage.java, I see that if the path of the DB is null, it is set to app-path. But there is no way to set the path of the DB or pass it in the call. It seems like an easy fix: we need a call to set the path to a string, or accept a FileEntry object as the database in the same openDatabase call.
Here is the relevant part of the code:
(Accessed from https://github.com/apache/incubator-cordova-android
as file: apache-incubator-cordova-android-2.0.0-16-g81ab0a4.zip)
<<
public void openDatabase(String db, String version, String display_name,
long size) {
// If database is open, then close it
if (this.myDb != null) {
this.myDb.close();
}
// If no database path, generate from application package
if (this.path == null) {
this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
}
this.dbName = this.path + File.pathSeparator + db + ".db";
this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
}
>>
Please let me know if I am missing something. I am new to this stuff.
Thanks and regards.
was:
I would like to be able to access or create an SQLite database on SD card in android/WP7 or in the persistent storage in iOS. Currently I am working in Android, so I will limit the comments to Android for now.
Looking at the android code for openDatabase call in Storage.java, I see that if the path of the DB is null, it is set to app-path. But there is no way to set the path of the DB or pass it in the call. It seems like an easy fix: we need a call to set the path to a string, or accept a FileEntry object as the database in the same openDatabase call.
Here is the relevant part of the code:
<<
public void openDatabase(String db, String version, String display_name,
long size) {
// If database is open, then close it
if (this.myDb != null) {
this.myDb.close();
}
// If no database path, generate from application package
if (this.path == null) {
this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
}
this.dbName = this.path + File.pathSeparator + db + ".db";
this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
}
>>
Please let me know if I am missing something. I am new to this stuff.
Thanks and regards.
> Load/create a database in SD card
> ---------------------------------
>
> Key: CB-1191
> URL: https://issues.apache.org/jira/browse/CB-1191
> Project: Apache Cordova
> Issue Type: Improvement
> Reporter: Samik R
> Labels: android, ios, sqlite
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> I would like to be able to access or create an SQLite database on SD card in android/WP7 or in the persistent storage in iOS. Currently I am working in Android, so I will limit the comments to Android for now.
> Looking at the android code for openDatabase call in Storage.java, I see that if the path of the DB is null, it is set to app-path. But there is no way to set the path of the DB or pass it in the call. It seems like an easy fix: we need a call to set the path to a string, or accept a FileEntry object as the database in the same openDatabase call.
> Here is the relevant part of the code:
> (Accessed from https://github.com/apache/incubator-cordova-android
> as file: apache-incubator-cordova-android-2.0.0-16-g81ab0a4.zip)
> <<
> public void openDatabase(String db, String version, String display_name,
> long size) {
> // If database is open, then close it
> if (this.myDb != null) {
> this.myDb.close();
> }
> // If no database path, generate from application package
> if (this.path == null) {
> this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
> }
> this.dbName = this.path + File.pathSeparator + db + ".db";
> this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
> }
> >>
> Please let me know if I am missing something. I am new to this stuff.
> Thanks and regards.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CB-1191) Load/create a database in SD card
Posted by "Samik R (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-1191?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13457516#comment-13457516 ]
Samik R commented on CB-1191:
-----------------------------
Hi Joe,
Thanks for the comment. Is there any reasoning for this decision? I am curious how you determine which feature should go in core and which feature shouldn't?
Thanks.
> Load/create a database in SD card
> ---------------------------------
>
> Key: CB-1191
> URL: https://issues.apache.org/jira/browse/CB-1191
> Project: Apache Cordova
> Issue Type: Improvement
> Components: Android, WP7
> Reporter: Samik R
> Labels: android, ios, sqlite
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> I would like to be able to access or create an SQLite database on SD card in android/WP7 or in the persistent storage in iOS. Currently I am working in Android, so I will limit the comments to Android for now.
> Looking at the android code for openDatabase call in Storage.java, I see that if the path of the DB is null, it is set to app-path. But there is no way to set the path of the DB or pass it in the call. It seems like an easy fix: we need a call to set the path to a string, or accept a FileEntry object as the database in the same openDatabase call.
> Here is the relevant part of the code:
> (Accessed from https://github.com/apache/incubator-cordova-android
> as file: apache-incubator-cordova-android-2.0.0-16-g81ab0a4.zip)
> <<
> public void openDatabase(String db, String version, String display_name,
> long size) {
> // If database is open, then close it
> if (this.myDb != null) {
> this.myDb.close();
> }
> // If no database path, generate from application package
> if (this.path == null) {
> this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
> }
> this.dbName = this.path + File.pathSeparator + db + ".db";
> this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
> }
> >>
> Please let me know if I am missing something. I am new to this stuff.
> Thanks and regards.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CB-1191) Load/create a database in SD card
Posted by "Joe Bowser (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CB-1191?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joe Bowser updated CB-1191:
---------------------------
Component/s: WP7
Android
> Load/create a database in SD card
> ---------------------------------
>
> Key: CB-1191
> URL: https://issues.apache.org/jira/browse/CB-1191
> Project: Apache Cordova
> Issue Type: Improvement
> Components: Android, WP7
> Reporter: Samik R
> Labels: android, ios, sqlite
> Original Estimate: 48h
> Remaining Estimate: 48h
>
> I would like to be able to access or create an SQLite database on SD card in android/WP7 or in the persistent storage in iOS. Currently I am working in Android, so I will limit the comments to Android for now.
> Looking at the android code for openDatabase call in Storage.java, I see that if the path of the DB is null, it is set to app-path. But there is no way to set the path of the DB or pass it in the call. It seems like an easy fix: we need a call to set the path to a string, or accept a FileEntry object as the database in the same openDatabase call.
> Here is the relevant part of the code:
> (Accessed from https://github.com/apache/incubator-cordova-android
> as file: apache-incubator-cordova-android-2.0.0-16-g81ab0a4.zip)
> <<
> public void openDatabase(String db, String version, String display_name,
> long size) {
> // If database is open, then close it
> if (this.myDb != null) {
> this.myDb.close();
> }
> // If no database path, generate from application package
> if (this.path == null) {
> this.path = this.cordova.getActivity().getApplicationContext().getDir("database", Context.MODE_PRIVATE).getPath();
> }
> this.dbName = this.path + File.pathSeparator + db + ".db";
> this.myDb = SQLiteDatabase.openOrCreateDatabase(this.dbName, null);
> }
> >>
> Please let me know if I am missing something. I am new to this stuff.
> Thanks and regards.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira