001: /*
002: Copyright (C) 2007 MySQL AB
003:
004: This program is free software; you can redistribute it and/or modify
005: it under the terms of version 2 of the GNU General Public License as
006: published by the Free Software Foundation.
007:
008: There are special exceptions to the terms and conditions of the GPL
009: as it is applied to this software. View the full text of the
010: exception in file EXCEPTIONS-CONNECTOR-J in the directory of this
011: software distribution.
012:
013: This program is distributed in the hope that it will be useful,
014: but WITHOUT ANY WARRANTY; without even the implied warranty of
015: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
016: GNU General Public License for more details.
017:
018: You should have received a copy of the GNU General Public License
019: along with this program; if not, write to the Free Software
020: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
021:
022: */
023:
024: package com.mysql.jdbc;
025:
026: import java.sql.SQLException;
027: import java.util.HashMap;
028: import java.util.Map;
029: import java.util.TreeMap;
030:
031: import com.mysql.jdbc.profiler.ProfileEventSink;
032: import com.mysql.jdbc.profiler.ProfilerEvent;
033:
034: /**
035: * This interface is intended to be used by implementors of statement
036: * interceptors so that implementors can create static or dynamic (via
037: * java.lang.reflect.Proxy) proxy instances of ResultSets. It consists
038: * of methods outside of java.sql.Result that are used internally by
039: * other classes in the driver.
040: *
041: * This interface, although public is <strong>not</strong> designed to
042: * be consumed publicly other than for the statement interceptor use case.
043: *
044: * @version $Id: $
045: */
046: public interface ResultSetInternalMethods extends java.sql.ResultSet {
047:
048: /**
049: * Returns a new instance of this result set, that shares the
050: * underlying row data.
051: */
052: public abstract ResultSetInternalMethods copy() throws SQLException;
053:
054: /**
055: * Does the result set contain rows, or is it the result of a DDL or DML
056: * statement?
057: */
058: public abstract boolean reallyResult();
059:
060: /**
061: * Functions like ResultSet.getObject(), but using the given SQL type
062: * (as registered during CallableStatement.registerOutParameter()).
063: */
064: public abstract Object getObjectStoredProc(int columnIndex,
065: int desiredSqlType) throws SQLException;
066:
067: /**
068: * Functions like ResultSet.getObject(), but using the given SQL type
069: * (as registered during CallableStatement.registerOutParameter()).
070: */
071: public abstract Object getObjectStoredProc(int i,
072: java.util.Map map, int desiredSqlType) throws SQLException;
073:
074: /**
075: * Functions like ResultSet.getObject(), but using the given SQL type
076: * (as registered during CallableStatement.registerOutParameter()).
077: */
078: public abstract Object getObjectStoredProc(String columnName,
079: int desiredSqlType) throws SQLException;
080:
081: /**
082: * Functions like ResultSet.getObject(), but using the given SQL type
083: * (as registered during CallableStatement.registerOutParameter()).
084: */
085: public abstract Object getObjectStoredProc(String colName,
086: java.util.Map map, int desiredSqlType) throws SQLException;
087:
088: /**
089: * Returns the server informational message returned from a DDL or DML
090: * statement (if any), or null if none.
091: */
092: public String getServerInfo();
093:
094: /**
095: * Returns the update count for this result set (if one exists), otherwise
096: * -1.
097: *
098: * @ return the update count for this result set (if one exists), otherwise
099: * -1.
100: */
101: public long getUpdateCount();
102:
103: /**
104: * Returns the AUTO_INCREMENT value for the DDL/DML statement which created
105: * this result set.
106: *
107: * @return the AUTO_INCREMENT value for the DDL/DML statement which created
108: * this result set.
109: */
110: public long getUpdateID();
111:
112: /**
113: * Closes this ResultSet and releases resources.
114: *
115: * @param calledExplicitly was realClose called by the standard
116: * ResultSet.close() method, or was it closed internally by the driver?
117: */
118: public void realClose(boolean calledExplicitly) throws SQLException;
119:
120: /**
121: * Sets the first character of the query that was issued to create
122: * this result set. The character should be upper-cased.
123: */
124: public void setFirstCharOfQuery(char firstCharUpperCase);
125:
126: /**
127: * Sets the statement that "owns" this result set (usually used when the
128: * result set should internally "belong" to one statement, but is created
129: * by another.
130: */
131: public void setOwningStatement(
132: com.mysql.jdbc.StatementImpl owningStatement);
133:
134: /**
135: * Returns the first character of the query that was issued to create this
136: * result set, upper-cased.
137: */
138: public char getFirstCharOfQuery();
139:
140: /**
141: * Clears the reference to the next result set in a multi-result set
142: * "chain".
143: */
144: public void clearNextResult();
145:
146: /**
147: * Returns the next ResultSet in a multi-resultset "chain", if any,
148: * null if none exists.
149: */
150: public ResultSetInternalMethods getNextResultSet();
151:
152: public void setStatementUsedForFetchingRows(PreparedStatement stmt);
153:
154: /**
155: * @param wrapperStatement
156: * The wrapperStatement to set.
157: */
158: public void setWrapperStatement(java.sql.Statement wrapperStatement);
159:
160: /**
161: * Builds a hash between column names and their indices for fast retrieval.
162: * This is done lazily to support findColumn() and get*(String), as it
163: * can be more expensive than just retrieving result set values by ordinal
164: * index.
165: */
166: public void buildIndexMapping() throws SQLException;
167:
168: public void initializeWithMetadata() throws SQLException;
169:
170: /**
171: * Used by DatabaseMetadata implementations to coerce the metadata returned
172: * by metadata queries into that required by the JDBC specification.
173: *
174: * @param metadataFields the coerced metadata to be applied to result sets
175: * returned by "SHOW ..." or SELECTs on INFORMATION_SCHEMA performed on behalf
176: * of methods in DatabaseMetadata.
177: */
178: public void redefineFieldsForDBMD(Field[] metadataFields);
179:
180: public void populateCachedMetaData(
181: CachedResultSetMetaData cachedMetaData) throws SQLException;
182:
183: public void initializeFromCachedMetaData(
184: CachedResultSetMetaData cachedMetaData);
185:
186: }
|