{ "id": "77321", "key": "TIMOB-4543", "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": [], "resolution": { "id": "10100", "description": "This issue won't be actioned.", "name": "Won't Do" }, "resolutiondate": "2020-01-09T19:16:14.000+0000", "created": "2011-07-02T15:35:52.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "parity", "rock_solid" ], "versions": [ { "id": "11367", "description": "", "name": "Release 1.7.1", "archived": true, "released": true, "releaseDate": "2011-06-21" } ], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2020-01-09T19:16:14.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": "When a database is created at the default locations using {{Ti.Database.open()}} or {{Ti.Database.install()}}, the resulting files are at different filesystem locations and with different filenames. The code below demonstrates how the user must access them directly using filesystem commands, on the respective platforms.\r\n\r\nIssues:\r\n* on Android, there is no way to access the default database directory (using {{applicationDataDirectory/../database}} is not allowed by design, for example) other than to specify the full filesystem path. On iOS, however, applicationSupportDirectory may be used.\r\n* Android does not automatically add a file extension whereas a {{.sql}} extension is added to the file name on iOS\r\n\r\nJust for incidental information, note that on Android:\r\n* Ti.Filesystem.applicationSupportDirectory is undefined. See TIMOB-3041 and TIMOB-4215\r\n* Ti.Filesystem.applicationDataDirectory is located at /data/data/appID/app_appdata\r\n* var db = Ti.Database.open(dbName); database created at /data/data/appID/databases/${dbName} by default\r\n\r\n{code:lang=javascript}\r\nvar dbName = 'myDB';\r\nvar db = Ti.Database.open(dbName);\r\ndb.close();\r\nvar dbPath;\r\nvar dbFile;\r\nvar dbPlatform = Ti.Platform.osname;\r\nTi.API.info(\"dbName: \" + dbName);\r\n\r\nif(dbPlatform === 'android'){\r\n dbPath = 'file:///data/data/' + Ti.App.getID() + '/databases';\r\n Ti.API.info(\"dbPath: \" + dbPath);\r\n dbFile = Ti.Filesystem.getFile(dbPath, dbName);\r\n Ti.API.info(\"dbFile.nativePath: \" + dbFile.nativePath);\r\n} else {\r\n dbPath = Ti.Filesystem.applicationSupportDirectory + '/database';\r\n Ti.API.info(\"dbPath: \" + dbPath);\r\n dbFile = Ti.Filesystem.getFile(dbPath, dbName + '.sql');\r\n Ti.API.info(\"dbFile.nativePath: \" + dbFile.nativePath);\r\n}\r\n\r\nif(dbFile.exists()){\r\n Ti.API.info('On the platform ' + dbPlatform + ', the database file was created at ' + dbFile.nativePath);\r\n} else {\r\n Ti.API.info('On the platform ' + dbPlatform + ', the database file was NOT created at ' + dbFile.nativePath);\r\n}\r\n{code}\r\n\r\nSee Doug's comments at:\r\n[http://developer.appcelerator.com/question/121945/update-database-from-remote-source]\r\n[http://developer.appcelerator.com/question/96771/location-of-titanium-sql-database-on-android]\r\n", "attachment": [], "flagged": false, "summary": "Ti.Database API filesystem discrepancies between iOS and Android", "creator": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "pdowsett", "key": "pdowsett", "displayName": "Paul Dowsett", "active": true, "timeZone": "Europe/London" }, "environment": null, "comment": { "comments": [ { "id": "453560", "author": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "body": "It has been decided that this issue should be closed as “Won’t do.” This issue is out of date with our current supported SDK release (7.5.2.GA as of the date of closure), and out of date with mobile OS versions. Updating, or creating code may not reproduce the issue reported, or be a valid test case.\r\n\r\nIf community members feel that the issue is still valid, please create a new ticket. Please reference this closed ticket number, include SDK used, comments, and code that demonstrates/reproduces the issue.", "updateAuthor": { "name": "ahutton", "key": "ahutton", "displayName": "Alan Hutton", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2020-01-09T19:16:14.000+0000", "updated": "2020-01-09T19:16:14.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }