diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java
index a6054b1fc..e0e4eebbf 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java
@@ -485,17 +485,22 @@ CallableStatement prepareCall(String sql, int nType, int nConcur, int nHold,
/**
* Get Currently installed message handler on the connection
- * @see {@link ISQLServerMessageHandler#messageHandler(ISQLServerMessage)}
- * @return
+ *
+ * @see ISQLServerMessageHandler#messageHandler(ISQLServerMessage)
+ * @return ISQLServerMessageHandler
*/
ISQLServerMessageHandler getServerMessageHandler();
/**
* Set message handler on the connection
- * @see {@link ISQLServerMessageHandler#messageHandler(ISQLServerMessage)}
+ *
+ * @param messageHandler
+ * message handler
+ *
+ * @see ISQLServerMessageHandler#messageHandler(ISQLServerMessage)
*/
ISQLServerMessageHandler setServerMessageHandler(ISQLServerMessageHandler messageHandler);
-
+
/**
* Returns the current flag for calcBigDecimalPrecision.
*
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerMessage.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerMessage.java
index 055e812b2..622b865c3 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerMessage.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerMessage.java
@@ -6,8 +6,11 @@
import java.sql.SQLException;
-public interface ISQLServerMessage
-{
+
+/**
+ * Provides an interface SQLServerMessage
+ */
+public interface ISQLServerMessage {
/**
* Returns SQLServerError containing detailed info about SQL Server Message as received from SQL Server.
*
@@ -67,16 +70,18 @@ public interface ISQLServerMessage
/**
* Creates a SQLServerException or SQLServerWarning from this SQLServerMessage
+ *
* @return
- *
RAISERROR ('Progress message...', 0, 1) WITH NOWAIT
RAISERROR ('Progress message...', 0, 1) WITH NOWAIT
* For example code, see {@link #messageHandler(ISQLServerMessage)} */ -public interface ISQLServerMessageHandler -{ +public interface ISQLServerMessageHandler { /** - * You can use the ISQLServerMessageHandler interface to customize the way JDBC handles error messages generated by the SQL Server. + * You can use the ISQLServerMessageHandler interface to customize the way JDBC handles error messages generated by the SQL Server. * Implementing ISQLServerMessageHandler in your own class for handling error messages can provide the following benefits: *
RAISERROR ('Progress message...', 0, 1) WITH NOWAIT
RAISERROR ('Progress message...', 0, 1) WITH NOWAIT
- * public ISQLServerMessage messageHandler(ISQLServerMessage serverErrorOrWarning) - * { - * ISQLServerMessage retObj = serverErrorOrWarning; + * public ISQLServerMessage messageHandler(ISQLServerMessage serverErrorOrWarning) { + * ISQLServerMessage retObj = serverErrorOrWarning; * - * if (serverErrorOrWarning.isErrorMessage()) { + * if (serverErrorOrWarning.isErrorMessage()) { * - * // Downgrade: 2601 -- Cannot insert duplicate key row... - * if (2601 == serverErrorOrWarning.getErrorNumber()) { - * retObj = serverErrorOrWarning.getSQLServerMessage().toSQLServerInfoMessage(); - * } + * // Downgrade: 2601 -- Cannot insert duplicate key row... + * if (2601 == serverErrorOrWarning.getErrorNumber()) { + * retObj = serverErrorOrWarning.getSQLServerMessage().toSQLServerInfoMessage(); + * } * - * // Discard: 3701 -- Cannot drop the table ... - * if (3701 == serverErrorOrWarning.getErrorNumber()) { - * retObj = null; - * } - * } + * // Discard: 3701 -- Cannot drop the table ... + * if (3701 == serverErrorOrWarning.getErrorNumber()) { + * retObj = null; + * } + * } * - * return retObj; - * } - + * return retObj; + * } + * ** * @param serverErrorOrWarning - * @return - *
* This is later on used when creating a SQLServerException.
- * This simply create a SQLServerInfoMessage from this SQLServerError,
- * without changing the message content.
- * @return
+ * This simply create a SQLServerInfoMessage from this SQLServerError,
+ * without changing the message content.
+ *
+ * @return ISQLServerMessage
*/
- public ISQLServerMessage toSQLServerInfoMessage()
- {
+ public ISQLServerMessage toSQLServerInfoMessage() {
return toSQLServerInfoMessage(-1, -1);
}
/**
* Downgrade a Error message into a Info message
*
- * This simply create a SQLServerInfoMessage from this SQLServerError,
+ * This simply create a SQLServerInfoMessage from this SQLServerError,
*
- * @param newErrorSeverity - The new ErrorSeverity
+ * @param newErrorSeverity
+ * - The new ErrorSeverity
*
- * @return
+ * @return ISQLServerMessage
*/
- public ISQLServerMessage toSQLServerInfoMessage(int newErrorSeverity)
- {
+ public ISQLServerMessage toSQLServerInfoMessage(int newErrorSeverity) {
return toSQLServerInfoMessage(newErrorSeverity, -1);
}
/**
* Downgrade a Error message into a Info message
*
- * This simply create a SQLServerInfoMessage from this SQLServerError,
+ * This simply create a SQLServerInfoMessage from this SQLServerError,
*
- * @param newErrorSeverity - If you want to change the ErrorSeverity (-1: leave unchanged)
- * @param newErrorNumber - If you want to change the ErrorNumber (-1: leave unchanged)
+ * @param newErrorSeverity
+ * - If you want to change the ErrorSeverity (-1: leave unchanged)
+ * @param newErrorNumber
+ * - If you want to change the ErrorNumber (-1: leave unchanged)
*
- * @return
+ * @return ISQLServerMessage
*/
- public ISQLServerMessage toSQLServerInfoMessage(int newErrorSeverity, int newErrorNumber)
- {
+ public ISQLServerMessage toSQLServerInfoMessage(int newErrorSeverity, int newErrorNumber) {
if (newErrorSeverity != -1) {
this.setErrorSeverity(newErrorSeverity);
}
@@ -331,25 +329,26 @@ public ISQLServerMessage toSQLServerInfoMessage(int newErrorSeverity, int newErr
/**
* Set a new ErrorSeverity for this Message
+ *
* @param newSeverity
+ * new severity
*/
- public void setErrorSeverity(int newSeverity)
- {
+ public void setErrorSeverity(int newSeverity) {
this.errorSeverity = newSeverity;
}
/**
* Set a new ErrorNumber for this Message
- * @param newSeverity
+ *
+ * @param newErrorNumber
+ * new error number
*/
- public void setErrorNumber(int newErrorNumber)
- {
+ public void setErrorNumber(int newErrorNumber) {
this.errorNumber = newErrorNumber;
}
-
+
@Override
- public SQLException toSqlExceptionOrSqlWarning()
- {
+ public SQLException toSqlExceptionOrSqlWarning() {
return new SQLServerException(this);
}
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerInfoMessage.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerInfoMessage.java
index 8b6579491..0b3a6075a 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerInfoMessage.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerInfoMessage.java
@@ -7,10 +7,11 @@
import java.sql.SQLException;
+
/**
* Holds information about SQL Server messages that is considered as Informational Messages (normally if SQL Server Severity is at 10)
*
- * Instead of just holding the SQL Server message (like a normal SQLWarning, it also holds all the
+ * Instead of just holding the SQL Server message (like a normal SQLWarning, it also holds all the
* SQL Servers extended information, like: ErrorSeverity, ServerName, ProcName etc
*
* This enables client to print out extra information about the message.
- * This simply create a SQLServerError from this SQLServerInfoMessage,
- * without changing the message content.
- * @return
+ * This simply create a SQLServerError from this SQLServerInfoMessage,
+ * without changing the message content.
+ *
+ * @return ISQLServerMessage
*/
- public ISQLServerMessage toSQLServerError()
- {
+ public ISQLServerMessage toSQLServerError() {
return toSQLServerError(-1, -1);
}
/**
* Upgrade a Info message into a Error message
*
- * This simply create a SQLServerError from this SQLServerInfoMessage.
+ * This simply create a SQLServerError from this SQLServerInfoMessage.
*
- * @param newErrorSeverity - The new ErrorSeverity
+ * @param newErrorSeverity
+ * - The new ErrorSeverity
*
- * @return
+ * @return ISQLServerMessage
*/
- public ISQLServerMessage toSQLServerError(int newErrorSeverity)
- {
+ public ISQLServerMessage toSQLServerError(int newErrorSeverity) {
return toSQLServerError(newErrorSeverity, -1);
}
/**
* Upgrade a Info message into a Error message
*
- * This simply create a SQLServerError from this SQLServerInfoMessage.
+ * This simply create a SQLServerError from this SQLServerInfoMessage.
*
- * @param newErrorSeverity - If you want to change the ErrorSeverity (-1: leave unchanged)
- * @param newErrorNumber - If you want to change the ErrorNumber (-1: leave unchanged)
+ * @param newErrorSeverity
+ * - If you want to change the ErrorSeverity (-1: leave unchanged)
+ * @param newErrorNumber
+ * - If you want to change the ErrorNumber (-1: leave unchanged)
*
- * @return
+ * @return ISQLServerMessage
*/
- public ISQLServerMessage toSQLServerError(int newErrorSeverity, int newErrorNumber)
- {
+ public ISQLServerMessage toSQLServerError(int newErrorSeverity, int newErrorNumber) {
if (newErrorSeverity != -1) {
this.msg.setErrorSeverity(newErrorSeverity);
}
@@ -129,8 +129,7 @@ public ISQLServerMessage toSQLServerError(int newErrorSeverity, int newErrorNumb
}
@Override
- public SQLException toSqlExceptionOrSqlWarning()
- {
+ public SQLException toSqlExceptionOrSqlWarning() {
return new SQLServerWarning(this.msg);
}
}
diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
index 294a1aa87..4274e6913 100644
--- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
+++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
@@ -71,10 +71,13 @@ public class SQLServerPreparedStatement extends SQLServerStatement implements IS
/** Processed SQL statement text, may not be same as what user initially passed. */
final String userSQL;
+ // flag whether is exec escape syntax
private boolean isExecEscapeSyntax;
+ // flag whether is call escape syntax
private boolean isCallEscapeSyntax;
+ // flag whether is four part syntax
private boolean isFourPartSyntax;
/** Parameter positions in processed SQL statement text. */
* Where all entries in the errorChain will be added {@link java.sql.SQLException#setNextException(SQLException)}
*/
private List
@@ -46,77 +47,76 @@ public SQLServerError getSQLServerMessage() {
public String getErrorMessage() {
return msg.getErrorMessage();
}
-
+
@Override
public int getErrorNumber() {
return msg.getErrorNumber();
}
-
+
@Override
public int getErrorState() {
return msg.getErrorState();
}
-
+
@Override
public int getErrorSeverity() {
return msg.getErrorSeverity();
}
-
+
@Override
public String getServerName() {
return msg.getServerName();
}
-
+
@Override
- public String getProcedureName()
- {
+ public String getProcedureName() {
return msg.getProcedureName();
}
-
+
@Override
- public long getLineNumber()
- {
+ public long getLineNumber() {
return msg.getLineNumber();
}
/**
* Upgrade a Info message into a Error message
*