Vignesh T.V.
Vignesh T.V.

Reputation: 1860

sqlite synchronous

i have been using sqlite, phonegap, javascript and i m in need of fetching information from the sqlite db.

I am able to fetch all info i need, insert, update, etc.

The problem is javascript works asynchronously. That is it is processing all other succeeding statements before all the necessary info from database gets fetched.

i have tried using callbacks all along and i am tired of it since there are difficulty in using loops. (not able to use sqlite queries within loops since loop gets iterated before the current sqlquery gets processed which is not what i want)

is it possible to do these db operations synchronously?

UPDATE Found out a new solution from here: webkit executesql sentence and loop problem

Upvotes: 7

Views: 7633

Answers (2)

Simply Innovative
Simply Innovative

Reputation: 568

You can use Siminov Framework. It allows you to make both Synchronous/Asynchronous calls to the native SQLite database. It supports most of the Hybrid Frameworks such as (Cordova, React Native, Xamarin)

However if you are building a Hybrid Apps using JavaScript, then I would recommend to use Asynchronous calls because it has a performance advantage over Synchronous calls.

Upvotes: 2

Reinstate Monica Cellio
Reinstate Monica Cellio

Reputation: 26143

No, but there's a library that may help...

http://html5sql.com/

I've just started using it myself and it allows you to execute multiple or single SQL requests, with 1 callback. It may be just what you need :)

Upvotes: 2

Related Questions