SQLiteDatabase(2)
-
[SQLiteDatabase] WHERE절 LIKE에 WILDCARD 사용하기
# WILDCARD를 SelectionArgs에 포함해서 처리 String[] selectionArgs = new String[] { searchString + "%" }; Cursor c = db.rawQuery("SELECT * FROM table WHERE column=?", selectionArgs);
2022.06.21 -
SQLiteDatabase 를 이용한 SQLite 사용하기
1. SQLiteDatabase 생성(Create) 및 열기(Open) SQLiteDatabase database = openOrCreateDatabase("database.db3", MODE_WORLD_WRITEABLE, null); 2. 쿼리 실행(CREATE, INSERT, UPDATE, DELETE 실행시) database.beginTransaction(); try{ database.execSQL(strSQL); database.setTransactionSuccessful(); }catch(Exception e){ e.printStackTrace(); }finally{ database.endTransaction(); } 3. 쿼리실행(SELECT 실행시) Cursor cursor = null; t..
2020.05.21