Titanium JIRA Archive
Alloy (ALOY)

[ALOY-732] Alloy: Model db_name is ignored when db_file is set

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-07-08T19:56:03.000+0000
Affected Version/sn/a
Fix Version/sAlloy 1.2.0, 2013 Sprint 14
ComponentsModels
Labelsqe-testadded
ReporterFokke Zandbergen
AssigneeTony Lukasavage
Created2013-07-02T18:39:06.000+0000
Updated2013-07-15T23:10:34.000+0000

Description

When you set both db_file to preload an existing SQLite database for a model, the db_name gets ignored. This is because a typo in the SQLite sync adapter for which I'll do a PR.
var dbName = config.adapter.db_name = match[2];
Should be:
var dbName = config.adapter.db_name || match[2];

Comments

  1. Fokke Zandbergen 2013-07-02

    The PR: https://github.com/appcelerator/alloy/pull/168
  2. Tony Lukasavage 2013-07-08

    Reviewed and merged. Also added a change for testing. PR: https://github.com/appcelerator/alloy/pull/168 test app: https://github.com/appcelerator/alloy/tree/master/test/apps/models/sql_preload The existing "models/sql_preload" test app was modified to use both db_name and db_file. If you run it on iOS (from a reset), you'll notice that it lists all the expected fighter names. Additionally, if you navigate to your apps directory, in my case:
       /Users/tlukasavage/Library/Application Support/iPhone Simulator/6.1/Applications/25822227-C9F2-40C2-82F7-9784F2DDF002/Library/Private Documents
       
    You'll see that the database file is named "fighters" instead of "myapp" now.
  3. Federico Casali 2013-07-15

    Verified as fixed. Environment: Titanium SDK 3.1.2.v20130710144553 Appcelerator Studio 3.1.2.201307101037 Alloy 1.2.0 Android device 4.2.2 and iOS 5. Closing.

JSON Source