"안드로이드 SQLite DB파일 열기"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
(사용자 3명의 중간 판 31개는 보이지 않습니다)
1번째 줄: 1번째 줄:
;안드로이드 SQLite DB 열어보기
;안드로이드 SQLite DB 열어보기


==실습==
==방법 1: 복사 후 GUI ==
<source lang='dos'>
{{참고|안드로이드 PC로 파일 복사}}
<syntaxhighlight lang='console'>
D:\adt-bundle\sdk\platform-tools>adb pull /data/data/com.android.deskclock/databases/alarms.db d:\
516 KB/s (16384 bytes in 0.031s)
</syntaxhighlight>
<syntaxhighlight lang='console'>
D:\adt-bundle\sdk\platform-tools>dir d:\ | findstr alarms.db
2012-12-12  오후 03:18            16,384 alarms.db
</syntaxhighlight>
 
;sqliteman 설치 & 실행
*http://sourceforge.net/projects/sqliteman/files/latest/download 접속하여 Sqliteman-1.2.2-win32.zip 다운로드 시작
*압축해제
*Sqliteman-1.2.2 폴더를 [[D:\Portable]]로 이동
*Sqliteman-1.2.2 폴더 내의 sqliteman.exe 실행
*File --- Open... --- "Open Database" --- d:\alarms.db 선택 --- [열기(O)]
왼쪽은 Object Browser, 오른쪽 위는 쿼리편집기, 오른쪽 아래는 쿼리결과창이다.
*main --- Tables --- alarms 더블클릭
오른쪽 아래 Full View 탭에 쿼리 결과가 나온다.<ref>SELECT * FROM alarms;의 결과</ref>
{{엑셀 행|1|2}}
{{엑셀 열| _id | hour | minutes | daysofweek | alarmtime | enabled | vibrate | message | alert }}
{{엑셀 데이터
| {{!}} 1 {{!!}} 8 {{!!}} 30 {{!!}} 31 {{!!}} 0 {{!!}} 0 {{!!}} 1 {{!!}} {{!!}}
| {{!}} 2 {{!!}} 9 {{!!}} 0 {{!!}} 96 {{!!}} 0 {{!!}} 0 {{!!}} 1 {{!!}} {{!!}}
}}
:→ 알람 2건 있으나 비활성화되어 있음<ref>enabled=0</ref>. 월~금 08:30<ref>daysofweek=31. 월화수목금 <math>2^0+2^1+2^2+2^3+2^4=1+2+4+8+16=31</math></ref>, 토일 09:00<ref>daysofweek=96. 토일 <math>2^5+2^6=32+64=96</math></ref>
 
==방법 2: 쉘 sqlite3 ==
<syntaxhighlight lang='console'>
D:\adt-bundle\sdk\platform-tools>adb shell
</syntaxhighlight>
<syntaxhighlight lang='console'>
root@android:/data # sqlite3 /data/data/com.android.deskclock/databases/alarms.db
root@android:/data # sqlite3 /data/data/com.android.deskclock/databases/alarms.db
SQLite version 3.7.11 2012-03-20 11:35:50
SQLite version 3.7.11 2012-03-20 11:35:50
9번째 줄: 40번째 줄:
sqlite> .tables
sqlite> .tables
alarms            android_metadata
alarms            android_metadata
</source>
</syntaxhighlight>
:→ alarms.db 에는 alarms 테이블과 android_metadata 테이블이 있다.
:→ alarms.db 파일에는 alarms 테이블과 android_metadata 테이블이 있다.
<syntaxhighlight lang='console'>
sqlite> .schema alarms
.schema alarms
CREATE TABLE alarms (_id INTEGER PRIMARY KEY,hour INTEGER, minutes INTEGER, daysofweek INTEGER,
alarmtime INTEGER, enabled INTEGER, vibrate INTEGER, message TEXT, alert TEXT);
</syntaxhighlight>
<syntaxhighlight lang='console'>
sqlite> select * from alarms;
select * from alarms;
1|8|30|31|0|0|1||
2|9|0|96|0|0|1||
</syntaxhighlight>
<syntaxhighlight lang='console'>
sqlite> .exit
root@android:/ # exit
 
D:\adt-bundle\sdk\platform-tools>
</syntaxhighlight>
 
==같이 보기==
==같이 보기==
*[[안드로이드 DB 목록 확인]]
*[[안드로이드 DB 목록 확인]]
*[[안드로이드 쉘 접속]]
*[[ADB]]
*[[SQLite]]
*[[안드로이드 PC로 파일 복사]]
==주석==
<references/>


[[분류: 안드로이드]]
[[분류: 안드로이드]]
[[분류: SQLite]]

2020년 12월 23일 (수) 11:01 기준 최신판

안드로이드 SQLite DB 열어보기

1 방법 1: 복사 후 GUI[ | ]

D:\adt-bundle\sdk\platform-tools>adb pull /data/data/com.android.deskclock/databases/alarms.db d:\
516 KB/s (16384 bytes in 0.031s)
D:\adt-bundle\sdk\platform-tools>dir d:\ | findstr alarms.db
2012-12-12  오후 03:18            16,384 alarms.db
sqliteman 설치 & 실행

왼쪽은 Object Browser, 오른쪽 위는 쿼리편집기, 오른쪽 아래는 쿼리결과창이다.

  • main --- Tables --- alarms 더블클릭

오른쪽 아래 Full View 탭에 쿼리 결과가 나온다.[1]

1
2
_id hour minutes daysofweek alarmtime enabled vibrate message alert
1 8 30 31 0 0 1
2 9 0 96 0 0 1
→ 알람 2건 있으나 비활성화되어 있음[2]. 월~금 08:30[3], 토일 09:00[4]

2 방법 2: 쉘 sqlite3[ | ]

D:\adt-bundle\sdk\platform-tools>adb shell
root@android:/data # sqlite3 /data/data/com.android.deskclock/databases/alarms.db
SQLite version 3.7.11 2012-03-20 11:35:50
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .tables
alarms            android_metadata
→ alarms.db 파일에는 alarms 테이블과 android_metadata 테이블이 있다.
sqlite> .schema alarms
.schema alarms
CREATE TABLE alarms (_id INTEGER PRIMARY KEY,hour INTEGER, minutes INTEGER, daysofweek INTEGER,
alarmtime INTEGER, enabled INTEGER, vibrate INTEGER, message TEXT, alert TEXT);
sqlite> select * from alarms;
select * from alarms;
1|8|30|31|0|0|1||
2|9|0|96|0|0|1||
sqlite> .exit
root@android:/ # exit

D:\adt-bundle\sdk\platform-tools>

3 같이 보기[ | ]

4 주석[ | ]

  1. SELECT * FROM alarms;의 결과
  2. enabled=0
  3. daysofweek=31. 월화수목금 [math]\displaystyle{ 2^0+2^1+2^2+2^3+2^4=1+2+4+8+16=31 }[/math]
  4. daysofweek=96. 토일 [math]\displaystyle{ 2^5+2^6=32+64=96 }[/math]
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}