MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / SECursor

Class SECursor

Ports/JavaSE/src/com/codename1/impl/javase/SECursor.java:41–298  ·  view source on GitHub ↗

@author Chen

Source from the content-addressed store, hash-verified

39 * @author Chen
40 */
41public class SECursor implements Cursor, RowExt {
42
43 private ResultSet resultSet;
44 private boolean closed;
45
46 public SECursor(ResultSet resultSet) {
47 this.resultSet = resultSet;
48 }
49
50 @Override
51 protected void finalize() throws Throwable {
52 if(!closed) {
53 System.out.println("**** WARNING! DB Cursor was released by the GC without being closed first! This might cause crashes on iOS *****");
54 }
55 }
56
57 @Override
58 public boolean first() throws IOException {
59 if(closed) {
60 throw new IOException("Cursor is closed");
61 }
62 try {
63 return resultSet.first();
64 } catch (SQLException ex) {
65 ex.printStackTrace();
66 throw new IOException(ex.getMessage());
67 }
68 }
69
70 @Override
71 public boolean last() throws IOException {
72 if(closed) {
73 throw new IOException("Cursor is closed");
74 }
75 try {
76 return resultSet.last();
77 } catch (SQLException ex) {
78 ex.printStackTrace();
79 throw new IOException(ex.getMessage());
80 }
81 }
82
83 @Override
84 public boolean next() throws IOException {
85 if(closed) {
86 throw new IOException("Cursor is closed");
87 }
88 try {
89 return resultSet.next();
90 } catch (SQLException ex) {
91 ex.printStackTrace();
92 throw new IOException(ex.getMessage());
93 }
94 }
95
96 @Override
97 public boolean prev() throws IOException {
98 if(closed) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected