{ "id": "61193", "key": "TIMOB-561", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "11225", "name": "Release 1.5.0", "archived": true, "released": true, "releaseDate": "2010-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-04-17T01:53:30.000+0000", "created": "2011-04-15T02:31:57.000+0000", "priority": { "name": "Trivial", "id": "5" }, "labels": [ "android", "database", "feature", "open" ], "versions": [], "issuelinks": [], "assignee": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-04-17T01:53:30.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "{html}

We often need to download database files and store them in the\nappDataDirectory. It would be nice if we could simply call\nDB.open(\"filename\") and pass a fully-qualified path and filename to\nthe database.

\n

We should not be required to place databases in a specific\nfolder, nor should we be forced to append a \".sql\" extension to the\nend of a database filename.

{html}", "attachment": [], "flagged": false, "summary": "Request: ability to open DB from any path and filename", "creator": { "name": "burggraf", "key": "burggraf", "displayName": "Burggraf", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "burggraf", "key": "burggraf", "displayName": "Burggraf", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "123554", "author": { "name": "martinrobinson", "key": "martinrobinson", "displayName": "Martin Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

This can be accomplished by\nTitanium.Database.openFile(...). I'm aware that the\ndocumentation on the Developer site is incorrect, but it should be\nfixed with the next release. Sorry for the inconvenience.

{html}", "updateAuthor": { "name": "martinrobinson", "key": "martinrobinson", "displayName": "Martin Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:58.000+0000", "updated": "2011-04-15T02:31:58.000+0000" }, { "id": "123555", "author": { "name": "martinrobinson", "key": "martinrobinson", "displayName": "Martin Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Whoops. Thought this was filed in Titanium Desktop. Need more\ncoffee. Reopening.

{html}", "updateAuthor": { "name": "martinrobinson", "key": "martinrobinson", "displayName": "Martin Robinson", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:59.000+0000", "updated": "2011-04-15T02:31:59.000+0000" }, { "id": "123556", "author": { "name": "burggraf", "key": "burggraf", "displayName": "Burggraf", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Any update on this? With the small amount of space available for\nmany Android devices, the ability to open a database stored on an\nSD card will be crucial for large databases.

{html}", "updateAuthor": { "name": "burggraf", "key": "burggraf", "displayName": "Burggraf", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:59.000+0000", "updated": "2011-04-15T02:31:59.000+0000" }, { "id": "123557", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

For now it should be possible to use an absolute path to any\nreadable location on the filesystem, here's a gist I made that\nshows the example using a DB pushed onto the SD card:

\n

http://gist.github.com/577943

\n

I'm changing this bug to better reflect our API, i.e. we should\naccept a file object as well as a path string in our open() method\nso this works more consistently.

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:59.000+0000", "updated": "2011-04-15T02:31:59.000+0000" }, { "id": "123558", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Note: Storing a database on the SDCard allows it to be used by\nany application on the system and or copied off by the user. App\nlevel security is not possible on SDCard.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:31:59.000+0000", "updated": "2011-04-15T02:31:59.000+0000" }, { "id": "123559", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

(from [b01fdb396b2b89aa87506654379c3755047a649f])\nallow sqlite databases to be opened from File objects as well as\napp:// paths [#561 state:fixed-in-qa] \nhttp://github.com/appcelerator/titanium_mobile/commit/b01fdb396b2b8...

{html}", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:32:00.000+0000", "updated": "2011-04-15T02:32:00.000+0000" }, { "id": "123560", "author": { "name": "burggraf", "key": "burggraf", "displayName": "Burggraf", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

Is this available in the current nightly build? If not, where\ncan I get a copy of this code for testing?

{html}", "updateAuthor": { "name": "burggraf", "key": "burggraf", "displayName": "Burggraf", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:32:00.000+0000", "updated": "2011-04-15T02:32:00.000+0000" }, { "id": "123561", "author": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

It's in the nightly build.

{html}", "updateAuthor": { "name": "dthorp", "key": "dthorp", "displayName": "Don Thorp", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:32:00.000+0000", "updated": "2011-04-15T02:32:00.000+0000" }, { "id": "123562", "author": { "name": "mschmulen", "key": "mschmulen", "displayName": "Matt Schmulen", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

test script

\n

Ti.API.info(\"db tst open att l16file:///sdcard/test.db\");
\nTi.API.info('for drillbit copy test.db to card');
\n//copy db to the sdcard

\n

var file =\nTitanium.Filesystem.getFile(\"file:///sdcard/test.db\");
\nvar db = Ti.Database.open(file);
\nif ( db == null ) { alert('db null');}
\nTi.API.info( 'db ... ' + db );
\nvar rs = db.execute('SELECT message FROM test');
\nif ( rs != null && rs.isValidRow()) {

\n
\nalert(rs.getFieldByName(\"message\"));\n
\n

}//end if else
\n{

\n
\nalert('Select fail');\n
\n

}//end else

\n

if ( rs != null ) rs.close();
\nif ( db != null ) db.close();

{html}", "updateAuthor": { "name": "mschmulen", "key": "mschmulen", "displayName": "Matt Schmulen", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:32:00.000+0000", "updated": "2011-04-15T02:32:00.000+0000" }, { "id": "123563", "author": { "name": "mschmulen", "key": "mschmulen", "displayName": "Matt Schmulen", "active": true, "timeZone": "America/Los_Angeles" }, "body": "{html}

pass Titanium SDK version: 1.5.0 (12/07/10 10:00 8f4eea3...)\nAndroid, 1.6/2.1, code above

{html}", "updateAuthor": { "name": "mschmulen", "key": "mschmulen", "displayName": "Matt Schmulen", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-04-15T02:32:00.000+0000", "updated": "2011-04-15T02:32:00.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }