2 import java
.sql
.Connection
;
3 import java
.sql
.Statement
;
4 import java
.sql
.SQLException
;
5 import java
.sql
.ResultSet
;
6 import java
.sql
.SQLWarning
;
7 public class JdbcSqlStatement
extends JSqlError
implements Statement
, JSqlErrorType
9 public boolean isClosed
;
10 public boolean isPrepared
;
11 public int rowsAffect
;
12 public JSqlStatement jniStmt
;
13 public JdbcSqlConnection conn
;
14 //public JdbcSqlResultSet rs;
16 JdbcSqlStatement(Connection con
)
18 jniStmt
= new JSqlStatement();
20 jniStmt
.setConnectionPtr(((JdbcSqlConnection
)con
).getConnection().getPtr());
21 conn
= (JdbcSqlConnection
)con
;
26 protected void finalize ()
35 System
.out
.println(e
);
38 public void prepareInt(String query
) throws SQLException
45 rv
= jniStmt
.prepare(query
);
46 if( rv
!= 0 ) // 0 ->OK
48 throw getException(CSQL_PREPARE_ERR
);
52 public boolean executeInt() throws SQLException
54 if (!isPrepared
) throw getException(CSQL_NOT_PREPARED
);
55 boolean isSelect
= jniStmt
.isSelect();
56 rowsAffect
= jniStmt
.execute();
58 throw getException(CSQL_EXECUTE_ERR
);
59 if(conn
.getAutoCommit())
65 public void close() throws SQLException
77 public boolean execute (String query
) throws SQLException
83 public ResultSet
executeQuery(String query
) throws SQLException
86 throw getException(CSQL_NOT_QUERY
);
89 public int executeUpdate (String query
) throws SQLException
92 throw getException(CSQL_NOT_UPDATE
);
95 public Connection
getConnection() throws SQLException
99 public int getFetchDirection() throws SQLException
101 return(ResultSet
.FETCH_FORWARD
);
103 public int getFetchSize() throws SQLException
107 public ResultSet
getResultSet() throws SQLException
109 if(!jniStmt
.isSelect())
112 //TODO::Create ResultSet object
115 public int getResultSetConcurrency() throws SQLException
117 return(ResultSet
.CONCUR_READ_ONLY
);
119 public int getResultSetHoldability() throws SQLException
121 return(ResultSet
.CLOSE_CURSORS_AT_COMMIT
);
123 public int getResultSetType() throws SQLException
125 return(ResultSet
.TYPE_FORWARD_ONLY
);
127 public int getUpdateCount() throws SQLException
129 if(jniStmt
.isSelect())
136 public void addBatch(String sql
) throws SQLException
138 throw getException(CSQL_NOT_SUPPORTED
);
140 public void cancel() throws SQLException
142 throw getException(CSQL_NOT_SUPPORTED
);
144 public void clearBatch() throws SQLException
146 throw getException(CSQL_NOT_SUPPORTED
);
148 public void clearWarnings() throws SQLException
150 throw getException(CSQL_NOT_SUPPORTED
);
152 public boolean execute(String sql
, int autoGeneratedKeys
) throws SQLException
154 throw getException(CSQL_NOT_SUPPORTED
);
156 public boolean execute(String sql
, int[] columnIndexes
) throws SQLException
158 throw getException(CSQL_NOT_SUPPORTED
);
160 public boolean execute(String sql
, String
[] columnNames
) throws SQLException
162 throw getException(CSQL_NOT_SUPPORTED
);
164 public int[] executeBatch() throws SQLException
166 throw getException(CSQL_NOT_SUPPORTED
);
168 public int executeUpdate(String sql
, int autoGeneratedKeys
) throws SQLException
170 throw getException(CSQL_NOT_SUPPORTED
);
172 public int executeUpdate(String sql
, int[] columnIndexes
) throws SQLException
174 throw getException(CSQL_NOT_SUPPORTED
);
176 public int executeUpdate(String sql
, String
[] columnNames
) throws SQLException
178 throw getException(CSQL_NOT_SUPPORTED
);
180 public ResultSet
getGeneratedKeys() throws SQLException
182 throw getException(CSQL_NOT_SUPPORTED
);
184 public int getMaxFieldSize() throws SQLException
186 throw getException(CSQL_NOT_SUPPORTED
);
188 public int getMaxRows() throws SQLException
190 throw getException(CSQL_NOT_SUPPORTED
);
192 public boolean getMoreResults() throws SQLException
194 throw getException(CSQL_NOT_SUPPORTED
);
196 public boolean getMoreResults( int current
) throws SQLException
198 throw getException(CSQL_NOT_SUPPORTED
);
200 public int getQueryTimeout() throws SQLException
202 throw getException(CSQL_NOT_SUPPORTED
);
204 public SQLWarning
getWarnings() throws SQLException
206 throw getException(CSQL_NOT_SUPPORTED
);
208 public void setCursorName(String name
) throws SQLException
210 throw getException(CSQL_NOT_SUPPORTED
);
212 public void setEscapeProcessing(boolean enable
) throws SQLException
214 throw getException(CSQL_NOT_SUPPORTED
);
216 public void setFetchDirection(int direction
) throws SQLException
218 throw getException(CSQL_NOT_SUPPORTED
);
220 public void setFetchSize(int rows
) throws SQLException
222 throw getException(CSQL_NOT_SUPPORTED
);
224 public void setMaxFieldSize(int max
) throws SQLException
226 throw getException(CSQL_NOT_SUPPORTED
);
228 public void setMaxRows(int maxRows
) throws SQLException
230 throw getException(CSQL_NOT_SUPPORTED
);
232 public void setQueryTimeout(int seconds
) throws SQLException
234 throw getException(CSQL_NOT_SUPPORTED
);