Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.
  1. #1
    Sencha User
    Join Date
    Dec 2012
    Posts
    32
    Vote Rating
    3
    alanthales is on a distinguished road

      0  

    Default Proxy SQL not persisted fields bug

    Proxy SQL not persisted fields bug


    REQUIRED INFORMATION


    Senha Touch version tested:
    • 2.1.0
    • 2.2.0rc


    Browser versions tested against:
    • Chrome 25


    Description:
    • SQL proxy create not persisted fields on database.


    Steps to reproduce the problem:
    • Create a model configured to proxy SQL and with a field seted to persist: false.
    • Create a dataview to show this model.


    The result that was expected:
    • Don't create "No persisted fields" in database.


    The result that occurs instead:
    • "No persisted" fields being created on database.


    Test Case:
    • Not provided.




    HELPFUL INFORMATION


    Possible fix:
    Code:
    Ext.define('Appname.util.proxySQL', {
    	override: 'Ext.data.proxy.SQL',
    	
        getSchemaString: function() {
            var me = this,
                schema = [],
                model = me.getModel(),
                idProperty = model.getIdProperty(),
                fields = model.getFields().items,
                uniqueIdStrategy = me.getUniqueIdStrategy(),
                ln = fields.length,
                i, field, type, name;
    
    
            for (i = 0; i < ln; i++) {
                field = fields[i];
                type = field.getType().type;
                name = field.getName();
                
                if (!field.getPersist()) {
                	continue;
                }
    
    
                if (name === idProperty) {
                    if (uniqueIdStrategy) {
                        type = me.convertToSqlType(type);
                        schema.unshift(idProperty + ' ' + type);
                    } else {
                        schema.unshift(idProperty + ' INTEGER PRIMARY KEY AUTOINCREMENT');
                    }
                } else {
                    type = me.convertToSqlType(type);
                    schema.push(name + ' ' + type);
                }
            }
    
    
            return schema.join(', ');
        }
    });

  2. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    37,647
    Vote Rating
    898
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Can I get a simple test case to reproduce?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

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

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

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

  3. #3
    Sencha User
    Join Date
    Dec 2012
    Posts
    32
    Vote Rating
    3
    alanthales is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Can I get a simple test case to reproduce?
    Code:
    Ext.define('MyModel', {
        extend: 'Ext.data.Model',
    
        config: {
            fields : [
            { name: 'code', type: 'int' },
            { name: 'value', type: 'float', persist: false }
        ]
        }
    });
    
    Ext.Viewport.add({
        xtype: 'dataview',
        itemTpl: 'code',
        store: {
        model: 'MyModel',
        proxy: 'sql',
        autoLoad: true
        }
    });

Thread Participants: 1

Tags for this Thread