설.현.아빠
기본 DB schema 본문
_size INTEGER,mime_type TEXT,date_added INTEGER,date_modified INTEGER,title TEXT NOT NULL,
title_key TEXT NOT NULL,duration INTEGER,artist_id INTEGER,composer TEXT,album_id INTEGER,
track INTEGER,year INTEGER CHECK(year!=0),is_ringtone INTEGER,is_music INTEGER,is_alarm INTEGER,
is_notification INTEGER, is_podcast INTEGER, bookmark INTEGER);
title TEXT,date_added INTEGER,date_modified INTEGER,description TEXT,picasa_id TEXT,
isprivate INTEGER,latitude DOUBLE,longitude DOUBLE,datetaken INTEGER,orientation INTEGER,
mini_thumb_magic INTEGER,bucket_id TEXT,bucket_display_name TEXT);
mime_type TEXT,date_added INTEGER,date_modified INTEGER,title TEXT,duration INTEGER,artist TEXT,
album TEXT,resolution TEXT,description TEXT,isprivate INTEGER,tags TEXT,category TEXT,
language TEXT,mini_thumb_data TEXT,latitude DOUBLE,longitude DOUBLE,datetaken INTEGER,
mini_thumb_magic INTEGER, bucket_id TEXT, bucket_display_name TEXT, bookmark INTEGER);
artist, artist_id, artist_key, count(*) AS numsongs,album_art._data AS album_art
FROM audio LEFT OUTER JOIN album_art ON audio.album_id=album_art.album_id
WHERE is_music=1 GROUP BY audio.album_id;
COUNT(*) AS number_of_tracks
FROM audio WHEREis_music=1 GROUP BY artist_key;
LEFT OUTER JOIN albums ON audio_meta.album_id=albums.album_id;
NULL AS text2,number_of_albums AS data1,number_of_tracks AS data2,artist_key AS match,
'content://media/external/audio/artists/'||_id AS suggest_intent_data,1 AS grouporder
FROM artist_info
WHERE (artist!='<unknown>') UNION ALL
SELECT _id,'album' AS mime_type,artist,album,NULL AS title,
album AS text1,artist AS text2,NULL AS data1,NULL AS data2,
artist_key||' '||album_key AS match,'content://media/external/audio/albums/'||_id AS suggest_intent_data,
2 AS grouporder
FROM album_info
WHERE (album!='<unknown>') UNION ALL
SELECT searchhelpertitle._id AS _id,mime_type,artist,album,title,title AS text1,
artist AS text2,NULL AS data1,NULL AS data2,
artist_key||' '||album_key||' '||title_key AS match,
'content://media/external/audio/media/'||searchhelpertitle._id AS suggest_intent_data,
3 AS grouporder FROM searchhelpertitle WHERE (title != '');
CREATE VIEW searchhelpertitle AS SELECT * FROM audio ORDER BY title_key;
CREATE TRIGGER audio_genres_cleanup DELETE ON audio_genres BEGIN DELETE FROM audio_genres_map WHERE genre_id = old._id;
CREATE TRIGGER audio_meta_cleanup DELETE ON audio_meta BEGIN DELETE FROM audio_genres_map WHERE audio_id = old._id;
DELETE FROM audio_playlists_map WHERE audio_id = old._id;
SELECT _DELETE_FILE(old._data);
SELECT _DELETE_FILE(old._data);
'안드로이드 > DB' 카테고리의 다른 글
DB의 각종 Method 설명(WHERE절 텍스트 비교법) (0) | 2011.05.20 |
---|---|
[DBMS] 공개 database 서버 (1) | 2011.05.12 |
데이터베이스 이용하기 (커니의 안드로이드 이야기) (0) | 2011.03.17 |
[DB연동] (5) | 2011.02.11 |