--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.tools.ij.ijStatementResult\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.tools.ij;\r
+\r
+import java.sql.Connection;\r
+import java.sql.ResultSet;\r
+import java.sql.Statement;\r
+import java.sql.SQLException;\r
+import java.sql.SQLWarning;\r
+\r
+/**\r
+ * This is an impl for a statement execution; the result\r
+ * is either an update count or result set depending\r
+ * on what was executed.\r
+ *\r
+ */\r
+class ijStatementResult extends ijResultImpl {\r
+\r
+ Statement statement;\r
+ boolean closeWhenDone;\r
+\r
+ ijStatementResult(Statement s, boolean c) {\r
+ statement = s;\r
+ closeWhenDone = c;\r
+ }\r
+\r
+ public boolean isStatement() { return true; }\r
+ public boolean isResultSet() throws SQLException { return statement.getUpdateCount() == -1; }\r
+ public boolean isUpdateCount() throws SQLException { return statement.getUpdateCount() >= 0; }\r
+\r
+ public Statement getStatement() { return statement; }\r
+ public int getUpdateCount() throws SQLException { return statement.getUpdateCount(); }\r
+ public ResultSet getResultSet() throws SQLException { return statement.getResultSet(); }\r
+\r
+ public void closeStatement() throws SQLException { if (closeWhenDone) statement.close(); }\r
+\r
+ public SQLWarning getSQLWarnings() throws SQLException { return statement.getWarnings(); }\r
+ public void clearSQLWarnings() throws SQLException { statement.clearWarnings(); }\r
+}\r