jdbcresultset.java
来自「一个可以在applet窗体上持行sql语句并显示返回结果的程序」· Java 代码 · 共 1,814 行 · 第 1/5 页
JAVA
1,814 行
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Moves the cursor to the insert row. The current cursor position is
* remembered while the cursor is positioned on the insert row.
*
* The insert row is a special row associated with an updatable
* result set. It is essentially a buffer where a new row may
* be constructed by calling the <code>updateXXX</code> methods prior to
* inserting the row into the result set.
*
* Only the <code>updateXXX</code>, <code>getXXX</code>,
* and <code>insertRow</code> methods may be
* called when the cursor is on the insert row. All of the columns in
* a result set must be given a value each time this method is
* called before calling <code>insertRow</code>.
* The method <code>updateXXX</code> must be called before a
* <code>getXXX</code> method can be called on a column value.
*
* @exception SQLException if a database access error occurs
* or the result set is not updatable
*/
//#ifdef JAVA2
public void moveToInsertRow() throws SQLException {
if(Trace.TRACE) Trace.trace();
throw Trace.error(Trace.FUNCTION_NOT_SUPPORTED);
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Moves the cursor to the remembered cursor position, usually the
* current row. This method has no effect if the cursor is not on the insert
* row.
*
* @exception SQLException if a database access error occurs
* or the result set is not updatable
*/
//#ifdef JAVA2
public void moveToCurrentRow() throws SQLException {
if(Trace.TRACE) Trace.trace();
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Returns the Statement that produced this <code>ResultSet</code> object.
* If the result set was generated some other way, such as by a
* <code>DatabaseMetaData</code> method, this method returns <code>null</code>.
*
* @return the Statment that produced the result set or
* null if the result set was produced some other way
* @exception SQLException if a database access error occurs
*/
//#ifdef JAVA2
public Statement getStatement() throws SQLException {
if(Trace.TRACE) Trace.trace();
// todo
return null;
}
//#endif
/**
* JDBC 2.0
*
* Returns the value of a column in the current row as a Java object.
* This method uses the given <code>Map</code> object
* for the custom mapping of the
* SQL structured or distinct type that is being retrieved.
*
* @param i the first column is 1, the second is 2, ...
* @param map the mapping from SQL type names to Java classes
* @return an object representing the SQL value
*/
//#ifdef JAVA2
public Object getObject(int column,Map map) throws SQLException {
return getObject(column);
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets a REF(<structured-type>) column value from the current row.
*
* @param i the first column is 1, the second is 2, ...
* @return a <code>Ref</code> object representing an SQL REF value
*/
//#ifdef JAVA2
public Ref getRef(int column) throws SQLException {
if(Trace.TRACE) Trace.trace();
throw Trace.error(Trace.FUNCTION_NOT_SUPPORTED);
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets a BLOB value in the current row of this <code>ResultSet</code> object.
*
* @param i the first column is 1, the second is 2, ...
* @return a <code>Blob</code> object representing the SQL BLOB value in
* the specified column
*/
//#ifdef JAVA2
public Blob getBlob(int column) throws SQLException {
if(Trace.TRACE) Trace.trace();
throw Trace.error(Trace.FUNCTION_NOT_SUPPORTED);
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets a CLOB value in the current row of this <code>ResultSet</code> object.
*
* @param i the first column is 1, the second is 2, ...
* @return a <code>Clob</code> object representing the SQL CLOB value in
* the specified column
*/
//#ifdef JAVA2
public Clob getClob(int column) throws SQLException {
if(Trace.TRACE) Trace.trace();
throw Trace.error(Trace.FUNCTION_NOT_SUPPORTED);
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets an SQL ARRAY value from the current row of this
* <code>ResultSet</code> object.
*
* @param i the first column is 1, the second is 2, ...
* @return an <code>Array</code> object representing the SQL ARRAY value in
* the specified column
*/
//#ifdef JAVA2
public Array getArray(int column) throws SQLException {
if(Trace.TRACE) Trace.trace();
throw Trace.error(Trace.FUNCTION_NOT_SUPPORTED);
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Returns the value in the specified column as a Java object.
* This method uses the specified <code>Map</code> object for
* custom mapping if appropriate.
*
* @param colName the name of the column from which to retrieve the value
* @param map the mapping from SQL type names to Java classes
* @return an object representing the SQL value in the specified column
*/
//#ifdef JAVA2
public Object getObject(String columnName,Map map) throws SQLException {
return getObject(findColumn(columnName),map);
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets a REF(<structured-type>) column value from the current row.
*
* @param colName the column name
* @return a <code>Ref</code> object representing the SQL REF value in
* the specified column
*/
//#ifdef JAVA2
public Ref getRef(String columnName) throws SQLException {
return getRef(findColumn(columnName));
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets a BLOB value in the current row of this <code>ResultSet</code> object.
*
* @param colName the name of the column from which to retrieve the value
* @return a <code>Blob</code> object representing the SQL BLOB value in
* the specified column
*/
//#ifdef JAVA2
public Blob getBlob(String columnName) throws SQLException {
return getBlob(findColumn(columnName));
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets a CLOB value in the current row of this <code>ResultSet</code> object.
*
* @param colName the name of the column from which to retrieve the value
* @return a <code>Clob</code> object representing the SQL CLOB value in
* the specified column
*/
//#ifdef JAVA2
public Clob getClob(String columnName) throws SQLException {
return getClob(findColumn(columnName));
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets an SQL ARRAY value in the current row of this <code>ResultSet</code>
* object.
*
* @param colName the name of the column from which to retrieve the value
* @return an <code>Array</code> object representing the SQL ARRAY value in
* the specified column
*/
//#ifdef JAVA2
public Array getArray(String columnName) throws SQLException {
return getArray(findColumn(columnName));
}
//#endif JAVA2
/**
* JDBC 2.0
*
* Gets the value of a column in the current row as a java.sql.Date
* object. This method uses the given calendar to construct an appropriate
* millisecond
* value for the Date if the underlying database does not store
* timezone information.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param cal the calendar to use in constructing the date
* @return the column value; if the value is SQL NULL, the result is null
* @exception SQLException if a database access error occurs
*/
//#ifdef JAVA2
public java.sql.Date getDate(int column,Calendar cal) throws SQLException {
return getDate(column);
}
//#endif JAVA2
/**
* Gets the value of a column in the current row as a java.sql.Date
* object. This method uses the given calendar to construct an appropriate
* millisecond
* value for the Date, if the underlying database does not store
* timezone information.
*
* @param columnName the SQL name of the column from which to retrieve the
* value
* @param cal the calendar to use in constructing the date
* @return the column value; if the value is SQL NULL, the result is null
* @exception SQLException if a database access error occurs
*/
//#ifdef JAVA2
public java.sql.Date getDate(String columnName,Calendar cal)
throws SQLException {
return getDate(findColumn(columnName));
}
//#endif JAVA2
/**
* Gets the value of a column in the current row as a java.sql.Time
* object. This method uses the given calendar to construct an appropriate
* millisecond
* value for the Time if the underlying database does not store
* timezone information.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param cal the calendar to use in constructing the time
* @return the column value; if the value is SQL NULL, the result is null
* @exception SQLException if a database access error occurs
*/
//#ifdef JAVA2
public Time getTime(int column,Calendar cal) throws SQLException {
return getTime(column);
}
//#endif JAVA2
/**
* Gets the value of a column in the current row as a java.sql.Time
* object. This method uses the given calendar to construct an appropriate
* millisecond
* value for the Time if the underlying database does not store
* timezone information.
*
* @param columnName the SQL name of the column
* @param cal the calendar to use in constructing the time
* @return the column value; if the value is SQL NULL, the result is null
* @exception SQLException if a database access error occurs
*/
//#ifdef JAVA2
public Time getTime(String columnName,Calendar cal) throws SQLException {
return getTime(findColumn(columnName));
}
//#endif JAVA2
/**
* Gets the value of a column in the current row as a java.sql.Timestamp
* object. This method uses the given calendar to construct an appropriate
* millisecond
* value for the Timestamp if the underlying database does not store
* timezone information.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param cal the calendar to use in constructing the timestamp
* @return the column value; if the value is SQL NULL, the result is null
* @exception SQLException if a database access error occurs
*/
//#ifdef JAVA2
public Timestamp getTimestamp(int column,Calendar cal) throws SQLException {
return getTimestamp(column);
}
//#endif JAVA2
/**
* Gets the value of a column in the current row as a java.sql.Timestamp
* object. This method uses the given calendar to construct an appropriate
* millisecond
* value for the Timestamp if the underlying database does not store
* timezone information.
*
* @param columnName the SQL name of the column
* @param cal the calendar to use in constructing the timestamp
* @return the column value; if the value is SQL NULL, the result is null
* @exception SQLException if a database access error occurs
*/
//#ifdef JAVA2
public Timestamp getTimestamp(String columnName,Calendar cal)
throws SQLException {
return getTimestamp(findColumn(columnName));
}
//#endif JAVA2
/**
* JDBC 2.0
*
* <p>Gets the value of a column in the current row as a java.io.Reader.
* @param columnIndex the first column is 1, the second is 2, ...
*/
//#ifdef JAVA2
public Reader getCharacterStream(int column) throws SQLException {
if(Trace.TRACE) Trace.trace();
throw Trace.error(Trace.FUNCTION_NOT_SUPPORTED);
}
//#endif JAVA2
jdbcResultSet(Result r) throws SQLException {
if(r.iMode==Result.UPDATECOUNT) {
iUpdateCount=r.iUpdateCount;
} else if(r.iMode==Result.ERROR) {
throw Trace.getError(r.sError);
} else {
iUpdateCount=-1;
rResult=r;
iColumnCount=r.getColumnCount();
}
bWasNull=false;
}
int getUpdateCount() {
return iUpdateCount;
}
boolean isResult() {
return rResult==null?false:true;
}
private void checkColumn(int column) throws SQLException {
if(column<0 || column>=iColumnCount) {
Trace.error(Trace.COLUMN_NOT_FOUND,column);
}
}
private void checkAvailable() throws SQLException {
if(rResult==null || !bInit || nCurrent==null) {
Trace.error(Trace.NO_DATA_IS_AVAILABLE);
}
}
private Object getColumnInType(int col
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?