2012-10-02 4 views
3

내가 SQLite는이 오류를 얻고있다 ,SQLite는 삽입 던지는 구문 예외

near ",": syntax error (code 1):, 컴파일하는 동안 :

UPDATE OutfitItem 
SET outfit_img_relative_pos_x=?,clothing_item_ID=?,outfit_img_relative_pos_y=?, 
outfit_img_relative_size_width=?,outfit_ID=?,outfit_img_relative_size_height=? 
WHERE (outfit_ID,clothing_item_ID) = (60,5) 

월 누군가가 나를 위해 오류를하시기 바랍니다 발견?

다음는 ...

테이블을 생성하는 코드 컴파일됩니다 코드 ...

// ---updates a outfitItem--- 
     public boolean update(long outfitID, long clothingItemID, double imgRelativePos_X, double imgRelativePos_Y, 
       double imgRelativeSize_width, double imgRelativeSize_height) 
     { 
      ContentValues args = new ContentValues(); 
      args.put(KEY_OUTFIT_ID, outfitID); 
      args.put(KEY_CLOTHING_ITEM_ID, clothingItemID); 
      args.put(KEY_OUTFIT_IMAGE_RELATIVE_POS_X, imgRelativePos_X); 
      args.put(KEY_OUTFIT_IMAGE_RELATIVE_POS_Y, imgRelativePos_Y); 
      args.put(KEY_OUTFIT_IMAGE_RELATIVE_SIZE_WIDTH, imgRelativeSize_width); 
      args.put(KEY_OUTFIT_IMAGE_RELATIVE_SIZE_HEIGHT, imgRelativeSize_height); 
      return db.update(TABLE_NAME, args, "(" + KEY_OUTFIT_ID + "," + KEY_CLOTHING_ITEM_ID + ") = (" + outfitID 
        + "," + clothingItemID + ")", null) > 0; 
     } 

다음을이다, 외국 키에에 설정되어 있습니다

public static final String TABLE_NAME = "OutfitItem"; public static final String TABLE_CREATE = "create table " + TABLE_NAME + "(" + KEY_OUTFIT_ID + " int not null REFERENCES " + Table_Outfit.TABLE_NAME + "(" + KEY_OUTFIT_ID + ") ON DELETE CASCADE," + KEY_CLOTHING_ITEM_ID + " int not null REFERENCES " + Table_ClothingItem.TABLE_NAME + "(" + KEY_CLOTHING_ITEM_ID + ") ON DELETE CASCADE, " + KEY_OUTFIT_IMAGE_RELATIVE_POS_X + " real not null, " + KEY_OUTFIT_IMAGE_RELATIVE_POS_Y + " real not null, " + KEY_OUTFIT_IMAGE_RELATIVE_SIZE_WIDTH + " real not null, " + KEY_OUTFIT_IMAGE_RELATIVE_SIZE_HEIGHT + " real not null, " + "primary key (" + KEY_OUTFIT_ID + "," + KEY_CLOTHING_ITEM_ID + "));"; 
+0

누군가가 조속한 도와주세요를 ??? – Blackbelt

답변

4

귀하의 문제는 WHERE 절에 있습니다

WHERE (outfit_ID,clothing_item_ID) = (60,5) 

이것은 유효한 SQL 구문이 아닙니다. AND 연결과 별도의 조건을 사용해야합니다. @Neil 으로

+0

정말 고마워요. 하루를 구 했어요! – basbas

0

바르게 지적, 다음 코드를 사용하여이 작업을 시작할 것입니다 :

UPDATE OutfitItem 
SET outfit_img_relative_pos_x=?,clothing_item_ID=?,outfit_img_relative_pos_y=?, 
outfit_img_relative_size_width=?,outfit_ID=?,outfit_img_relative_size_height=? 

WHERE outfit_ID = 60 AND clothing_item_ID = 5;

+0

정말 고마워, 너 하루를 구 했어! – basbas

+0

문제가없는 친구입니다! 행운을 빈다! :) – Swayam