You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Daniel Robles Pichardo (JIRA)" <ji...@apache.org> on 2013/04/18 14:27:19 UTC

[jira] [Commented] (CB-3047) db.transaction succes callback called on every tx.executeSql on android 4.0.x

    [ https://issues.apache.org/jira/browse/CB-3047?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13635121#comment-13635121 ] 

Daniel Robles Pichardo commented on CB-3047:
--------------------------------------------

But on Android 4.x using cordova 2.5.0 I doesn't have this problem, I looked for changes on Storage.java (any diff) and in js file but I can't see any changes on Storage module. Any Hint?
                
> db.transaction succes callback called on every tx.executeSql on android 4.0.x
> -----------------------------------------------------------------------------
>
>                 Key: CB-3047
>                 URL: https://issues.apache.org/jira/browse/CB-3047
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Android, CordovaJS
>    Affects Versions: 2.6.0
>         Environment:  Galaxy S2 (4.1.2), Asus Transformer TF101 (4.0.3), Galaxy Tab (4.0.4)
>            Reporter: Daniel Robles Pichardo
>            Assignee: Joe Bowser
>              Labels: newbie
>
> The transaction callback is fired on every executeSql like in this example. But in 2.5.0 is only called only when populate_table ends (end of transaction).
> {code:javascript}
> function save_table(table_data) {
>         console.log(JSON.stringify(table_data));
>         var metadata = table_data.content.meta;
>         var name = metadata.table_name;
>         var fields = metadata.fields_order;
>         var rows = table_data.content.data;
>  
>         var populate_table = function (tx) {
>             tx.executeSql('DROP TABLE IF EXISTS ' + name); // <-- fired HERE
>  
>             var create_smt = 'CREATE TABLE IF NOT EXISTS ' + name +
>                 ' (' + fields.join(', ') + ');';
>  
>             tx.executeSql(create_smt); // <-- fired HERE
>  
>             var placeholders = fields.map(function () {
>                 return '?';
>             });
>             var insert_smt = 'INSERT INTO ' + name +
>                 ' VALUES (' + placeholders.join(', ') + ')';
>  
>             for (var i = 0; i < rows.length; i++) {
>                 tx.executeSql(insert_smt, rows[i]); // <-- fired HERE
>             }
>         };
>  
>         var success = function () {
>             TABLES_DONNE ++;
>             update_progress();
>             if (TABLES_DONNE >= TOTAL_TABLES) {
>                 load_assignments_table();
>             }
>         };
>  
>         ISDS.db.transaction(populate_table, sql_error, success);
>     }
> {code}
> EDIT: I put a wrong version

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira