Javascript 多次触发事务回调

Javascript 多次触发事务回调,javascript,sqlite,cordova,transactions,callback,Javascript,Sqlite,Cordova,Transactions,Callback,今天我的应用程序出现了一些非常奇怪的行为: 我有这个函数来创建表,然后,成功后,在代码中继续 db.transaction(function (tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS newsDetail(id unique, title, text, created, createdTS, imageSmall, imageBig, facebook, gameNumber)'); tx.executeSql('CREAT

今天我的应用程序出现了一些非常奇怪的行为: 我有这个函数来创建表,然后,成功后,在代码中继续

db.transaction(function (tx) {
    tx.executeSql('CREATE TABLE IF NOT EXISTS newsDetail(id unique, title, text, created, createdTS, imageSmall, imageBig, facebook, gameNumber)');
    tx.executeSql('CREATE TABLE IF NOT EXISTS lastModified(id unique, ts)');
    tx.executeSql('CREATE TABLE IF NOT EXISTS teams(pos unique, name, games, gd, points, s, snv, gl, glo, goals)');
    tx.executeSql('CREATE TABLE IF NOT EXISTS players(number unique, name, nickname, birthdate, height, married, children, profession, clubs, position, image)');
    tx.executeSql('CREATE TABLE IF NOT EXISTS games(id unique, home, away, score, date, shortDate)');
    tx.executeSql('CREATE TABLE IF NOT EXISTS galleryCategories(id unique, name, date, thumb, ordering)');
    tx.executeSql('CREATE TABLE IF NOT EXISTS galleryImages(id unique, url, description, catid, ordering)');
    tx.executeSql('CREATE TABLE IF NOT EXISTS videos(id unique, url, title, image)');
}, errorCB, function () {
    loadData('newslist', createNewslist, true);
    loadData('refresh', loadNewOnes, true);
});

现在的问题是,success回调函数被调用了8次。为什么呢?我已经使用这段代码几个月了,以前从未遇到过这个问题。有人遇到过类似的事情吗?非常感谢您的帮助。

您可能添加了一些多次调用该函数的代码。由于该函数是异步的,所以如果循环该函数或运行不断调用该函数的代码,该代码将不会阻塞并等待函数完成执行。相反,它被多次调用,而不知道为什么会发生

您是否碰巧编写了围绕该问题的测试,以便知道发生了什么问题