실제 Application의 database 사용 방식


지난 실험에 이어 안드로이드 플랫폼에서 어플리케이션이 database를 사용할 때 어떤 API를 어떻게 사용하는지 알아보았다.

1. Android developers page

 developer.android.com의 reference page에서 Android API들을 볼 수 있다. android.database.package에서는 private database 관리를 위해서 android.database.sqlite package를 사용하라고 설명되어 있다.

 android.database.sqlite package의 SQLiteDatabase class 안에서 우리에게 익숙한 insert, update, delete, 그리고 select문과 drop, create문을 위한 execsql, query method들을 찾을 수 있었다. 각각의 method들은 개발자가 사용하기 편리하게 선언되어 있었다.

 실제 application에서 위와 같은 method들을 어떻게 사용하고 있는지 알아보기 위한 실험을 계속 진행하였다.


2. Method profiling

 안드로이드 기기에 기본 내장되어 있으며 database를 사용하는 연락처(contacts) application을 타겟으로 하여 method profiling을 진행해 보았다.

 contacts application을 실행하면 전체 연락처 목록을 database로부터 가져오는 동작을 DDMS로 method profiling하여 traceview로 확인하였다.

 위에서 조사한 API들을 어떤식으로 사용하는지 알아보고자 했으나, 실제로 contact app에서는 위에서 조사한 API들을 전혀 사용하고 있지 않았다. 어떤 method들을 사용하고 있는지 직접 찾아보았다.

 contacts application은 AsyncTask class를 이용해 background에서 직접 아래와 같은 method들을 호출하여 database를 사용하고 있었다.

사용자 삽입 이미지

ContentResulver.query : 주어진 URI를 질의하여 Cursor를 return
CursorWrapper.moveToFirst : 첫번째 row로 Cursor를 이동
CursorWrapper.getString : 요청한 column의 string 값을 return
CursorWrapper.getInt : 요청한 column의 int 값을 return

 먼저 연락처 목록을 불러오기 위해 query method로 질의한 뒤 return 받은 cursor를 통해getString, getInt method로 직접 database로부터 data를 가져오는 방식을 사용하고 있었다.

 이번 실험으로 알아낸 동작 방식을 적용한 test application을 작성하여 table 구조를 변화시켜 가면서 실험하여 I/O와의 관련성을 더 조사해 볼 것이다.


Posted by blondeness

2014/09/02 20:32 2014/09/02 20:32
Response
1 Trackbacks , 117498 Comments
RSS :
http://dmclab.hanyang.ac.kr/tc/scv/rss/response/30

Trackback URL : http://dmclab.hanyang.ac.kr/tc/scv/trackback/30

Trackbacks List

  1. :: 실제 Application의 database 사용 방식

    Tracked from pligg.com 2016/01/17 08:11 Delete

    When utilizing your own webhosting or an image internet hosting service, you may make your listing with lots of photos throughout to extend sales and appeal to more visitors.

Comments List

  1. celtic woman concert philadelphia 2016/05/28 16:54 # M/D Reply Permalink

    It normally takes years to free you against debt through
    the implementation of the program of debt consolidation loan celtic woman concert philadelphia having less credit open is
    not going to provide all the information which the finance bureaus are
    searching for.

  2. berita kpop 2016/05/28 16:54 # M/D Reply Permalink

    Wow that was unusual. I just wrote an really long comment but after I clicked submit my comment didn't
    show up. Grrrr... well I'm not writing all that over again. Anyhow, just wanted to
    say wonderful blog!

  3. Abigail 2016/05/28 16:54 # M/D Reply Permalink

    Ben Foster played with Angel in Brett Ratner's ill fated X-Men: The
    Last Stand, though the sequel tried too hard to cram the
    hero's arc into one film and wound up shortchanging him.

  4. Coffee health Benefits 2016/05/28 16:53 # M/D Reply Permalink

    Do you have a spam issue on this website; I also am a blogger, and I was curious
    about your situation; many of us have developed some nice practices and we
    are looking to exchange methods with other folks, please shoot me an e-mail if interested.

  5. How to Get Abs Fast 2016/05/28 16:47 # M/D Reply Permalink

    Quality articles is the crucial to interest the visitors to visit the web site, that's what this web site is providing.

  6. New If Theres Anything 2016/05/28 16:46 # M/D Reply Permalink

    I'm really impressed together with your writing abilities and also
    with the format in your blog. Is this a paid theme or did you modify it yourself?

    Either way stay up the excellent quality writing, it is rare to peer
    a great blog like this one nowadays..

  7. Pandora Sale 2016/05/28 16:44 # M/D Reply Permalink

    Hey great website! Does running a blog such as this take a great deal of work?

    I have no expertise in computer programming however I had been hoping
    to start my own blog soon. Anyway, should you have
    any suggestions or tips for new blog owners please share.
    I know this is off topic but I simply needed to ask.
    Appreciate it!

  8. cara berhijab modern 2016/05/28 16:44 # M/D Reply Permalink

    Keep this going please, great job!

  9. افضل شركة شراء اثاث مستعمل بالرياض 2016/05/28 16:40 # M/D Reply Permalink

    Take the time to research the site, and the furnishings
    you program to get, to make absolutely sure you
    get the ideal deal.

  10. Ministry of Deals 2016/05/28 16:40 # M/D Reply Permalink

    This design is spectacular! You most certainly know how to keep a
    reader amused. Between your wit and your videos, I was almost moved to start my own blog (well, almost...HaHa!) Great job.
    I really loved what you had to say, and more than that, how you presented it.
    Too cool!

  11. desain halaman depan 2016/05/28 16:39 # M/D Reply Permalink

    Normallу I do not learn post on blogs, but I would like too say that
    this write-up very compelled me to take a ook at and do so!
    Your writing style has been amazed me. Thanks, very great post.

  12. شركة مكافحة الفئران بالدمام 2016/05/28 16:39 # M/D Reply Permalink

    I took the one out to hold her tonight and I seen her ears are
    all scratched up and a bit of bloody.

  13. eCom Success Academy 2016/05/28 16:38 # M/D Reply Permalink

    I like what you guys are usually up too. This sort of clever work
    and coverage! Keep up the fantastic works guys I've added you guys to my own blogroll.

  14. http://www.nexopia.com/ 2016/05/28 16:37 # M/D Reply Permalink

    We are a group oof volunteers and opening a new scheme in our community.
    Your web site provided us with valuable inhfo to work on.
    You have done a formidable job and our whole community wijll be thankful to you.

  15. Kassandra 2016/05/28 16:33 # M/D Reply Permalink

    Males can get very large and wish sufficient house or they
    get upset.

« Previous : 1 : 2 : 3 : 4 : 5 : ... 7834 : Next »
Leave a comment
[로그인][오픈아이디란?]
« Previous : 1 : ... 4 : 5 : 6 : 7 : 8 : 9 : 10 : 11 : 12 : ... 31 : Next »