Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction through promises #832

Open
GuilhermeLessa opened this issue Nov 19, 2018 · 3 comments
Open

Transaction through promises #832

GuilhermeLessa opened this issue Nov 19, 2018 · 3 comments

Comments

@GuilhermeLessa
Copy link

GuilhermeLessa commented Nov 19, 2018

things like this dont work because transactions close on first promise resolve:
andpor/react-native-sqlite-storage#117

some solution? Thanks for your support!

main = function (data) {
    return new Promise(function (resolve, reject) {
        db.transaction(function (t) {
            var fetchDataOne = function (t) {
                return new Promise(function (resolve, reject) {
                    t.executeSql('...');
                    resolve();
                });
            };

            var fetchDataTwo = function (t) {
                return new Promise(function (resolve, reject) {
                    t.executeSql('...');
                    resolve();
                });
            };

            Promise.all([].concat(fetchDataOne, fetchDataTwo)).then(resolve).catch(reject);
        }, reject, resolve);
    });
};

@k-koehler
Copy link

I also noticed this... a fix would be great

@salmaazakii
Copy link

Is this issue still open?

@GNUGradyn
Copy link

Is this still open? This is a major issue for anyone trying to wait for an entire transaction to complete asynchronously

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants