Actually, Im just guessing here, shouldnt you use staretTransaction
and endTransaction instead of setTransactionSuccesfull() ???
Right now you as a developer are specifically marking the transaction
as succesfull, is that what you want ?

On 12 apr, 16:22, Alok Kulkarni <[email protected]> wrote:
> Each of these above functions insert records in 3 seperate tables in the
> same database.
> Thanks ,
> Alok
>
> On Mon, Apr 12, 2010 at 7:51 PM, Alok Kulkarni <[email protected]> wrote:
> > Before the 1st insert call i am doing
> > db.beginTransaction();
>
> > for(i = 0 i <2000 ; i++)
> >    addAlbumDB();
> > for(i = 0 i <3000 ; i++)
> >    addArtistDB();
> > for(i = 0 i <2000 ; i++)
> >    addSongDB();
> > try {
> >             db.setTransactionSuccessful();
> >         } finally {
> >             db.endTransaction();
>
> >         }
>
> > On Mon, Apr 12, 2010 at 7:18 PM, MobDev <[email protected]> wrote:
>
> >> I don't see a specific transaction ???
> >> Anyways transaction should only be used if you have multiple actions
> >> you are doing on your database (like several insert/update
> >> operations)...
>
> >> On 12 apr, 15:43, Alok Kulkarni <[email protected]> wrote:
> >> > This is a standard class DatabaseHelper extending SQLiteOpenHelper...
>
> >> > private static class DatabaseHelper extends SQLiteOpenHelper {
> >> >         DatabaseHelper(Context context, String databaseName) {
> >> >             super(context, databaseName, null, DATABASE_VERSION);
> >> >         }
>
> >> >         @Override
> >> >         public void onCreate(SQLiteDatabase db) {
> >> >             // Nothing to do
> >> >         }
>
> >> >         @Override
> >> >         public void onUpgrade(SQLiteDatabase db, int oldVersion, int
> >> > newVersion) {
> >> >             Log
> >> >                     .w("Upgrade", "Upgrading database from version "
> >> >                             + oldVersion + " to " + newVersion
> >> >                             + ", which will destroy all old data");
> >> >             db.execSQL("DROP TABLE IF EXISTS titles");
> >> >             onCreate(db);
> >> >         }
> >> >     }
>
> >> > Then i have
> >> > private SQLiteDatabase db;
> >> > This db object is used to perform insert operations.
> >> > Thanks,
> >> > Alok.
> >> >     // ---opens the database---
>
> >> >     public void open() throws SQLException {
> >> >         db = DBHelper.getWritableDatabase();
> >> >     }
>
> >> > On Mon, Apr 12, 2010 at 6:20 PM, MobDev <[email protected]>
> >> wrote:
> >> > > do you have some code specifically showing the sequence and the
> >> > > syntax ?
> >> > > AAfaik a transaction SHOULD make it faster accroding to this
> >> > > documentation :
>
> >>http://web.utk.edu/~jplyon/sqlite/SQLite_optimization_FAQ.html#transa..<http://web.utk.edu/%7Ejplyon/sqlite/SQLite_optimization_FAQ.html#transa..>
> >> .<http://web.utk.edu/%7Ejplyon/sqlite/SQLite_optimization_FAQ.html#tran..
> >> .>
>
> >> > > On 12 apr, 12:32, Alok Kulkarni <[email protected]> wrote:
> >> > > > I have started the transaction before the 1st insert , and ended it
> >> after
> >> > > > the last insert....
> >> > > > Thanks,
> >> > > > Alok.
>
> >> > > > On Mon, Apr 12, 2010 at 4:01 PM, Alok Kulkarni <[email protected]>
> >> > > wrote:
> >> > > > > Ok,
> >> > > > > @Yahel:- For the insertion of same records on a Palm device(Say
> >> Palm
> >> > > Pre) ,
> >> > > > > its taking 3 seconds..
> >> > > > > On an IPhone , its taking 1 or  2 seconds..
> >> > > > > Here is an example of what i am doing..
> >> > > > > private Boolean addAlbumDB(int AlbumId, String Name, String Label,
> >> > > > >             int MultipleArtists, int ArtistId) {
> >> > > > >         long result = -1;
>
> >> > > > >         try {
>
> >> > > > >             ContentValues initialValues = new ContentValues();
> >> > > > >             initialValues.put(KEY_ID, AlbumId);
> >> > > > >             initialValues.put(KEY_NAME, Name);
> >> > > > >             initialValues.put(KEY_LABEL, Label);
> >> > > > >             initialValues.put(KEY_ARTIST_ID, ArtistId);
> >> > > > >             initialValues.put(KEY_MULTIPLE_ARTISTS,
> >> MultipleArtists);
>
> >> > > > >              result = db.insert(DATABASE_TABLE, null,
> >> initialValues);
>
> >> > > > >         } catch (Exception e) {
> >> > > > >             Log.i("Exception in addAlbumDB", "" + e.toString());
> >> > > > >             return false;
> >> > > > >         }
>
> >> > > > >         if (result == -1)
> >> > > > >             return false;
> >> > > > >         return true;
> >> > > > >     }
>
> >> > > > > The above function is called for around 2000 times..
> >> > > > > Similarly there are 2 3 more functions for other tables.
> >> > > > > Thanks,
> >> > > > > Alok.
>
> >> > > > > On Mon, Apr 12, 2010 at 2:33 PM, Michael Rueger <
> >> [email protected]
> >> > > >wrote:
>
> >> > > > >> On 4/12/2010 10:59 AM, Yahel wrote:
>
> >> > > > >>> Hi Alok,
>
> >> > > > >>> Posting some logic, or some sql would help us see if you are
> >> missing
> >> > > > >>> something :)
>
> >> > > > >> (excessive) use of indices comes to mind :-)
>
> >> > > > >> Michael
>
> >> > > > >>> Yahel
>
> >> > > > >>> On 12 avr, 08:50, Alok Kulkarni<[email protected]>  wrote:
>
> >> > > > >>>> Hi,
> >> > > > >>>> I am inserting around 7000 to 8000 records in my database
> >> having 4
> >> > > > >>>> tables
> >> > > > >>>> each having 3 to 4 columns.Its taking me around 22 seconds to
> >> do the
> >> > > > >>>> insertion which is i think is too long. I am using transaction
> >> while
> >> > > > >>>> doing
> >> > > > >>>> this without which its taking around 55 seconds.
> >> > > > >>>> According to SQLite documentation , inserting 10000 records in
> >> a
> >> > > > >>>> database
> >> > > > >>>> takes time  around 2 to 3 seconds.
> >> > > > >>>> Am i missing something , or is the behaviour correct?
> >> > > > >>>> Thanks,
> >> > > > >>>> Alok
>
> >> > > > >> --
> >> > > > >> You received this message because you are subscribed to the
> >> Google
> >> > > > >> Groups "Android Developers" group.
> >> > > > >> To post to this group, send email to
> >> > > [email protected]
> >> > > > >> To unsubscribe from this group, send email to
> >> > > > >> [email protected]<android-developers%[email protected]>
> >> <android-developers%[email protected]<android-developers%[email protected]>
>
> >> > > <android-developers%[email protected]<android-developers%[email protected]>
> >> <android-developers%[email protected]<android-developers%[email protected]>
>
> >> > > > >> For more options, visit this group at
> >> > > > >>http://groups.google.com/group/android-developers?hl=en
>
> >> > > > >> To unsubscribe, reply using "remove me" as the subject.
>
> >> > > --
> >> > > You received this message because you are subscribed to the Google
> >> > > Groups "Android Developers" group.
> >> > > To post to this group, send email to
> >> [email protected]
> >> > > To unsubscribe from this group, send email to
> >> > > [email protected]<android-developers%[email protected]>
> >> <android-developers%[email protected]<android-developers%[email protected]>
>
> >> > > For more options, visit this group at
> >> > >http://groups.google.com/group/android-developers?hl=en
>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Android Developers" group.
> >> To post to this group, send email to [email protected]
> >> To unsubscribe from this group, send email to
> >> [email protected]<android-developers%[email protected]>
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" 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/android-developers?hl=en

Reply via email to