Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-18308

The Sync method of the sqlite adapter doesn't use the idAttribute

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Environment:

      CLI version 3.4.1
      Titanium SDK version 3.4.1.GA
      OS: Mac OS X 10.10.1

      Description

      The Sync method uses model.idAttribute instead of model.config.adapter.idAttribute making fetch with an id go wrong.

      For example the following model:

      exports.definition = {
        config: {
          columns: {
            "order_id": "INTEGER PRIMARY KEY AUTOINCREMENT",
            "title": "TEXT",
            "created_at": "INTEGER",
            "price": "INTEGER"
          },
          adapter: {
            type: "sql",
            collection_name: "Orders",
            idAttribute : "order_id"
          }
        },
        // other keys
      }
      

      Now if we do a fetch on a specifc id:

      var orders = Alloy.createCollection("Order");
        orders.fetch({
          id : 2,
          success : function() {
            console.log("OK");
          }
        }
      );
      

      We get an error "no such column: alloy_id" because the sync adapter didn't use the model.config.adapter.idAttribute, but model.idAttribute that returned undefined so it used the default alloy id.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              michielve Michiel van Eerd
            • Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-19546
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration