8000 implementing cross process cursor interface · Fiv38/android-database-sqlcipher@1ec5e73 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ec5e73

Browse files
committed
implementing cross process cursor interface
1 parent 2416926 commit 1ec5e73

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/info/guardianproject/database/sqlcipher/SQLiteCursor.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import android.database.CharArrayBuffer;
3030
import android.database.ContentObserver;
31+
import android.database.CrossProcessCursor;
3132
import android.os.Handler;
3233
import android.os.Message;
3334
import android.os.Process;
@@ -42,7 +43,7 @@
4243
* SQLiteCursor is not internally synchronized so code using a SQLiteCursor from multiple
4344
* threads should perform its own synchronization when using the SQLiteCursor.
4445
*/
45-
public class SQLiteCursor extends AbstractWindowedCursor {
46+
public class SQLiteCursor extends AbstractWindowedCursor implements CrossProcessCursor {
4647
static final String TAG = "Cursor";
4748
static final int NO_COUNT = -1;
4849

@@ -608,14 +609,14 @@ protected void finalize() {
608609

609610
@Override
610611
public void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer) {
611-
// TODO Auto-generated method stub
612+
612613

613614
}
614615

615616
@Override
616617
public void registerContentObserver(ContentObserver observer) {
617618
// TODO Auto-generated method stub
618-
619+
619620
}
620621

621622
@Override
@@ -638,4 +639,20 @@ public void unregisterDataSetObserver(
638639

639640
}
640641

642+
@Override
643+
public void fillWindow(int startPos, android.database.CursorWindow window) {
644+
645+
646+
window.setStartPosition(startPos);
647+
mCount = mQuery.fillWindow((info< 703A /span>.guardianproject.database.CursorWindow)window, mInitialRead, 0);
648+
// return -1 means not finished
649+
if (mCount == NO_COUNT){
650+
mCount = startPos + mInitialRead;
651+
Thread t = new Thread(new QueryThread(mCursorState), "query thread");
652+
t.start();
653+
}
654+
655+
}
656+
657+
641658
}

0 commit comments

Comments
 (0)
0