| 1 package com.quadcap.sql; 2 3 40 41 import java.sql.SQLException ; 42 43 import com.quadcap.util.Debug; 44 45 50 public class FilterCursor extends CursorImpl { 51 Cursor cursor; 52 53 public FilterCursor(Session session) { 54 super(session, null); 55 } 56 57 public FilterCursor(Session session, String name, Cursor cursor) 58 throws SQLException  59 { 60 super(session, name); 61 this.cursor = cursor; 62 addColumns(session, cursor); 63 } 64 65 public FilterCursor(Session session, Cursor cursor) 66 throws SQLException  67 { 68 super(session, cursor.getName(), cursor.getOuterCursor()); 69 this.cursor = cursor; 70 addColumns(session, cursor); 71 } 72 73 protected void setCursor(Cursor cursor) { 74 this.cursor = cursor; 75 } 76 77 public Row getRow() throws SQLException { 78 return cursor.getRow(); 79 } 80 81 public long getRowId() { 82 return cursor.getRowId(); 83 } 84 85 public void updateRow(Row row) throws SQLException { 86 cursor.updateRow(row); 87 } 88 89 public void insertRow(Row row) throws SQLException { 90 cursor.insertRow(row); 91 } 92 93 public void deleteRow() throws SQLException { 94 cursor.deleteRow(); 95 } 96 97 public void beforeFirst() throws SQLException { 98 cursor.beforeFirst(); 99 } 100 101 public void afterLast() throws SQLException { 102 cursor.afterLast(); 103 } 104 105 public boolean absolute(int row) throws SQLException { 106 return cursor.absolute(row); 107 } 108 109 public boolean next() throws SQLException { 110 return cursor.next(); 111 } 112 113 public boolean prev() throws SQLException { 114 return cursor.prev(); 115 } 116 117 public boolean isWritable(int column) throws SQLException { 118 return cursor.isWritable(column); 119 } 120 121 public void setOuterCursor(Cursor c) { 122 super.setOuterCursor(c); 123 if (cursor != null) cursor.setOuterCursor(c); 124 } 125 126 public void close() throws SQLException { 127 cursor.close(); 128 } 129 130 public long size() throws SQLException { 131 return cursor.size(); 132 } 133 134 public String toString() { 136 return super.toString() + " (filters: " + cursor + ")"; 137 } 138 } 140 | Popular Tags |