The reason you are seeing all 95's is a scope issue, you need a closure to perform an asynchronous op like this.
On 2010-08-02, at 7:27 PM, sajid saiyed <[email protected]> wrote: > Hi, > I am making an iPad app which uses localstorage Sqlite database. > > I am having some problems with the performance of the database queries. > > Here is my code: > > addG: function(fname, fid){ > alert('4'+fid); > for(var i=0; i<95; i++){ > alert('5'); > this.dbConn.transaction(function (transaction) { > transaction.executeSql('INSERT INTO `GTable` > (`id`,`gname`) VALUES (?, ?);', [fid, i], > classObj.nullDataHandler,classObj.errorHandler); > }); > } > } > > What actually happens that the insert query works so slow that after a first > few records, all entries insert a value of 95 in the 'gname' column. > > Is there an optimised way of inserting multiple entries in sqlite database? > > Thanks > -- > You received this message because you are subscribed to the Google Groups > "iPhoneWebDev" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/iphonewebdev?hl=en. -- You received this message because you are subscribed to the Google Groups "iPhoneWebDev" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/iphonewebdev?hl=en.
