Exemplo n.º 1
0
 public void saveToDB(SQLiteDatabase db) {
   String where =
       ObjectInfoColumns.OBJECT_NAME
           + "='"
           + mName
           + "' and "
           + ObjectInfoColumns.SCENE_NAME
           + "='"
           + mSceneName
           + "' and "
           + ObjectInfoColumns.OBJECT_INDEX
           + "="
           + mIndex;
   Cursor cursor = null;
   try {
     cursor = db.query(Tables.OBJECTS_INFO, null, where, null, null, null, null);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         return;
       }
     }
   } finally {
     if (cursor != null) {
       cursor.close();
     }
   }
   ContentValues values = new ContentValues();
   saveToDB(values);
   mID = (int) db.insert(Tables.OBJECTS_INFO, null, values);
   mObjectSlot.mObjectID = mID;
   if (mVesselName != null) {
     where =
         ObjectInfoColumns.OBJECT_NAME
             + "='"
             + mVesselName
             + "' and "
             + ObjectInfoColumns.SCENE_NAME
             + "='"
             + mSceneName
             + "' and "
             + ObjectInfoColumns.OBJECT_INDEX
             + "="
             + mVesselIndex;
     String[] columns = {ObjectInfoColumns.OBJECT_ID};
     cursor = db.query(Tables.OBJECTS_INFO, columns, where, null, null, null, null);
     if (cursor != null) {
       if (cursor.moveToFirst()) {
         mObjectSlot.mVesselID = cursor.getInt(0);
       }
       cursor.close();
     }
   }
   saveSlotToDB(db);
 }
Exemplo n.º 2
0
 public void saveToDB() {
   Runnable finishListener = null;
   saveToDB(finishListener);
 }