cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel Robles Pichardo (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-3047) db.transaction succes callback called on every tx.executeSql on android 4.0.x
Date Tue, 16 Apr 2013 17:35:16 GMT
Daniel Robles Pichardo created CB-3047:
------------------------------------------

             Summary: 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.5.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


The transaction callback is fired on every executeSql like in this example. But in 2.4.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}

--
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

Mime
View raw message