提交 3ac7cad3 authored 作者: Thomas Mueller's avatar Thomas Mueller

catch Exception instead of Throwable

上级 f031fa50
......@@ -55,7 +55,7 @@ public class Driver implements java.sql.Driver {
return null;
}
return new JdbcConnection(url, info);
} catch (Throwable e) {
} catch (Exception e) {
throw Message.convert(e);
}
}
......
......@@ -42,13 +42,14 @@ public class JdbcArray extends TraceObject implements Array {
* This method always returns an Object[].
*
* @return the Object array
* @throws SQLException
*/
public Object getArray() throws SQLException {
try {
debugCodeCall("getArray");
checkClosed();
return get();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -59,6 +60,7 @@ public class JdbcArray extends TraceObject implements Array {
*
* @param map is ignored. Only empty or null maps are supported
* @return the Object array
* @throws SQLException
*/
public Object getArray(Map map) throws SQLException {
try {
......@@ -66,7 +68,7 @@ public class JdbcArray extends TraceObject implements Array {
checkMap(map);
checkClosed();
return get();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -79,13 +81,14 @@ public class JdbcArray extends TraceObject implements Array {
* @param index the start index of the subset (starting with 1)
* @param count the maximum number of values
* @return the Object array
* @throws SQLException
*/
public Object getArray(long index, int count) throws SQLException {
try {
debugCode("getArray(" + index + ", " + count + ");");
checkClosed();
return get(index, count);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -99,6 +102,7 @@ public class JdbcArray extends TraceObject implements Array {
* @param count the maximum number of values
* @param map is ignored. Only empty or null maps are supported
* @return the Object array
* @throws SQLException
*/
public Object getArray(long index, int count, Map map) throws SQLException {
try {
......@@ -106,7 +110,7 @@ public class JdbcArray extends TraceObject implements Array {
checkClosed();
checkMap(map);
return get(index, count);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -116,13 +120,14 @@ public class JdbcArray extends TraceObject implements Array {
* arrays and therefore there is no base type.
*
* @return Types.NULL
* @throws SQLException
*/
public int getBaseType() throws SQLException {
try {
debugCodeCall("getBaseType");
checkClosed();
return Types.NULL;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -132,13 +137,14 @@ public class JdbcArray extends TraceObject implements Array {
* type arrays and therefore there is no base type.
*
* @return "NULL"
* @throws SQLException
*/
public String getBaseTypeName() throws SQLException {
try {
debugCodeCall("getBaseTypeName");
checkClosed();
return "NULL";
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -149,13 +155,14 @@ public class JdbcArray extends TraceObject implements Array {
* (starting with 1) and the second column the value.
*
* @return the result set
* @throws SQLException
*/
public ResultSet getResultSet() throws SQLException {
try {
debugCodeCall("getResultSet");
checkClosed();
return getResultSet(get(), 0);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -166,6 +173,7 @@ public class JdbcArray extends TraceObject implements Array {
*
* @param map is ignored. Only empty or null maps are supported
* @return the result set
* @throws SQLException
*/
public ResultSet getResultSet(Map map) throws SQLException {
try {
......@@ -173,7 +181,7 @@ public class JdbcArray extends TraceObject implements Array {
checkClosed();
checkMap(map);
return getResultSet(get(), 0);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -187,13 +195,14 @@ public class JdbcArray extends TraceObject implements Array {
* @param index the start index of the subset (starting with 1)
* @param count the maximum number of values
* @return the result set
* @throws SQLException
*/
public ResultSet getResultSet(long index, int count) throws SQLException {
try {
debugCode("getResultSet("+index+", " + count+");");
checkClosed();
return getResultSet(get(index, count), index);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -209,6 +218,7 @@ public class JdbcArray extends TraceObject implements Array {
* @param count the maximum number of values
* @param map is ignored. Only empty or null maps are supported
* @return the result set
* @throws SQLException
*/
public ResultSet getResultSet(long index, int count, Map map) throws SQLException {
try {
......@@ -216,7 +226,7 @@ public class JdbcArray extends TraceObject implements Array {
checkClosed();
checkMap(map);
return getResultSet(get(index, count), index);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......
......@@ -6,6 +6,7 @@
*/
package org.h2.jdbc;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
......@@ -41,6 +42,7 @@ public class JdbcBlob extends TraceObject implements Blob {
* Returns the length.
*
* @return the length
* @throws SQLException
*/
public long length() throws SQLException {
try {
......@@ -67,7 +69,7 @@ public class JdbcBlob extends TraceObject implements Blob {
in.close();
}
return size;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -76,6 +78,7 @@ public class JdbcBlob extends TraceObject implements Blob {
* [Not supported] Truncates the object.
*
* @param len the new length
* @throws SQLException
*/
public void truncate(long len) throws SQLException {
debugCodeCall("truncate", len);
......@@ -88,6 +91,7 @@ public class JdbcBlob extends TraceObject implements Blob {
* @param pos the index, the first byte is at position 1
* @param length the number of bytes
* @return the bytes, at most length bytes
* @throws SQLException
*/
public byte[] getBytes(long pos, int length) throws SQLException {
try {
......@@ -109,13 +113,18 @@ public class JdbcBlob extends TraceObject implements Blob {
in.close();
}
return out.toByteArray();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
/**
* [Not supported] Sets some bytes of the object.
*
* @param pos the write position
* @param bytes the bytes to set
* @return how many bytes have been written
* @throws SQLException
*/
public int setBytes(long pos, byte[] bytes) throws SQLException {
debugCode("setBytes("+pos+", bytes);");
......@@ -124,6 +133,13 @@ public class JdbcBlob extends TraceObject implements Blob {
/**
* [Not supported] Sets some bytes of the object.
*
* @param pos the write position
* @param bytes the bytes to set
* @param offset the bytes offset
* @param len the number of bytes to write
* @return how many bytes have been written
* @throws SQLException
*/
public int setBytes(long pos, byte[] bytes, int offset, int len) throws SQLException {
debugCode("setBytes("+pos+", bytes, "+offset+", "+len+");");
......@@ -134,19 +150,24 @@ public class JdbcBlob extends TraceObject implements Blob {
* Returns the input stream.
*
* @return the input stream
* @throws SQLException
*/
public InputStream getBinaryStream() throws SQLException {
try {
debugCodeCall("getBinaryStream");
checkClosed();
return value.getInputStream();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
/**
* [Not supported] Returns an output stream.
*
* @param pos where to start writing
* @return the output stream to write into
* @throws SQLException
*/
public OutputStream setBinaryStream(long pos) throws SQLException {
debugCodeCall("setBinaryStream", pos);
......@@ -159,50 +180,51 @@ public class JdbcBlob extends TraceObject implements Blob {
* @param pattern the pattern to search
* @param start the index, the first byte is at position 1
* @return the position (first byte is at position 1), or -1 for not found
* @throws SQLException
*/
public long position(byte[] pattern, long start) throws SQLException {
debugCode("position(pattern, "+start+");");
if (false) {
try {
debugCode("position(pattern, " + start + ");");
if (pattern == null) {
return -1;
}
if (pattern.length == 0) {
return 1;
}
// TODO performance: blob pattern search is slow
BufferedInputStream in = new BufferedInputStream(value.getInputStream());
IOUtils.skipFully(in, start - 1);
int pos = 0;
int patternPos = 0;
while (true) {
int x = in.read();
if (x < 0) {
break;
}
if (x == (pattern[patternPos] & 0xff)) {
if (patternPos == 0) {
in.mark(pattern.length);
}
if (patternPos == pattern.length) {
return pos - patternPos;
}
patternPos++;
} else {
if (patternPos > 0) {
in.reset();
pos -= patternPos;
}
}
pos++;
}
return -1;
} catch (Exception e) {
throw logAndConvert(e);
}
}
throw Message.getUnsupportedException();
// TODO test
// try {
// debugCode("position(pattern, "+start+");");
// if(pattern == null) {
// return -1;
// }
// if(pattern.length == 0) {
// return 1;
// }
// // TODO performance: blob pattern search is slow
// BufferedInputStream in =
// new BufferedInputStream(value.getInputStream());
// IOUtils.skipFully(in, start - 1);
// int pos = 0;
// int patternPos = 0;
// while(true) {
// int x = in.read();
// if(x<0) {
// break;
// }
// if(x == (pattern[patternPos] & 0xff)) {
// if(patternPos == 0) {
// in.mark(pattern.length);
// }
// if(patternPos == pattern.length) {
// return pos - patternPos;
// }
// patternPos++;
// } else {
// if(patternPos > 0) {
// in.reset();
// pos -= patternPos;
// }
// }
// pos++;
// }
// return -1;
// } catch(Throwable e) {
// throw logAndConvert(e);
// }
}
/**
......@@ -211,31 +233,33 @@ public class JdbcBlob extends TraceObject implements Blob {
* @param blobPattern the pattern to search
* @param start the index, the first byte is at position 1
* @return the position (first byte is at position 1), or -1 for not found
* @throws SQLException
*/
public long position(Blob blobPattern, long start) throws SQLException {
debugCode("position(blobPattern, "+start+");");
throw Message.getUnsupportedException();
// try {
// debugCode("position(blobPattern, "+start+");");
// if(blobPattern == null) {
// return -1;
// }
// ByteArrayOutputStream out = new ByteArrayOutputStream();
// InputStream in = blobPattern.getBinaryStream();
// while(true) {
// int x = in.read();
// if(x < 0) {
// break;
// }
// out.write(x);
// }
// return position(out.toByteArray(), start);
// } catch(Throwable e) {
// throw logAndConvert(e);
// }
debugCode("position(blobPattern, "+start+");");
if (false) {
try {
debugCode("position(blobPattern, " + start + ");");
if (blobPattern == null) {
return -1;
}
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream in = blobPattern.getBinaryStream();
while (true) {
int x = in.read();
if (x < 0) {
break;
}
out.write(x);
}
return position(out.toByteArray(), start);
} catch (Exception e) {
throw logAndConvert(e);
}
}
throw Message.getUnsupportedException();
}
/**
* Release all resources of this object.
*/
......@@ -246,6 +270,11 @@ public class JdbcBlob extends TraceObject implements Blob {
/**
* [Not supported] Returns the input stream, starting from an offset.
*
* @param pos where to start reading
* @param length the number of bytes that will be read
* @return the input stream to read
* @throws SQLException
*/
public InputStream getBinaryStream(long pos, long length) throws SQLException {
debugCode("getBinaryStream("+pos+", "+length+");");
......
......@@ -27,7 +27,6 @@ import java.sql.Timestamp;
import java.util.Calendar;
import java.util.Map;
import org.h2.engine.SessionInterface;
import org.h2.message.Message;
import org.h2.message.TraceObject;
......@@ -37,8 +36,9 @@ import org.h2.message.TraceObject;
*/
public class JdbcCallableStatement extends JdbcPreparedStatement implements CallableStatement {
JdbcCallableStatement(SessionInterface session, JdbcConnection conn, String sql, int resultSetType, int id) throws SQLException {
super(session, conn, sql, resultSetType, id, false);
JdbcCallableStatement(JdbcConnection conn, String sql, int resultSetType, int id)
throws SQLException {
super(conn, sql, resultSetType, id, false);
setTrace(session.getTrace(), TraceObject.CALLABLE_STATEMENT, id);
}
......
......@@ -76,7 +76,7 @@ public class JdbcClob extends TraceObject implements Clob
} finally {
in.close();
}
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -100,7 +100,7 @@ public class JdbcClob extends TraceObject implements Clob
checkClosed();
String s = value.getString();
return IOUtils.getInputStream(s);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -123,7 +123,7 @@ public class JdbcClob extends TraceObject implements Clob
debugCodeCall("getCharacterStream");
checkClosed();
return value.getReader();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -168,7 +168,7 @@ public class JdbcClob extends TraceObject implements Clob
reader.close();
}
return buff.toString();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......
......@@ -159,7 +159,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(4 + i, types[i]);
}
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -241,7 +241,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(3, getPattern(tableNamePattern));
prep.setString(4, getPattern(columnNamePattern));
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -319,7 +319,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName);
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -369,7 +369,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName);
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -403,7 +403,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
try {
debugCodeCall("getURL");
return conn.getURL();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -418,7 +418,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
try {
debugCodeCall("getUserName");
return conn.getUser();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -432,7 +432,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
try {
debugCodeCall("isReadOnly");
return conn.isReadOnly();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -538,7 +538,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(procedureNamePattern));
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -600,7 +600,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(3, getPattern(procedureNamePattern));
prep.setString(4, getPattern(columnNamePattern));
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -630,7 +630,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.SCHEMATA "
+ "ORDER BY SCHEMA_NAME");
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -654,7 +654,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
"SELECT CATALOG_NAME TABLE_CAT "
+ "FROM INFORMATION_SCHEMA.CATALOGS");
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -680,7 +680,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.TABLE_TYPES "
+ "ORDER BY TABLE_TYPE");
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -742,7 +742,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(3, table);
prep.setString(4, getPattern(columnNamePattern));
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -797,7 +797,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schemaPattern));
prep.setString(3, getPattern(tableNamePattern));
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -862,7 +862,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(4, getSchemaPattern(schema));
prep.setString(5, tableName);
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -909,7 +909,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.COLUMNS "
+ "WHERE FALSE");
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -978,7 +978,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName);
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -1048,7 +1048,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(2, getSchemaPattern(schema));
prep.setString(3, tableName);
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -1134,7 +1134,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
prep.setString(5, getSchemaPattern(foreignSchema));
prep.setString(6, foreignTable);
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -1182,7 +1182,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.CATALOGS "
+ "WHERE FALSE");
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -1244,7 +1244,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "ORDER BY DATA_TYPE, POS");
ResultSet rs = prep.executeQuery();
return rs;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -1356,7 +1356,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
rs.close();
prep.close();
return buff.toString();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -2463,7 +2463,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+quote(typeNamePattern)+");");
}
throw Message.getUnsupportedException();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -2499,7 +2499,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+ "FROM INFORMATION_SCHEMA.CATALOGS "
+ "WHERE FALSE");
return prep.executeQuery();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -2519,7 +2519,7 @@ public class JdbcDatabaseMetaData extends TraceObject implements DatabaseMetaDat
+quote(attributeNamePattern)+");");
}
throw Message.getUnsupportedException();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......
......@@ -49,7 +49,7 @@ implements ParameterMetaData
debugCodeCall("getParameterCount");
checkClosed();
return paramCount;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -67,7 +67,7 @@ implements ParameterMetaData
debugCodeCall("getParameterMode", param);
getParameter(param);
return parameterModeIn;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -89,7 +89,7 @@ implements ParameterMetaData
type = Value.STRING;
}
return DataType.getDataType(type).sqlType;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -106,7 +106,7 @@ implements ParameterMetaData
debugCodeCall("getPrecision", param);
ParameterInterface p = getParameter(param);
return MathUtils.convertLongToInt(p.getPrecision());
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -123,7 +123,7 @@ implements ParameterMetaData
debugCodeCall("getScale", param);
ParameterInterface p = getParameter(param);
return p.getScale();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -139,7 +139,7 @@ implements ParameterMetaData
try {
debugCodeCall("isNullable", param);
return getParameter(param).getNullable();
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -156,7 +156,7 @@ implements ParameterMetaData
debugCodeCall("isSigned", param);
getParameter(param);
return true;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -177,7 +177,7 @@ implements ParameterMetaData
type = Value.STRING;
}
return DataType.getTypeClassName(type);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -198,7 +198,7 @@ implements ParameterMetaData
type = Value.STRING;
}
return DataType.getDataType(type).name;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......
......@@ -27,7 +27,8 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
private final ResultInterface result;
private final int columnCount;
JdbcResultSetMetaData(JdbcResultSet rs, JdbcPreparedStatement prep, ResultInterface result, String catalog, Trace trace, int id) {
JdbcResultSetMetaData(JdbcResultSet rs, JdbcPreparedStatement prep, ResultInterface result,
String catalog, Trace trace, int id) {
setTrace(trace, TraceObject.RESULT_SET_META_DATA, id);
this.catalog = catalog;
this.rs = rs;
......@@ -47,7 +48,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnCount");
checkClosed();
return columnCount;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -64,7 +65,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnLabel", column);
checkColumnIndex(column);
return result.getAlias(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -81,7 +82,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnName", column);
checkColumnIndex(column);
return result.getColumnName(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -99,7 +100,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column);
int type = result.getColumnType(--column);
return DataType.convertTypeToSQLType(type);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -117,7 +118,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column);
int type = result.getColumnType(--column);
return DataType.getDataType(type).name;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -134,7 +135,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getSchemaName", column);
checkColumnIndex(column);
return result.getSchemaName(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -151,7 +152,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getTableName", column);
checkColumnIndex(column);
return result.getTableName(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -168,7 +169,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getCatalogName", column);
checkColumnIndex(column);
return catalog;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -186,7 +187,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isAutoIncrement", column);
checkColumnIndex(column);
return result.isAutoIncrement(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -204,7 +205,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isCaseSensitive", column);
checkColumnIndex(column);
return true;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -222,7 +223,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isSearchable", column);
checkColumnIndex(column);
return true;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -240,7 +241,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isCurrency", column);
checkColumnIndex(column);
return false;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -261,7 +262,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isNullable", column);
checkColumnIndex(column);
return result.getNullable(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -279,7 +280,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isSigned", column);
checkColumnIndex(column);
return true;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -297,7 +298,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isReadOnly", column);
checkColumnIndex(column);
return false;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -315,7 +316,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isWritable", column);
checkColumnIndex(column);
return true;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -333,7 +334,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("isDefinitelyWritable", column);
checkColumnIndex(column);
return false;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -352,7 +353,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column);
int type = result.getColumnType(--column);
return DataType.getTypeClassName(type);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -371,7 +372,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
checkColumnIndex(column);
long prec = result.getColumnPrecision(--column);
return MathUtils.convertLongToInt(prec);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -389,7 +390,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getScale", column);
checkColumnIndex(column);
return result.getColumnScale(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -406,7 +407,7 @@ public class JdbcResultSetMetaData extends TraceObject implements ResultSetMetaD
debugCodeCall("getColumnDisplaySize", column);
checkColumnIndex(column);
return result.getDisplaySize(--column);
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......
......@@ -75,7 +75,7 @@ implements Savepoint
throw Message.getSQLException(ErrorCode.SAVEPOINT_IS_NAMED);
}
return savepointId;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......@@ -92,7 +92,7 @@ implements Savepoint
throw Message.getSQLException(ErrorCode.SAVEPOINT_IS_UNNAMED);
}
return name;
} catch (Throwable e) {
} catch (Exception e) {
throw logAndConvert(e);
}
}
......
......@@ -26,9 +26,9 @@ import java.sql.SQLException;
import java.util.Stack;
import javax.sql.ConnectionEvent;
import javax.sql.DataSource;
import javax.sql.ConnectionEventListener;
import javax.sql.ConnectionPoolDataSource;
import javax.sql.DataSource;
import javax.sql.PooledConnection;
/*## Java 1.6 begin ##
......
......@@ -59,7 +59,7 @@ implements ObjectFactory
* not JdbcDataSource.
*/
//## Java 1.4 begin ##
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception {
public synchronized Object getObjectInstance(Object obj, Name name, Context nameCtx, Hashtable environment) {
if (trace.isDebugEnabled()) {
trace.debug("getObjectInstance obj=" + obj + " name=" + name + " nameCtx=" + nameCtx + " environment=" + environment);
}
......
......@@ -19,10 +19,10 @@ import javax.sql.XAConnection;
import javax.transaction.xa.XAException;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;
import org.h2.jdbc.JdbcConnection;
import org.h2.util.ByteUtils;
import org.h2.util.JdbcConnectionListener;
import org.h2.util.JdbcUtils;
import org.h2.jdbc.JdbcConnection;
//## Java 1.4 end ##
import org.h2.message.TraceObject;
......@@ -83,6 +83,8 @@ implements XAConnection, XAResource, JdbcConnectionListener
/**
* Close the physical connection.
* This method is usually called by the connection pool.
*
* @throws SQLException
*/
//## Java 1.4 begin ##
public void close() throws SQLException {
......@@ -102,6 +104,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* pool when there are no more connections in the pool.
*
* @return the connection
* @throws SQLException
*/
//## Java 1.4 begin ##
public Connection getConnection() throws SQLException {
......@@ -217,6 +220,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* @param flag TMSTARTRSCAN, TMENDRSCAN, or TMNOFLAGS. If no other flags are set,
* TMNOFLAGS must be used.
* @return zero or more Xid objects
* @throws XAException
*/
//## Java 1.4 begin ##
public Xid[] recover(int flag) throws XAException {
......@@ -249,6 +253,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* Prepare a transaction.
*
* @param xid the transaction id
* @throws XAException
*/
//## Java 1.4 begin ##
public int prepare(Xid xid) throws XAException {
......@@ -291,6 +296,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
* Roll back a transaction.
*
* @param xid the transaction id
* @throws XAException
*/
//## Java 1.4 begin ##
public void rollback(Xid xid) throws XAException {
......@@ -311,6 +317,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*
* @param xid the transaction id
* @param flags TMSUCCESS, TMFAIL, or TMSUSPEND
* @throws XAException
*/
//## Java 1.4 begin ##
public void end(Xid xid, int flags) throws XAException {
......@@ -332,6 +339,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*
* @param xid the transaction id
* @param flags TMNOFLAGS, TMJOIN, or TMRESUME
* @throws XAException
*/
//## Java 1.4 begin ##
public void start(Xid xid, int flags) throws XAException {
......@@ -358,6 +366,7 @@ implements XAConnection, XAResource, JdbcConnectionListener
*
* @param xid the transaction id
* @param onePhase use a one-phase protocol if true
* @throws XAException
*/
//## Java 1.4 begin ##
public void commit(Xid xid, boolean onePhase) throws XAException {
......
......@@ -44,7 +44,7 @@ implements Xid
formatId = Integer.parseInt(tokenizer.nextToken());
branchQualifier = ByteUtils.convertStringToBytes(tokenizer.nextToken());
globalTransactionId = ByteUtils.convertStringToBytes(tokenizer.nextToken());
} catch (Throwable e) {
} catch (Exception e) {
throw Message.getSQLException(ErrorCode.WRONG_XID_FORMAT_1, tid);
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论