Modified:
branches/branch_5_0/connector-j/CHANGES
branches/branch_5_0/connector-j/src/com/mysql/jdbc/Blob.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/BlobFromLocator.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/Buffer.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/Clob.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/EscapeProcessor.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/MiniAdmin.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlParameterMetadata.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlSavepoint.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringReplicationDriver.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSet.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSetMetaData.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/StringUtils.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/integration/jboss/MysqlValidConnectionChecker.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/StatementWrapper.java
branches/branch_5_0/connector-j/src/com/mysql/jdbc/log/LogFactory.java
Log:
Moved all SQLException constructor usage to a factory in SQLError
(ground-work for JDBC-4.0 SQLState-based exception classes).
Modified: branches/branch_5_0/connector-j/CHANGES
===================================================================
--- branches/branch_5_0/connector-j/CHANGES 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/CHANGES 2005-11-01 00:43:01 UTC (rev 4489)
@@ -50,6 +50,9 @@
- Added support for Connector/MXJ integration via url subprotocol
"jdbc:mysql:mxj://....".
+ - Moved all SQLException constructor usage to a factory in SQLError
+ (ground-work for JDBC-4.0 SQLState-based exception classes).
+
09-xx-05 - Version 3.1.11-stable
- Fixed BUG#11629 - Spurious "!" on console when character
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Blob.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Blob.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Blob.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -115,7 +115,7 @@
*/
public byte[] getBytes(long pos, int length) throws SQLException {
if (pos < 1) {
- throw new SQLException(Messages.getString("Blob.2"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Blob.2"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -142,7 +142,7 @@
* @see java.sql.Blob#position(byte[], long)
*/
public long position(byte[] pattern, long start) throws SQLException {
- throw new SQLException("Not implemented"); //$NON-NLS-1$
+ throw SQLError.createSQLException("Not implemented"); //$NON-NLS-1$
}
/**
@@ -173,7 +173,7 @@
public OutputStream setBinaryStream(long indexToWriteAt)
throws SQLException {
if (indexToWriteAt < 1) {
- throw new SQLException(Messages.getString("Blob.0"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Blob.0"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -204,7 +204,7 @@
try {
bytesOut.write(bytes, offset, length);
} catch (IOException ioEx) {
- throw new SQLException(Messages.getString("Blob.1"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Blob.1"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
} finally {
try {
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/BlobFromLocator.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/BlobFromLocator.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/BlobFromLocator.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -152,7 +152,7 @@
}
private void notEnoughInformationInQuery() throws SQLException {
- throw new SQLException("Emulated BLOB locators must come from "
+ throw SQLError.createSQLException("Emulated BLOB locators must come from "
+ "a ResultSet with only one table selected, and all primary "
+ "keys selected", SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -229,7 +229,7 @@
int rowsUpdated = pStmt.executeUpdate();
if (rowsUpdated != 1) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"BLOB data not found! Did primary keys change?",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -336,7 +336,7 @@
return blobRs.getLong(1);
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"BLOB data not found! Did primary keys change?",
SQLError.SQL_STATE_GENERAL_ERROR);
} finally {
@@ -422,7 +422,7 @@
return blobRs.getLong(1);
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"BLOB data not found! Did primary keys change?",
SQLError.SQL_STATE_GENERAL_ERROR);
} finally {
@@ -486,7 +486,7 @@
int rowsUpdated = pStmt.executeUpdate();
if (rowsUpdated != 1) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"BLOB data not found! Did primary keys change?",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -548,7 +548,7 @@
return ((com.mysql.jdbc.ResultSet) blobRs).getBytes(1, true);
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"BLOB data not found! Did primary keys change?",
SQLError.SQL_STATE_GENERAL_ERROR);
} finally {
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Buffer.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Buffer.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Buffer.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -427,7 +427,7 @@
try {
return new String(this.byteBuffer, this.position, len, encoding);
} catch (UnsupportedEncodingException uEE) {
- throw new SQLException(Messages.getString("ByteArrayBuffer.1") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("ByteArrayBuffer.1") //$NON-NLS-1$
+ encoding + "'", SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
} finally {
this.position += (len + 1); // update cursor
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/CallableStatement.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -188,7 +188,7 @@
int localParamIndex = paramIndex - 1;
if ((paramIndex < 0) || (localParamIndex >= this.numParameters)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("CallableStatement.11") + paramIndex //$NON-NLS-1$
+ Messages.getString("CallableStatement.12") + numParameters //$NON-NLS-1$
+ Messages.getString("CallableStatement.13"), SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
@@ -429,7 +429,7 @@
.getParameter(localParamIndex);
if (!paramDescriptor.isOut) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("CallableStatement.9") + paramIndex //$NON-NLS-1$
+ Messages.getString("CallableStatement.10"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -461,7 +461,7 @@
*/
private void checkStreamability() throws SQLException {
if (this.hasOutputParams && createStreamingResultSet()) {
- throw new SQLException(Messages.getString("CallableStatement.14"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("CallableStatement.14"), //$NON-NLS-1$
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
}
}
@@ -643,7 +643,7 @@
return nameBuf.toString();
}
- throw new SQLException(Messages.getString("CallableStatement.1"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("CallableStatement.1"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -661,7 +661,7 @@
*/
private String fixParameterName(String paramNameIn) throws SQLException {
if ((paramNameIn == null) || (paramNameIn.length() == 0)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
((Messages.getString("CallableStatement.0") + paramNameIn) == null) //$NON-NLS-1$
? Messages.getString("CallableStatement.15") : Messages.getString("CallableStatement.16"), SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -1083,7 +1083,7 @@
private int getNamedParamIndex(String paramName, boolean forOut)
throws SQLException {
if ((paramName == null) || (paramName.length() == 0)) {
- throw new SQLException(Messages.getString("CallableStatement.2"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("CallableStatement.2"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1091,13 +1091,13 @@
.getParameter(paramName);
if (this.paramInfo == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("CallableStatement.3") + paramName + Messages.getString("CallableStatement.4"), //$NON-NLS-1$ //$NON-NLS-2$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if (forOut && !namedParamInfo.isOut) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("CallableStatement.5") + paramName //$NON-NLS-1$
+ Messages.getString("CallableStatement.6"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -1190,11 +1190,11 @@
if (this.outputParameterResults == null) {
if (this.paramInfo.numberOfParameters() == 0) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("CallableStatement.7"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
- throw new SQLException(Messages.getString("CallableStatement.8"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("CallableStatement.8"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1457,7 +1457,7 @@
int rsIndex = this.parameterIndexToRsIndex[localParamIndex];
if (rsIndex == NOT_OUTPUT_PARAMETER_INDICATOR) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("CallableStatement.21") + paramIndex //$NON-NLS-1$
+ Messages.getString("CallableStatement.22"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -1887,7 +1887,7 @@
public int[] executeBatch() throws SQLException {
if (this.hasOutputParams) {
- throw new SQLException("Can't call executeBatch() on CallableStatement with OUTPUT parameters",
+ throw SQLError.createSQLException("Can't call executeBatch() on CallableStatement with OUTPUT parameters",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Clob.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Clob.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Clob.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -73,7 +73,7 @@
*/
public String getSubString(long startPos, int length) throws SQLException {
if (startPos < 1) {
- throw new SQLException(Messages.getString("Clob.6"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.6"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -82,7 +82,7 @@
if (this.charData != null) {
if (adjustedEndIndex > this.charData.length()) {
- throw new SQLException(Messages.getString("Clob.7"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.7"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -117,14 +117,14 @@
public long position(String stringToFind, long startPos)
throws SQLException {
if (startPos < 1) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("Clob.8") //$NON-NLS-1$
+ startPos + Messages.getString("Clob.9"), SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
if (this.charData != null) {
if ((startPos - 1) > this.charData.length()) {
- throw new SQLException(Messages.getString("Clob.10"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.10"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -141,7 +141,7 @@
*/
public OutputStream setAsciiStream(long indexToWriteAt) throws SQLException {
if (indexToWriteAt < 1) {
- throw new SQLException(Messages.getString("Clob.0"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.0"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -161,7 +161,7 @@
*/
public Writer setCharacterStream(long indexToWriteAt) throws SQLException {
if (indexToWriteAt < 1) {
- throw new SQLException(Messages.getString("Clob.1"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.1"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -183,12 +183,12 @@
*/
public int setString(long pos, String str) throws SQLException {
if (pos < 1) {
- throw new SQLException(Messages.getString("Clob.2"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.2"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if (str == null) {
- throw new SQLException(Messages.getString("Clob.3"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.3"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -211,12 +211,12 @@
public int setString(long pos, String str, int offset, int len)
throws SQLException {
if (pos < 1) {
- throw new SQLException(Messages.getString("Clob.4"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.4"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if (str == null) {
- throw new SQLException(Messages.getString("Clob.5"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Clob.5"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -258,7 +258,7 @@
*/
public void truncate(long length) throws SQLException {
if (length > this.charData.length()) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("Clob.11") //$NON-NLS-1$
+ this.charData.length()
+ Messages.getString("Clob.12") + length + Messages.getString("Clob.13")); //$NON-NLS-1$ //$NON-NLS-2$
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Connection.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -252,7 +252,7 @@
}
public java.sql.Array getArray(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -263,7 +263,7 @@
}
public java.math.BigDecimal getBigDecimal(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -280,7 +280,7 @@
*/
public java.math.BigDecimal getBigDecimal(int p1, int p2)
throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -291,7 +291,7 @@
}
public java.sql.Blob getBlob(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -302,7 +302,7 @@
}
public boolean getBoolean(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -313,7 +313,7 @@
}
public byte getByte(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -324,7 +324,7 @@
}
public byte[] getBytes(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -335,7 +335,7 @@
}
public java.sql.Clob getClob(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -350,12 +350,12 @@
}
public java.sql.Date getDate(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public java.sql.Date getDate(int p1, final Calendar p2)
throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -373,7 +373,7 @@
}
public double getDouble(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -392,7 +392,7 @@
}
public float getFloat(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -410,7 +410,7 @@
}
public int getInt(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -421,7 +421,7 @@
}
public long getLong(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -440,7 +440,7 @@
}
public java.sql.ResultSetMetaData getMetaData() throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public boolean getMoreResults() throws SQLException {
@@ -455,12 +455,12 @@
}
public java.lang.Object getObject(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public java.lang.Object getObject(int p1, final java.util.Map p2)
throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -489,7 +489,7 @@
}
public java.sql.Ref getRef(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -519,7 +519,7 @@
}
public short getShort(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -530,7 +530,7 @@
}
public java.lang.String getString(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -541,12 +541,12 @@
}
public java.sql.Time getTime(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public java.sql.Time getTime(int p1, final java.util.Calendar p2)
throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -564,12 +564,12 @@
}
public java.sql.Timestamp getTimestamp(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public java.sql.Timestamp getTimestamp(int p1,
final java.util.Calendar p2) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -610,17 +610,17 @@
}
public void registerOutParameter(int p1, int p2) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public void registerOutParameter(int p1, int p2, int p3)
throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public void registerOutParameter(int p1, int p2, java.lang.String p3)
throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
/**
@@ -746,7 +746,7 @@
}
public void setCursorName(java.lang.String p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public void setDate(int p1, final java.sql.Date p2) throws SQLException {
@@ -900,11 +900,11 @@
}
public void setQueryTimeout(int p1) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public void setRef(int p1, final Ref p2) throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
public void setShort(int p1, short p2) throws SQLException {
@@ -1013,7 +1013,7 @@
}
public boolean wasNull() throws SQLException {
- throw new SQLException("Not supported");
+ throw SQLError.createSQLException("Not supported");
}
}
@@ -1085,7 +1085,7 @@
messageBuf.append(origMessage);
messageBuf.append(messageToAppend);
- SQLException sqlExceptionWithNewMessage = new SQLException(messageBuf
+ SQLException sqlExceptionWithNewMessage = SQLError.createSQLException(messageBuf
.toString(), sqlState, vendorErrorCode);
//
@@ -1532,7 +1532,7 @@
mesg.append(Util.stackTraceToString(ex));
}
- throw new SQLException(mesg.toString(),
+ throw SQLError.createSQLException(mesg.toString(),
SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE);
}
}
@@ -1849,7 +1849,7 @@
.stackTraceToString(this.forceClosedReason));
}
- throw new SQLException(messageBuf.toString(),
+ throw SQLError.createSQLException(messageBuf.toString(),
SQLError.SQL_STATE_CONNECTION_NOT_OPEN);
}
}
@@ -1914,7 +1914,7 @@
}
if (mappedServerEncoding == null) {
- throw new SQLException("Unknown character encoding on server '"
+ throw SQLError.createSQLException("Unknown character encoding on server '"
+ serverEncoding
+ "', use 'characterEncoding=' property "
+ " to provide correct mapping",
@@ -1930,7 +1930,7 @@
setEncoding(mappedServerEncoding);
setUseUnicode(true);
} catch (UnsupportedEncodingException UE) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"The driver can not map the character encoding '"
+ getEncoding()
+ "' that your server is using "
@@ -2163,7 +2163,7 @@
try {
// no-op if _relaxAutoCommit == true
if (this.autoCommit && !getRelaxAutoCommit()) {
- throw new SQLException("Can't call commit when autocommit=true");
+ throw SQLError.createSQLException("Can't call commit when autocommit=true");
} else if (this.transactionsSupported) {
execSQL(null, "commit", -1, null,
java.sql.ResultSet.TYPE_FORWARD_ONLY,
@@ -2173,7 +2173,7 @@
} catch (SQLException sqlException) {
if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE
.equals(sqlException.getSQLState())) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Communications link failure during commit(). Transaction resolution unknown.",
SQLError.SQL_STATE_TRANSACTION_RESOLUTION_UNKNOWN);
}
@@ -2207,7 +2207,7 @@
oldEncoding, this));
if (getEncoding() == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Java does not support the MySQL character encoding "
+ " " + "encoding '" + oldEncoding + "'.",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
@@ -2217,7 +2217,7 @@
String testString = "abc";
testString.getBytes(getEncoding());
} catch (UnsupportedEncodingException encodingEx) {
- throw new SQLException("Unsupported character "
+ throw SQLError.createSQLException("Unsupported character "
+ "encoding '" + getEncoding() + "'.",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
}
@@ -2262,7 +2262,7 @@
// user knows best, try it
setEncoding(realJavaEncoding);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Unknown initial character set index '"
+ this.io.serverCharsetIndex
+ "' received from server. Initial client character set can be forced via the 'characterEncoding' property.",
@@ -2446,13 +2446,13 @@
.getCanoncialTimezone(serverTimezoneStr);
if (canoncicalTimezone == null) {
- throw new SQLException("Can't map timezone '"
+ throw SQLError.createSQLException("Can't map timezone '"
+ serverTimezoneStr + "' to "
+ " canonical timezone.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (IllegalArgumentException iae) {
- throw new SQLException(iae.getMessage(),
+ throw SQLError.createSQLException(iae.getMessage(),
SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -2466,7 +2466,7 @@
//
if (!canoncicalTimezone.equalsIgnoreCase("GMT")
&& this.serverTimezoneTZ.getID().equals("GMT")) {
- throw new SQLException("No timezone mapping entry for '"
+ throw SQLError.createSQLException("No timezone mapping entry for '"
+ canoncicalTimezone + "'",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -2551,7 +2551,7 @@
newPort = Integer
.parseInt(hostPortPair[NonRegisteringDriver.PORT_NUMBER_INDEX]);
} catch (NumberFormatException nfe) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Illegal connection port value '"
+ hostPortPair[NonRegisteringDriver.PORT_NUMBER_INDEX]
+ "'",
@@ -2676,7 +2676,7 @@
newPort = Integer
.parseInt(hostPortPair[NonRegisteringDriver.PORT_NUMBER_INDEX]);
} catch (NumberFormatException nfe) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Illegal connection port value '"
+ hostPortPair[NonRegisteringDriver.PORT_NUMBER_INDEX]
+ "'",
@@ -2752,7 +2752,7 @@
if (!connectionGood) {
// We've really failed!
- throw new SQLException(
+ throw SQLError.createSQLException(
"Server connection failure during transaction. Due to underlying exception: '"
+ connectionException
+ "'."
@@ -2860,7 +2860,7 @@
throws SQLException {
if (getPedantic()) {
if (resultSetHoldability != java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"HOLD_CUSRORS_OVER_COMMIT is only supported holdability level",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -3241,7 +3241,7 @@
}
}
} catch (ArrayIndexOutOfBoundsException outOfBoundsEx) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Unknown character set index for field '"
+ charsetIndex + "' received from server.",
SQLError.SQL_STATE_GENERAL_ERROR);
@@ -3306,7 +3306,7 @@
*/
protected MysqlIO getIO() throws SQLException {
if ((this.io == null) || this.isClosed) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Operation not allowed on closed connection",
SQLError.SQL_STATE_CONNECTION_NOT_OPEN);
}
@@ -3432,7 +3432,7 @@
*/
Object getMutex() throws SQLException {
if (this.io == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Connection.close() has already been called. Invalid operation in this state.",
SQLError.SQL_STATE_CONNECTION_NOT_OPEN);
}
@@ -3531,13 +3531,13 @@
}
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"Could not map transaction isolation '" + s
+ " to a valid JDBC level.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"Could not retrieve transaction isolation level from server",
SQLError.SQL_STATE_GENERAL_ERROR);
@@ -3658,7 +3658,7 @@
}
if (getNoDatetimeStringSync() && getUseTimezone()) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Can't enable noDatetimeSync and useTimezone configuration "
+ "properties at the same time",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
@@ -4229,7 +4229,7 @@
return cStmt;
}
- throw new SQLException("Callable statements not " + "supported.",
+ throw SQLError.createSQLException("Callable statements not " + "supported.",
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
}
@@ -4241,7 +4241,7 @@
int resultSetHoldability) throws SQLException {
if (getPedantic()) {
if (resultSetHoldability != java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"HOLD_CUSRORS_OVER_COMMIT is only supported holdability level",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -4379,7 +4379,7 @@
int resultSetHoldability) throws SQLException {
if (getPedantic()) {
if (resultSetHoldability != java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"HOLD_CUSRORS_OVER_COMMIT is only supported holdability level",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -4781,7 +4781,7 @@
try {
// no-op if _relaxAutoCommit == true
if (this.autoCommit && !getRelaxAutoCommit()) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Can't call rollback when autocommit=true",
SQLError.SQL_STATE_CONNECTION_NOT_OPEN);
} else if (this.transactionsSupported) {
@@ -4798,7 +4798,7 @@
} catch (SQLException sqlException) {
if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE
.equals(sqlException.getSQLState())) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Communications link failure during rollback(). Transaction resolution unknown.",
SQLError.SQL_STATE_TRANSACTION_RESOLUTION_UNKNOWN);
}
@@ -4840,7 +4840,7 @@
int indexOfError153 = msg.indexOf("153");
if (indexOfError153 != -1) {
- throw new SQLException("Savepoint '"
+ throw SQLError.createSQLException("Savepoint '"
+ savepoint.getSavepointName()
+ "' does not exist",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
@@ -4857,7 +4857,7 @@
if (SQLError.SQL_STATE_COMMUNICATION_LINK_FAILURE
.equals(sqlEx.getSQLState())) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Communications link failure during rollback(). Transaction resolution unknown.",
SQLError.SQL_STATE_TRANSACTION_RESOLUTION_UNKNOWN);
}
@@ -4974,7 +4974,7 @@
} else {
if ((autoCommitFlag == false) && !getRelaxAutoCommit()) {
- throw new SQLException("MySQL Versions Older than 3.23.15 "
+ throw SQLError.createSQLException("MySQL Versions Older than 3.23.15 "
+ "do not support transactions",
SQLError.SQL_STATE_CONNECTION_NOT_OPEN);
}
@@ -5007,7 +5007,7 @@
checkClosed();
if (catalog == null) {
- throw new SQLException("Catalog can not be null",
+ throw SQLError.createSQLException("Catalog can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -5218,7 +5218,7 @@
if (shouldSendSet) {
switch (level) {
case java.sql.Connection.TRANSACTION_NONE:
- throw new SQLException("Transaction isolation level "
+ throw SQLError.createSQLException("Transaction isolation level "
+ "NONE not supported by MySQL");
case java.sql.Connection.TRANSACTION_READ_COMMITTED:
@@ -5242,7 +5242,7 @@
break;
default:
- throw new SQLException("Unsupported transaction "
+ throw SQLError.createSQLException("Unsupported transaction "
+ "isolation level '" + level + "'",
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
}
@@ -5255,7 +5255,7 @@
this.isolationLevel = level;
}
} else {
- throw new SQLException("Transaction Isolation Levels are "
+ throw SQLError.createSQLException("Transaction Isolation Levels are "
+ "not supported on MySQL versions older than 3.23.36.",
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
}
@@ -5300,7 +5300,7 @@
try {
this.io.sendCommand(MysqlDefs.SHUTDOWN, null, null, false, null);
} catch (Exception ex) {
- throw new SQLException("Unhandled exception '" + ex.toString()
+ throw SQLError.createSQLException("Unhandled exception '" + ex.toString()
+ "'", SQLError.SQL_STATE_GENERAL_ERROR);
}
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/ConnectionProperties.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -298,7 +298,7 @@
errorMessageBuf.append(valueToValidate);
errorMessageBuf.append("' is not in this set.");
- throw new SQLException(errorMessageBuf.toString(),
+ throw SQLError.createSQLException(errorMessageBuf.toString(),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
@@ -384,7 +384,7 @@
*/
this.valueAsObject = new Integer(intValue * multiplier);
} catch (NumberFormatException nfe) {
- throw new SQLException("The connection property '"
+ throw SQLError.createSQLException("The connection property '"
+ getPropertyName()
+ "' only accepts integer values. The value '"
+ extractedValue
@@ -1347,7 +1347,7 @@
propToExpose.syncDriverPropertyInfo();
driverProperties[i] = propToExpose;
} catch (IllegalAccessException iae) {
- throw new SQLException("Internal properties failure",
+ throw SQLError.createSQLException("Internal properties failure",
SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -1378,7 +1378,7 @@
.toString());
}
} catch (IllegalAccessException iae) {
- throw new SQLException("Internal properties failure",
+ throw SQLError.createSQLException("Internal properties failure",
SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -1509,7 +1509,7 @@
xmlBuf.append("\n </PropertyCategory>");
}
} catch (IllegalAccessException iae) {
- throw new SQLException("Internal properties failure",
+ throw SQLError.createSQLException("Internal properties failure",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -2350,7 +2350,7 @@
propToSet.initializeFrom(ref);
}
} catch (IllegalAccessException iae) {
- throw new SQLException("Internal properties failure",
+ throw SQLError.createSQLException("Internal properties failure",
SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -2397,7 +2397,7 @@
propToSet.initializeFrom(infoCopy);
} catch (IllegalAccessException iae) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Unable to initialize driver properties due to "
+ iae.toString(),
SQLError.SQL_STATE_GENERAL_ERROR);
@@ -2492,7 +2492,7 @@
String testString = "abc";
testString.getBytes(testEncoding);
} catch (UnsupportedEncodingException UE) {
- throw new SQLException("Unsupported character " + "encoding '"
+ throw SQLError.createSQLException("Unsupported character " + "encoding '"
+ testEncoding + "'.", "0S100");
}
}
@@ -3464,7 +3464,7 @@
propToStore.storeTo(ref);
}
} catch (IllegalAccessException iae) {
- throw new SQLException("Huh?");
+ throw SQLError.createSQLException("Huh?");
}
}
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaData.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -587,7 +587,7 @@
break;
default:
- throw new SQLException(
+ throw SQLError.createSQLException(
"Internal error while parsing callable statement metadata (unknown nullability value fount)",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -734,7 +734,7 @@
int indexOfParenClose = StringUtils.indexOfIgnoreCaseRespectQuotes(indexOfParenOpen, line, ")", quote, true);
if (indexOfParenOpen == -1 || indexOfParenClose == -1) {
- // throw new SQLException();
+ // throw SQLError.createSQLException();
}
localColumnName = line.substring(indexOfParenOpen + 1, indexOfParenClose);
@@ -968,7 +968,7 @@
String schema, final String table, int scope, boolean nullable)
throws SQLException {
if (table == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1147,7 +1147,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
parameterNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Parameter/Column name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1310,7 +1310,7 @@
// Okay, give up...
if (beginIndex == -1) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Driver requires declaration of procedure to either contain a '\\nbegin' or '\\n' to follow argument declaration, or SELECT privilege on mysql.proc to parse column types.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1340,7 +1340,7 @@
if (beginIndex != -1) {
beforeBegin = procedureDef.substring(0, beginIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Driver requires declaration of procedure to either contain a '\\nbegin' or '\\n' to follow argument declaration, or SELECT privilege on mysql.proc to parse column types.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1351,7 +1351,7 @@
if ((openParenIndex == -1) || (endParenIndex == -1)) {
// parse error?
- throw new SQLException(
+ throw SQLError.createSQLException(
"Internal error when parsing callable statement metadata",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1422,7 +1422,7 @@
if (declarationTok.hasMoreTokens()) {
paramName = declarationTok.nextToken();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Internal error when parsing callable statement metadata (missing parameter name)",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1433,7 +1433,7 @@
if (declarationTok.hasMoreTokens()) {
paramName = declarationTok.nextToken();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Internal error when parsing callable statement metadata (missing parameter name)",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1444,7 +1444,7 @@
if (declarationTok.hasMoreTokens()) {
paramName = declarationTok.nextToken();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Internal error when parsing callable statement metadata (missing parameter name)",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1469,7 +1469,7 @@
typeDesc = new TypeDescriptor(typeInfo, null);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Internal error when parsing callable statement metadata (missing parameter type)",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1485,7 +1485,7 @@
resultRows.add(row);
}
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Internal error when parsing callable statement metadata (unknown output from 'SHOW CREATE PROCEDURE')",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1876,7 +1876,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
columnNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Column name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -2110,7 +2110,7 @@
rowVal[16] = realOrdinal.toString()
.getBytes();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Can not find column in full column list to determine true ordinal position.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -2228,7 +2228,7 @@
final String foreignCatalog, final String foreignSchema,
final String foreignTable) throws SQLException {
if (primaryTable == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -2564,7 +2564,7 @@
public java.sql.ResultSet getExportedKeys(String catalog, String schema,
final String table) throws SQLException {
if (table == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -2833,7 +2833,7 @@
public java.sql.ResultSet getImportedKeys(String catalog, String schema,
final String table) throws SQLException {
if (table == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -3434,7 +3434,7 @@
fields[5] = new Field("", "PK_NAME", Types.CHAR, 32);
if (table == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -3714,7 +3714,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
procedureNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Procedure name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -3898,7 +3898,7 @@
if (parsedInfo.localColumnsList.size() != parsedInfo.referencedColumnsList
.size()) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Error parsing foreign keys definition,"
+ "number of local and referenced columns is not the same.",
SQLError.SQL_STATE_GENERAL_ERROR);
@@ -4141,7 +4141,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
tableNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Table name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -4312,7 +4312,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
tableNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Table name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -6163,7 +6163,7 @@
true);
if (indexOfOpenParenLocalColumns == -1) {
- throw new SQLException("Error parsing foreign keys definition,"
+ throw SQLError.createSQLException("Error parsing foreign keys definition,"
+ " couldn't find start of local columns list.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -6180,7 +6180,7 @@
quoteChar, true);
if (indexOfCloseParenLocalColumns == -1) {
- throw new SQLException("Error parsing foreign keys definition,"
+ throw SQLError.createSQLException("Error parsing foreign keys definition,"
+ " couldn't find end of local columns list.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -6192,7 +6192,7 @@
keysCommentTrimmed, "REFER ", this.quotedId.charAt(0), true);
if (indexOfRefer == -1) {
- throw new SQLException("Error parsing foreign keys definition,"
+ throw SQLError.createSQLException("Error parsing foreign keys definition,"
+ " couldn't find start of referenced tables list.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -6202,7 +6202,7 @@
keysCommentTrimmed, "(", quoteChar, false);
if (indexOfOpenParenReferCol == -1) {
- throw new SQLException("Error parsing foreign keys definition,"
+ throw SQLError.createSQLException("Error parsing foreign keys definition,"
+ " couldn't find start of referenced columns list.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -6214,7 +6214,7 @@
referCatalogTableString, "/", this.quotedId.charAt(0), false);
if (indexOfSlash == -1) {
- throw new SQLException("Error parsing foreign keys definition,"
+ throw SQLError.createSQLException("Error parsing foreign keys definition,"
+ " couldn't find name of referenced catalog.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -6229,7 +6229,7 @@
keysCommentTrimmed, ")", quoteChar, true);
if (indexOfCloseParenRefer == -1) {
- throw new SQLException("Error parsing foreign keys definition,"
+ throw SQLError.createSQLException("Error parsing foreign keys definition,"
+ " couldn't find end of referenced columns list.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -7076,7 +7076,7 @@
|| (concurrency == ResultSet.CONCUR_UPDATABLE)) {
return true;
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Illegal arguments to supportsResultSetConcurrency()",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -7085,14 +7085,14 @@
|| (concurrency == ResultSet.CONCUR_UPDATABLE)) {
return true;
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Illegal arguments to supportsResultSetConcurrency()",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
case ResultSet.TYPE_SCROLL_SENSITIVE:
return false;
default:
- throw new SQLException(
+ throw SQLError.createSQLException(
"Illegal arguments to supportsResultSetConcurrency()",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/DatabaseMetaDataUsingInfoSchema.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -90,7 +90,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
columnNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Column name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -98,7 +98,7 @@
if (catalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -189,7 +189,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
columnNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Column name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -197,7 +197,7 @@
if (catalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -345,13 +345,13 @@
String primarySchema, String primaryTable, String foreignCatalog,
String foreignSchema, String foreignTable) throws SQLException {
if (primaryTable == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if (primaryCatalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -360,7 +360,7 @@
if (foreignCatalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -510,13 +510,13 @@
// TODO: Can't determine actions using INFORMATION_SCHEMA yet...
if (table == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if (catalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -673,13 +673,13 @@
public java.sql.ResultSet getImportedKeys(String catalog, String schema,
String table) throws SQLException {
if (table == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if (catalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -888,7 +888,7 @@
if (catalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -896,7 +896,7 @@
}
if (table == null) {
- throw new SQLException("Table not specified.",
+ throw SQLError.createSQLException("Table not specified.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -978,7 +978,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
procedureNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Procedure name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -992,7 +992,7 @@
db = catalog;
} else {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1079,7 +1079,7 @@
String tableNamePattern, String[] types) throws SQLException {
if (catalog == null) {
if (!this.conn.getNullCatalogMeansCurrent()) {
- throw new SQLException("'catalog' parameter can not be null",
+ throw SQLError.createSQLException("'catalog' parameter can not be null",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1090,7 +1090,7 @@
if (this.conn.getNullNamePatternMatchesAll()) {
tableNamePattern = "%";
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Table name pattern can not be NULL or empty.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/EscapeProcessor.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/EscapeProcessor.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/EscapeProcessor.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -135,7 +135,7 @@
if (token.charAt(0) == '{') { // It's an escape code
if (!token.endsWith("}")) {
- throw new SQLException("Not a valid escape sequence: "
+ throw SQLError.createSQLException("Not a valid escape sequence: "
+ token);
}
@@ -186,7 +186,7 @@
escapeSequence = st.nextToken();
if (escapeSequence.length() < 3) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for escape sequence '"
+ token + "'", "42000");
}
@@ -195,7 +195,7 @@
escapeSequence.length() - 1);
replaceEscapeSequence = true;
} catch (java.util.NoSuchElementException e) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for escape sequence '"
+ token + "'", "42000");
}
@@ -222,7 +222,7 @@
int endPos = token.lastIndexOf('\''); // no }
if ((startPos == -1) || (endPos == -1)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for DATE escape sequence '"
+ token + "'", "42000");
}
@@ -239,7 +239,7 @@
+ "-" + day2 + "'";
newSql.append(dateString);
} catch (java.util.NoSuchElementException e) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for DATE escape sequence '"
+ argument + "'", "42000");
}
@@ -249,7 +249,7 @@
int endPos = token.lastIndexOf('\''); // no }
if ((startPos == -1) || (endPos == -1)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for TIMESTAMP escape sequence '"
+ token + "'", "42000");
}
@@ -352,13 +352,13 @@
} catch (NumberFormatException nfe) {
- throw new SQLException("Syntax error in TIMESTAMP escape sequence '"
+ throw SQLError.createSQLException("Syntax error in TIMESTAMP escape sequence '"
+ token + "'.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
} catch (java.util.NoSuchElementException e) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for TIMESTAMP escape sequence '"
+ argument + "'", "42000");
}
@@ -368,7 +368,7 @@
int endPos = token.lastIndexOf('\''); // no }
if ((startPos == -1) || (endPos == -1)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for TIME escape sequence '"
+ token + "'", "42000");
}
@@ -422,13 +422,13 @@
}
} catch (NumberFormatException nfe) {
- throw new SQLException("Syntax error in TIMESTAMP escape sequence '"
+ throw SQLError.createSQLException("Syntax error in TIMESTAMP escape sequence '"
+ token + "'.",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
} catch (java.util.NoSuchElementException e) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error for escape sequence '"
+ argument + "'", "42000");
}
@@ -541,7 +541,7 @@
int firstIndexOfParen = functionToken.indexOf("(");
if (firstIndexOfParen == -1) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error while processing {fn convert (... , ...)} token, missing opening parenthesis in token '"
+ functionToken + "'.",
SQLError.SQL_STATE_SYNTAX_ERROR);
@@ -552,7 +552,7 @@
int indexOfComma = functionToken.lastIndexOf(",");
if (indexOfComma == -1) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error while processing {fn convert (... , ...)} token, missing comma in token '"
+ functionToken + "'.",
SQLError.SQL_STATE_SYNTAX_ERROR);
@@ -561,7 +561,7 @@
int indexOfCloseParen = functionToken.indexOf(')', indexOfComma);
if (indexOfCloseParen == -1) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Syntax error while processing {fn convert (... , ...)} token, missing closing parenthesis in token '"
+ functionToken + "'.",
SQLError.SQL_STATE_SYNTAX_ERROR);
@@ -596,7 +596,7 @@
// (date,time,timestamp, datetime)
if (newType == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Can't find conversion re-write for type '"
+ type
+ "' that is applicable for this server version while processing escape tokens.",
@@ -605,7 +605,7 @@
}
if (newType == null) {
- throw new SQLException("Unsupported conversion type '"
+ throw SQLError.createSQLException("Unsupported conversion type '"
+ type.trim() + "' found while processing escape token.",
SQLError.SQL_STATE_GENERAL_ERROR);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/MiniAdmin.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/MiniAdmin.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/MiniAdmin.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -53,12 +53,12 @@
*/
public MiniAdmin(java.sql.Connection conn) throws SQLException {
if (conn == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("MiniAdmin.0"), SQLError.SQL_STATE_GENERAL_ERROR); //$NON-NLS-1$
}
if (!(conn instanceof Connection)) {
- throw new SQLException(Messages.getString("MiniAdmin.1"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MiniAdmin.1"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlIO.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -958,7 +958,7 @@
String xOpen = SQLError.mysqlToSqlState(errno,
this.connection.getUseSqlStateCodes());
- throw new SQLException(SQLError.get(xOpen) + ", " //$NON-NLS-1$
+ throw SQLError.createSQLException(SQLError.get(xOpen) + ", " //$NON-NLS-1$
+errorBuf.toString(), xOpen, errno);
}
@@ -1063,7 +1063,7 @@
if (this.connection.getRequireSSL()) {
this.connection.close();
forceClose();
- throw new SQLException(Messages.getString("MysqlIO.15"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.15"), //$NON-NLS-1$
SQLError.SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE);
}
@@ -1326,12 +1326,12 @@
void closeStreamer(RowData streamer) throws SQLException {
if (this.streamingData == null) {
- throw new SQLException(Messages.getString("MysqlIO.17") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.17") //$NON-NLS-1$
+streamer + Messages.getString("MysqlIO.18")); //$NON-NLS-1$
}
if (streamer != this.streamingData) {
- throw new SQLException(Messages.getString("MysqlIO.19") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.19") //$NON-NLS-1$
+streamer + Messages.getString("MysqlIO.20") //$NON-NLS-1$
+Messages.getString("MysqlIO.21") //$NON-NLS-1$
+Messages.getString("MysqlIO.22")); //$NON-NLS-1$
@@ -1366,7 +1366,7 @@
if (serverHasMoreResults && streamResults) {
clearInputStream();
- throw new SQLException(Messages.getString("MysqlIO.23"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.23"), //$NON-NLS-1$
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
}
@@ -2002,7 +2002,7 @@
info = resultPacket.readString();
}
} catch (Exception ex) {
- throw new SQLException(SQLError.get(
+ throw SQLError.createSQLException(SQLError.get(
SQLError.SQL_STATE_GENERAL_ERROR) + ": " //$NON-NLS-1$
+ex.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR, -1);
}
@@ -2020,7 +2020,7 @@
private void checkForOutstandingStreamingData() throws SQLException {
if (this.streamingData != null) {
if (!this.connection.getClobberStreamingResults()) {
- throw new SQLException(Messages.getString("MysqlIO.39") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.39") //$NON-NLS-1$
+this.streamingData +
Messages.getString("MysqlIO.40") //$NON-NLS-1$
+Messages.getString("MysqlIO.41") //$NON-NLS-1$
@@ -2109,14 +2109,14 @@
private SocketFactory createSocketFactory() throws SQLException {
try {
if (this.socketFactoryClassName == null) {
- throw new SQLException(Messages.getString("MysqlIO.75"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.75"), //$NON-NLS-1$
SQLError.SQL_STATE_UNABLE_TO_CONNECT_TO_DATASOURCE);
}
return (SocketFactory) (Class.forName(this.socketFactoryClassName)
.newInstance());
} catch (Exception ex) {
- throw new SQLException(Messages.getString("MysqlIO.76") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.76") //$NON-NLS-1$
+this.socketFactoryClassName +
Messages.getString("MysqlIO.77") + ex.toString() //$NON-NLS-1$
+(this.connection.getParanoid() ? "" //$NON-NLS-1$
@@ -2399,7 +2399,7 @@
if (bytesRead != lengthToWrite) {
throw new CommunicationsException(this.connection,
this.lastPacketSentTimeMs,
- new SQLException(Messages.getString(
+ SQLError.createSQLException(Messages.getString(
"MysqlIO.50") //$NON-NLS-1$
+lengthToWrite +
Messages.getString("MysqlIO.51") +
@@ -2439,7 +2439,7 @@
if (bytesRead != lengthToWrite) {
throw new CommunicationsException(this.connection,
this.lastPacketSentTimeMs,
- new SQLException(Messages.getString(
+ SQLError.createSQLException(Messages.getString(
"MysqlIO.54") //$NON-NLS-1$
+lengthToWrite +
Messages.getString("MysqlIO.55") //$NON-NLS-1$
@@ -2637,7 +2637,7 @@
filePacket = new Buffer((packetLength + HEADER_LENGTH));
this.loadFileBufRef = new SoftReference(filePacket);
} catch (OutOfMemoryError oom) {
- throw new SQLException("Could not allocate packet of " + packetLength
+ throw SQLError.createSQLException("Could not allocate packet of " + packetLength
+ " bytes required for LOAD DATA LOCAL INFILE operation."
+ " Try increasing max heap allocation for JVM or decreasing server variable "
+ "'max_allowed_packet'", SQLError.SQL_STATE_MEMORY_ALLOCATION_FAILURE);
@@ -2700,14 +2700,14 @@
messageBuf.append(Util.stackTraceToString(ioEx));
}
- throw new SQLException(messageBuf.toString(),
+ throw SQLError.createSQLException(messageBuf.toString(),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} finally {
if (fileIn != null) {
try {
fileIn.close();
} catch (Exception ex) {
- throw new SQLException(Messages.getString("MysqlIO.65"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.65"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -2816,7 +2816,7 @@
if (xOpen != null && xOpen.startsWith("22")) {
throw new MysqlDataTruncation(errorBuf.toString(), 0, true, false, 0, 0);
} else {
- throw new SQLException(errorBuf.toString(), xOpen, errno);
+ throw SQLError.createSQLException(errorBuf.toString(), xOpen, errno);
}
}
@@ -2824,7 +2824,7 @@
clearInputStream();
if (serverErrorMessage.indexOf(Messages.getString("MysqlIO.70")) != -1) { //$NON-NLS-1$
- throw new SQLException(SQLError.get(
+ throw SQLError.createSQLException(SQLError.get(
SQLError.SQL_STATE_COLUMN_NOT_FOUND) +
", " //$NON-NLS-1$
+serverErrorMessage, SQLError.SQL_STATE_COLUMN_NOT_FOUND,
@@ -2836,7 +2836,7 @@
errorBuf.append(serverErrorMessage);
errorBuf.append("\""); //$NON-NLS-1$
- throw new SQLException(SQLError.get(
+ throw SQLError.createSQLException(SQLError.get(
SQLError.SQL_STATE_GENERAL_ERROR) + ", " //$NON-NLS-1$
+errorBuf.toString(), SQLError.SQL_STATE_GENERAL_ERROR, -1);
}
@@ -3084,7 +3084,7 @@
send(packet2, 24);
} catch (NoSuchAlgorithmException nse) {
- throw new SQLException(Messages.getString("MysqlIO.91") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.91") //$NON-NLS-1$
+Messages.getString("MysqlIO.92"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -3115,7 +3115,7 @@
send(packet2, 24);
} catch (NoSuchAlgorithmException nse) {
- throw new SQLException(Messages.getString("MysqlIO.93") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.93") //$NON-NLS-1$
+Messages.getString("MysqlIO.94"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -3193,7 +3193,7 @@
try {
packet.writeBytesNoNull(Security.scramble411(password, this.seed));
} catch (NoSuchAlgorithmException nse) {
- throw new SQLException(Messages.getString("MysqlIO.95") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.95") //$NON-NLS-1$
+Messages.getString("MysqlIO.96"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -3364,7 +3364,7 @@
break;
default:
- throw new SQLException(Messages.getString("MysqlIO.97") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.97") //$NON-NLS-1$
+curField.getMysqlType() +
Messages.getString("MysqlIO.98") + columnIndex +
Messages.getString("MysqlIO.99") //$NON-NLS-1$ //$NON-NLS-2$
@@ -3534,7 +3534,7 @@
break;
} else if (ConnectionProperties.ZERO_DATETIME_BEHAVIOR_EXCEPTION.equals(
this.connection.getZeroDateTimeBehavior())) {
- throw new SQLException("Value '0000-00-00' can not be represented as java.sql.Date",
+ throw SQLError.createSQLException("Value '0000-00-00' can not be represented as java.sql.Date",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -3616,7 +3616,7 @@
break;
} else if (ConnectionProperties.ZERO_DATETIME_BEHAVIOR_EXCEPTION.equals(
this.connection.getZeroDateTimeBehavior())) {
- throw new SQLException("Value '0000-00-00' can not be represented as java.sql.Timestamp",
+ throw SQLError.createSQLException("Value '0000-00-00' can not be represented as java.sql.Timestamp",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -3710,7 +3710,7 @@
break;
default:
- throw new SQLException(Messages.getString("MysqlIO.97") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("MysqlIO.97") //$NON-NLS-1$
+curField.getMysqlType() +
Messages.getString("MysqlIO.98") + columnIndex +
Messages.getString("MysqlIO.99") //$NON-NLS-1$ //$NON-NLS-2$
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlParameterMetadata.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlParameterMetadata.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlParameterMetadata.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -50,7 +50,7 @@
private void checkAvailable() throws SQLException {
if (this.metadata == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Parameter metadata not available for the given statement",
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlSavepoint.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlSavepoint.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/MysqlSavepoint.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -82,7 +82,7 @@
*/
MysqlSavepoint(String name) throws SQLException {
if (name == null || name.length() == 0) {
- throw new SQLException("Savepoint name can not be NULL or empty",
+ throw SQLError.createSQLException("Savepoint name can not be NULL or empty",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -93,7 +93,7 @@
* @see java.sql.Savepoint#getSavepointId()
*/
public int getSavepointId() throws SQLException {
- throw new SQLException("Only named savepoints are supported.",
+ throw SQLError.createSQLException("Only named savepoints are supported.",
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringDriver.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -161,7 +161,7 @@
splitValues[PORT_NUMBER_INDEX] = portAsString;
} else {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("NonRegisteringDriver.37"), //$NON-NLS-1$
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
}
@@ -272,7 +272,7 @@
// them un-changed.
throw sqlEx;
} catch (Exception ex) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("NonRegisteringDriver.17") //$NON-NLS-1$
+ ex.toString()
+ Messages.getString("NonRegisteringDriver.18"), //$NON-NLS-1$
@@ -528,21 +528,21 @@
urlProps = propTransformer.transformProperties(urlProps);
} catch (InstantiationException e) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Unable to create properties transform instance '"
+ propertiesTransformClassName
+ "' due to underlying exception: "
+ e.toString(),
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
} catch (IllegalAccessException e) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Unable to create properties transform instance '"
+ propertiesTransformClassName
+ "' due to underlying exception: "
+ e.toString(),
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
} catch (ClassNotFoundException e) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Unable to create properties transform instance '"
+ propertiesTransformClassName
+ "' due to underlying exception: "
@@ -580,14 +580,14 @@
"configs/" + configName + ".properties");
if (configAsStream == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Can't find configuration template named '"
+ configName + "'",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
}
configProps.load(configAsStream);
} catch (IOException ioEx) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Unable to load configuration template '"
+ configName
+ "' due to underlying IOException: "
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringReplicationDriver.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringReplicationDriver.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/NonRegisteringReplicationDriver.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -104,7 +104,7 @@
}
if (slaveHosts.length() == 0) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Must specify at least one slave host to connect to for master/slave replication load-balancing functionality",
SQLError.SQL_STATE_INVALID_CONNECTION_ATTRIBUTE);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/PreparedStatement.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -142,7 +142,7 @@
java.sql.DatabaseMetaData dbmd, String encoding,
SingleByteCharsetConverter converter) throws SQLException {
if (sql == null) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("PreparedStatement.61"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -424,7 +424,7 @@
super(conn, catalog);
if (sql == null) {
- throw new SQLException(Messages.getString("PreparedStatement.0"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.0"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -460,7 +460,7 @@
super(conn, catalog);
if (sql == null) {
- throw new SQLException(Messages.getString("PreparedStatement.1"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.1"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -685,7 +685,7 @@
*/
public boolean execute() throws SQLException {
if (this.connection.isReadOnly() && (this.firstCharOfStmt != 'S')) {
- throw new SQLException(Messages.getString("PreparedStatement.20") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.20") //$NON-NLS-1$
+ Messages.getString("PreparedStatement.21"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -802,7 +802,7 @@
*/
public int[] executeBatch() throws SQLException {
if (this.connection.isReadOnly()) {
- throw new SQLException(Messages.getString("PreparedStatement.25") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.25") //$NON-NLS-1$
+ Messages.getString("PreparedStatement.26"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1098,7 +1098,7 @@
int[] batchedStreamLengths, boolean[] batchedIsNull)
throws SQLException {
if (this.connection.isReadOnly()) {
- throw new SQLException(Messages.getString("PreparedStatement.34") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.34") //$NON-NLS-1$
+ Messages.getString("PreparedStatement.35"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1108,7 +1108,7 @@
if ((this.firstCharOfStmt == 'S')
&& StringUtils.startsWithIgnoreCaseAndWs(this.originalSql,
"SELECT")) { //$NON-NLS-1$
- throw new SQLException(Messages.getString("PreparedStatement.37"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.37"), //$NON-NLS-1$
"01S03"); //$NON-NLS-1$
}
@@ -1244,7 +1244,7 @@
for (int i = 0; i < batchedParameterStrings.length; i++) {
if ((batchedParameterStrings[i] == null)
&& (batchedParameterStreams[i] == null)) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("PreparedStatement.40") //$NON-NLS-1$
+ (i + 1), SQLError.SQL_STATE_WRONG_NO_OF_PARAMETERS);
}
@@ -1647,7 +1647,7 @@
try {
return i.read(b);
} catch (Throwable E) {
- throw new SQLException(Messages.getString("PreparedStatement.56") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.56") //$NON-NLS-1$
+ E.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -1663,7 +1663,7 @@
return i.read(b, 0, lengthToRead);
} catch (Throwable E) {
- throw new SQLException(Messages.getString("PreparedStatement.55") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.55") //$NON-NLS-1$
+ E.getClass().getName(), SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -1801,7 +1801,7 @@
} else {
if ((parameterIndex < 1)
|| (parameterIndex > this.staticSqlStrings.length)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("PreparedStatement.2") //$NON-NLS-1$
+ parameterIndex
+ Messages.getString("PreparedStatement.3") + this.staticSqlStrings.length + Messages.getString("PreparedStatement.4"), //$NON-NLS-1$ //$NON-NLS-2$
@@ -2093,7 +2093,7 @@
0,
numCharsRead).getBytes(forcedEncoding));
} catch (UnsupportedEncodingException uee) {
- throw new SQLException("Unsupported character encoding " +
+ throw SQLError.createSQLException("Unsupported character encoding " +
forcedEncoding, SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
@@ -2113,14 +2113,14 @@
setBytes(parameterIndex,
buf.toString().getBytes(forcedEncoding));
} catch (UnsupportedEncodingException uee) {
- throw new SQLException("Unsupported character encoding " +
+ throw SQLError.createSQLException("Unsupported character encoding " +
forcedEncoding, SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
}
}
} catch (java.io.IOException ioEx) {
- throw new SQLException(ioEx.toString(),
+ throw SQLError.createSQLException(ioEx.toString(),
SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -2152,7 +2152,7 @@
setBytes(i, x.getSubString(1L,
(int)x.length()).getBytes(forcedEncoding));
} catch (UnsupportedEncodingException uee) {
- throw new SQLException("Unsupported character encoding " +
+ throw SQLError.createSQLException("Unsupported character encoding " +
forcedEncoding, SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
@@ -2219,7 +2219,7 @@
if (!this.connection.getAllowNanAndInf()
&& (x == Double.POSITIVE_INFINITY
|| x == Double.NEGATIVE_INFINITY || Double.isNaN(x))) {
- throw new SQLException("'" + x
+ throw SQLError.createSQLException("'" + x
+ "' is not a valid numeric or approximate numeric value",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -2265,17 +2265,17 @@
private final void setInternal(int paramIndex, byte[] val)
throws SQLException {
if (this.isClosed) {
- throw new SQLException(Messages.getString("PreparedStatement.48"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.48"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if ((paramIndex < 1)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("PreparedStatement.49") //$NON-NLS-1$
+ paramIndex
+ Messages.getString("PreparedStatement.50"), SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
} else if (paramIndex > this.parameterCount) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("PreparedStatement.51") //$NON-NLS-1$
+ paramIndex
+ Messages.getString("PreparedStatement.52") + (this.parameterValues.length) + Messages.getString("PreparedStatement.53"), //$NON-NLS-1$ //$NON-NLS-2$
@@ -2458,7 +2458,7 @@
.setScale(scale,
BigDecimal.ROUND_HALF_UP);
} catch (ArithmeticException arEx) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Can't set scale of '"
+ scale
+ "' for DECIMAL argument '"
@@ -2632,7 +2632,7 @@
break;
} else {
- throw new SQLException("No conversion from " + parameterObj.getClass().getName() +
+ throw SQLError.createSQLException("No conversion from " + parameterObj.getClass().getName() +
" to Types.BOOLEAN possible.", SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -2761,7 +2761,7 @@
break;
default:
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("PreparedStatement.16"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -2770,7 +2770,7 @@
throw (SQLException) ex;
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("PreparedStatement.17") //$NON-NLS-1$
+ parameterObj.getClass().toString()
+ Messages.getString("PreparedStatement.18") //$NON-NLS-1$
@@ -2854,7 +2854,7 @@
ByteArrayInputStream bytesIn = new ByteArrayInputStream(buf);
setBinaryStream(parameterIndex, bytesIn, buf.length);
} catch (Exception ex) {
- throw new SQLException(Messages.getString("PreparedStatement.54") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("PreparedStatement.54") //$NON-NLS-1$
+ ex.getClass().getName(),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSet.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSet.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSet.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -442,7 +442,7 @@
b = false;
} else {
if (row == 0) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Cannot_absolute_position_to_row_0_110"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -636,7 +636,7 @@
*/
protected final synchronized void checkClosed() throws SQLException {
if (this.isClosed) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Operation_not_allowed_after_ResultSet_closed_144"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
@@ -654,7 +654,7 @@
*/
protected final void checkColumnBounds(int columnIndex) throws SQLException {
if ((columnIndex < 1) || (columnIndex > this.fields.length)) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range", new Object[] {
new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -677,20 +677,20 @@
checkClosed();
if (!this.rowData.isDynamic() && (this.rowData.size() == 0)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Illegal_operation_on_empty_result_set"),
SQLError.SQL_STATE_GENERAL_ERROR);
}
if (this.rowData.isBeforeFirst()) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Before_start_of_result_set_146"),
SQLError.SQL_STATE_GENERAL_ERROR); //$NON-NLS-1$
}
if (this.rowData.isAfterLast()) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.After_end_of_result_set_148"),
SQLError.SQL_STATE_GENERAL_ERROR); //$NON-NLS-1$
}
@@ -744,7 +744,7 @@
return 0;
}
- throw new SQLException("Can't convert empty string ('') to numeric",
+ throw SQLError.createSQLException("Can't convert empty string ('') to numeric",
SQLError.SQL_STATE_INVALID_CHARACTER_VALUE_FOR_CAST);
}
@@ -823,7 +823,7 @@
}
}
} catch (java.io.UnsupportedEncodingException E) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Unsupported_character_encoding____138") //$NON-NLS-1$
+ this.connection.getEncoding() + "'.", "0S100");
@@ -936,7 +936,7 @@
}
}
- throw new SQLException(Messages.getString("ResultSet.Column____112")
+ throw SQLError.createSQLException(Messages.getString("ResultSet.Column____112")
+ columnName
+ Messages.getString("ResultSet.___not_found._113"), //$NON-NLS-1$ //$NON-NLS-2$
SQLError.SQL_STATE_COLUMN_NOT_FOUND);
@@ -1095,7 +1095,7 @@
return val;
} catch (NumberFormatException ex) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Bad_format_for_BigDecimal",
new Object[] { stringVal,
new Integer(columnIndex) }),
@@ -1147,7 +1147,7 @@
return val
.setScale(scale, BigDecimal.ROUND_HALF_UP);
} catch (ArithmeticException arEx) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____124") //$NON-NLS-1$
+ stringVal
@@ -1165,7 +1165,7 @@
try {
val = new BigDecimal(stringVal);
} catch (NumberFormatException ex) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Bad_format_for_BigDecimal",
new Object[] { new Integer(columnIndex),
stringVal }),
@@ -1178,7 +1178,7 @@
try {
return val.setScale(scale, BigDecimal.ROUND_HALF_UP);
} catch (ArithmeticException arithEx) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Bad_format_for_BigDecimal",
new Object[] { new Integer(columnIndex),
stringVal }),
@@ -1253,7 +1253,7 @@
return new BigDecimal(stringVal).setScale(scale,
BigDecimal.ROUND_HALF_UP);
} catch (ArithmeticException arEx) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____166") //$NON-NLS-1$
+ stringVal
@@ -1265,7 +1265,7 @@
}
}
} catch (NumberFormatException ex) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____166") //$NON-NLS-1$
+ stringVal
@@ -1344,7 +1344,7 @@
checkRowPos();
if ((columnIndex < 1) || (columnIndex > this.fields.length)) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range", new Object[] {
new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -1550,7 +1550,7 @@
return (byte) valueAsLong;
} catch (NumberFormatException NFE) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("ResultSet.Value____173")
+ stringVal //$NON-NLS-1$
+ Messages
@@ -1592,7 +1592,7 @@
} catch (NullPointerException E) {
this.wasNullFlag = true;
} catch (ArrayIndexOutOfBoundsException aioobEx) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range", new Object[] {
new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -1792,7 +1792,7 @@
* if a database access error occurs
*/
public String getCursorName() throws SQLException {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Positioned_Update_not_supported"),
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE); //$NON-NLS-1$
}
@@ -1905,7 +1905,7 @@
return null;
} else if (ConnectionProperties.ZERO_DATETIME_BEHAVIOR_EXCEPTION
.equals(this.connection.getZeroDateTimeBehavior())) {
- throw new SQLException("Value '" + stringVal
+ throw SQLError.createSQLException("Value '" + stringVal
+ "' can not be represented as java.sql.Date",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -1973,7 +1973,7 @@
}
default:
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Bad_format_for_Date", new Object[] {
stringVal, new Integer(columnIndex) }),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
@@ -1997,7 +1997,7 @@
return fastDateCreate(null, 1970, 1, 1); // Return EPOCH
} else {
if (stringVal.length() < 10) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Bad_format_for_Date", new Object[] {
stringVal, new Integer(columnIndex) }),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
@@ -2021,7 +2021,7 @@
} catch (SQLException sqlEx) {
throw sqlEx; // don't re-wrap
} catch (Exception e) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Bad_format_for_Date", new Object[] { stringVal,
new Integer(columnIndex) }),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
@@ -2143,7 +2143,7 @@
return d;
} catch (NumberFormatException e) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Bad_format_for_number", new Object[] {
stringVal, new Integer(colIndex) }),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -2265,7 +2265,7 @@
; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getFloat()_-____200")
+ val //$NON-NLS-1$
@@ -2299,7 +2299,7 @@
} catch (NullPointerException E) {
this.wasNullFlag = true;
} catch (ArrayIndexOutOfBoundsException aioobEx) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range",
new Object[] { new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -2340,7 +2340,7 @@
; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getInt()_-____74")
+ new String(intAsBytes) //$NON-NLS-1$
@@ -2377,7 +2377,7 @@
; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getInt()_-____74")
+ val //$NON-NLS-1$
@@ -2466,7 +2466,7 @@
; // ignore, it's not a number
}
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Invalid_value_for_getInt()_-____206")
+ val //$NON-NLS-1$
+ Messages.getString("ResultSet.___in_column__207")
@@ -2499,7 +2499,7 @@
} catch (NullPointerException E) {
this.wasNullFlag = true;
} catch (ArrayIndexOutOfBoundsException aioobEx) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range",
new Object[] { new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -2540,7 +2540,7 @@
// ; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getLong()_-____79")
+ new String(longAsBytes) //$NON-NLS-1$
@@ -2577,7 +2577,7 @@
// ; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getLong()_-____79")
+ val //$NON-NLS-1$
@@ -2629,7 +2629,7 @@
; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getLong()_-____211")
+ val //$NON-NLS-1$
@@ -2758,7 +2758,7 @@
try {
return val.setScale(scale, BigDecimal.ROUND_HALF_UP);
} catch (ArithmeticException arEx) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____124") //$NON-NLS-1$
+ stringVal
@@ -2774,7 +2774,7 @@
try {
val = new BigDecimal(stringVal);
} catch (NumberFormatException ex) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____119") //$NON-NLS-1$
+ stringVal
@@ -2790,7 +2790,7 @@
try {
return val.setScale(scale, BigDecimal.ROUND_HALF_UP);
} catch (ArithmeticException arEx) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____124") //$NON-NLS-1$
+ stringVal
@@ -3317,7 +3317,7 @@
try {
val = new BigDecimal(stringVal);
} catch (NumberFormatException ex) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____86") //$NON-NLS-1$
+ stringVal
@@ -3362,7 +3362,7 @@
objIn.close();
bytesIn.close();
} catch (ClassNotFoundException cnfe) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Class_not_found___91") //$NON-NLS-1$
+ cnfe.toString()
@@ -3519,7 +3519,7 @@
return null;
} else if (ConnectionProperties.ZERO_DATETIME_BEHAVIOR_EXCEPTION
.equals(this.connection.getZeroDateTimeBehavior())) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Value '0000-00-00' can not be represented as java.sql.Date",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -4010,7 +4010,7 @@
checkColumnBounds(columnIndex);
if (this.fields == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Query_generated_no_fields_for_ResultSet_133"), //$NON-NLS-1$
SQLError.SQL_STATE_INVALID_COLUMN_NUMBER);
@@ -4182,7 +4182,7 @@
return null;
} else if (ConnectionProperties.ZERO_DATETIME_BEHAVIOR_EXCEPTION
.equals(this.connection.getZeroDateTimeBehavior())) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Value '0000-00-00' can not be represented as java.sql.Timestamp",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -4268,7 +4268,7 @@
try {
return new URL(val);
} catch (MalformedURLException mfe) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Malformed_URL____141")
+ val + "'", SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -4316,7 +4316,7 @@
return null;
}
} catch (ArrayIndexOutOfBoundsException aioobEx) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range", new Object[] {
new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -4407,7 +4407,7 @@
try {
return new BigInteger(stringVal);
} catch (NumberFormatException nfe) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Bad_format_for_BigInteger", new Object[] {
new Integer(columnIndex), stringVal }),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
@@ -4429,7 +4429,7 @@
try {
val = new BigDecimal(stringVal);
} catch (NumberFormatException ex) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____86") //$NON-NLS-1$
+ stringVal
@@ -4489,7 +4489,7 @@
objIn.close();
bytesIn.close();
} catch (ClassNotFoundException cnfe) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Class_not_found___91") //$NON-NLS-1$
+ cnfe.toString()
@@ -4605,7 +4605,7 @@
return null;
}
} catch (ArrayIndexOutOfBoundsException aioobEx) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range", new Object[] {
new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -4663,7 +4663,7 @@
try {
val = new BigDecimal(stringVal);
} catch (NumberFormatException ex) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Bad_format_for_BigDecimal____86") //$NON-NLS-1$
+ stringVal
@@ -4844,7 +4844,7 @@
} catch (NullPointerException E) {
this.wasNullFlag = true;
} catch (ArrayIndexOutOfBoundsException aioobEx) {
- throw new SQLException(Messages.getString(
+ throw SQLError.createSQLException(Messages.getString(
"ResultSet.Column_Index_out_of_range",
new Object[] { new Integer(columnIndex),
new Integer(this.fields.length) }),
@@ -4885,7 +4885,7 @@
; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getShort()_-____96")
+ new String(shortAsBytes) //$NON-NLS-1$
@@ -4924,7 +4924,7 @@
; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getShort()_-____96")
+ val //$NON-NLS-1$
@@ -4976,7 +4976,7 @@
; // ignore, it's not a number
}
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Invalid_value_for_getShort()_-____217")
+ val //$NON-NLS-1$
@@ -4996,7 +4996,7 @@
*/
public java.sql.Statement getStatement() throws SQLException {
if (this.isClosed && !this.retainOwningStatement) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Operation not allowed on closed ResultSet. Statements "
+ "can be retained over result set closure by setting the connection property "
+ "\"retainStatementAfterResultSetClose\" to \"true\".",
@@ -5068,7 +5068,7 @@
asString = new String(asBytes, forcedEncoding);
}
} catch (UnsupportedEncodingException uee) {
- throw new SQLException("Unsupported character encoding " +
+ throw SQLError.createSQLException("Unsupported character encoding " +
forcedEncoding, SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
@@ -5083,7 +5083,7 @@
checkColumnBounds(columnIndex);
if (this.fields == null) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Query_generated_no_fields_for_ResultSet_99"), //$NON-NLS-1$
SQLError.SQL_STATE_INVALID_COLUMN_NUMBER);
@@ -5127,7 +5127,7 @@
}
}
} catch (java.io.UnsupportedEncodingException E) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Unsupported_character_encoding____101") //$NON-NLS-1$
+ encoding + "'.", "0S100");
@@ -5309,7 +5309,7 @@
return null;
} else if (ConnectionProperties.ZERO_DATETIME_BEHAVIOR_EXCEPTION
.equals(this.connection.getZeroDateTimeBehavior())) {
- throw new SQLException("Value '" + timeAsString
+ throw SQLError.createSQLException("Value '" + timeAsString
+ " can not be represented as java.sql.Time",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -5349,7 +5349,7 @@
break;
default:
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Timestamp_too_small_to_convert_to_Time_value_in_column__257") //$NON-NLS-1$
+ columnIndex
@@ -5394,7 +5394,7 @@
// convert a String to a Time
if ((timeAsString.length() != 5)
&& (timeAsString.length() != 8)) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Bad_format_for_Time____267") //$NON-NLS-1$
+ timeAsString
+ Messages.getString("ResultSet.___in_column__268")
@@ -5419,7 +5419,7 @@
tz, rollForward);
}
} catch (Exception ex) {
- throw new SQLException(ex.toString(),
+ throw SQLError.createSQLException(ex.toString(),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
}
@@ -5560,7 +5560,7 @@
return null;
} else if (ConnectionProperties.ZERO_DATETIME_BEHAVIOR_EXCEPTION
.equals(this.connection.getZeroDateTimeBehavior())) {
- throw new SQLException("Value '" + timestampValue
+ throw SQLError.createSQLException("Value '" + timestampValue
+ " can not be represented as java.sql.Timestamp",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -5928,7 +5928,7 @@
try {
return new URL(val);
} catch (MalformedURLException mfe) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Malformed_URL____104")
+ val + "'", SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -5947,7 +5947,7 @@
try {
return new URL(val);
} catch (MalformedURLException mfe) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ResultSet.Malformed_URL____107")
+ val + "'", SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -6233,7 +6233,7 @@
boolean b;
if (!reallyResult()) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.ResultSet_is_from_UPDATE._No_Data_115"),
SQLError.SQL_STATE_GENERAL_ERROR); //$NON-NLS-1$
@@ -6780,7 +6780,7 @@
public void setFetchDirection(int direction) throws SQLException {
if ((direction != FETCH_FORWARD) && (direction != FETCH_REVERSE)
&& (direction != FETCH_UNKNOWN)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Illegal_value_for_fetch_direction_64"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
@@ -6807,7 +6807,7 @@
*/
public void setFetchSize(int rows) throws SQLException {
if (rows < 0) { /* || rows > getMaxRows() */
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages
.getString("ResultSet.Value_must_be_between_0_and_getMaxRows()_66"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -6918,7 +6918,7 @@
datatype = " (JDBC type '" + jdbcType + "')";
}
- throw new SQLException("'" + valueAsString + "' in column '"
+ throw SQLError.createSQLException("'" + valueAsString + "' in column '"
+ columnIndex + "' is outside valid range for the datatype "
+ datatype + ".", SQLError.SQL_STATE_NUMERIC_VALUE_OUT_OF_RANGE);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSetMetaData.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSetMetaData.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/ResultSetMetaData.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -478,7 +478,7 @@
*/
protected Field getField(int columnIndex) throws SQLException {
if ((columnIndex < 1) || (columnIndex > this.fields.length)) {
- throw new SQLException(Messages.getString("ResultSetMetaData.46"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("ResultSetMetaData.46"), //$NON-NLS-1$
SQLError.SQL_STATE_INVALID_COLUMN_NUMBER);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/SQLError.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -863,4 +863,18 @@
return SQL_STATE_GENERAL_ERROR;
}
+
+ public static SQLException createSQLException(String message, String sqlState) {
+ return new SQLException(message, sqlState);
+ }
+
+ public static SQLException createSQLException(String message) {
+ return new SQLException(message);
+ }
+
+ public static SQLException createSQLException(String message,
+ String sqlState,
+ int vendorErrorCode) {
+ return new SQLException(message, sqlState, vendorErrorCode);
+ }
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/ServerPreparedStatement.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -319,7 +319,7 @@
} catch (Exception ex) {
realClose(false, true);
- throw new SQLException(ex.toString(),
+ throw SQLError.createSQLException(ex.toString(),
SQLError.SQL_STATE_GENERAL_ERROR);
}
}
@@ -541,7 +541,7 @@
*/
public synchronized int[] executeBatch() throws SQLException {
if (this.connection.isReadOnly()) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.2") //$NON-NLS-1$
+ Messages.getString("ServerPreparedStatement.3"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -704,7 +704,7 @@
this.connection.getIO().dumpPacketRingBuffer();
}
- SQLException sqlEx = new SQLException(ex.toString(),
+ SQLException sqlEx = SQLError.createSQLException(ex.toString(),
SQLError.SQL_STATE_GENERAL_ERROR);
if (this.connection.getDumpQueriesOnException()) {
@@ -745,7 +745,7 @@
checkClosed();
if (this.parameterBindings.length == 0) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.8"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -754,7 +754,7 @@
if ((parameterIndex < 0)
|| (parameterIndex >= this.parameterBindings.length)) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.9") //$NON-NLS-1$
+ (parameterIndex + 1)
+ Messages.getString("ServerPreparedStatement.10") //$NON-NLS-1$
@@ -935,7 +935,7 @@
// don't wrap SQLExceptions
this.invalidationException = sqlEx;
} catch (Exception ex) {
- this.invalidationException = new SQLException(ex.toString(),
+ this.invalidationException = SQLError.createSQLException(ex.toString(),
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1012,7 +1012,7 @@
if (this.parameterBindings[i].isLongData) {
if (firstFound && boundTimeToCheck !=
this.parameterBindings[i].boundBeforeExecutionNum) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.11") //$NON-NLS-1$
+ Messages.getString("ServerPreparedStatement.12"), //$NON-NLS-1$
SQLError.SQL_STATE_DRIVER_NOT_CAPABLE);
@@ -1033,7 +1033,7 @@
// Check bindings
for (int i = 0; i < this.parameterCount; i++) {
if (!this.parameterBindings[i].isSet) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.13") + (i + 1) //$NON-NLS-1$
+ Messages.getString("ServerPreparedStatement.14"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
@@ -1268,7 +1268,7 @@
} else if (value instanceof Reader) {
storeReader(mysql, parameterIndex, packet, (Reader) value);
} else {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.18") //$NON-NLS-1$
+ value.getClass().getName() + "'", //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -1417,7 +1417,7 @@
} catch (SQLException sqlEx) {
throw sqlEx;
} catch (Exception ex) {
- throw new SQLException(ex.toString(),
+ throw SQLError.createSQLException(ex.toString(),
SQLError.SQL_STATE_GENERAL_ERROR);
} finally {
mysql.clearInputStream();
@@ -1666,7 +1666,7 @@
if (!this.connection.getAllowNanAndInf()
&& (x == Double.POSITIVE_INFINITY
|| x == Double.NEGATIVE_INFINITY || Double.isNaN(x))) {
- throw new SQLException("'" + x
+ throw SQLError.createSQLException("'" + x
+ "' is not a valid numeric or approximate numeric value",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
@@ -2064,7 +2064,7 @@
} catch (UnsupportedEncodingException uEE) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.22") //$NON-NLS-1$
+ this.connection.getEncoding() + "'", //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR);
@@ -2260,7 +2260,7 @@
null);
}
} catch (IOException ioEx) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.24") //$NON-NLS-1$
+ ioEx.toString(), SQLError.SQL_STATE_GENERAL_ERROR);
} finally {
@@ -2325,7 +2325,7 @@
null);
}
} catch (IOException ioEx) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("ServerPreparedStatement.25") //$NON-NLS-1$
+ ioEx.toString(), SQLError.SQL_STATE_GENERAL_ERROR);
} finally {
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/Statement.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -186,7 +186,7 @@
*/
public Statement(Connection c, String catalog) throws SQLException {
if ((c == null) || c.isClosed()) {
- throw new SQLException(Messages.getString("Statement.0"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.0"), //$NON-NLS-1$
SQLError.SQL_STATE_CONNECTION_NOT_OPEN); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -279,7 +279,7 @@
*/
protected void checkClosed() throws SQLException {
if (this.isClosed) {
- throw new SQLException(Messages.getString("Statement.49"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.49"), //$NON-NLS-1$
SQLError.SQL_STATE_CONNECTION_NOT_OPEN); //$NON-NLS-1$
}
}
@@ -307,7 +307,7 @@
|| StringUtils.startsWithIgnoreCaseAndWs(sql, "DROP") //$NON-NLS-1$
|| StringUtils.startsWithIgnoreCaseAndWs(sql, "CREATE") //$NON-NLS-1$
|| StringUtils.startsWithIgnoreCaseAndWs(sql, "ALTER")) { //$NON-NLS-1$
- throw new SQLException(Messages.getString("Statement.57"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.57"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
}
@@ -324,12 +324,12 @@
*/
protected void checkNullOrEmptyQuery(String sql) throws SQLException {
if (sql == null) {
- throw new SQLException(Messages.getString("Statement.59"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.59"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
}
if (sql.length() == 0) {
- throw new SQLException(Messages.getString("Statement.61"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.61"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -447,7 +447,7 @@
isSelect = false;
if (this.connection.isReadOnly()) {
- throw new SQLException(Messages.getString("Statement.27") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.27") //$NON-NLS-1$
+ Messages.getString("Statement.28"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -674,7 +674,7 @@
*/
public synchronized int[] executeBatch() throws SQLException {
if (this.connection.isReadOnly()) {
- throw new SQLException(Messages.getString("Statement.34") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.34") //$NON-NLS-1$
+ Messages.getString("Statement.35"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -859,7 +859,7 @@
* if (!this.results.reallyResult()) { if
* (!this.connection.getAutoCommit()) { this.connection.rollback(); }
*
- * throw new SQLException(Messages.getString("Statement.40"),
+ * throw SQLError.createSQLException(Messages.getString("Statement.40"),
* //$NON-NLS-1$ SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ }
*/
if (cachedMetaData != null) {
@@ -897,13 +897,13 @@
checkClosed();
if (this.connection.isReadOnly()) {
- throw new SQLException(Messages.getString("Statement.42") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.42") //$NON-NLS-1$
+ Messages.getString("Statement.43"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
if (StringUtils.startsWithIgnoreCaseAndWs(sql, "select")) { //$NON-NLS-1$
- throw new SQLException(Messages.getString("Statement.46"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.46"), //$NON-NLS-1$
"01S03"); //$NON-NLS-1$
}
@@ -1322,7 +1322,7 @@
break;
default:
- throw new SQLException(Messages.getString("Statement.19"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.19"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -1713,7 +1713,7 @@
break;
default:
- throw new SQLException(Messages.getString("Statement.5"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.5"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
}
@@ -1736,7 +1736,7 @@
if (((rows < 0) && (rows != Integer.MIN_VALUE))
|| ((this.maxRows != 0) && (this.maxRows != -1) && (rows > this
.getMaxRows()))) {
- throw new SQLException(Messages.getString("Statement.7"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.7"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -1754,7 +1754,7 @@
*/
public synchronized void setMaxFieldSize(int max) throws SQLException {
if (max < 0) {
- throw new SQLException(Messages.getString("Statement.11"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.11"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -1762,7 +1762,7 @@
.getMaxAllowedPacket() : MysqlIO.getMaxBuf();
if (max > maxBuf) {
- throw new SQLException(Messages.getString("Statement.13", //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.13", //$NON-NLS-1$
new Object[] { new Long(maxBuf) }), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -1783,7 +1783,7 @@
*/
public synchronized void setMaxRows(int max) throws SQLException {
if ((max > MysqlDefs.MAX_ROWS) || (max < 0)) {
- throw new SQLException(
+ throw SQLError.createSQLException(
Messages.getString("Statement.15") + max //$NON-NLS-1$
+ " > " //$NON-NLS-1$ //$NON-NLS-2$
+ MysqlDefs.MAX_ROWS + ".", SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1820,7 +1820,7 @@
*/
public void setQueryTimeout(int seconds) throws SQLException {
if (seconds < 0) {
- throw new SQLException(Messages.getString("Statement.21"), //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("Statement.21"), //$NON-NLS-1$
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/StringUtils.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/StringUtils.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/StringUtils.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -392,7 +392,7 @@
return b;
} catch (UnsupportedEncodingException uee) {
- throw new SQLException(Messages.getString("StringUtils.5") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("StringUtils.5") //$NON-NLS-1$
+ encoding + Messages.getString("StringUtils.6"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -436,7 +436,7 @@
return b;
} catch (UnsupportedEncodingException uee) {
- throw new SQLException(Messages.getString("StringUtils.10") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("StringUtils.10") //$NON-NLS-1$
+ encoding + Messages.getString("StringUtils.11"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -452,7 +452,7 @@
return getBytes(c, converter, encoding, serverEncoding,
parserKnowsUnicode);
} catch (UnsupportedEncodingException uee) {
- throw new SQLException(Messages.getString("StringUtils.0") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("StringUtils.0") //$NON-NLS-1$
+ encoding + Messages.getString("StringUtils.1"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -504,7 +504,7 @@
return b;
} catch (UnsupportedEncodingException uee) {
- throw new SQLException(Messages.getString("StringUtils.5") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("StringUtils.5") //$NON-NLS-1$
+ encoding + Messages.getString("StringUtils.6"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -571,7 +571,7 @@
return b;
} catch (UnsupportedEncodingException uee) {
- throw new SQLException(Messages.getString("StringUtils.10") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("StringUtils.10") //$NON-NLS-1$
+ encoding + Messages.getString("StringUtils.11"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
@@ -603,7 +603,7 @@
return getBytes(s, converter, encoding, serverEncoding,
parserKnowsUnicode);
} catch (UnsupportedEncodingException uee) {
- throw new SQLException(Messages.getString("StringUtils.0") //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("StringUtils.0") //$NON-NLS-1$
+ encoding + Messages.getString("StringUtils.1"),
SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/UpdatableResultSet.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -326,7 +326,7 @@
this.catalog = this.fields[0].getDatabaseName();
if ((this.catalog == null) || (this.catalog.length() == 0)) {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("UpdatableResultSet.43") //$NON-NLS-1$
, SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -417,13 +417,13 @@
}
if (this.onInsertRow) {
- throw new SQLException(Messages.getString("UpdatableResultSet.1")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.1")); //$NON-NLS-1$
} else if (this.rowData.size() == 0) {
- throw new SQLException(Messages.getString("UpdatableResultSet.2")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.2")); //$NON-NLS-1$
} else if (isBeforeFirst()) {
- throw new SQLException(Messages.getString("UpdatableResultSet.3")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.3")); //$NON-NLS-1$
} else if (isAfterLast()) {
- throw new SQLException(Messages.getString("UpdatableResultSet.4")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.4")); //$NON-NLS-1$
}
if (this.deleter == null) {
@@ -471,7 +471,7 @@
this.deleter.executeUpdate();
this.rowData.removeRow(this.rowData.getCurrentRowNumber());
} catch (java.io.UnsupportedEncodingException encodingEx) {
- throw new SQLException(Messages.getString("UpdatableResultSet.39", //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.39", //$NON-NLS-1$
new Object[] { this.charEncoding }) //$NON-NLS-1$
, SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -723,7 +723,7 @@
checkClosed();
if (!this.onInsertRow) {
- throw new SQLException(Messages.getString("UpdatableResultSet.7")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.7")); //$NON-NLS-1$
}
this.inserter.executeUpdate();
@@ -1117,13 +1117,13 @@
}
if (this.onInsertRow) {
- throw new SQLException(Messages.getString("UpdatableResultSet.8")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.8")); //$NON-NLS-1$
} else if (this.rowData.size() == 0) {
- throw new SQLException(Messages.getString("UpdatableResultSet.9")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.9")); //$NON-NLS-1$
} else if (isBeforeFirst()) {
- throw new SQLException(Messages.getString("UpdatableResultSet.10")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.10")); //$NON-NLS-1$
} else if (isAfterLast()) {
- throw new SQLException(Messages.getString("UpdatableResultSet.11")); //$NON-NLS-1$
+ throw SQLError.createSQLException(Messages.getString("UpdatableResultSet.11")); //$NON-NLS-1$
}
if (this.refresher == null) {
@@ -1198,7 +1198,7 @@
}
}
} else {
- throw new SQLException(Messages
+ throw SQLError.createSQLException(Messages
.getString("UpdatableResultSet.12"), //$NON-NLS-1$
SQLError.SQL_STATE_GENERAL_ERROR); //$NON-NLS-1$
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/integration/jboss/MysqlValidConnectionChecker.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/integration/jboss/MysqlValidConnectionChecker.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/integration/jboss/MysqlValidConnectionChecker.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -30,6 +30,8 @@
import org.jboss.resource.adapter.jdbc.ValidConnectionChecker;
+import com.mysql.jdbc.SQLError;
+
/**
* A more efficient connection checker for JBoss.
*
@@ -74,7 +76,7 @@
return (SQLException) ex;
}
- return new SQLException("Ping failed: " + ex.toString());
+ return SQLError.createSQLException("Ping failed: " + ex.toString());
}
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/CallableStatementWrapper.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -74,7 +74,7 @@
((CallableStatement) this.wrappedStmt).registerOutParameter(
parameterIndex, sqlType);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -95,7 +95,7 @@
((CallableStatement) this.wrappedStmt).registerOutParameter(
parameterIndex, sqlType, scale);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -114,7 +114,7 @@
if (this.wrappedStmt != null) {
return ((CallableStatement) this.wrappedStmt).wasNull();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -136,7 +136,7 @@
return ((CallableStatement) this.wrappedStmt)
.getString(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -157,7 +157,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBoolean(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -179,7 +179,7 @@
return ((CallableStatement) this.wrappedStmt)
.getByte(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -201,7 +201,7 @@
return ((CallableStatement) this.wrappedStmt)
.getShort(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -223,7 +223,7 @@
return ((CallableStatement) this.wrappedStmt)
.getInt(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -245,7 +245,7 @@
return ((CallableStatement) this.wrappedStmt)
.getLong(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -267,7 +267,7 @@
return ((CallableStatement) this.wrappedStmt)
.getFloat(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -289,7 +289,7 @@
return ((CallableStatement) this.wrappedStmt)
.getDouble(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -312,7 +312,7 @@
return ((CallableStatement) this.wrappedStmt).getBigDecimal(
parameterIndex, scale);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -334,7 +334,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBytes(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -356,7 +356,7 @@
return ((CallableStatement) this.wrappedStmt)
.getDate(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -378,7 +378,7 @@
return ((CallableStatement) this.wrappedStmt)
.getTime(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -400,7 +400,7 @@
return ((CallableStatement) this.wrappedStmt)
.getTimestamp(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -422,7 +422,7 @@
return ((CallableStatement) this.wrappedStmt)
.getObject(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -444,7 +444,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBigDecimal(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -467,7 +467,7 @@
return ((CallableStatement) this.wrappedStmt).getObject(
parameterIndex, typeMap);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -488,7 +488,7 @@
return ((CallableStatement) this.wrappedStmt)
.getRef(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -510,7 +510,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBlob(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -532,7 +532,7 @@
return ((CallableStatement) this.wrappedStmt)
.getClob(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -553,7 +553,7 @@
return ((CallableStatement) this.wrappedStmt)
.getArray(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -574,7 +574,7 @@
return ((CallableStatement) this.wrappedStmt).getDate(
parameterIndex, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -595,7 +595,7 @@
return ((CallableStatement) this.wrappedStmt).getTime(
parameterIndex, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -617,7 +617,7 @@
return ((CallableStatement) this.wrappedStmt).getTimestamp(
parameterIndex, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -640,7 +640,7 @@
((CallableStatement) this.wrappedStmt).registerOutParameter(
paramIndex, sqlType, typeName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -662,7 +662,7 @@
((CallableStatement) this.wrappedStmt).registerOutParameter(
parameterName, sqlType);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -684,7 +684,7 @@
((CallableStatement) this.wrappedStmt).registerOutParameter(
parameterName, sqlType, scale);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -706,7 +706,7 @@
((CallableStatement) this.wrappedStmt).registerOutParameter(
parameterName, sqlType, typeName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -726,7 +726,7 @@
return ((CallableStatement) this.wrappedStmt)
.getURL(parameterIndex);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -748,7 +748,7 @@
((CallableStatement) this.wrappedStmt).setURL(parameterName,
val);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -768,7 +768,7 @@
((CallableStatement) this.wrappedStmt).setNull(parameterName,
sqlType);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -788,7 +788,7 @@
((CallableStatement) this.wrappedStmt).setBoolean(
parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -808,7 +808,7 @@
((CallableStatement) this.wrappedStmt)
.setByte(parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -828,7 +828,7 @@
((CallableStatement) this.wrappedStmt).setShort(parameterName,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -847,7 +847,7 @@
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setInt(parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -867,7 +867,7 @@
((CallableStatement) this.wrappedStmt)
.setLong(parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -887,7 +887,7 @@
((CallableStatement) this.wrappedStmt).setFloat(parameterName,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -907,7 +907,7 @@
((CallableStatement) this.wrappedStmt).setDouble(parameterName,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -929,7 +929,7 @@
((CallableStatement) this.wrappedStmt).setBigDecimal(
parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -950,7 +950,7 @@
((CallableStatement) this.wrappedStmt).setString(parameterName,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -970,7 +970,7 @@
((CallableStatement) this.wrappedStmt).setBytes(parameterName,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -990,7 +990,7 @@
((CallableStatement) this.wrappedStmt)
.setDate(parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1010,7 +1010,7 @@
((CallableStatement) this.wrappedStmt)
.setTime(parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1032,7 +1032,7 @@
((CallableStatement) this.wrappedStmt).setTimestamp(
parameterName, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1054,7 +1054,7 @@
((CallableStatement) this.wrappedStmt).setAsciiStream(
parameterName, x, length);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1077,7 +1077,7 @@
((CallableStatement) this.wrappedStmt).setBinaryStream(
parameterName, x, length);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1099,7 +1099,7 @@
((CallableStatement) this.wrappedStmt).setObject(parameterName,
x, targetSqlType, scale);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1121,7 +1121,7 @@
((CallableStatement) this.wrappedStmt).setObject(parameterName,
x, targetSqlType);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1142,7 +1142,7 @@
((CallableStatement) this.wrappedStmt).setObject(parameterName,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1164,7 +1164,7 @@
((CallableStatement) this.wrappedStmt).setCharacterStream(
parameterName, reader, length);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1186,7 +1186,7 @@
((CallableStatement) this.wrappedStmt).setDate(parameterName,
x, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1208,7 +1208,7 @@
((CallableStatement) this.wrappedStmt).setTime(parameterName,
x, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1230,7 +1230,7 @@
((CallableStatement) this.wrappedStmt).setTimestamp(
parameterName, x, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1252,7 +1252,7 @@
((CallableStatement) this.wrappedStmt).setNull(parameterName,
sqlType, typeName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1272,7 +1272,7 @@
return ((CallableStatement) this.wrappedStmt)
.getString(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1293,7 +1293,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBoolean(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1315,7 +1315,7 @@
return ((CallableStatement) this.wrappedStmt)
.getByte(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1337,7 +1337,7 @@
return ((CallableStatement) this.wrappedStmt)
.getShort(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1359,7 +1359,7 @@
return ((CallableStatement) this.wrappedStmt)
.getInt(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1381,7 +1381,7 @@
return ((CallableStatement) this.wrappedStmt)
.getLong(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1403,7 +1403,7 @@
return ((CallableStatement) this.wrappedStmt)
.getFloat(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1425,7 +1425,7 @@
return ((CallableStatement) this.wrappedStmt)
.getDouble(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1447,7 +1447,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBytes(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1469,7 +1469,7 @@
return ((CallableStatement) this.wrappedStmt)
.getDate(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1491,7 +1491,7 @@
return ((CallableStatement) this.wrappedStmt)
.getTime(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1513,7 +1513,7 @@
return ((CallableStatement) this.wrappedStmt)
.getTimestamp(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1535,7 +1535,7 @@
return ((CallableStatement) this.wrappedStmt)
.getObject(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1557,7 +1557,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBigDecimal(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1580,7 +1580,7 @@
return ((CallableStatement) this.wrappedStmt).getObject(
parameterName, typeMap);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1601,7 +1601,7 @@
return ((CallableStatement) this.wrappedStmt)
.getRef(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1623,7 +1623,7 @@
return ((CallableStatement) this.wrappedStmt)
.getBlob(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1645,7 +1645,7 @@
return ((CallableStatement) this.wrappedStmt)
.getClob(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1666,7 +1666,7 @@
return ((CallableStatement) this.wrappedStmt)
.getArray(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1687,7 +1687,7 @@
return ((CallableStatement) this.wrappedStmt).getDate(
parameterName, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1708,7 +1708,7 @@
return ((CallableStatement) this.wrappedStmt).getTime(
parameterName, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1730,7 +1730,7 @@
return ((CallableStatement) this.wrappedStmt).getTimestamp(
parameterName, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -1751,7 +1751,7 @@
return ((CallableStatement) this.wrappedStmt)
.getURL(parameterName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -98,7 +98,7 @@
checkClosed();
if (autoCommit && this.isForXa) {
- throw new SQLException("Can't set autocommit to 'true' on an XAConnection",
+ throw SQLError.createSQLException("Can't set autocommit to 'true' on an XAConnection",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -430,7 +430,7 @@
checkClosed();
if (this.isForXa) {
- throw new SQLException("Can't call commit() on an XAConnection",
+ throw SQLError.createSQLException("Can't call commit() on an XAConnection",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -734,7 +734,7 @@
if (this.isForXa) {
- throw new SQLException("Can't call rollback() on an XAConnection",
+ throw SQLError.createSQLException("Can't call rollback() on an XAConnection",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -752,7 +752,7 @@
checkClosed();
if (this.isForXa) {
- throw new SQLException("Can't call rollback() on an XAConnection",
+ throw SQLError.createSQLException("Can't call rollback() on an XAConnection",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -791,7 +791,7 @@
private void checkClosed() throws SQLException {
if (this.closed) {
- throw new SQLException(this.invalidHandleStr);
+ throw SQLError.createSQLException(this.invalidHandleStr);
}
}
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/MysqlPooledConnection.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -34,6 +34,8 @@
import javax.sql.ConnectionEventListener;
import javax.sql.PooledConnection;
+import com.mysql.jdbc.SQLError;
+
/**
* This class is used to wrap and return a physical connection within a logical
* handle. It also registers and notifies ConnectionEventListeners of any
@@ -126,7 +128,7 @@
throws SQLException {
if (this.physicalConn == null) {
- SQLException sqlException = new SQLException(
+ SQLException sqlException = SQLError.createSQLException(
"Physical Connection doesn't exist");
callListener(CONNECTION_ERROR_EVENT, sqlException);
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/PreparedStatementWrapper.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -75,7 +75,7 @@
((PreparedStatement) this.wrappedStmt).setArray(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -97,7 +97,7 @@
((PreparedStatement) this.wrappedStmt).setAsciiStream(
parameterIndex, x, length);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -118,7 +118,7 @@
((PreparedStatement) this.wrappedStmt).setBigDecimal(
parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -140,7 +140,7 @@
((PreparedStatement) this.wrappedStmt).setBinaryStream(
parameterIndex, x, length);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -160,7 +160,7 @@
((PreparedStatement) this.wrappedStmt).setBlob(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -180,7 +180,7 @@
((PreparedStatement) this.wrappedStmt).setBoolean(
parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -200,7 +200,7 @@
((PreparedStatement) this.wrappedStmt).setByte(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -220,7 +220,7 @@
((PreparedStatement) this.wrappedStmt).setBytes(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -242,7 +242,7 @@
((PreparedStatement) this.wrappedStmt).setCharacterStream(
parameterIndex, reader, length);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -262,7 +262,7 @@
((PreparedStatement) this.wrappedStmt).setClob(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -282,7 +282,7 @@
((PreparedStatement) this.wrappedStmt).setDate(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -304,7 +304,7 @@
((PreparedStatement) this.wrappedStmt).setDate(parameterIndex,
x, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -324,7 +324,7 @@
((PreparedStatement) this.wrappedStmt).setDouble(
parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -344,7 +344,7 @@
((PreparedStatement) this.wrappedStmt).setFloat(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -364,7 +364,7 @@
((PreparedStatement) this.wrappedStmt)
.setInt(parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -384,7 +384,7 @@
((PreparedStatement) this.wrappedStmt).setLong(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -404,7 +404,7 @@
return ((PreparedStatement) this.wrappedStmt).getMetaData();
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
} catch (SQLException sqlEx) {
@@ -425,7 +425,7 @@
((PreparedStatement) this.wrappedStmt).setNull(parameterIndex,
sqlType);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -446,7 +446,7 @@
((PreparedStatement) this.wrappedStmt).setNull(parameterIndex,
sqlType, typeName);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -466,7 +466,7 @@
((PreparedStatement) this.wrappedStmt).setObject(
parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -487,7 +487,7 @@
((PreparedStatement) this.wrappedStmt).setObject(
parameterIndex, x, targetSqlType);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -509,7 +509,7 @@
((PreparedStatement) this.wrappedStmt).setObject(
parameterIndex, x, scale);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -530,7 +530,7 @@
.getParameterMetaData();
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
} catch (SQLException sqlEx) {
@@ -551,7 +551,7 @@
((PreparedStatement) this.wrappedStmt)
.setRef(parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -571,7 +571,7 @@
((PreparedStatement) this.wrappedStmt).setShort(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -591,7 +591,7 @@
((PreparedStatement) this.wrappedStmt).setString(
parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -611,7 +611,7 @@
((PreparedStatement) this.wrappedStmt).setTime(parameterIndex,
x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -633,7 +633,7 @@
((PreparedStatement) this.wrappedStmt).setTime(parameterIndex,
x, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -654,7 +654,7 @@
((PreparedStatement) this.wrappedStmt).setTimestamp(
parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -676,7 +676,7 @@
((PreparedStatement) this.wrappedStmt).setTimestamp(
parameterIndex, x, cal);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -696,7 +696,7 @@
((PreparedStatement) this.wrappedStmt)
.setURL(parameterIndex, x);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -729,7 +729,7 @@
((PreparedStatement) this.wrappedStmt).setUnicodeStream(
parameterIndex, x, length);
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -748,7 +748,7 @@
if (this.wrappedStmt != null) {
((PreparedStatement) this.wrappedStmt).addBatch();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -767,7 +767,7 @@
if (this.wrappedStmt != null) {
((PreparedStatement) this.wrappedStmt).clearParameters();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
@@ -787,7 +787,7 @@
return ((PreparedStatement) this.wrappedStmt).execute();
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
} catch (SQLException sqlEx) {
@@ -816,7 +816,7 @@
return rs;
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
} catch (SQLException sqlEx) {
@@ -840,7 +840,7 @@
return ((PreparedStatement) this.wrappedStmt).executeUpdate();
}
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
} catch (SQLException sqlEx) {
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/StatementWrapper.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/StatementWrapper.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/jdbc2/optional/StatementWrapper.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -64,7 +64,7 @@
return this.wrappedConn;
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -86,7 +86,7 @@
if (this.wrappedStmt != null) {
this.wrappedStmt.setCursorName(name);
} else {
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (SQLException sqlEx) {
@@ -104,7 +104,7 @@
if (this.wrappedStmt != null) {
this.wrappedStmt.setEscapeProcessing(enable);
} else {
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (SQLException sqlEx) {
@@ -122,7 +122,7 @@
if (this.wrappedStmt != null) {
this.wrappedStmt.setFetchDirection(direction);
} else {
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (SQLException sqlEx) {
@@ -141,7 +141,7 @@
return this.wrappedStmt.getFetchDirection();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -163,7 +163,7 @@
if (this.wrappedStmt != null) {
this.wrappedStmt.setFetchSize(rows);
} else {
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (SQLException sqlEx) {
@@ -182,7 +182,7 @@
return this.wrappedStmt.getFetchSize();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -204,7 +204,7 @@
return this.wrappedStmt.getGeneratedKeys();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -226,7 +226,7 @@
if (this.wrappedStmt != null) {
this.wrappedStmt.setMaxFieldSize(max);
} else {
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (SQLException sqlEx) {
@@ -245,7 +245,7 @@
return this.wrappedStmt.getMaxFieldSize();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -266,7 +266,7 @@
if (this.wrappedStmt != null) {
this.wrappedStmt.setMaxRows(max);
} else {
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (SQLException sqlEx) {
@@ -285,7 +285,7 @@
return this.wrappedStmt.getMaxRows();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -307,7 +307,7 @@
return this.wrappedStmt.getMoreResults();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -327,7 +327,7 @@
return this.wrappedStmt.getMoreResults(current);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -346,7 +346,7 @@
if (this.wrappedStmt != null) {
this.wrappedStmt.setQueryTimeout(seconds);
} else {
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} catch (SQLException sqlEx) {
@@ -365,7 +365,7 @@
return this.wrappedStmt.getQueryTimeout();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -389,7 +389,7 @@
return rs;
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -409,7 +409,7 @@
return this.wrappedStmt.getResultSetConcurrency();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -429,7 +429,7 @@
return this.wrappedStmt.getResultSetHoldability();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -449,7 +449,7 @@
return this.wrappedStmt.getResultSetType();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -469,7 +469,7 @@
return this.wrappedStmt.getUpdateCount();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -489,7 +489,7 @@
return this.wrappedStmt.getWarnings();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -588,7 +588,7 @@
return this.wrappedStmt.execute(sql, autoGeneratedKeys);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -611,7 +611,7 @@
return this.wrappedStmt.execute(sql, columnIndexes);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -635,7 +635,7 @@
return this.wrappedStmt.execute(sql, columnNames);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -658,7 +658,7 @@
return this.wrappedStmt.execute(sql);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -681,7 +681,7 @@
return this.wrappedStmt.executeBatch();
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -708,7 +708,7 @@
return rs;
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -732,7 +732,7 @@
return this.wrappedStmt.executeUpdate(sql, autoGeneratedKeys);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -755,7 +755,7 @@
return this.wrappedStmt.executeUpdate(sql, columnIndexes);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -779,7 +779,7 @@
return this.wrappedStmt.executeUpdate(sql, columnNames);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -801,7 +801,7 @@
return this.wrappedStmt.executeUpdate(sql);
}
- throw new SQLException("Statement already closed",
+ throw SQLError.createSQLException("Statement already closed",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
@@ -818,7 +818,7 @@
((com.mysql.jdbc.Statement) this.wrappedStmt)
.enableStreamingResults();
} else {
- throw new SQLException(
+ throw SQLError.createSQLException(
"No operations allowed after statement closed",
SQLError.SQL_STATE_GENERAL_ERROR);
}
Modified: branches/branch_5_0/connector-j/src/com/mysql/jdbc/log/LogFactory.java
===================================================================
--- branches/branch_5_0/connector-j/src/com/mysql/jdbc/log/LogFactory.java 2005-10-31 01:01:06 UTC (rev 4488)
+++ branches/branch_5_0/connector-j/src/com/mysql/jdbc/log/LogFactory.java 2005-11-01 00:43:01 UTC (rev 4489)
@@ -55,12 +55,12 @@
throws SQLException {
if (className == null) {
- throw new SQLException("Logger class can not be NULL",
+ throw SQLError.createSQLException("Logger class can not be NULL",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
if (instanceName == null) {
- throw new SQLException("Logger instance name can not be NULL",
+ throw SQLError.createSQLException("Logger instance name can not be NULL",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
@@ -71,26 +71,26 @@
return (Log) constructor.newInstance(new Object[] { instanceName });
} catch (ClassNotFoundException cnfe) {
- throw new SQLException("Unable to load class for logger '"
+ throw SQLError.createSQLException("Unable to load class for logger '"
+ className + "'", SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (NoSuchMethodException nsme) {
- throw new SQLException(
+ throw SQLError.createSQLException(
"Logger class does not have a single-arg constructor that takes an instance name",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (InstantiationException inse) {
- throw new SQLException("Unable to instantiate logger class '"
+ throw SQLError.createSQLException("Unable to instantiate logger class '"
+ className + "', exception in constructor?",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (InvocationTargetException ite) {
- throw new SQLException("Unable to instantiate logger class '"
+ throw SQLError.createSQLException("Unable to instantiate logger class '"
+ className + "', exception in constructor?",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (IllegalAccessException iae) {
- throw new SQLException("Unable to instantiate logger class '"
+ throw SQLError.createSQLException("Unable to instantiate logger class '"
+ className + "', constructor not public",
SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
} catch (ClassCastException cce) {
- throw new SQLException("Logger class '" + className
+ throw SQLError.createSQLException("Logger class '" + className
+ "' does not implement the '" + Log.class.getName()
+ "' interface", SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
| Thread |
|---|
| • Connector/J commit: r4489 - in branches/branch_5_0/connector-j: . src/com/mysql/jdbc src/com/mysql/jdbc/integration/jboss src/com/mysql/jdbc/jdbc2/opt... | mmatthews | 1 Nov |