-
16 Oct 2012 4:36 AM #1
ST2.1 RC2 Crash when new SQL Proxy without "filter"
ST2.1 RC2 Crash when new SQL Proxy without "filter"
Hi,
when I use the new Ext.data.proxy.SQL to save my data I run into:
- [COLOR=red !important]Uncaught TypeError: Cannot read property 'length' of null SQL.js:268[/COLOR]
- [COLOR=red !important]Ext.define.selectRecords[/COLOR]SQL.js:268
- [COLOR=red !important](anonymous function)[/COLOR]SQL.js:108
Greetings -Ralf Kraus-
- [COLOR=red !important]Uncaught TypeError: Cannot read property 'length' of null SQL.js:268[/COLOR]
-
16 Oct 2012 5:17 AM #2Sencha - Senior Forum Manager
- Join Date
- Mar 2007
- Location
- St. Louis, MO
- Posts
- 33,710
- Vote Rating
- 436
Can I get a locally runnable test case to reproduce?
Mitchell Simoens @SenchaMitch
Sencha Inc, Senior Forum Manager
________________
http://www.JSONPLint.com - Source to lint your JSONP!
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 almost in print!
When posting code, please use BBCode's CODE tags.
-
17 Oct 2012 1:04 AM #3
-
17 Oct 2012 1:46 AM #4
Will this patch be in the next nightly build?
Greetings -Ralf Kraus-
-
17 Oct 2012 1:50 AM #5
Hi,
It won´t fix my problem...
I have problems with line 268 !
When there are no filters setup in the proxy config...Code:ln = params.filters.length;
Greetings -Ralf Kraus-
-
17 Oct 2012 1:57 AM #6
I fixed it....
Code:Index: touch/src/data/proxy/SQL.js=================================================================== --- touch/src/data/proxy/SQL.js (revision 6988) +++ touch/src/data/proxy/SQL.js (working copy) @@ -110,23 +110,25 @@ me.fireEvent('exception', me, operation); } - if (filters.length) { - filtered = Ext.create('Ext.util.Collection', function(record) { - return record.getId(); - }); - filtered.setFilterRoot('data'); - for (i = 0, ln = filters.length; i < ln; i++) { - if (filters[i].getProperty() === null) { - filtered.addFilter(filters[i]); - } - } - filtered.addAll(operation.getRecords()); + if (params.sorters != null) { + if (filters.length) { + filtered = Ext.create('Ext.util.Collection', function(record) { + return record.getId(); + }); + filtered.setFilterRoot('data'); + for (i = 0, ln = filters.length; i < ln; i++) { + if (filters[i].getProperty() === null) { + filtered.addFilter(filters[i]); + } + } + filtered.addAll(operation.getRecords()); - operation.setRecords(filtered.items.slice()); - resultSet.setRecords(operation.getRecords()); - resultSet.setCount(filtered.items.length); - resultSet.setTotal(filtered.items.length); - } + operation.setRecords(filtered.items.slice()); + resultSet.setRecords(operation.getRecords()); + resultSet.setCount(filtered.items.length); + resultSet.setTotal(filtered.items.length); + } + } if (typeof callback == 'function') { callback.call(scope || me, operation); @@ -265,35 +267,40 @@ if (!Ext.isObject(params)) { sql += filterStatement + idProperty + ' = ' + params; } else { - ln = params.filters.length; - if (ln) { - for (i = 0; i < ln; i++) { - filter = params.filters[i]; - property = filter.getProperty(); - value = filter.getValue(); - if (property !== null) { - sql += filterStatement + property + ' ' + (filter.anyMatch ? ('LIKE \'%' + value + '%\'') : ('= \'' + value + '\'')); - filterStatement = ' AND '; - } - } - } - ln = params.sorters.length; - if (ln) { - for (i = 0; i < ln; i++) { - sorter = params.sorters[i]; - property = sorter.getProperty(); - if (property !== null) { - sql += sortStatement + property + ' ' + sorter.getDirection(); - sortStatement = ', '; - } - } - } + if (params.sorters != null) { + ln = params.sorters.length; + if (ln) { + for (i = 0; i < ln; i++) { + sorter = params.sorters[i]; + property = sorter.getProperty(); + if (property !== null) { + sql += sortStatement + property + ' ' + sorter.getDirection(); + sortStatement = ', '; + } + } + } + } - // handle start, limit, sort, filter and group params - if (params.page !== undefined) { - sql += ' LIMIT ' + parseInt(params.start, 10) + ', ' + parseInt(params.limit, 10); - } + if (params.filters != null) { + ln = params.filters.length; + if (ln) { + for (i = 0; i < ln; i++) { + filter = params.filters[i]; + property = filter.getProperty(); + value = filter.getValue(); + if (property !== null) { + sql += filterStatement + property + ' ' + (filter.getAnyMatch() ? ('LIKE \'%' + value + '%\'') : ('= \'' + value + '\'')); + filterStatement = ' AND '; + } + } + } + } + + // handle start, limit, sort, filter and group params + if (params.page !== undefined) { + sql += ' LIMIT ' + parseInt(params.start, 10) + ', ' + parseInt(params.limit, 10); + } } transaction.executeSql(sql, null,Greetings -Ralf Kraus-
Wait! Looks like we don't have enough information to add this to bug database. Please follow this template bug format.



Reply With Quote