Beispiel #1
0
 private void saveSlotToDB(SQLiteDatabase db) {
   String table = Tables.VESSEL;
   final String updateTable = table;
   ContentValues values = new ContentValues();
   saveSlotToDB(values);
   db.insert(updateTable, null, values);
 }
Beispiel #2
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);
 }
Beispiel #3
0
 public void saveSlotToDB() {
   ContentValues values = new ContentValues();
   saveSlotToDB(values);
   mContentResolver.insert(VesselColumns.CONTENT_URI, values);
 }