Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-17831] iOS - SQLite module throws warnings about deprecated API usage

GitHub Issuen/a
TypeImprovement
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2014-10-14T18:06:40.000+0000
Affected Version/sn/a
Fix Version/sRelease 3.4.2, Release 3.5.0, Release 4.0.0
ComponentsiOS
Labelsmodule_database, qe-manualtest
ReporterPedro Enrique
AssigneeMuhammad Dadu
Created2014-10-08T18:55:41.000+0000
Updated2014-11-26T07:06:40.000+0000

Description

Comments

  1. Muhammad Dadu 2014-10-08

    PR: https://github.com/appcelerator/titanium_mobile/pull/6207 Removed warnings by implementing 'sqlite3_open_v2'. Tested using Kitchen SInk.
  2. Marek Zwick 2014-10-14

    This change crashes a newly installed app (without existing database) on IOS. Instead of creating a new database, Titanium.Database.open() causes an error. To reproduce, just run a Ti.Database.open('_alloy_'); in a newly installed app, you will get [ERROR] : message = "couldn't open database"; [ERROR] : nativeLocation = "-[TiDatabaseProxy open:] (TiDatabaseProxy.m:112)"; If I add the removed line sqlite3_enable_shared_cache(TRUE); in the iphone/Classes/DatabaseModule.m, everything works as expected.
  3. Marek Zwick 2014-10-14

    found the problem: in the sqlite3_open_v2 there must be an additional SQLITE_OPEN_CREATE flag, so the database will be created if not existing (which seemed to be a default behaviour of sqlite3_open) in PLSqliteDatabase.m openAndReturnError: /* Open the database */ err = sqlite3_open_v2([_path fileSystemRepresentation], &_sqlite, SQLITE_OPEN_SHAREDCACHE | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, NULL); So the removed sqlite3_enable_shared_cache(TRUE); in iphone/Classes/DatabaseModule.m wasn't problematic at all.
  4. Muhammad Dadu 2014-10-14

    PR: https://github.com/appcelerator/titanium_mobile/pull/6218 Thank you for the help [~marek].
  5. Vishal Duggal 2014-10-24

    Backport to 3_4_X done as part of https://github.com/appcelerator/titanium_mobile/pull/6271
  6. Khushbu Agrawal 2014-11-26

    The database is created without crash when it doesn't exist. Verified with the Xcode=>Devices=>Installed Apps . Closing the ticket. Tested with the below Environment: 1. Mac OSX Yosemite 10.10 2. Appcelerator Studio, build: 3.4.1.201410281743 3. Titanium SDK, build: 3.5.0.v20141125154115 4. Titanium CLI, build: 3.4.1 5. Alloy: 1.5.1 6. Xcode 6.1 7. iOS SDK 8.1 8. iPhone 5s with iOS 8.1

JSON Source