Lines Matching defs:cursor
311 * Opens a cursor for a given database, dup'ing an existing CDB cursor if
335 * meaningful cursor attribute for CDB, and here we count on
344 * Although CDB allows opening a write cursor when a read
345 * cursor is open, a self-deadlock will occur if a write is
350 "cannot open CDB write cursor when read cursor is open");
359 Cursor cursor;
362 cursor = other.dup(false);
364 cursor = db.openCursor(null, cdbConfig);
366 cursors.add(cursor);
367 return cursor;
374 * Duplicates a cursor for a given database.
376 * @param writeCursor true to open a write cursor in a CDB environment, and
381 * @return the open cursor.
385 Cursor dupCursor(Cursor cursor, boolean writeCursor, boolean samePosition)
391 Database db = cursor.getDatabase();
396 if (cursors.contains(cursor)) {
397 Cursor newCursor = cursor.dup(samePosition);
403 throw new IllegalStateException("cursor to dup not tracked");
405 return cursor.dup(samePosition);
410 * Closes a cursor.
412 * @param cursor the cursor to close.
416 void closeCursor(Cursor cursor)
419 if (cursor == null) {
425 Database db = cursor.getDatabase();
428 if (cdbCursors.readCursors.remove(cursor) ||
429 cdbCursors.writeCursors.remove(cursor)) {
430 cursor.close();
436 "closing CDB cursor that was not known to be open");
438 cursor.close();
443 * Returns true if a CDB cursor is open and therefore a Database write