- sqliteDatabase
- sqliteConnectionPool
- sqliteConnection -> execute() -> nativeExecute(mConnectionPtr,statement.mStatementPtr);
- /home/fyf/WORK/kitkat/mydroid/frameworks/base/core/jni/android_database_sqliteConnection.cpp: nativeExecute(JNIEnv* env,jclass clazz,jint connectionPtr,jint statementPtr) -> executeNonQuery(env,connection,statement) -> sqlite3_step(statement).
sqlite3_step()已经是sqlite3Lib提供的函数: http://www.cnblogs.com/kfqcome/archive/2011/06/27/2136999.html: sqlite3_setp().
- sqliteStatement statement = new sqliteStatement(this,sql,bindArgs)
executeUpdateDelete(). - executeUpdateDelete() -> getSession().executeForChangedRowCount(…) -> sqliteProgram的mDatabase.getThreadSession()
- mConnection.executeForChangedRowCount(…)
-> nativeExecuteForChangedRowCount(mConnectionPtr,statement.mStatementPtr);
sqliteDataBase->rawQuery->rawQueryWithFactory
- sqliteCursorDriver driver = new sqliteDirectCursorDriver(this,editTable,cancellationSignal) -> driver.query(…)
- -> sqliteDirectCursorDriver -> query(…) :
- cursor = new sqliteCursor(this,mEditTable,q uery);
- cursor = factory.newCursor(mDatabase,this,query);
- sqliteCursor -> fillWindow(int requiredPos) -> mQuery.fillWindow(…..)
- sqliteQuery -> fillWindow(….) -> int numRows = getSession().executeForCursorWindow(getsql(),getBindArgs(),window,startPos,requiredPos,countAllRows,getConnectionFlags(),mCancellationSignal)
- sqliteSession -> executeForCursorWindow(…) -> mConnection.executeForCursorWindow(sql,bindArgs,cancellationSignal)
- sqliteConnection -> executeForCursorWindow(…) -> nativeExecuteForCursorWindow(mConnectionPtr,statement.mStatementPtr,window.mWindowPtr,countAllRows);
- android_database_sqliteConnection.cpp -> nativeExecuteForCursorWindow(…) -> copyRow(…)
- copyRow(…)区分了五种类型(sqlite3_column_type(statement,i)):
- sqlite3_XXX()函数都是sqlite3的库函数.
sqliteOpenHelper:
- 在构造时传入了对应的sql DB的信息,但是不会在构造时就对DB进行创建/修改,而是delay到第一次对getDatabaseLocked(XXX)的调用,其很多的回调点onOpen/onCreate/XX等也是在这个函数内被调用的.
- getDatabaseLocked(boolean writable):