1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    51
    Vote Rating
    -1
    Seb_ST is an unknown quantity at this point

      0  

    Default SQL proxy and sync

    SQL proxy and sync


    Hello,.

    I was using the localStorage proxy to record a couple of stores on the device but I figured out that its size limit (5 Mb I guess) is too binding for my use. Looking around I understood that I should change to a SQL proxy. Please note that my app is supposed to work offline.

    I changed the proxy the same way on two different models and the sync() function of the corresponding stores is only working on one of them. The store on which it isn't working has many fields (1700) but none of them is undefined. Is the problem coming from this number of fields? Do you have another idea?

    Everything was working fine with localStorage, except the size limit...

    Thanks

  2. #2
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Do you mean 1700 records?
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    51
    Vote Rating
    -1
    Seb_ST is an unknown quantity at this point

      0  

    Default


    I mean each record is defined by 1700 fields.

  4. #4
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    That's a lot of fields to have on one record. What debugging have you done?
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  5. #5
    Sencha User
    Join Date
    Dec 2012
    Posts
    51
    Vote Rating
    -1
    Seb_ST is an unknown quantity at this point

      0  

    Default


    There were two things I had to look at:
    1. It looks like the maximum number of fields for the sync() function to work is 1000.
    2. I wasn't able to sync() a record with a field which wasn't defined at the creation of the table.

  6. #6
    Sencha User
    Join Date
    Dec 2012
    Posts
    51
    Vote Rating
    -1
    Seb_ST is an unknown quantity at this point

      0  

    Default


    It is not going as I planned... as the sync() function isn't really working, or not always.

    Here is the Model:
    Code:
    Ext.define("CharacterSheet.model.Perso", {
    extend: "Ext.data.Model", requires: ['Ext.data.identifier.Uuid','Ext.data.proxy.Sql'], config: {
    identifier: 'uuid', proxy: {
    type: "sql", database: "Sencha", table: "PersosAct"
    }, fields: [ ... ]
    }
    });
    I have even tried to change a field of a record, sync() the store and reload it and the corresponding field value was the first one... please help me because I am going crazy!

    At the beginning I did not use the uuid identifier but as it was not working and the only thing which was different from the localstorage proxy was this identifier, I tried to change it. Please note that everything worked fine with the localstorage proxy (except that I need more than 5Mb) and that I use ST 2.3.1.

  7. #7
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Thanks for the update. 1000+ fields in a single record is a lot. You may have to look at redesigning your tables or try the cordova sqlite plugin.
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  8. #8
    Sencha User
    Join Date
    Dec 2012
    Posts
    51
    Vote Rating
    -1
    Seb_ST is an unknown quantity at this point

      0  

    Default


    I have already redesigned the table and each record is defined by less than 1000 fields now... And still the sync function is not working as expected...

  9. #9
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,936
    Vote Rating
    130
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    So you are dynamically adding columns to your table and this is breaking sync?
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

  10. #10
    Sencha User
    Join Date
    Dec 2012
    Posts
    51
    Vote Rating
    -1
    Seb_ST is an unknown quantity at this point

      0  

    Default


    No, I was not trying to perform that anymore, but it seems there is a way of doing it reading the end of this blog post.

    In my case, sync() did not work most of the time when there were records to update and it looks like it was doing ok when adding or removing records. However, Shepsii's override seems to solve this issue. As I have not yet performed extensive tests I cannot completely confirm it.

Thread Participants: 1

Tags for this Thread