{ "id": "121090", "key": "TIMOB-15458", "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": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2020-01-15T16:54:53.000+0000", "created": "2013-10-11T11:42:58.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "supportTeam" ], "versions": [ { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" }, { "id": "15479", "description": "Release 3.1.2", "name": "Release 3.1.2", "archived": true, "released": true, "releaseDate": "2013-07-31" }, { "id": "15593", "description": "Release 3.1.3", "name": "Release 3.1.3", "archived": true, "released": true, "releaseDate": "2013-09-18" }, { "id": "15856", "description": "Release 3.2.1", "name": "Release 3.2.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [ { "id": "58076", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "89871", "key": "TIMOB-8695", "fields": { "summary": "Android: Database Install fails to install from applicationDataDirectory", "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" } }, "priority": { "name": "Low", "id": "4" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": null, "updated": "2020-01-15T16:54:53.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "Using a temporary file to install existing database, does not copy the content rather creates a blank instance.\r\n\r\n*sample code*\r\n{code}\r\n// This block will succeed when installing the database from the resourcesDirectory\r\nvar sourceDbFile = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'testDB');\r\n\r\nvar sourceDb = Ti.Database.install(sourceDbFile.nativePath, 'test');\r\n\r\nvar sourceRs = sourceDb.execute('SELECT count(*) AS c FROM test');\r\n\r\nif (sourceRs.isValidRow()) {\r\n Ti.API.info('Test record count: ' + sourceRs.fieldByName('c') + ' (should be 3)');\r\n}\r\n\r\n// This block will succeed when copying the database file to the applicationDataDirectory before installing\r\nvar otherDbFile = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, 'dbCopy');\r\n\r\notherDbFile.write(sourceDbFile.read());\r\n\r\nvar otherDb = Ti.Database.install(otherDbFile.nativePath, 'otherTest');\r\n\r\nvar otherRs = otherDb.execute('SELECT count(*) AS c FROM test');\r\n\r\nif (otherRs.isValidRow()) {\r\n Ti.API.info('Other record count: ' + otherRs.fieldByName('c') + ' (should be 3)');\r\n}\r\n\r\n// This block will fail if attempting to install the same database from a temp file/directory\r\nvar tempDbFile = Ti.Filesystem.createTempFile();\r\nTi.API.info(tempDbFile.nativePath);\r\n\r\ntempDbFile.write(sourceDbFile.read()); // Copy\r\n\r\nvar tempDb = Ti.Database.install(tempDbFile.nativePath, 'tempTest');\r\n\r\nvar tempRs = tempDb.execute('SELECT count(*) AS c FROM test');\r\n\r\nif (tempRs.isValidRow()) {\r\n Ti.API.info('Temp record count: ' + tempRs.fieldByName('c') + ' (should be 3)');\r\n}\r\n{code}\r\n\r\n\r\nSteps to reproduce:\r\n\r\n1: Use the above code and paste it in Alloy.js file.\r\n2: Execute the project and check the console.\r\n3: Third execution to install DB using temporary file is failed, as no test table is found.\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: Can not install database file using temporary directory", "creator": { "name": "anigam", "key": "anigam", "displayName": "Ashish Nigam", "active": true, "timeZone": "Asia/Kolkata" }, "subtasks": [], "reporter": { "name": "anigam", "key": "anigam", "displayName": "Ashish Nigam", "active": true, "timeZone": "Asia/Kolkata" }, "environment": "Titanium Mobile SDK 3.1.3, 3.2.0.GA\r\niOS 6 & 7", "comment": { "comments": [], "maxResults": 2, "total": 2, "startAt": 0 } } }