diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/DataTypes.java b/src/main/java/com/microsoft/sqlserver/jdbc/DataTypes.java index 9af5d640c..66f71bac9 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/DataTypes.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/DataTypes.java @@ -531,11 +531,11 @@ static JavaType of(Object obj) { return JavaType.OBJECT; } - // Retrieve JDBC to use with this Java type. By default we use the static JDBC type - // associated with the Java type, ignoring the JDBC type specified by the application. - // But this behavior is overridden for certain Java types, like InputStream, which - // require the JDBC type to be specified externally to be able to distinguish between - // ASCII and binary streams. + /** + * Returns the JDBC type to use with this Java type. We use the static JDBC type associated with the Java type by + * default, ignoring the JDBC type specified by the application. This behavior is overridden for certain Java types, + * such as InputStream, which requires the JDBC type to be specified externally in order to distinguish between. + */ JDBCType getJDBCType(SSType ssType, JDBCType jdbcTypeFromApp) { return jdbcTypeFromJavaType; } @@ -677,7 +677,7 @@ private JDBCType(Category category, int intValue, String className) { } /** - * Gets the integer value of JDBCType + * Returns the integer value of JDBCType. * * @return integer representation of JDBCType */ @@ -916,7 +916,7 @@ static JDBCType of(int intValue) throws SQLServerException { } /** - * Identify numerically signed data types. + * Identifies numerically signed data types. * * @return true if the type can be signed */ @@ -928,7 +928,7 @@ boolean isSigned() { } /** - * Identify binary JDBC data types. + * Identifies binary JDBC data types. * * @return true if the JDBC type is binary */ @@ -939,7 +939,7 @@ boolean isBinary() { } /** - * Identify textual JDBC data types -- those types for which conversion from another type is simply a matter of + * Identifies textual JDBC data types -- those types for which conversion from another type is simply a matter of * representing that type as a string. * * Note: SQLXML does not qualify as a "textual" type in this context. That is, calling, for example, @@ -955,7 +955,7 @@ boolean isTextual() { } /** - * Identify unsupported JDBC data types. + * Returns if datat types are supported by JDBC. * * @param jdbcType * the JDBC type to check @@ -993,7 +993,7 @@ int asJavaSqlType() { } /* - * Used for verifying if a data type can be normalized for AE + * Used for verifying if a data type can be normalized for AE. */ enum NormalizationAE { CHARACTER_NORMALIZED_TO(JDBCType.CHAR, EnumSet.of(SSType.CHAR, SSType.VARCHAR, SSType.VARCHARMAX)), @@ -1093,51 +1093,53 @@ static final void throwConversionError(String fromType, String toType) throws SQ SQLServerException.makeFromDriverError(null, null, form.format(msgArgs), null, true); } - // Max length in Unicode characters allowed by the "short" NVARCHAR type. - // Values longer than this must use NVARCHAR(max) (Yukon or later) or NTEXT (Shiloh) + /** + * Max length in Unicode characters allowed by the "short" NVARCHAR type. Values longer than this must use + * NVARCHAR(max) (Yukon or later) or NTEXT (Shiloh) + */ final static int SHORT_VARTYPE_MAX_CHARS = 4000; - // Max length in bytes allowed by the "short" VARBINARY/VARCHAR types. - // Values longer than this must use VARBINARY(max)/VARCHAR(max) (Yukon or later) or IMAGE/TEXT (Shiloh) + /** + * Max length in bytes allowed by the "short" VARBINARY/VARCHAR types. Values longer than this must use + * VARBINARY(max)/VARCHAR(max) (Yukon or later) or IMAGE/TEXT (Shiloh) + */ final static int SHORT_VARTYPE_MAX_BYTES = 8000; - // A type with unlimited max size, known as varchar(max), varbinary(max) and nvarchar(max), - // which has a max size of 0xFFFF, defined by PARTLENTYPE. + /** + * A type with unlimited max size, known as varchar(max), varbinary(max) and nvarchar(max), which has a max size of + * 0xFFFF, defined by PARTLENTYPE. + */ final static int SQL_USHORTVARMAXLEN = 65535; // 0xFFFF - // From SQL Server 2005 Books Online : ntext, text, and image (Transact-SQL) - // http://msdn.microsoft.com/en-us/library/ms187993.aspx - // - // image - // "... through 2^31 - 1 (2,147,483,687) bytes." - // - // text - // "... maximum length of 2^31 - 1 (2,147,483,687) characters." - // - // ntext - // "... maximum length of 2^30 - 1 (1,073,741,823) characters." + /** + * From SQL Server 2005 Books Online : ntext, text, and image (Transact-SQL) + * http://msdn.microsoft.com/en-us/library/ms187993.aspx + * + * image "... through 2^31 - 1 (2,147,483,687) bytes." + * + * text "... maximum length of 2^31 - 1 (2,147,483,687) characters." + * + * ntext "... maximum length of 2^30 - 1 (1,073,741,823) characters." + */ final static int NTEXT_MAX_CHARS = 0x3FFFFFFF; final static int IMAGE_TEXT_MAX_BYTES = 0x7FFFFFFF; - // From SQL Server 2005 Books Online : Transact-SQL Data Types - // http://msdn.microsoft.com/en-us/library/ms179910.aspx - // - // varbinary(max) - // "max indicates that the maximum storage size is 2^31 - 1 bytes. The storage size is the actual - // length of the data entered + 2 bytes." - // - // varchar(max) - // "max indicates that the maximum storage size is 2^31 - 1 bytes. The storage size is the actual - // length of the data entered + 2 bytes." - // - // nvarchar(max) - // "max indicates that the maximum storage size is 2^31 - 1 bytes. The storage size, in bytes, - // is two times the number of characters entered + 2 bytes." - // - // Normally, that would mean that the maximum length of nvarchar(max) data is 0x3FFFFFFE characters - // and that the maximum length of varchar(max) or varbinary(max) data is 0x3FFFFFFD bytes. However... - // Despite the documentation, SQL Server returns 2^30 - 1 and 2^31 - 1 respectively as the PRECISION - // of these types, so use that instead. + /** + * Transact-SQL Data Types: http://msdn.microsoft.com/en-us/library/ms179910.aspx + * + * varbinary(max) "max indicates that the maximum storage size is 2^31 - 1 bytes. The storage size is the actual + * length of the data entered + 2 bytes." + * + * varchar(max) "max indicates that the maximum storage size is 2^31 - 1 bytes. The storage size is the actual + * length of the data entered + 2 bytes." + * + * nvarchar(max) "max indicates that the maximum storage size is 2^31 - 1 bytes. The storage size, in bytes, is two + * times the number of characters entered + 2 bytes." + * + * Normally, that would mean that the maximum length of nvarchar(max) data is 0x3FFFFFFE characters and that the + * maximum length of varchar(max) or varbinary(max) data is 0x3FFFFFFD bytes. However... Despite the documentation, + * SQL Server returns 2^30 - 1 and 2^31 - 1 respectively as the PRECISION of these types, so use that instead. + */ final static int MAX_VARTYPE_MAX_CHARS = 0x3FFFFFFF; final static int MAX_VARTYPE_MAX_BYTES = 0x7FFFFFFF; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerBulkRecord.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerBulkRecord.java index 3df14c51b..1f347cac9 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerBulkRecord.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerBulkRecord.java @@ -9,22 +9,22 @@ /** - * The ISQLServerBulkRecord interface can be used to create classes that read in data from any source (such as a file) - * and allow a SQLServerBulkCopy class to write the data to SQL Server tables. + * Provides an interface used to create classes that read in data from any source (such as a file) and allows a + * SQLServerBulkCopy class to write the data to SQL Server tables. * * This interface is implemented by {@link SQLServerBulkCommon} Class */ public interface ISQLServerBulkRecord { /** - * Get the ordinals for each of the columns represented in this data record. + * Returns the ordinals for each of the columns represented in this data record. * * @return Set of ordinals for the columns. */ public java.util.Set getColumnOrdinals(); /** - * Get the name of the given column. + * Returns the name of the given column. * * @param column * Column ordinal @@ -33,7 +33,7 @@ public interface ISQLServerBulkRecord { public String getColumnName(int column); /** - * Get the JDBC data type of the given column. + * Returns the JDBC data type of the given column. * * @param column * Column ordinal @@ -42,7 +42,7 @@ public interface ISQLServerBulkRecord { public int getColumnType(int column); /** - * Get the precision for the given column. + * Returns the precision for the given column. * * @param column * Column ordinal @@ -51,7 +51,7 @@ public interface ISQLServerBulkRecord { public int getPrecision(int column); /** - * Get the scale for the given column. + * Returns the scale for the given column. * * @param column * Column ordinal @@ -60,7 +60,7 @@ public interface ISQLServerBulkRecord { public int getScale(int column); /** - * Indicates whether the column represents an identity column. + * Returns whether the column represents an identity column. * * @param column * Column ordinal @@ -69,7 +69,7 @@ public interface ISQLServerBulkRecord { public boolean isAutoIncrement(int column); /** - * Gets the data for the current row as an array of Objects. + * Returns the data for the current row as an array of Objects. * * Each Object must match the Java language Type that is used to represent the indicated JDBC data type for the * given column. For more information, see 'Understanding the JDBC Driver Data Types' for the appropriate mappings. @@ -130,7 +130,7 @@ public void addColumnMetadata(int positionInFile, String name, int jdbcType, int int scale) throws SQLServerException; /** - * Set the format for reading in dates from the file. + * Sets the format for reading in dates from the file. * * @param dateTimeFormat * format to parse data sent as java.sql.Types.TIMESTAMP_WITH_TIMEZONE @@ -138,7 +138,7 @@ public void addColumnMetadata(int positionInFile, String name, int jdbcType, int public void setTimestampWithTimezoneFormat(String dateTimeFormat); /** - * Set the format for reading in dates from the file. + * Sets the format for reading in dates from the file. * * @param dateTimeFormatter * format to parse data sent as java.sql.Types.TIMESTAMP_WITH_TIMEZONE @@ -146,7 +146,7 @@ public void addColumnMetadata(int positionInFile, String name, int jdbcType, int public void setTimestampWithTimezoneFormat(DateTimeFormatter dateTimeFormatter); /** - * Set the format for reading in dates from the file. + * Sets the format for reading in dates from the file. * * @param timeFormat * format to parse data sent as java.sql.Types.TIME_WITH_TIMEZONE @@ -154,7 +154,7 @@ public void addColumnMetadata(int positionInFile, String name, int jdbcType, int public void setTimeWithTimezoneFormat(String timeFormat); /** - * Set the format for reading in dates from the file. + * Sets the format for reading in dates from the file. * * @param dateTimeFormatter * format to parse data sent as java.sql.Types.TIME_WITH_TIMEZONE @@ -162,7 +162,7 @@ public void addColumnMetadata(int positionInFile, String name, int jdbcType, int public void setTimeWithTimezoneFormat(DateTimeFormatter dateTimeFormatter); /** - * Retreives dateTimeFormatter for the given column + * Returns the dateTimeFormatter for the given column. * * @param column * Column ordinal diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerCallableStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerCallableStatement.java index 8f254c78b..da7d75fde 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerCallableStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerCallableStatement.java @@ -12,7 +12,7 @@ /** - * This interface is implemented by {@link SQLServerCallableStatement} Class. + * Provides an interface to the {@link SQLServerCallableStatement} class. */ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, ISQLServerPreparedStatement { @@ -20,7 +20,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public BigDecimal getBigDecimal(String parameterName, int scale) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param index @@ -32,7 +32,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getDateTime(int index) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param parameterName @@ -45,7 +45,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getDateTime(String parameterName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. This method uses the given calendar to construct an appropriate * millisecond value for the timestamp if the underlying database does not store timezone information. * @@ -60,7 +60,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getDateTime(int index, Calendar cal) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. This method uses the given calendar to construct an appropriate * millisecond value for the timestamp if the underlying database does not store timezone information. * @@ -75,7 +75,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getDateTime(String name, Calendar cal) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param index @@ -87,7 +87,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getSmallDateTime(int index) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param parameterName @@ -99,7 +99,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getSmallDateTime(String parameterName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param index @@ -113,7 +113,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getSmallDateTime(int index, Calendar cal) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param name @@ -127,7 +127,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public Timestamp getSmallDateTime(String name, Calendar cal) throws SQLServerException; /** - * Gets the DateTimeOffset value of parameter with index parameterIndex + * Returns the DateTimeOffset value of parameter with index parameterIndex. * * @param parameterIndex * the first parameter is 1, the second is 2, and so on @@ -139,7 +139,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public microsoft.sql.DateTimeOffset getDateTimeOffset(int parameterIndex) throws SQLServerException; /** - * Gets the DateTimeOffset value of parameter with name parameterName + * Returns the DateTimeOffset value of parameter with name parameterName. * * @param parameterName * the name of the parameter @@ -151,7 +151,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public microsoft.sql.DateTimeOffset getDateTimeOffset(String parameterName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a stream + * Returns the value of the designated column in the current row of this ResultSet object as a stream * of ASCII characters. The value can then be read in chunks from the stream. This method is particularly suitable * for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the * database format into ASCII. @@ -172,7 +172,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public java.io.InputStream getAsciiStream(int parameterIndex) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a stream + * Returns the value of the designated column in the current row of this ResultSet object as a stream * of ASCII characters. The value can then be read in chunks from the stream. This method is particularly suitable * for retrieving large LONGVARCHAR values. The JDBC driver will do any necessary conversion from the * database format into ASCII. @@ -193,7 +193,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public java.io.InputStream getAsciiStream(String parameterName) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param parameterIndex * The zero-based ordinal of a column. @@ -204,7 +204,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public BigDecimal getMoney(int parameterIndex) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param parameterName * The name of a column. @@ -215,7 +215,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public BigDecimal getMoney(String parameterName) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param parameterIndex * The zero-based ordinal of a column. @@ -226,7 +226,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public BigDecimal getSmallMoney(int parameterIndex) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param parameterName * The name of a column. @@ -237,7 +237,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public BigDecimal getSmallMoney(String parameterName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a stream + * Returns the value of the designated column in the current row of this ResultSet object as a stream * of uninterpreted bytes. The value can then be read in chunks from the stream. This method is particularly * suitable for retrieving large LONGVARBINARY values. * @@ -257,7 +257,7 @@ public interface ISQLServerCallableStatement extends java.sql.CallableStatement, public java.io.InputStream getBinaryStream(int parameterIndex) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a stream + * Returns the value of the designated column in the current row of this ResultSet object as a stream * of uninterpreted bytes. The value can then be read in chunks from the stream. This method is * particularly suitable for retrieving large LONGVARBINARY values. * @@ -478,7 +478,7 @@ public void setTimestamp(String parameterName, java.sql.Timestamp value, int sca boolean forceEncrypt) throws SQLServerException; /** - * Sets parameter parameterName to DateTimeOffset x + * Sets parameter parameterName to DateTimeOffset value. * * @param parameterName * the name of the parameter @@ -490,7 +490,7 @@ public void setTimestamp(String parameterName, java.sql.Timestamp value, int sca public void setDateTimeOffset(String parameterName, microsoft.sql.DateTimeOffset value) throws SQLServerException; /** - * Sets parameter parameterName to DateTimeOffset x + * Sets parameter parameterName to DateTimeOffset value. * * @param parameterName * the name of the parameter @@ -505,7 +505,7 @@ public void setDateTimeOffset(String parameterName, microsoft.sql.DateTimeOffset int scale) throws SQLServerException; /** - * Sets parameter parameterName to DateTimeOffset x + * Sets parameter parameterName to DateTimeOffset value. * * @param parameterName * the name of the parameter diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java index 628a1d282..44d991782 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection.java @@ -12,7 +12,7 @@ /** - * This interface is implemented by {@link SQLServerConnection} and {@link SQLServerConnectionPoolProxy} Classes. + * Provides an interface to the {@link SQLServerConnection} and {@link SQLServerConnectionPoolProxy} classes. */ public interface ISQLServerConnection extends java.sql.Connection { @@ -21,7 +21,7 @@ public interface ISQLServerConnection extends java.sql.Connection { public final static int TRANSACTION_SNAPSHOT = 0x1000; /** - * Gets the connection ID of the most recent connection attempt, regardless of whether the attempt succeeded or + * Returns the connection ID of the most recent connection attempt, regardless of whether the attempt succeeded or * failed. * * @return 16-byte GUID representing the connection ID of the most recent connection attempt. Or, NULL if there is a @@ -215,8 +215,8 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo SQLServerStatementColumnEncryptionSetting stmtColEncSetting) throws SQLServerException; /** - * Modifies the setting of the sendTimeAsDatetime connection property. When true, java.sql.Time values will be sent - * to the server as SQL Serverdatetime values. When false, java.sql.Time values will be sent to the server as SQL + * Sets the value of the sendTimeAsDatetime connection property. When true, java.sql.Time values will be sent to the + * server as SQL Serverdatetime values. When false, java.sql.Time values will be sent to the server as SQL * Servertime values. sendTimeAsDatetime can also be modified programmatically with * SQLServerDataSource.setSendTimeAsDatetime. The default value for this property may change in a future release. * @@ -232,7 +232,7 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo public void setSendTimeAsDatetime(boolean sendTimeAsDateTimeValue) throws SQLServerException; /** - * Checks the sendTimeAsDatetime property. + * Returns the value of the sendTimeAsDatetime property. * * @return boolean value of sendTimeAsDatetime * @@ -265,7 +265,7 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo public boolean getEnablePrepareOnFirstPreparedStatementCall(); /** - * Specifies the behavior for a specific connection instance. If value is false the first execution will call + * Sets the behavior for a specific connection instance. If value is false the first execution will call * sp_executesql and not prepare a statement, once the second execution happens it will call sp_prepexec and * actually setup a prepared statement handle. Following executions will call sp_execute. This relieves the need for * sp_unprepare on prepared statement close if the statement is only executed once. @@ -288,7 +288,7 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo public int getServerPreparedStatementDiscardThreshold(); /** - * Specifies the behavior for a specific connection instance. This setting controls how many outstanding prepared + * Sets the behavior for a specific connection instance. This setting controls how many outstanding prepared * statement discard actions (sp_unprepare) can be outstanding per connection before a call to clean-up the * outstanding handles on the server is executed. If the setting is {@literal <=} 1 unprepare actions will be * executed immedietely on prepared statement close. If it is set to {@literal >} 1 these calls will be batched @@ -300,7 +300,7 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo public void setServerPreparedStatementDiscardThreshold(int value); /** - * Specifies the size of the prepared statement cache for this connection. A value less than 1 means no cache. + * Sets the size of the prepared statement cache for this connection. A value less than 1 means no cache. * * @param value * The new cache size. @@ -316,7 +316,7 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo public int getStatementPoolingCacheSize(); /** - * Whether statement pooling is enabled or not for this connection. + * Returns whether statement pooling is enabled or not for this connection. * * @return Returns the current setting per the description. */ @@ -330,7 +330,7 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo public int getStatementHandleCacheEntryCount(); /** - * Disable/enable statement pooling. + * Sets the value to Disable/enable statement pooling. * * @param value * true to disable statement pooling, false to enable it. @@ -338,7 +338,7 @@ public CallableStatement prepareCall(String sql, int nType, int nConcur, int nHo public void setDisableStatementPooling(boolean value); /** - * Determine whether statement pooling is disabled. + * Returns the value whether statement pooling is disabled. * * @return true if statement pooling is disabled, false if it is enabled. */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection43.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection43.java index c6e9224da..b17597aa6 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection43.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerConnection43.java @@ -9,7 +9,7 @@ /** - * This interface is implemented by {@link SQLServerConnection43} class. + * Provides an interface to the {@link SQLServerConnection43} class. */ public interface ISQLServerConnection43 extends ISQLServerConnection { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataRecord.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataRecord.java index 3236ae290..7c45b8449 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataRecord.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataRecord.java @@ -6,12 +6,12 @@ package com.microsoft.sqlserver.jdbc; /** - * This interface can be used to create classes that read in data from any source (such as a file) and allow a - * structured type to be sent to SQL Server tables. + * Provides an interface to create classes that read in data from any source (such as a file) and allow a structured + * type to be sent to SQL Server tables. */ public interface ISQLServerDataRecord { /** - * Get the column meta data + * Returns the column meta data. * * @param column * the first column is 1, the second is 2, and so on @@ -20,14 +20,14 @@ public interface ISQLServerDataRecord { public SQLServerMetaData getColumnMetaData(int column); /** - * Get the column count. + * Returns the column count. * * @return Set of ordinals for the columns. */ public int getColumnCount(); /** - * Gets the data for the current row as an array of Objects. + * Returns the data for the current row as an array of Objects. * * Each Object must match the Java language Type that is used to represent the indicated JDBC data type for the * given column. For more information, see 'Understanding the JDBC Driver Data Types' for the appropriate mappings. diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java index 7330feeea..9e02e154c 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerDataSource.java @@ -9,8 +9,8 @@ /** - * A factory to create connections to the data source represented by this object. This interface was added in SQL Server - * JDBC Driver 3.0. + * Provides a factory to create connections to the data source represented by this object. This interface was added in + * SQL Server JDBC Driver 3.0. * * This interface is implemented by {@link SQLServerDataSource} Class. */ @@ -117,12 +117,12 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public boolean getEncrypt(); /** - * Beginning in version 6.0 of the Microsoft JDBC Driver for SQL Server, a new connection property - * transparentNetworkIPResolution (TNIR) is added for transparent connection to Always On availability groups or to - * a server which has multiple IP addresses associated. When transparentNetworkIPResolution is true, the driver - * attempts to connect to the first IP address available. If the first attempt fails, the driver tries to connect to - * all IP addresses in parallel until the timeout expires, discarding any pending connection attempts when one of - * them succeeds. + * Sets the value to enable/disable Transparent Netowrk IP Resolution (TNIR) Beginning in version 6.0 of the + * Microsoft JDBC Driver for SQL Server, a new connection property transparentNetworkIPResolution (TNIR) is added + * for transparent connection to Always On availability groups or to a server which has multiple IP addresses + * associated. When transparentNetworkIPResolution is true, the driver attempts to connect to the first IP address + * available. If the first attempt fails, the driver tries to connect to all IP addresses in parallel until the + * timeout expires, discarding any pending connection attempts when one of them succeeds. *

* transparentNetworkIPResolution is ignored if multiSubnetFailover is true *

@@ -136,7 +136,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setTransparentNetworkIPResolution(boolean tnir); /** - * Retrieves the TransparentNetworkIPResolution value. + * Returns the TransparentNetworkIPResolution value. * * @return if enabled, returns true. Otherwise, false. */ @@ -159,7 +159,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public boolean getTrustServerCertificate(); /** - * This parameter defines the keystore type for the trustStore. + * Sets the keystore type for the trustStore. * * @param trustStoreType * A String that contains the trust store type @@ -167,7 +167,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setTrustStoreType(String trustStoreType); /** - * Returns the keyStore Type for the trustStore + * Returns the keyStore Type for the trustStore. * * @return trustStoreType A String that contains the trust store type */ @@ -285,7 +285,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public String getResponseBuffering(); /** - * Modifies the setting of the sendTimeAsDatetime connection property. + * Sets the value to enable/disable the sendTimeAsDatetime connection property. * * @param sendTimeAsDatetime * A Boolean value. When true, causes java.sql.Time values to be sent to the server as SQL Server datetime @@ -294,8 +294,8 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setSendTimeAsDatetime(boolean sendTimeAsDatetime); /** - * This method was added in SQL Server JDBC Driver 3.0. Returns the setting of the sendTimeAsDatetime connection - * property. + * Returns the value of the sendTimeAsDatetime connection property. This method was added in SQL Server JDBC Driver + * 3.0. Returns the setting of the sendTimeAsDatetime connection property. * * @return true if java.sql.Time values will be sent to the server as a SQL Server datetime type. false if * java.sql.Time values will be sent to the server as a SQL Server time type. @@ -311,14 +311,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setSendStringParametersAsUnicode(boolean sendStringParametersAsUnicode); /** - * Returns a boolean value that indicates if sending string parameters to the server in UNICODE format is enabled. + * Returns whether sending string parameters to the server in UNICODE format is enabled. * * @return true if string parameters are sent to the server in UNICODE format. Otherwise, false. */ public boolean getSendStringParametersAsUnicode(); /** - * Translates the serverName from Unicode to ASCII Compatible Encoding (ACE) + * Sets whether the serverName will be translated from Unicode to ASCII Compatible Encoding (ACE). * * @param serverNameAsACE * if enabled the servername will be translated to ASCII Compatible Encoding (ACE) @@ -326,7 +326,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setServerNameAsACE(boolean serverNameAsACE); /** - * Retrieves if the serverName should be translated from Unicode to ASCII Compatible Encoding (ACE) + * Returns if the serverName should be translated from Unicode to ASCII Compatible Encoding (ACE). * * @return if enabled, will return true. Otherwise, false. */ @@ -408,7 +408,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public String getWorkstationID(); /** - * Sets a Boolean value that indicates if converting SQL states to XOPEN compliant states is enabled. + * Sets whether converting SQL states to XOPEN compliant states is enabled. * * @param xopenStates * true if converting SQL states to XOPEN compliant states is enabled. Otherwise, false. @@ -416,7 +416,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setXopenStates(boolean xopenStates); /** - * Returns a boolean value that indicates if converting SQL states to XOPEN compliant states is enabled. + * Returns the value that indicates if converting SQL states to XOPEN compliant states is enabled. * * @return true if converting SQL states to XOPEN compliant states is enabled. Otherwise, false. */ @@ -468,7 +468,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public int getPacketSize(); /** - * Indicates the kind of integrated security you want your application to use. + * Sets the kind of integrated security you want your application to use. * * @param authenticationScheme * Values are "JavaKerberos" and the default "NativeAuthentication". @@ -476,7 +476,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setAuthenticationScheme(String authenticationScheme); /** - * sets the authentication mode + * Sets the authentication mode. * * @param authentication * the authentication mode @@ -484,14 +484,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setAuthentication(String authentication); /** - * Retrieves the authentication mode + * Returns the authentication mode. * * @return the authentication value */ public String getAuthentication(); /** - * Sets the server spn + * Sets the server spn. * * @param serverSpn * A String that contains the server spn @@ -499,14 +499,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setServerSpn(String serverSpn); /** - * Returns the server spn + * Returns the server spn. * * @return A String that contains the server spn */ public String getServerSpn(); /** - * sets GSSCredential + * Sets the GSSCredential. * * @param userCredential * the credential @@ -514,7 +514,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setGSSCredentials(GSSCredential userCredential); /** - * Retrieves the GSSCredential + * Returns the GSSCredential. * * @return GSSCredential */ @@ -529,14 +529,15 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setAccessToken(String accessToken); /** - * Retrieves the access token. + * Returns the access token. * * @return the access token. */ public String getAccessToken(); /** - * Enables/disables Always Encrypted functionality for the data source object. The default is Disabled. + * Sets the value to enable/disable Always Encrypted functionality for the data source object. The default is + * Disabled. * * @param columnEncryptionSetting * Enables/disables Always Encrypted functionality for the data source object. The default is Disabled. @@ -544,7 +545,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setColumnEncryptionSetting(String columnEncryptionSetting); /** - * Retrieves the Always Encrypted functionality setting for the data source object. + * Returns the Always Encrypted functionality setting for the data source object. * * @return the Always Encrypted functionality setting for the data source object. */ @@ -560,7 +561,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setKeyStoreAuthentication(String keyStoreAuthentication); /** - * Gets the value of the keyStoreAuthentication setting for the data source object. + * Returns the value of the keyStoreAuthentication setting for the data source object. * * @return the value of the keyStoreAuthentication setting for the data source object. */ @@ -585,14 +586,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setKeyStoreLocation(String keyStoreLocation); /** - * Retrieves the keyStoreLocation for the Java Key Store. + * Returns the keyStoreLocation for the Java Key Store. * * @return the keyStoreLocation for the Java Key Store. */ public String getKeyStoreLocation(); /** - * Setting the query timeout + * Setting the query timeout. * * @param queryTimeout * The number of seconds to wait before a timeout has occurred on a query. The default value is 0, which @@ -601,14 +602,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setQueryTimeout(int queryTimeout); /** - * Getting the query timeout + * Returns the query timeout. * * @return The number of seconds to wait before a timeout has occurred on a query. */ public int getQueryTimeout(); /** - * Setting the cancel timeout + * Sets the cancel timeout. * * @param cancelQueryTimeout * The number of seconds to wait before we wait for the query timeout to happen. @@ -616,17 +617,18 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setCancelQueryTimeout(int cancelQueryTimeout); /** - * Getting the cancel timeout + * Returns the cancel timeout. * * @return the number of seconds to wait before we wait for the query timeout to happen. */ public int getCancelQueryTimeout(); /** - * If this configuration is false the first execution of a prepared statement will call sp_executesql and not - * prepare a statement, once the second execution happens it will call sp_prepexec and actually setup a prepared - * statement handle. Following executions will call sp_execute. This relieves the need for sp_unprepare on prepared - * statement close if the statement is only executed once. + * Sets the value that enables/disables whether the first execution of a prepared statement will call sp_executesql + * and not prepare a statement. If this configuration is false the first execution of a prepared statement will call + * sp_executesql and not prepare a statement, once the second execution happens it will call sp_prepexec and + * actually setup a prepared statement handle. Following executions will call sp_execute. This relieves the need for + * sp_unprepare on prepared statement close if the statement is only executed once. * * @param enablePrepareOnFirstPreparedStatementCall * Changes the setting per the description. @@ -634,20 +636,21 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setEnablePrepareOnFirstPreparedStatementCall(boolean enablePrepareOnFirstPreparedStatementCall); /** - * If this configuration returns false the first execution of a prepared statement will call sp_executesql and not - * prepare a statement, once the second execution happens it will call sp_prepexec and actually setup a prepared - * statement handle. Following executions will call sp_execute. This relieves the need for sp_unprepare on prepared - * statement close if the statement is only executed once. + * Returns the value that indicates whether the first execution of a prepared statement will call sp_executesql and + * not prepare a statement. If this configuration returns false the first execution of a prepared statement will + * call sp_executesql and not prepare a statement, once the second execution happens it will call sp_prepexec and + * actually setup a prepared statement handle. Following executions will call sp_execute. This relieves the need for + * sp_unprepare on prepared statement close if the statement is only executed once. * * @return Returns the current setting per the description. */ public boolean getEnablePrepareOnFirstPreparedStatementCall(); /** - * This setting controls how many outstanding prepared statement discard actions (sp_unprepare) can be outstanding - * per connection before a call to clean-up the outstanding handles on the server is executed. If the setting is - * {@literal <=} 1 unprepare actions will be executed immedietely on prepared statement close. If it is set to - * {@literal >} 1 these calls will be batched together to avoid overhead of calling sp_unprepare too often. + * Sets the value that controls how many outstanding prepared statement discard actions (sp_unprepare) can be + * outstanding per connection before a call to clean-up the outstanding handles on the server is executed. If the + * setting is {@literal <=} 1 unprepare actions will be executed immedietely on prepared statement close. If it is + * set to {@literal >} 1 these calls will be batched together to avoid overhead of calling sp_unprepare too often. * * @param serverPreparedStatementDiscardThreshold * Changes the setting per the description. @@ -655,17 +658,16 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setServerPreparedStatementDiscardThreshold(int serverPreparedStatementDiscardThreshold); /** - * This setting controls how many outstanding prepared statement discard actions (sp_unprepare) can be outstanding - * per connection before a call to clean-up the outstanding handles on the server is executed. If the setting is - * {@literal <=} 1 unprepare actions will be executed immedietely on prepared statement close. If it is set to - * {@literal >} 1 these calls will be batched together to avoid overhead of calling sp_unprepare too often. + * Returns the value of the setting that controls how many outstanding prepared statement discard actions + * (sp_unprepare) can be outstanding per connection before a call to clean-up the outstanding handles on the server + * is executed. * * @return Returns the current setting per the description. */ public int getServerPreparedStatementDiscardThreshold(); /** - * Specifies the size of the prepared statement cache for this connection. A value less than 1 means no cache. + * Sets the size of the prepared statement cache for this connection. A value less than 1 means no cache. * * @param statementPoolingCacheSize * Changes the setting per the description. @@ -680,7 +682,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public int getStatementPoolingCacheSize(); /** - * Disable/enable statement pooling. + * Sets the value to disable/enable statement pooling. * * @param disableStatementPooling * true to disable statement pooling, false to enable it. @@ -688,14 +690,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setDisableStatementPooling(boolean disableStatementPooling); /** - * Determine whether statement pooling is disabled. + * Returns whether statement pooling is disabled. * * @return true if statement pooling is disabled, false if it is enabled. */ public boolean getDisableStatementPooling(); /** - * Setting the socket timeout + * Sets the socket timeout value. * * @param socketTimeout * The number of milliseconds to wait before a timeout is occurred on a socket read or accept. The default @@ -704,7 +706,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setSocketTimeout(int socketTimeout); /** - * Getting the socket timeout + * Returns the socket timeout value. * * @return The number of milliseconds to wait before a timeout is occurred on a socket read or accept. */ @@ -720,14 +722,15 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setJASSConfigurationName(String configurationName); /** - * Retrieves the login configuration file for Kerberos authentication. + * Returns the login configuration file for Kerberos authentication. * * @return login configuration file name */ public String getJASSConfigurationName(); /** - * Enables Fips Mode on the connection For FIPS enabled JVM this property should be true. + * Sets whether Fips Mode should be enabled/disabled on the connection. For FIPS enabled JVM this property should be + * true. * * @param fips * Boolean property to enable/disable fips @@ -735,7 +738,7 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setFIPS(boolean fips); /** - * Retrieves value of connection property "fips" For FIPS enabled JVM this property should be true. + * Returns the value of connection property "fips". For FIPS enabled JVM this property should be true. * * @return fips boolean value */ @@ -752,14 +755,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setSSLProtocol(String sslProtocol); /** - * Retrieves value of connection property 'sslProtocol' + * Returns the value of connection property 'sslProtocol'. * * @return sslProtocol property value */ public String getSSLProtocol(); /** - * Sets the connection property 'trustManagerClass' on the connection + * Sets the connection property 'trustManagerClass' on the connection. * * @param trustManagerClass * The fully qualified class name of a custom javax.net.ssl.TrustManager. @@ -767,14 +770,14 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setTrustManagerClass(String trustManagerClass); /** - * Retrieves value for the connection property 'trustManagerClass' + * Returns the value for the connection property 'trustManagerClass'. * * @return trustManagerClass property value */ public String getTrustManagerClass(); /** - * Sets Constructor Arguments to be provided on constructor of 'trustManagerClass' + * Sets Constructor Arguments to be provided on constructor of 'trustManagerClass'. * * @param trustManagerConstructorArg * 'trustManagerClass' constructor arguments @@ -782,21 +785,21 @@ public interface ISQLServerDataSource extends javax.sql.CommonDataSource { public void setTrustManagerConstructorArg(String trustManagerConstructorArg); /** - * Retrieves value for the connection property 'trustManagerConstructorArg' + * Returns the value for the connection property 'trustManagerConstructorArg'. * * @return trustManagerConstructorArg property value */ public String getTrustManagerConstructorArg(); /** - * Getting the use Bulk Copy API for Batch Insert + * Returns whether the use Bulk Copy API is used for Batch Insert. * * @return whether the driver should use Bulk Copy API for Batch Insert operations. */ public boolean getUseBulkCopyForBatchInsert(); /** - * Setting the use Bulk Copy API for Batch Insert + * Sets whether the use Bulk Copy API should be used for Batch Insert. * * @param useBulkCopyForBatchInsert * indicates whether Bulk Copy API should be used for Batch Insert operations. diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerPreparedStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerPreparedStatement.java index 7068eaa6f..187d20821 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerPreparedStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerPreparedStatement.java @@ -12,7 +12,7 @@ /** - * This interface is implemented by {@link SQLServerPreparedStatement} class. + * Provides an interface to the {@link SQLServerPreparedStatement} class. */ public interface ISQLServerPreparedStatement extends java.sql.PreparedStatement, ISQLServerStatement { /** @@ -367,7 +367,6 @@ public void setBigDecimal(int parameterIndex, BigDecimal x, int precision, int s public void setLong(int parameterIndex, long x, boolean forceEncrypt) throws SQLServerException; /** - *

* Sets the value of the designated parameter with the given object. * *

@@ -400,7 +399,6 @@ public void setObject(int parameterIndex, Object x, int targetSqlType, Integer p int scale) throws SQLServerException; /** - *

* Sets the value of the designated parameter with the given object. * *

@@ -490,7 +488,7 @@ public void setObject(int parameterIndex, Object x, int targetSqlType, Integer p public void setNString(int parameterIndex, String value, boolean forceEncrypt) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Time value + * Sets the designated parameter to the given java.sql.Time value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -504,7 +502,7 @@ public void setObject(int parameterIndex, Object x, int targetSqlType, Integer p public void setTime(int parameterIndex, java.sql.Time x, int scale) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Time value + * Sets the designated parameter to the given java.sql.Time value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -522,7 +520,7 @@ public void setObject(int parameterIndex, Object x, int targetSqlType, Integer p public void setTime(int parameterIndex, java.sql.Time x, int scale, boolean forceEncrypt) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Timestamp value + * Sets the designated parameter to the given java.sql.Timestamp value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -536,7 +534,7 @@ public void setObject(int parameterIndex, Object x, int targetSqlType, Integer p public void setTimestamp(int parameterIndex, java.sql.Timestamp x, int scale) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Timestamp value + * Sets the designated parameter to the given java.sql.Timestamp value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -555,7 +553,7 @@ public void setTimestamp(int parameterIndex, java.sql.Timestamp x, int scale, boolean forceEncrypt) throws SQLServerException; /** - * Sets the designated parameter to the given microsoft.sql.DatetimeOffset value + * Sets the designated parameter to the given microsoft.sql.DatetimeOffset value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -570,7 +568,7 @@ public void setDateTimeOffset(int parameterIndex, microsoft.sql.DateTimeOffset x int scale) throws SQLServerException; /** - * Sets the designated parameter to the given microsoft.sql.DatetimeOffset value + * Sets the designated parameter to the given microsoft.sql.DatetimeOffset value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -589,7 +587,7 @@ public void setDateTimeOffset(int parameterIndex, microsoft.sql.DateTimeOffset x boolean forceEncrypt) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Timestamp value + * Sets the designated parameter to the given java.sql.Timestamp value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -601,7 +599,7 @@ public void setDateTimeOffset(int parameterIndex, microsoft.sql.DateTimeOffset x public void setDateTime(int parameterIndex, java.sql.Timestamp x) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Timestamp value + * Sets the designated parameter to the given java.sql.Timestamp value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -617,7 +615,7 @@ public void setDateTimeOffset(int parameterIndex, microsoft.sql.DateTimeOffset x public void setDateTime(int parameterIndex, java.sql.Timestamp x, boolean forceEncrypt) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Timestamp value + * Sets the designated parameter to the given java.sql.Timestamp value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -629,7 +627,7 @@ public void setDateTimeOffset(int parameterIndex, microsoft.sql.DateTimeOffset x public void setSmallDateTime(int parameterIndex, java.sql.Timestamp x) throws SQLServerException; /** - * Sets the designated parameter to the given java.sql.Timestamp value + * Sets the designated parameter to the given java.sql.Timestamp value. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -646,7 +644,7 @@ public void setSmallDateTime(int parameterIndex, java.sql.Timestamp x, boolean forceEncrypt) throws SQLServerException; /** - * Populates a table valued parameter with a data table + * Sets the data table to populates a table valued parameter. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -661,7 +659,7 @@ public void setStructured(int parameterIndex, String tvpName, SQLServerDataTable tvpDataTable) throws SQLServerException; /** - * Populates a table valued parameter with a data table + * Sets the result set to populate a table-valued parameter. * * @param parameterIndex * the first parameter is 1, the second is 2, ... @@ -675,7 +673,7 @@ public void setStructured(int parameterIndex, String tvpName, public void setStructured(int parameterIndex, String tvpName, ResultSet tvpResultSet) throws SQLServerException; /** - * Populates a table valued parameter with a data table + * Sets the server bulk record to populate a table valued parameter. * * @param parameterIndex * the first parameter is 1, the second is 2, ... diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSet.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSet.java index 7325ef213..2ac7bc1b5 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSet.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSet.java @@ -13,7 +13,7 @@ /** - * This interface is implemented by {@link SQLServerResultSet} class. + * Provides an interface to the {@link SQLServerResultSet} class. */ public interface ISQLServerResultSet extends java.sql.ResultSet { @@ -29,7 +29,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public static final int CONCUR_SS_OPTIMISTIC_CCVAL = 1010; // CONCUR_UPDATABLE + 2 /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a + * Returns the value of the designated column in the current row of this ResultSet object as a * com.microsoft.sqlserver.jdbc.Geometry object in the Java programming language. * * @param columnIndex @@ -41,7 +41,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public Geometry getGeometry(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a + * Returns the value of the designated column in the current row of this ResultSet object as a * com.microsoft.sqlserver.jdbc.Geometry object in the Java programming language. * * @param columnName @@ -53,7 +53,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public Geometry getGeometry(String columnName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a + * Returns the value of the designated column in the current row of this ResultSet object as a * com.microsoft.sqlserver.jdbc.Geography object in the Java programming language. * * @param columnIndex @@ -65,7 +65,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public Geography getGeography(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a + * Returns the value of the designated column in the current row of this ResultSet object as a * com.microsoft.sqlserver.jdbc.Geography object in the Java programming language. * * @param columnName @@ -77,8 +77,8 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public Geography getGeography(String columnName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a String object in - * the Java programming language. + * Returns the value of the designated column in the current row of this ResultSet object as a String object in the + * Java programming language. * * @param columnIndex * the first column is 1, the second is 2, ... @@ -89,8 +89,8 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public String getUniqueIdentifier(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a String object in - * the Java programming language. + * Returns the value of the designated column in the current row of this ResultSet object as a String object in the + * Java programming language. * * @param columnLabel * the name of the column @@ -101,7 +101,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public String getUniqueIdentifier(String columnLabel) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param columnIndex @@ -113,7 +113,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getDateTime(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param columnName @@ -125,7 +125,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getDateTime(String columnName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. This method uses the given calendar to construct an appropriate * millisecond value for the timestamp if the underlying database does not store timezone information. * @@ -140,7 +140,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getDateTime(int columnIndex, Calendar cal) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. This method uses the given calendar to construct an appropriate * millisecond value for the timestamp if the underlying database does not store timezone information. * @@ -156,7 +156,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getDateTime(String colName, Calendar cal) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param columnIndex @@ -168,7 +168,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getSmallDateTime(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param columnName @@ -180,7 +180,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getSmallDateTime(String columnName) throws SQLServerException; /** - * Retrieves the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp * object in the Java programming language. * * @param columnIndex @@ -194,6 +194,8 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getSmallDateTime(int columnIndex, Calendar cal) throws SQLServerException; /** + * Returns the value of the designated column in the current row of this ResultSet object as a java.sql.Timestamp + * object in the Java programming language. * * @param colName * The name of a column @@ -206,7 +208,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public java.sql.Timestamp getSmallDateTime(String colName, Calendar cal) throws SQLServerException; /** - * Retrieves the value of the designated column as a microsoft.sql.DateTimeOffset object, given a zero-based column + * Returns the value of the designated column as a microsoft.sql.DateTimeOffset object, given a zero-based column * ordinal. * * @param columnIndex @@ -218,7 +220,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public microsoft.sql.DateTimeOffset getDateTimeOffset(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the column specified as a microsoft.sql.DateTimeOffset object, given a column name. + * Returns the value of the column specified as a microsoft.sql.DateTimeOffset object, given a column name. * * @param columnName * The name of a column. @@ -229,7 +231,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public microsoft.sql.DateTimeOffset getDateTimeOffset(String columnName) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param columnIndex * The zero-based ordinal of a column. @@ -240,7 +242,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public BigDecimal getMoney(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param columnName * is the name of a column. @@ -251,7 +253,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public BigDecimal getMoney(String columnName) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param columnIndex * The zero-based ordinal of a column. @@ -262,7 +264,7 @@ public interface ISQLServerResultSet extends java.sql.ResultSet { public BigDecimal getSmallMoney(int columnIndex) throws SQLServerException; /** - * Retrieves the value of the column specified as a java.math.BigDecimal object. + * Returns the value of the column specified as a java.math.BigDecimal object. * * @param columnName * is the name of a column. @@ -353,7 +355,7 @@ public void updateObject(int index, Object obj, SQLType targetSqlType, int scale * must contain the number of bytes specified by scaleOrLength. If the second argument is a Reader then the reader * must contain the number of characters specified by scaleOrLength. If these conditions are not true the driver * will generate a SQLServerException when the statement is executed. The default implementation will throw - * SQLFeatureNotSupportedException + * SQLFeatureNotSupportedException. * * @param columnName * the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then @@ -1563,8 +1565,8 @@ public void updateObject(String columnName, Object x, int precision, int scale, boolean forceEncrypt) throws SQLServerException; /** - * Exposes Data Classification information for the current ResultSet For SQL Servers that do not support Data - * Classification or results that do not fetch any classified columns, this data can be null + * Returns the Data Classification information for the current ResultSet For SQL Servers that do not support Data + * Classification or results that do not fetch any classified columns, this data can be null. * * @return SensitivityClassification */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSetMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSetMetaData.java index c91a18ac8..32788d998 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSetMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerResultSetMetaData.java @@ -9,12 +9,12 @@ /** - * This interface is implemented by {@link SQLServerResultSetMetaData} class. + * Provides an interface to the{@link SQLServerResultSetMetaData} class. */ public interface ISQLServerResultSetMetaData extends ResultSetMetaData { /** - * Returns true if the column is a SQLServer SparseColumnSet + * Returns if the column is a SQLServer SparseColumnSet. * * @param column * The column number diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerSavepoint.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerSavepoint.java index e5813da6f..3f97fe79b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerSavepoint.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerSavepoint.java @@ -9,26 +9,26 @@ /** - * This interface is implemented by {@link SQLServerSavepoint} class. + * Provides an interface to the {@link SQLServerSavepoint} class. */ public interface ISQLServerSavepoint extends Savepoint { /** - * Get the savepoint name + * Returns the savepoint name * * @return the name of savepoint */ public String getSavepointName() throws SQLServerException; /** - * Get the savepoint label + * Returns the savepoint label * * @return the label for Savepoint */ public String getLabel(); /** - * Checks if the savepoint label is null + * Returns if the savepoint label is null * * @return true is the savepoint is named. Otherwise, false. */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerStatement.java index 66e229386..51797677b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/ISQLServerStatement.java @@ -6,7 +6,7 @@ package com.microsoft.sqlserver.jdbc; /** - * This interface is implemented by {@link SQLServerStatement} class. + * Provides an interface to the {@link SQLServerStatement} class. */ public interface ISQLServerStatement extends java.sql.Statement { /** @@ -29,7 +29,7 @@ public interface ISQLServerStatement extends java.sql.Statement { public void setResponseBuffering(String value) throws SQLServerException; /** - * Retrieves the response buffering mode for this SQLServerStatement object. + * Returns the response buffering mode for this SQLServerStatement object. * * @return A String that contains a lower-case full or adaptive. * @throws SQLServerException @@ -38,7 +38,7 @@ public interface ISQLServerStatement extends java.sql.Statement { public String getResponseBuffering() throws SQLServerException; /** - * Retrieves the cancelQueryTimeout property set on this SQLServerStatement object. + * Returns the cancelQueryTimeout property set on this SQLServerStatement object. * * @return cancelQueryTimeout Time duration in seconds. * @throws SQLServerException @@ -47,8 +47,8 @@ public interface ISQLServerStatement extends java.sql.Statement { public int getCancelQueryTimeout() throws SQLServerException; /** - * Sets the cancelQueryTimeout property on this SQLServerStatement object to cancel queryTimeout set on - * Connection or Statement level. + * Sets the cancelQueryTimeout property on this SQLServerStatement object to cancel + * queryTimeout set on Connection or Statement level. * * @param seconds * Time duration in seconds. diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/InternalSpatialDatatype.java b/src/main/java/com/microsoft/sqlserver/jdbc/InternalSpatialDatatype.java index 0fac3699b..216615447 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/InternalSpatialDatatype.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/InternalSpatialDatatype.java @@ -5,6 +5,9 @@ package com.microsoft.sqlserver.jdbc; +/** + * Specifies the spatial data types values + */ public enum InternalSpatialDatatype { POINT((byte) 1, "POINT"), LINESTRING((byte) 2, "LINESTRING"), diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java index 55a51739a..2f8dda592 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/JaasConfiguration.java @@ -12,7 +12,7 @@ /** - * This class overrides JAAS Configuration and always provide a configuration is not defined for default configuration. + * Overrides JAAS Configuration and always provide a configuration is not defined for default configuration. */ public class JaasConfiguration extends Configuration { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/KerbCallback.java b/src/main/java/com/microsoft/sqlserver/jdbc/KerbCallback.java index 0df4f1011..454688591 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/KerbCallback.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/KerbCallback.java @@ -16,6 +16,9 @@ import javax.security.auth.callback.UnsupportedCallbackException; +/** + * Provides implemention of the callback handler for Kerberos. + */ public class KerbCallback implements CallbackHandler { private final SQLServerConnection con; @@ -38,7 +41,7 @@ private static String getAnyOf(Callback callback, Properties properties, } /** - * If a name was retrieved By Kerberos, return it. + * Returns if a name was retrieved By Kerberos. * * @return null if callback was not called or username was not provided */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBlob.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBlob.java index 8d3bb849f..b1e785817 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBlob.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBlob.java @@ -18,9 +18,8 @@ /** - * SQLServerBlob represents a binary LOB object and implements a java.sql.Blob. + * Represents a binary LOB object and implements a java.sql.Blob. */ - public final class SQLServerBlob extends SQLServerLob implements java.sql.Blob, java.io.Serializable { /** * Always refresh SerialVersionUID when prompted diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkBatchInsertRecord.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkBatchInsertRecord.java index a3432ff90..3203f07f1 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkBatchInsertRecord.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkBatchInsertRecord.java @@ -21,8 +21,8 @@ /** - * A simple implementation of the ISQLServerBulkRecord interface that can be used to read in the basic Java data types - * from an ArrayList of Parameters that were provided by pstmt/cstmt. + * Provides a simple implementation of the ISQLServerBulkRecord interface that can be used to read in the basic Java + * data types from an ArrayList of Parameters that were provided by pstmt/cstmt. */ public class SQLServerBulkBatchInsertRecord extends SQLServerBulkCommon { @@ -41,6 +41,9 @@ public class SQLServerBulkBatchInsertRecord extends SQLServerBulkCommon { */ private static final java.util.logging.Logger loggerExternal = java.util.logging.Logger.getLogger(loggerClassName); + /* + * Constructs a SQLServerBulkBatchInsertRecord with the batch parameter, column list, value list, and encoding + */ public SQLServerBulkBatchInsertRecord(ArrayList batchParam, ArrayList columnList, ArrayList valueList, String encoding) throws SQLServerException { loggerExternal.entering(loggerClassName, "SQLServerBulkBatchInsertRecord", new Object[] {batchParam, encoding}); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java index c8e6b27b2..ac84bc58d 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCSVFileRecord.java @@ -25,8 +25,8 @@ /** - * A simple implementation of the ISQLServerBulkRecord interface that can be used to read in the basic Java data types - * from a delimited file where each line represents a row of data. + * Provides a simple implementation of the ISQLServerBulkRecord interface that can be used to read in the basic Java + * data types from a delimited file where each line represents a row of data. */ public class SQLServerBulkCSVFileRecord extends SQLServerBulkCommon implements java.lang.AutoCloseable { /* @@ -57,7 +57,7 @@ public class SQLServerBulkCSVFileRecord extends SQLServerBulkCommon implements j private static final java.util.logging.Logger loggerExternal = java.util.logging.Logger.getLogger(loggerClassName); /** - * Creates a simple reader to parse data from a delimited file with the given encoding. + * Constructs a simple reader to parse data from a delimited file with the given encoding. * * @param fileToParse * File to parse data from @@ -111,7 +111,7 @@ public SQLServerBulkCSVFileRecord(String fileToParse, String encoding, String de } /** - * Creates a simple reader to parse data from a delimited file with the given encoding. + * Constructs a SQLServerBulkCSVFileRecord to parse data from a delimited file with the given encoding. * * @param fileToParse * InputStream to parse data from @@ -162,7 +162,7 @@ public SQLServerBulkCSVFileRecord(InputStream fileToParse, String encoding, Stri } /** - * Creates a simple reader to parse data from a CSV file with the given encoding. + * Constructs a SQLServerBulkCSVFileRecord to parse data from a CSV file with the given encoding. * * @param fileToParse * File to parse data from @@ -179,7 +179,7 @@ public SQLServerBulkCSVFileRecord(String fileToParse, String encoding, } /** - * Creates a simple reader to parse data from a CSV file with the default encoding. + * Constructs a SQLServerBulkCSVFileRecord to parse data from a CSV file with the default encoding. * * @param fileToParse * File to parse data from diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java index c7e9ce2b3..0c66c088f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java @@ -50,7 +50,7 @@ /** - * Lets you efficiently bulk load a SQL Server table with data from another source.
+ * Provides functionality to efficiently bulk load a SQL Server table with data from another source.
*
* Microsoft SQL Server includes a popular command-prompt utility named bcp for moving data from one table to another, * whether on a single server or between servers. The SQLServerBulkCopy class lets you write code solutions in Java that @@ -62,12 +62,12 @@ */ public class SQLServerBulkCopy implements java.lang.AutoCloseable, java.io.Serializable { /** - * + * Update serialVersionUID when making changes to this file */ private static final long serialVersionUID = 1989903904654306244L; - /* - * Class to represent the column mappings between the source and destination table + /** + * Represents the column mappings between the source and destination table */ private class ColumnMapping { String sourceColumnName = null; @@ -96,72 +96,76 @@ private class ColumnMapping { } } - /* + /** * Class name for logging. */ private static final String loggerClassName = "com.microsoft.sqlserver.jdbc.SQLServerBulkCopy"; private static final int SQL_SERVER_2016_VERSION = 13; - /* + /** * Logger */ private static final java.util.logging.Logger loggerExternal = java.util.logging.Logger.getLogger(loggerClassName); - /* + /** * Destination server connection. */ private SQLServerConnection connection; - /* + /** * Options to control how the WriteToServer methods behave. */ private SQLServerBulkCopyOptions copyOptions; - /* + /** * Mappings between columns in the data source and columns in the destination */ private List columnMappings; - /* + /** * Flag if SQLServerBulkCopy owns the connection and should close it when Close is called */ private boolean ownsConnection; - /* + /** * Name of destination table on server. If destinationTable has not been set when WriteToServer is called, an - * Exception is thrown. destinationTable is a three-part name (..). You can qualify - * the table name with its database and owning schema if you choose. However, if the table name uses an underscore - * ("_") or any other special characters, you must escape the name using surrounding brackets. For more information, - * see "Identifiers" in SQL Server Books Online. You can bulk-copy data to a temporary table by using a value such - * as tempdb..#table or tempdb..#table for the destinationTable property. + * Exception is thrown. destinationTable is a three-part name {@code (..)}. You can + * qualify the table name with its database and owning schema if you choose. However, if the table name uses an + * underscore ("_") or any other special characters, you must escape the name using surrounding brackets. For more + * information, see "Identifiers" in SQL Server Books Online. You can bulk-copy data to a temporary table by using a + * value such as {@code tempdb..#table or tempdb..#table} for the destinationTable property. */ private String destinationTableName; - /* + /** * Source data (from a Record). Is null unless the corresponding version of writeToServer is called. */ private ISQLServerBulkRecord sourceBulkRecord; - /* + /** * Source data (from ResultSet). Is null unless the corresponding version of writeToServer is called. */ private ResultSet sourceResultSet; - /* + /** * Metadata for the source table columns */ private ResultSetMetaData sourceResultSetMetaData; - /* The CekTable for the destination table. */ + /** + * The CekTable for the destination table. + */ private CekTable destCekTable = null; - /* Statement level encryption setting needed for querying against encrypted columns. */ + /** + * Statement level encryption setting needed for querying against encrypted columns. + */ private SQLServerStatementColumnEncryptionSetting stmtColumnEncriptionSetting = SQLServerStatementColumnEncryptionSetting.UseConnectionSetting; private ResultSet destinationTableMetadata; - /* + /** * Metadata for the destination table columns */ class BulkColumnMetaData { @@ -222,27 +226,27 @@ class BulkColumnMetaData { } }; - /* + /** * A map to store the metadata information for the destination table. */ private Map destColumnMetadata; - /* + /** * A map to store the metadata information for the source table. */ private Map srcColumnMetadata; - /* + /** * Variable to store destination column count. */ private int destColumnCount; - /* + /** * Variable to store source column count. */ private int srcColumnCount; - /* + /** * Timer for the bulk copy operation. The other timeout timers in the TDS layer only measure the response of the * first packet from SQL Server. */ @@ -315,8 +319,7 @@ public void run() { private static final int sourceBulkRecordTemporalMaxPrecision = 50; /** - * Initializes a new instance of the SQLServerBulkCopy class using the specified open instance of - * SQLServerConnection. + * Constructs a SQLServerBulkCopy using the specified open instance of SQLServerConnection. * * @param connection * Open instance of Connection to destination server. Must be from the Microsoft JDBC driver for SQL Server. @@ -349,7 +352,7 @@ public SQLServerBulkCopy(Connection connection) throws SQLServerException { } /** - * Initializes and opens a new instance of SQLServerConnection based on the supplied connectionString. + * Constructs a SQLServerBulkCopy based on the supplied connectionString. * * @param connectionUrl * Connection string for the destination server. @@ -498,7 +501,7 @@ public void close() { } /** - * Gets the name of the destination table on the server. + * Returns the name of the destination table on the server. * * @return Destination table name. */ @@ -527,7 +530,7 @@ public void setDestinationTableName(String tableName) throws SQLServerException } /** - * Gets the current SQLServerBulkCopyOptions. + * Returns the current SQLServerBulkCopyOptions. * * @return Current SQLServerBulkCopyOptions settings. */ @@ -664,7 +667,7 @@ public void writeToServer(ISQLServerBulkRecord sourceData) throws SQLServerExcep loggerExternal.exiting(loggerClassName, "writeToServer"); } - /* + /** * Initializes the defaults for member variables that require it. */ private void initializeDefaults() { @@ -730,7 +733,7 @@ final boolean doExecute() throws SQLServerException { connection.executeCommand(new InsertBulk()); } - /* + /** * write ColumnData token in COLMETADATA header */ private void writeColumnMetaDataColumnData(TDSWriter tdsWriter, int idx) throws SQLServerException { @@ -751,13 +754,13 @@ private void writeColumnMetaDataColumnData(TDSWriter tdsWriter, int idx) throws userType[3] = (byte) 0x00; tdsWriter.writeBytes(userType); - /* + /** * Flags token - Bit flags in least significant bit order https://msdn.microsoft.com/en-us/library/dd357363.aspx * flags[0] = (byte) 0x05; flags[1] = (byte) 0x00; */ int destColumnIndex = columnMappings.get(idx).destinationColumnOrdinal; - /* + /** * TYPE_INFO FIXEDLENTYPE Example INT: tdsWriter.writeByte((byte) 0x38); */ srcColumnIndex = columnMappings.get(idx).sourceColumnOrdinal; @@ -1120,7 +1123,7 @@ private void writeTypeInfo(TDSWriter tdsWriter, int srcJdbcType, int srcScale, i } } - /* + /** * Writes the CEK table needed for AE. Cek table (with 0 entries) will be present if AE was enabled and server * supports it! OR if encryption was disabled in connection options */ @@ -1148,7 +1151,7 @@ private void writeCekTable(TDSWriter tdsWriter) throws SQLServerException { } } - /* + /** * ... */ private void writeColumnMetaData(TDSWriter tdsWriter) throws SQLServerException { @@ -1182,7 +1185,7 @@ private void writeColumnMetaData(TDSWriter tdsWriter) throws SQLServerException } } - /* + /** * Helper method that throws a timeout exception if the cause of the exception was that the query was cancelled */ private void checkForTimeoutException(SQLException e, BulkTimeoutTimer timeoutTimer) throws SQLServerException { @@ -1198,7 +1201,7 @@ private void checkForTimeoutException(SQLException e, BulkTimeoutTimer timeoutTi } } - /* + /** * Validates whether the source JDBC types are compatible with the destination table data types. We need to do this * only once for the whole bulk copy session. */ @@ -1625,7 +1628,7 @@ private void writePacketDataDone(TDSWriter tdsWriter) throws SQLServerException tdsWriter.writeInt(0); } - /* + /** * Helper method to throw a SQLServerExeption with the invalidArgument message and given argument. */ private void throwInvalidArgument(String argument) throws SQLServerException { @@ -1634,7 +1637,7 @@ private void throwInvalidArgument(String argument) throws SQLServerException { SQLServerException.makeFromDriverError(null, null, form.format(msgArgs), null, false); } - /* + /** * Helper method to throw a SQLServerExeption with the errorConvertingValue message and given arguments. */ private void throwInvalidJavaToJDBC(String javaClassName, int jdbcType) throws SQLServerException { @@ -1642,7 +1645,7 @@ private void throwInvalidJavaToJDBC(String javaClassName, int jdbcType) throws S throw new SQLServerException(form.format(new Object[] {javaClassName, jdbcType}), null, 0, null); } - /* + /** * The bulk copy operation */ private void writeToServer() throws SQLServerException { @@ -1704,8 +1707,8 @@ private void validateStringBinaryLengths(Object colValue, int srcCol, int destCo } } - /* - * Retrieves the column metadata for the destination table (and saves it for later) + /** + * Returns the column metadata for the destination table (and saves it for later) */ private void getDestinationMetadata() throws SQLServerException { if (null == destinationTableName) { @@ -1770,8 +1773,8 @@ private void getDestinationMetadata() throws SQLServerException { } } - /* - * Retrieves the column metadata for the source (and saves it for later). Retrieving source metadata in + /** + * Returns the column metadata for the source (and saves it for later). Retrieving source metadata in * BulkColumnMetaData object helps to access source metadata from the same place for both ResultSet and File. */ private void getSourceMetadata() throws SQLServerException { @@ -1813,7 +1816,7 @@ private void getSourceMetadata() throws SQLServerException { } } - /* + /** * Oracle 12c database returns precision = 0 for char/varchar data types. */ private int validateSourcePrecision(int srcPrecision, int srcJdbcType, int destPrecision) { @@ -1823,7 +1826,7 @@ private int validateSourcePrecision(int srcPrecision, int srcJdbcType, int destP return srcPrecision; } - /* + /** * Validates the column mappings */ private void validateColumnMappings() throws SQLServerException { @@ -2885,7 +2888,7 @@ private Object readColumnFromResultSet(int srcColOrdinal, int srcJdbcType, boole } } - /* + /** * Reads the given column from the result set current row and writes the data to tdsWriter. */ private void writeColumn(TDSWriter tdsWriter, int srcColOrdinal, int destColOrdinal, @@ -3012,8 +3015,20 @@ else if (null != sourceBulkRecord && (null == destCryptoMeta)) { destColOrdinal, isStreaming, colValue); } - // this method is called against jdbc41, but it require jdbc42 to work - // therefore, we will throw exception. + /** + * Returns the temporal object from CSV + * This method is called against jdbc41, but it require jdbc42 to work therefore, we will throw exception. + * @param valueStrUntrimmed + * valueStrUntrimmed + * @param srcJdbcType + * srcJdbcType + * @param srcColOrdinal + * srcColOrdinal + * @param dateTimeFormatter + * dateTimeFormatter + * @return temporal object + * @throws SQLServerException if parsing error + */ protected Object getTemporalObjectFromCSVWithFormatter(String valueStrUntrimmed, int srcJdbcType, int srcColOrdinal, DateTimeFormatter dateTimeFormatter) throws SQLServerException { try { @@ -3494,7 +3509,7 @@ private boolean goToNextRow() throws SQLServerException { } } - /* + /** * Writes data for a batch of rows to the TDSWriter object. Writes the following part in the BulkLoadBCP stream * (https://msdn.microsoft.com/en-us/library/dd340549.aspx) ... */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopyOptions.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopyOptions.java index 7f353e2c4..67f76277b 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopyOptions.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerBulkCopyOptions.java @@ -9,7 +9,7 @@ /** - * A collection of settings that control how an instance of SQLServerBulkCopy behaves. Used when constructing a + * Provides a collection of settings that control how an instance of SQLServerBulkCopy behaves. Used when constructing a * SQLServerBulkCopy instance to change how the writeToServer methods for that instance behave. */ public class SQLServerBulkCopyOptions { @@ -37,7 +37,7 @@ public class SQLServerBulkCopyOptions { private int bulkCopyTimeout; /** - * Check constraints while data is being inserted. + * Checks constraints while data is being inserted. * * Default: false - constraints are not checked */ @@ -81,7 +81,7 @@ public class SQLServerBulkCopyOptions { private boolean allowEncryptedValueModifications; /** - * Initializes an instance of the SQLServerBulkCopySettings class using defaults for all of the settings. + * Constructs a SQLServerBulkCopySettings class using defaults for all of the settings. */ public SQLServerBulkCopyOptions() { batchSize = 0; @@ -96,7 +96,7 @@ public SQLServerBulkCopyOptions() { } /** - * Gets the number of rows in each batch. At the end of each batch, the rows in the batch are sent to the server. + * Returns the number of rows in each batch. At the end of each batch, the rows in the batch are sent to the server. * * @return Number of rows in each batch. */ @@ -123,7 +123,7 @@ public void setBatchSize(int batchSize) throws SQLServerException { } /** - * Gets the number of seconds for the operation to complete before it times out. + * Returns the number of seconds for the operation to complete before it times out. * * @return Number of seconds before operation times out. */ @@ -150,7 +150,7 @@ public void setBulkCopyTimeout(int timeout) throws SQLServerException { } /** - * Indicates whether or not to preserve any source identity values. + * Returns whether or not to preserve any source identity values. * * @return True if source identity values are to be preserved; false if they are to be assigned by the destination. */ @@ -169,7 +169,7 @@ public void setKeepIdentity(boolean keepIdentity) { } /** - * Indicates whether to preserve null values in the destination table regardless of the settings for default values, + * Returns whether to preserve null values in the destination table regardless of the settings for default values, * or if they should be replaced by default values (where applicable). * * @return True if null values should be preserved; false if null values should be replaced by default values where @@ -192,7 +192,7 @@ public void setKeepNulls(boolean keepNulls) { } /** - * Indicates whether SQLServerBulkCopy should obtain a bulk update lock for the duration of the bulk copy operation. + * Returns whether SQLServerBulkCopy should obtain a bulk update lock for the duration of the bulk copy operation. * * @return True to obtain row locks; false otherwise. */ @@ -211,7 +211,7 @@ public void setTableLock(boolean tableLock) { } /** - * Indicates whether each batch of the bulk-copy operation will occur within a transaction or not. + * Returns whether each batch of the bulk-copy operation will occur within a transaction or not. * * @return True if the batch will occur within a transaction; false otherwise. */ @@ -230,7 +230,7 @@ public void setUseInternalTransaction(boolean useInternalTransaction) { } /** - * Indicates whether constraints are to be checked while data is being inserted or not. + * Returns whether constraints are to be checked while data is being inserted or not. * * @return True if constraints are to be checked; false otherwise. */ @@ -249,7 +249,7 @@ public void setCheckConstraints(boolean checkConstraints) { } /** - * Indicates if the server should fire insert triggers for rows being inserted into the database. + * Returns if the server should fire insert triggers for rows being inserted into the database. * * @return True triggers are enabled; false otherwise. */ @@ -268,7 +268,7 @@ public void setFireTriggers(boolean fireTriggers) { } /** - * Indicates if allowEncryptedValueModifications option is enabled or not + * Returns if allowEncryptedValueModifications option is enabled or not * * @return True if allowEncryptedValueModification is set to true; false otherwise. */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java index 82ad28875..87054ef95 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerCallableStatement.java @@ -30,7 +30,7 @@ /** - * CallableStatement implements JDBC callable statements. CallableStatement allows the caller to specify the procedure + * Provides implementation of JDBC callable statements. CallableStatement allows the caller to specify the procedure * name to call along with input parameter value and output parameter types. Callable statement also allows the return * of a return status with the ? = call( ?, ..) JDBC syntax *

diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerClob.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerClob.java index cd947d88b..b59fd9062 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerClob.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerClob.java @@ -30,9 +30,8 @@ /** - * SQLServerClob represents a character LOB object and implements java.sql.Clob. + * Represents a character LOB object and implements java.sql.Clob. */ - public class SQLServerClob extends SQLServerClobBase implements Clob { /** * Always refresh SerialVersionUID when prompted @@ -44,7 +43,7 @@ public class SQLServerClob extends SQLServerClobBase implements Clob { private static final Logger logger = Logger.getLogger("com.microsoft.sqlserver.jdbc.internals.SQLServerClob"); /** - * Create a new CLOB + * Constructs a SQLServerClob. * * @param connection * the database connection this blob is implemented on @@ -161,13 +160,11 @@ abstract class SQLServerClobBase extends SQLServerLob implements Serializable { private final TypeInfo typeInfo; - // Active streams which must be closed when the Clob/NClob is closed - // - // Initial size of the array is based on an assumption that a Clob/NClob - // object is - // typically used either for input or output, and then only once. The array - // size - // grows automatically if multiple streams are used. + /** + * Active streams which must be closed when the Clob/NClob is closed. Initial size of the array is based on an + * assumption that a Clob/NClob object is typically used either for input or output, and then only once. The array + * size grows automatically if multiple streams are used. + */ private ArrayList activeStreams = new ArrayList<>(1); transient SQLServerConnection con; @@ -198,7 +195,7 @@ private String getDisplayClassName() { } /** - * Create a new CLOB from a String + * Constructs a new CLOB from a String. * * @param connection * SQLServerConnection @@ -272,7 +269,7 @@ private void checkClosed() throws SQLServerException { } /** - * Materialize the CLOB as an ASCII stream. + * Returns the CLOB as an ASCII stream. * * @throws SQLException * when an error occurs @@ -292,8 +289,7 @@ public InputStream getAsciiStream() throws SQLException { } /** - * Retrieves the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of - * characters). + * Returns the CLOB value designated by this Clob object as a java.io.Reader object (or as a stream of characters). * * @throws SQLException * if there is an error accessing the CLOB value @@ -331,8 +327,8 @@ public Reader getCharacterStream(long pos, long length) throws SQLException { } /** - * Retrieves a copy of the specified substring in the CLOB value designated by this Clob object. The substring - * begins at position pos and has up to length consecutive characters. + * Returns a copy of the specified substring in the CLOB value designated by this Clob object. The substring begins + * at position pos and has up to length consecutive characters. * * @param pos * - the first character of the substring to be extracted. The first character is at position 1. @@ -377,7 +373,7 @@ public String getSubString(long pos, int length) throws SQLException { } /** - * Retrieves the number of characters in the CLOB value designated by this Clob object. + * Returns the number of characters in the CLOB value designated by this Clob object. * * @throws SQLException * when an error occurs @@ -393,7 +389,7 @@ public long length() throws SQLException { } /** - * Function for the result set to maintain clobs it has created + * Provides functionality for the result set to maintain clobs it has created. * * @throws SQLException */ @@ -404,7 +400,7 @@ void fillFromStream() throws SQLException { } /** - * Converts the stream to String + * Converts the stream to String. * * @throws SQLServerException */ @@ -421,7 +417,7 @@ private void getStringFromStream() throws SQLServerException { } /** - * Retrieves the character position at which the specified Clob object searchstr appears in this Clob object. The + * Returns the character position at which the specified Clob object searchstr appears in this Clob object. The * search begins at position start. * * @param searchstr @@ -449,7 +445,7 @@ public long position(Clob searchstr, long start) throws SQLException { } /** - * Retrieves the character position at which the specified substring searchstr appears in the SQL CLOB value + * Returns the character position at which the specified substring searchstr appears in the SQL CLOB value * represented by this Clob object. The search begins at position start. * * @param searchstr @@ -508,7 +504,7 @@ public void truncate(long len) throws SQLException { } /** - * Retrieves a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, + * Returns a stream to be used to write Ascii characters to the CLOB value that this Clob object represents, * starting at position pos. * * @param pos @@ -530,7 +526,7 @@ public java.io.OutputStream setAsciiStream(long pos) throws SQLException { } /** - * Retrieves a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object + * Returns a stream to be used to write a stream of Unicode characters to the CLOB value that this Clob object * represents, at position pos. * * @param pos @@ -668,16 +664,11 @@ public int setString(long pos, String str, int offset, int len) throws SQLExcept } -// SQLServerClobWriter is a simple java.io.Writer interface implementing class -// that -// forwards all calls to SQLServerClob.setString. This class is returned to -// caller by -// SQLServerClob class when setCharacterStream is called. -// -// SQLServerClobWriter starts writing at postion streamPos and continues to -// write -// in a forward only manner. There is no reset with java.io.Writer. -// +/** + * Provides a simple java.io.Writer interface that forwards all calls to SQLServerClob.setString.\ This class is + * returned to caller by SQLServerClob class when setCharacterStream is called. SQLServerClobWriter starts writing at + * postion streamPos and continues to write in a forward only manner. There is no reset with java.io.Writer. + */ final class SQLServerClobWriter extends java.io.Writer { private SQLServerClobBase parentClob = null; private long streamPos; @@ -740,16 +731,11 @@ private void checkClosed() throws IOException { } -// SQLServerClobAsciiOutputStream is a simple java.io.OutputStream interface -// implementing class that -// forwards all calls to SQLServerClob.setString. This class is returned to -// caller by -// SQLServerClob class when setAsciiStream is called. -// -// SQLServerClobAsciiOutputStream starts writing at character postion streamPos -// and continues to write -// in a forward only manner. Reset/mark are not supported. -// +/** + * Provides a simple java.io.OutputStream interface that forwards all calls to SQLServerClob.setString. This class is + * returned to caller by SQLServerClob class when setAsciiStream is called. SQLServerClobAsciiOutputStream starts + * writing at character postion streamPos and continues to write in a forward only manner. Reset/mark are not supported. + */ final class SQLServerClobAsciiOutputStream extends java.io.OutputStream { private SQLServerClobBase parentClob = null; private long streamPos; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionAzureKeyVaultProvider.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionAzureKeyVaultProvider.java index 9852513bc..5b3e25eab 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionAzureKeyVaultProvider.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionAzureKeyVaultProvider.java @@ -72,8 +72,8 @@ public String getName() { } /** - * Constructor that takes a callback function to authenticate to AAD. This is used by KeyVaultClient at runtime to - * authenticate to Azure Key Vault. + * Constructs a SQLServerColumnEncryptionAzureKeyVaultProvider with a callback function to authenticate to AAD and + * an executor service.. This is used by KeyVaultClient at runtime to authenticate to Azure Key Vault. * * This constructor is present to maintain backwards compatibility with 6.0 version of the driver. Deprecated for * removal in next stable release. @@ -94,8 +94,8 @@ public SQLServerColumnEncryptionAzureKeyVaultProvider( } /** - * Constructor that takes a callback function to authenticate to AAD. This is used by KeyVaultClient at runtime to - * authenticate to Azure Key Vault. + * Constructs a SQLServerColumnEncryptionAzureKeyVaultProvider with a callback function to authenticate to AAD. This + * is used by KeyVaultClient at runtime to authenticate to Azure Key Vault. * * @param authenticationCallback * - Callback function used for authenticating to AAD. @@ -117,8 +117,8 @@ public SQLServerColumnEncryptionAzureKeyVaultProvider( } /** - * Constructor that authenticates to AAD. This is used by KeyVaultClient at runtime to authenticate to Azure Key - * Vault. + * Constructs a SQLServerColumnEncryptionAzureKeyVaultProvider with a client id and client key to authenticate to + * AAD. This is used by KeyVaultClient at runtime to authenticate to Azure Key Vault. * * @param clientId * Identifier of the client requesting the token. @@ -133,8 +133,7 @@ public SQLServerColumnEncryptionAzureKeyVaultProvider(String clientId, String cl } /** - * This function uses the asymmetric key specified by the key path and decrypts an encrypted CEK with RSA encryption - * algorithm. + * Decryptes an encrypted CEK with RSA encryption algorithm using the asymmetric key specified by the key path * * @param masterKeyPath * - Complete path of an asymmetric key in AKV @@ -270,7 +269,7 @@ private short convertTwoBytesToShort(byte[] input, int index) throws SQLServerEx } /** - * This function uses the asymmetric key specified by the key path and encrypts CEK with RSA encryption algorithm. + * Encrypts CEK with RSA encryption algorithm using the asymmetric key specified by the key path. * * @param masterKeyPath * - Complete path of an asymmetric key in AKV @@ -398,7 +397,7 @@ public byte[] encryptColumnEncryptionKey(String masterKeyPath, String encryption } /** - * This function validates that the encryption algorithm is RSA_OAEP and if it is not, then throws an exception + * Validates that the encryption algorithm is RSA_OAEP and if it is not, then throws an exception. * * @param encryptionAlgorithm * - Asymmetric key encryptio algorithm @@ -460,7 +459,7 @@ private void ValidateNonEmptyAKVPath(String masterKeyPath) throws SQLServerExcep } /** - * Encrypt the text using specified Azure Key Vault key. + * Encrypts the text using specified Azure Key Vault key. * * @param masterKeyPath * - Azure Key Vault key url. @@ -485,7 +484,7 @@ private byte[] AzureKeyVaultWrap(String masterKeyPath, String encryptionAlgorith } /** - * Encrypt the text using specified Azure Key Vault key. + * Encrypts the text using specified Azure Key Vault key. * * @param masterKeyPath * - Azure Key Vault key url. @@ -554,7 +553,7 @@ private boolean AzureKeyVaultVerifySignature(byte[] dataToVerify, byte[] signatu } /** - * Gets the public Key size in bytes + * Returns the public Key size in bytes. * * @param masterKeyPath * - Azure Key Vault Key path diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionCertificateStoreProvider.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionCertificateStoreProvider.java index eb2cd0722..1f87ecbe0 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionCertificateStoreProvider.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionCertificateStoreProvider.java @@ -25,8 +25,8 @@ /** - * The implementation of the key store provider for the Windows Certificate Store. This class enables using keys stored - * in the Windows Certificate Store as column master keys. + * Provides the implementation of the key store provider for the Windows Certificate Store. This class enables using + * keys stored in the Windows Certificate Store as column master keys. * */ public final class SQLServerColumnEncryptionCertificateStoreProvider extends SQLServerColumnEncryptionKeyStoreProvider { @@ -50,6 +50,9 @@ public final class SQLServerColumnEncryptionCertificateStoreProvider extends SQL } private Path keyStoreDirectoryPath = null; + /** + * Constructs a SQLServerColumnEncryptionCertificateStoreProvider. + */ public SQLServerColumnEncryptionCertificateStoreProvider() { windowsCertificateStoreLogger.entering(SQLServerColumnEncryptionCertificateStoreProvider.class.getName(), "SQLServerColumnEncryptionCertificateStoreProvider"); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java index 608ca98ca..cd0a2f755 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionJavaKeyStoreProvider.java @@ -33,8 +33,8 @@ /** * - * The implementation of the key store provider for Java Key Store. This class enables using certificates stored in the - * Java keystore as column master keys. + * Provides the implementation of the key store provider for Java Key Store. This class enables using certificates + * stored in the Java keystore as column master keys. * */ public class SQLServerColumnEncryptionJavaKeyStoreProvider extends SQLServerColumnEncryptionKeyStoreProvider { @@ -54,7 +54,7 @@ public String getName() { } /** - * Key store provider for the Java Key Store. + * Constructs a SQLServerColumnEncryptionJavaKeyStoreProvider for the Java Key Store. * * @param keyStoreLocation * specifies the location of the keystore @@ -264,7 +264,7 @@ public byte[] encryptColumnEncryptionKey(String masterKeyPath, String encryption } /** - * Encrypt plainText with the certificate provided + * Encrypt. plainText with the certificate provided. * * @param plainText * plain CEK to be encrypted diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionKeyStoreProvider.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionKeyStoreProvider.java index 2778f9c13..6fd8b845f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionKeyStoreProvider.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerColumnEncryptionKeyStoreProvider.java @@ -7,7 +7,8 @@ /** * - * Extend this class to implement a custom key store provider. + * Defines the abtract class for a SQL Server Column Encryption key store provider Extend this class to implement a + * custom key store provider. * */ public abstract class SQLServerColumnEncryptionKeyStoreProvider { @@ -21,16 +22,15 @@ public abstract class SQLServerColumnEncryptionKeyStoreProvider { public abstract void setName(String name); /** - * Retrieves the name of this key store provider. + * Returns the name of this key store provider. * * @return the name of this key store provider. */ public abstract String getName(); /** - * Base class method for decrypting the specified encrypted value of a column encryption key. The encrypted value is - * expected to be encrypted using the column master key with the specified key path and using the specified - * algorithm. + * Decrypts the specified encrypted value of a column encryption key. The encrypted value is expected to be + * encrypted using the column master key with the specified key path and using the specified algorithm. * * @param masterKeyPath * The column master key path. @@ -46,8 +46,8 @@ public abstract byte[] decryptColumnEncryptionKey(String masterKeyPath, String e byte[] encryptedColumnEncryptionKey) throws SQLServerException; /** - * Base class method for encrypting a column encryption key using the column master key with the specified key path - * and using the specified algorithm. + * Encrypts a column encryption key using the column master key with the specified key path and using the specified + * algorithm. * * @param masterKeyPath * The column master key path. diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java index 86998e04a..5495ab9ba 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection.java @@ -52,8 +52,9 @@ /** - * SQLServerConnection implements a JDBC connection to SQL Server. SQLServerConnections support JDBC connection pooling - * and may be either physical JDBC connections or logical JDBC connections. + * Provides an implementation java.sql.connection interface that assists creating a JDBC connection to SQL Server. + * SQLServerConnections support JDBC connection pooling and may be either physical JDBC connections or logical JDBC + * connections. *

* SQLServerConnection manages transaction control for all statements that were created from it. SQLServerConnection may * participate in XA distributed transactions managed via an XAResource adapter. @@ -72,12 +73,11 @@ *

* The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. + * + * NOTE: All the public functions in this class also need to be defined in SQLServerConnectionPoolProxy Declare all new + * custom (non-static) Public APIs in ISQLServerConnection interface such that they can also be implemented by + * SQLServerConnectionPoolProxy */ - -// NOTE: All the public functions in this class also need to be defined in SQLServerConnectionPoolProxy -// Declare all new custom (non-static) Public APIs in ISQLServerConnection interface such that they can also be -// implemented by -// SQLServerConnectionPoolProxy public class SQLServerConnection implements ISQLServerConnection, java.io.Serializable { /** @@ -99,17 +99,12 @@ public class SQLServerConnection implements ISQLServerConnection, java.io.Serial /** * The default for if prepared statements should execute sp_executesql before following the prepare, unprepare * pattern. + * + * Used to set the initial default, can be changed later. false == use sp_executesql -> sp_prepexec -> sp_execute -> + * batched -> sp_unprepare pattern, true == skip sp_executesql part of pattern. */ - static final boolean DEFAULT_ENABLE_PREPARE_ON_FIRST_PREPARED_STATEMENT_CALL = false; // Used to set the initial - // default, can be changed - // later. - // false == use sp_executesql - // -> sp_prepexec -> - // sp_execute - // -> batched -> sp_unprepare - // pattern, true == skip - // sp_executesql part of - // pattern. + static final boolean DEFAULT_ENABLE_PREPARE_ON_FIRST_PREPARED_STATEMENT_CALL = false; + private Boolean enablePrepareOnFirstPreparedStatementCall = null; // Current limit for this particular connection. // Handle the actual queue of discarded prepared statements. @@ -174,7 +169,7 @@ public int hashCode() { } /** - * Used to keep track of an individual prepared statement handle. + * Keeps track of an individual prepared statement handle. */ class PreparedStatementHandle { private int handle = 0; @@ -214,12 +209,12 @@ private boolean isExplicitlyDiscarded() { return explicitlyDiscarded; } - /** Get the actual handle. */ + /** Returns the actual handle. */ int getHandle() { return handle; } - /** Get the cache key. */ + /** Returns the cache key. */ CityHash128Key getKey() { return key; } @@ -229,7 +224,7 @@ boolean isDirectSql() { } /** - * Make sure handle cannot be re-used. + * Makes sure handle cannot be re-used. * * @return false: Handle could not be discarded, it is in use. true: Handle was successfully put on path for * discarding. @@ -275,12 +270,12 @@ void removeReference() { .maximumWeightedCapacity(PARSED_SQL_CACHE_SIZE).build(); } - /** Get prepared statement cache entry if exists, if not parse and create a new one */ + /** Returns prepared statement cache entry if exists, if not parse and create a new one */ static ParsedSQLCacheItem getCachedParsedSQL(CityHash128Key key) { return parsedSQLCache.get(key); } - /** Parse and create a information about parsed SQL text */ + /** Parses and create a information about parsed SQL text */ static ParsedSQLCacheItem parseAndCacheSQL(CityHash128Key key, String sql) throws SQLServerException { JDBCSyntaxTranslator translator = new JDBCSyntaxTranslator(); @@ -311,7 +306,7 @@ static ParsedSQLCacheItem parseAndCacheSQL(CityHash128Key key, String sql) throw private boolean disableStatementPooling = true; /** - * Locate statement parameters. + * Locates statement parameters. * * @param sql * SQL text to parse for positions of parameters to intialize. @@ -334,7 +329,7 @@ SqlFedAuthToken getAuthenticationResult() { } /** - * Struct encapsulating the data to be sent to the server as part of Federated Authentication Feature Extension. + * Eencapsulates the data to be sent to the server as part of Federated Authentication Feature Extension. */ class FederatedAuthenticationFeatureExtensionData { boolean fedAuthRequiredPreLoginResponse; @@ -391,7 +386,7 @@ class ActiveDirectoryAuthentication { } /** - * denotes the state of the SqlServerConnection + * Denotes the state of the SqlServerConnection. */ private enum State { Initialized, // default value on calling SQLServerConnection constructor @@ -490,12 +485,12 @@ final int getQueryTimeoutSeconds() { } /** - * timeout value for canceling the query timeout + * Timeout value for canceling the query timeout. */ private int cancelQueryTimeoutSeconds; /** - * Retrieves the cancelTimeout in seconds + * Returns the cancelTimeout in seconds. * * @return */ @@ -510,12 +505,12 @@ final int getSocketTimeoutMilliseconds() { } /** - * boolean value for deciding if the driver should use bulk copy API for batch inserts + * boolean value for deciding if the driver should use bulk copy API for batch inserts. */ private boolean useBulkCopyForBatchInsert; /** - * Retrieves the useBulkCopyForBatchInsert value. + * Returns the useBulkCopyForBatchInsert value. * * @return flag for using Bulk Copy API for batch insert operations. */ @@ -775,7 +770,7 @@ public static synchronized void removeColumnEncryptionTrustedMasterKeyPaths(Stri } /** - * Retrieves the Trusted Master Key Paths. + * Returns the Trusted Master Key Paths. * * @return columnEncryptionTrustedMasterKeyPaths. */ @@ -1001,9 +996,9 @@ final void setAssociatedProxy(SQLServerConnectionPoolProxy proxy) { } /* - * This function is used by the functions that return a connection object to outside world. E.g. stmt.getConnection, - * these functions should return the proxy not the actual physical connection when the physical connection is pooled - * and the user should be accessing the connection functions via the proxy object. + * Provides functionality to return a connection object to outside world. E.g. stmt.getConnection, these functions + * should return the proxy not the actual physical connection when the physical connection is pooled and the user + * should be accessing the connection functions via the proxy object. */ final Connection getConnection() { if (null != proxy) @@ -1018,7 +1013,7 @@ final void resetPooledConnection() { } /** - * Generate the next unique connection id. + * Generates the next unique connection id. * * @return the next conn id */ @@ -1035,7 +1030,7 @@ String getClassNameLogging() { } /** - * This is a helper function to provide an ID string suitable for tracing. + * Provides a helper function to return an ID string suitable for tracing. */ @Override public String toString() { @@ -1046,7 +1041,7 @@ public String toString() { } /** - * Check if the connection is closed Create a new connection if it's a fedauth connection and the access token is + * Checks if the connection is closed Create a new connection if it's a fedauth connection and the access token is * going to expire. * * @throws SQLServerException @@ -1065,7 +1060,7 @@ void checkClosed() throws SQLServerException { } /** - * Check if a string property is enabled. + * Returns if a string property is enabled. * * @param propName * the string property name @@ -1136,13 +1131,9 @@ Connection connect(Properties propsIn, SQLServerPooledConnection pooledConnectio // We do not need to check for exceptions here, as the connection properties are already // verified during the first try. Also, we would like to do this calculation // only for the TLS 1.2 exception case. - loginTimeoutSeconds = SQLServerDriverIntProperty.LOGIN_TIMEOUT.getDefaultValue(); // if the user - // does not - // specify a - // default - // timeout, - // default is - // 15 per spec + // if the user does not specify a default timeout, default is 15 per spec + loginTimeoutSeconds = SQLServerDriverIntProperty.LOGIN_TIMEOUT.getDefaultValue(); + String sPropValue = propsIn.getProperty(SQLServerDriverIntProperty.LOGIN_TIMEOUT.toString()); if (null != sPropValue && sPropValue.length() > 0) { int sPropValueInt = Integer.parseInt(sPropValue); @@ -1279,11 +1270,8 @@ Connection connectInternal(Properties propsIn, sPropValue = activeConnectionProperties.getProperty(sPropKey); ValidateMaxSQLLoginName(sPropKey, sPropValue); - int loginTimeoutSeconds = SQLServerDriverIntProperty.LOGIN_TIMEOUT.getDefaultValue(); // if the user does - // not specify a - // default timeout, - // default is 15 per - // spec + // if the user does not specify a default timeout, default is 15 per spec + int loginTimeoutSeconds = SQLServerDriverIntProperty.LOGIN_TIMEOUT.getDefaultValue(); sPropValue = activeConnectionProperties.getProperty(SQLServerDriverIntProperty.LOGIN_TIMEOUT.toString()); if (null != sPropValue && sPropValue.length() > 0) { try { @@ -1938,12 +1926,11 @@ else if (0 == requestedPacketSize) } - // This function is used by non failover and failover cases. Even when we make a standard connection the server can - // provide us with its - // FO partner. - // If no FO information is available a standard connection is made. - // If the server returns a failover upon connection, we shall store the FO in our cache. - // + /** + * This function is used by non failover and failover cases. Even when we make a standard connection the server can + * provide us with its FO partner. If no FO information is available a standard connection is made. If the server + * returns a failover upon connection, we shall store the FO in our cache. + */ private void login(String primary, String primaryInstanceName, int primaryPortNumber, String mirror, FailoverInfo foActual, int timeout, long timerStart) throws SQLServerException { // standardLogin would be false only for db mirroring scenarios. It would be true @@ -2409,7 +2396,7 @@ private void connectHelper(ServerPortPlaceHolder serverInfo, int timeOutsliceInM } /** - * Negotiates prelogin information with the server + * Negotiates prelogin information with the server. */ void Prelogin(String serverName, int portNumber) throws SQLServerException { // Build a TDS Pre-Login packet to send to the server. @@ -2938,7 +2925,7 @@ private String sqlStatementToInitialize() { } /** - * Return the syntax to set the database calatog to use. + * Sets the syntax to set the database calatog to use. * * @param sDB * the new catalog @@ -2953,7 +2940,7 @@ void setCatalogName(String sDB) { } /** - * Return the syntax to set the database isolation level. + * Returns the syntax to set the database isolation level. * * @return the required syntax */ @@ -2991,7 +2978,7 @@ String sqlStatementToSetTransactionIsolationLevel() throws SQLServerException { } /** - * Return the syntax to set the database commit mode. + * Returns the syntax to set the database commit mode. * * @return the required syntax */ @@ -3431,15 +3418,11 @@ int writeAEFeatureRequest(boolean write, return len; } + // if false just calculates the length + int writeFedAuthFeatureRequest(boolean write, TDSWriter tdsWriter, - FederatedAuthenticationFeatureExtensionData fedAuthFeatureExtensionData) throws SQLServerException { /* - * if - * false - * just - * calculates - * the - * length - */ + FederatedAuthenticationFeatureExtensionData fedAuthFeatureExtensionData) throws SQLServerException { + assert (fedAuthFeatureExtensionData.libraryType == TDS.TDS_FEDAUTH_LIBRARY_ADAL || fedAuthFeatureExtensionData.libraryType == TDS.TDS_FEDAUTH_LIBRARY_SECURITYTOKEN); @@ -3452,10 +3435,9 @@ int writeFedAuthFeatureRequest(boolean write, TDSWriter tdsWriter, break; case TDS.TDS_FEDAUTH_LIBRARY_SECURITYTOKEN: assert null != fedAuthFeatureExtensionData.accessToken; - dataLen = 1 + 4 + fedAuthFeatureExtensionData.accessToken.length; // length of feature data = 1 byte for - // library and echo, security - // token length and sizeof(int) for - // token lengh itself + // length of feature data = 1 byte for library and echo, + // security token length and sizeof(int) for token length itself + dataLen = 1 + 4 + fedAuthFeatureExtensionData.accessToken.length; break; default: assert (false); // Unrecognized library type for fedauth feature extension request" @@ -5471,7 +5453,7 @@ protected void endRequestInternal() throws SQLException { } /** - * Replace JDBC syntax parameter markets '?' with SQL Server paramter markers @p1, @p2 etc... + * Replaces JDBC syntax parameter markets '?' with SQL Server paramter markers @p1, @p2 etc... * * @param sql * the user's SQL @@ -5515,7 +5497,7 @@ String replaceParameterMarkers(String sqlSrc, int[] paramPositions, Parameter[] } /** - * Make a SQL Server style parameter name. + * Makes a SQL Server style parameter name. * * @param nParam * the parameter number @@ -5549,11 +5531,12 @@ static int makeParamName(int nParam, char[] name, int offset) { } } - // Notify any interested parties (e.g. pooling managers) of a ConnectionEvent activity - // on the connection. Calling notifyPooledConnection with null event will place this - // connection back in the pool. Calling notifyPooledConnection with a non-null event is - // used to notify the pooling manager that the connection is bad and should be removed - // from the pool. + /** + * Notify any interested parties (e.g. pooling managers) of a ConnectionEvent activity on the connection. Calling + * notifyPooledConnection with null event will place this connection back in the pool. Calling + * notifyPooledConnection with a non-null event is used to notify the pooling manager that the connection is bad and + * should be removed from the pool. + */ void notifyPooledConnection(SQLServerException e) { synchronized (this) { if (null != pooledConnectionParent) { @@ -5571,7 +5554,7 @@ void DetachFromPool() { } /** - * Determine the listening port of a named SQL Server instance. + * Determines the listening port of a named SQL Server instance. * * @param server * the server name @@ -5695,16 +5678,19 @@ int getNextSavepointId() { return nNextSavePointId; } - // Returns this connection's SQLServerConnectionSecurityManager class to caller. - // Used by SQLServerPooledConnection to verify security when passing out Connection objects. + /** + * Returns this connection's SQLServerConnectionSecurityManager class to caller. Used by SQLServerPooledConnection + * to verify security when passing out Connection objects. + */ void doSecurityCheck() { assert null != currentConnectPlaceHolder; currentConnectPlaceHolder.doSecurityCheck(); } - // ColumnEncryptionKeyCache sets time-to-live for column encryption key entries in - // the column encryption key cache for the Always Encrypted feature. The default value is 2 hours. - // This variable holds the value in seconds. + /** + * Sets time-to-live for column encryption key entries in the column encryption key cache for the Always Encrypted + * feature. The default value is 2 hours. This variable holds the value in seconds. + */ private static long columnEncryptionKeyCacheTtl = TimeUnit.SECONDS.convert(2, TimeUnit.HOURS); /** @@ -5733,7 +5719,7 @@ static synchronized long getColumnEncryptionKeyCacheTtl() { } /** - * Enqueue a discarded prepared statement handle to be clean-up on the server. + * Enqueues a discarded prepared statement handle to be clean-up on the server. * * @param statementHandle * The prepared statement handle that should be scheduled for unprepare. @@ -5762,7 +5748,7 @@ public void closeUnreferencedPreparedStatementHandles() { } /** - * Remove references to outstanding un-prepare requests. Should be run when connection is closed. + * Removes references to outstanding un-prepare requests. Should be run when connection is closed. */ private final void cleanupPreparedStatementDiscardActions() { discardedPreparedStatementHandles.clear(); @@ -5800,7 +5786,7 @@ final boolean isPreparedStatementUnprepareBatchingEnabled() { } /** - * Cleans-up discarded prepared statement handles on the server using batched un-prepare actions if the batching + * Cleans up discarded prepared statement handles on the server using batched un-prepare actions if the batching * threshold has been reached. * * @param force @@ -5900,7 +5886,7 @@ public void setStatementPoolingCacheSize(int value) { } /** - * Internal method to prepare the cache handle + * Prepares the cache handle. * * @param value */ @@ -5913,7 +5899,7 @@ private void prepareCache() { .maximumWeightedCapacity(getStatementPoolingCacheSize()).build(); } - /** Get a parameter metadata cache entry if statement pooling is enabled */ + /** Returns a parameter metadata cache entry if statement pooling is enabled */ final SQLServerParameterMetaData getCachedParameterMetadata(CityHash128Key key) { if (!isStatementPoolingEnabled()) return null; @@ -5921,7 +5907,7 @@ final SQLServerParameterMetaData getCachedParameterMetadata(CityHash128Key key) return parameterMetadataCache.get(key); } - /** Register a parameter metadata cache entry if statement pooling is enabled */ + /** Registers a parameter metadata cache entry if statement pooling is enabled */ final void registerCachedParameterMetadata(CityHash128Key key, SQLServerParameterMetaData pmd) { if (!isStatementPoolingEnabled() || null == pmd) return; @@ -5929,7 +5915,7 @@ final void registerCachedParameterMetadata(CityHash128Key key, SQLServerParamete parameterMetadataCache.put(key, pmd); } - /** Get or create prepared statement handle cache entry if statement pooling is enabled */ + /** Gets or creates prepared statement handle cache entry if statement pooling is enabled */ final PreparedStatementHandle getCachedPreparedStatementHandle(CityHash128Key key) { if (!isStatementPoolingEnabled()) return null; @@ -5937,7 +5923,7 @@ final PreparedStatementHandle getCachedPreparedStatementHandle(CityHash128Key ke return preparedStatementHandleCache.get(key); } - /** Get or create prepared statement handle cache entry if statement pooling is enabled */ + /** Gets or creates prepared statement handle cache entry if statement pooling is enabled */ final PreparedStatementHandle registerCachedPreparedStatementHandle(CityHash128Key key, int handle, boolean isDirectSql) { if (!isStatementPoolingEnabled() || null == key) @@ -5948,7 +5934,7 @@ final PreparedStatementHandle registerCachedPreparedStatementHandle(CityHash128K return cacheItem; } - /** Return prepared statement handle cache entry so it can be un-prepared. */ + /** Returns prepared statement handle cache entry so it can be un-prepared. */ final void returnCachedPreparedStatementHandle(PreparedStatementHandle handle) { handle.removeReference(); @@ -5956,7 +5942,7 @@ final void returnCachedPreparedStatementHandle(PreparedStatementHandle handle) { enqueueUnprepareStatementHandle(handle); } - /** Force eviction of prepared statement handle cache entry. */ + /** Forces eviction of prepared statement handle cache entry. */ final void evictCachedPreparedStatementHandle(PreparedStatementHandle handle) { if (null == handle || null == handle.getKey()) return; @@ -5964,7 +5950,9 @@ final void evictCachedPreparedStatementHandle(PreparedStatementHandle handle) { preparedStatementHandleCache.remove(handle.getKey()); } - // Handle closing handles when removed from cache. + /* + * Handles closing handles when removed from cache. + */ final class PreparedStatementCacheEvictionListener implements EvictionListener { public void onEviction(CityHash128Key key, PreparedStatementHandle handle) { @@ -6009,6 +5997,8 @@ boolean isAzureDW() throws SQLServerException, SQLException { } /** + * Adds statement to openStatements + * * @param st * Statement to add to openStatements */ @@ -6019,6 +6009,8 @@ final synchronized void addOpenStatement(Statement st) { } /** + * Removes state from openStatements + * * @param st * Statement to remove from openStatements */ @@ -6030,7 +6022,10 @@ final synchronized void removeOpenStatement(Statement st) { } -// Helper class for security manager functions used by SQLServerConnection class. +/** + * Provides Helper class for security manager functions used by SQLServerConnection class. + * + */ final class SQLServerConnectionSecurityManager { static final String dllName = "sqljdbc_auth.dll"; String serverName; @@ -6042,8 +6037,8 @@ final class SQLServerConnectionSecurityManager { } /** - * checkConnect will throws a SecurityException if the calling thread is not allowed to open a socket connection to - * the specified serverName and portNumber. + * Throws a SecurityException if the calling thread is not allowed to open a socket connection to the specified + * serverName and portNumber. * * @throws SecurityException * when an error occurs diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection43.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection43.java index d3903938c..93505f5f1 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection43.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnection43.java @@ -10,14 +10,14 @@ /** - * SQLServerConnection43 extends {@link SQLServerConnection43} class and implements {@link ISQLServerConnection43} with - * methods introduced in JDBC 4.3 Specifications. This class is used by the drdiver when initializing a class with 43 - * driver version + * Extends {@link SQLServerConnection43} and implements {@link ISQLServerConnection43} with methods introduced in JDBC + * 4.3 Specifications. This class is used by the driver when initializing a class with with JDBC 4.3 Specs supported + * JVM. */ public class SQLServerConnection43 extends SQLServerConnection implements ISQLServerConnection43 { /** - * Always refresh SerialVersionUID when prompted + * Always refresh SerialVersionUID when prompted. */ private static final long serialVersionUID = -6904163521498951547L; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolDataSource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolDataSource.java index a63891c3f..4ac11100f 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolDataSource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolDataSource.java @@ -14,11 +14,10 @@ /** - * SQLServerConnectionPoolDataSource provides physical database connections for connection pool managers. - * SQLServerConnectionPoolDataSource is typically used in Java Application Server environments that support built-in - * connection pooling and require a ConnectionPoolDataSource to provide physical connections. For example, J2EE - * application servers that provide JDBC 3.0 API spec connection pooling. - * + * Provides physical database connections for connection pool managers. SQLServerConnectionPoolDataSource is typically + * used in Java Application Server environments that support built-in connection pooling and require a + * ConnectionPoolDataSource to provide physical connections. For example, J2EE application servers that provide JDBC 3.0 + * API spec connection pooling. */ public class SQLServerConnectionPoolDataSource extends SQLServerDataSource implements ConnectionPoolDataSource { // Get a new physical connection that the pool manager will issue logical connections from @@ -65,9 +64,9 @@ private void readObject(java.io.ObjectInputStream stream) throws java.io.Invalid throw new java.io.InvalidObjectException(""); } - // This is 90% duplicate from the SQLServerDataSource, the serialization proxy pattern does not lend itself to - // inheritance - // so the duplication is necessary + /** + * Implements java.io.Serializable the same way as {@link SQLServerDataSource} + */ private static class SerializationProxy implements java.io.Serializable { private final Reference ref; private static final long serialVersionUID = 654661379842314126L; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java index b389677b9..1ee3d0128 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerConnectionPoolProxy.java @@ -17,7 +17,7 @@ /** - * SQLServerConnectionPoolProxy is a wrapper around SQLServerConnection object. When returning a connection object from + * Provides a wrapper around SQLServerConnection object. When returning a connection object from * PooledConnection.getConnection we return this proxy per SPEC. *

* This class's public functions need to be kept identical to the SQLServerConnection's. @@ -25,7 +25,6 @@ * The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. */ - class SQLServerConnectionPoolProxy implements ISQLServerConnection, java.io.Serializable { /** * Always refresh SerialVersionUID when prompted @@ -39,12 +38,13 @@ class SQLServerConnectionPoolProxy implements ISQLServerConnection, java.io.Seri // dispenser final private String traceID; - // Permission targets - // currently only callAbort is implemented + /** + * Permission targets currently only callAbort is implemented + */ private static final String callAbortPerm = "callAbort"; /** - * Generate the next unique connection id. + * Generates the next unique connection id. * * @return the next conn id */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java index 2357e47d6..218f58dbb 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataColumn.java @@ -6,7 +6,7 @@ package com.microsoft.sqlserver.jdbc; /** - * This class represents a column of the in-memory data table represented by SQLServerDataTable. + * Represents a column of the in-memory data table represented by {@link SQLServerDataTable}. */ public final class SQLServerDataColumn { String columnName; @@ -16,7 +16,7 @@ public final class SQLServerDataColumn { int numberOfDigitsIntegerPart = 0; /** - * Initializes a new instance of SQLServerDataColumn with the column name and type. + * Constructs a SQLServerDataColumn with the column name and type. * * @param columnName * the name of the column @@ -29,7 +29,7 @@ public SQLServerDataColumn(String columnName, int sqlType) { } /** - * Retrieves the column name. + * Returns the column name. * * @return the name of the column. */ @@ -38,11 +38,11 @@ public String getColumnName() { } /** - * Retrieves the column type. + * Returns the column type. * * @return the column type. */ public int getColumnType() { return javaSqlType; } -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java index c6a0dad5c..a0b32b32e 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSource.java @@ -21,7 +21,7 @@ /** - * This datasource lists properties specific for the SQLServerConnection class. + * Contains a list of properties specific for the {@link SQLServerConnection} class. */ public class SQLServerDataSource implements ISQLServerDataSource, javax.sql.DataSource, java.io.Serializable, javax.naming.Referenceable { @@ -57,7 +57,7 @@ public class SQLServerDataSource final private String traceID; /** - * Initializes a new instance of the SQLServerDataSource class. + * Constructs a SQLServerDataSource. */ public SQLServerDataSource() { connectionProps = new Properties(); @@ -97,8 +97,10 @@ public Connection getConnection(String username, String password) throws SQLServ return con; } - // Sets the maximum time in seconds that this data source will wait while - // attempting to connect to a database. Note default value is 0. + /** + * Sets the maximum time in seconds that this data source will wait while attempting to connect to a database. Note + * default value is 0. + */ @Override public void setLoginTimeout(int loginTimeout) { setIntProperty(connectionProps, SQLServerDriverIntProperty.LOGIN_TIMEOUT.toString(), loginTimeout); @@ -113,9 +115,10 @@ public int getLoginTimeout() { return (logintimeout == 0) ? defaultTimeOut : logintimeout; } - // Sets the log writer for this DataSource. - // Currently we just hold onto this logWriter and pass it back to callers, - // nothing else. + /** + * Sets the log writer for this DataSource. Currently we just hold onto this logWriter and pass it back to callers, + * nothing else. + */ private transient PrintWriter logWriter; @Override @@ -125,7 +128,9 @@ public void setLogWriter(PrintWriter out) { loggerExternal.exiting(getClassNameLogging(), "setLogWriter"); } - // Retrieves the log writer for this DataSource. + /** + * Returns the log writer for this DataSource. + */ @Override public PrintWriter getLogWriter() { loggerExternal.entering(getClassNameLogging(), "getLogWriter"); @@ -140,9 +145,9 @@ public Logger getParentLogger() throws java.sql.SQLFeatureNotSupportedException // Core Connection property setters/getters. - // applicationName is used to identify the specific application in various - // SQL Server - // profiling and logging tools. + /** + * Sets the specific application in various SQL Server profiling and logging tools. + */ @Override public void setApplicationName(String applicationName) { setStringProperty(connectionProps, SQLServerDriverStringProperty.APPLICATION_NAME.toString(), applicationName); @@ -154,9 +159,12 @@ public String getApplicationName() { SQLServerDriverStringProperty.APPLICATION_NAME.getDefaultValue()); } - // databaseName is the name of the database to connect to. If databaseName - // is not set, - // getDatabaseName returns the default value of null. + /** + * Sets the the database to connect to. + * + * @param databaseName + * if not set, returns the default value of null. + */ @Override public void setDatabaseName(String databaseName) { setStringProperty(connectionProps, SQLServerDriverStringProperty.DATABASE_NAME.toString(), databaseName); @@ -167,9 +175,12 @@ public String getDatabaseName() { return getStringProperty(connectionProps, SQLServerDriverStringProperty.DATABASE_NAME.toString(), null); } - // instanceName is the SQL Server instance name to connect to. - // If instanceName is not set, getInstanceName returns the default value of - // null. + /** + * Sets the the SQL Server instance name to connect to. + * + * @param instanceName + * if not set, returns the default value of null. + */ @Override public void setInstanceName(String instanceName) { setStringProperty(connectionProps, SQLServerDriverStringProperty.INSTANCE_NAME.toString(), instanceName); @@ -224,13 +235,11 @@ public String getAccessToken() { return getStringProperty(connectionProps, SQLServerDriverStringProperty.ACCESS_TOKEN.toString(), null); } - // If lastUpdateCount is set to true, the driver will return only the last - // update - // count from all the update counts returned by a batch. The default of - // false will - // return all update counts. If lastUpdateCount is not set, - // getLastUpdateCount - // returns the default value of false. + /** + * Sets the Column Encryption setting. If lastUpdateCount is set to true, the driver will return only the last + * update count from all the update counts returned by a batch. The default of false will return all update counts. + * If lastUpdateCount is not set, getLastUpdateCount returns the default value of false. + */ @Override public void setColumnEncryptionSetting(String columnEncryptionSetting) { setStringProperty(connectionProps, SQLServerDriverStringProperty.COLUMN_ENCRYPTION.toString(), @@ -360,14 +369,14 @@ public String getHostNameInCertificate() { null); } - // lockTimeout is the number of milliseconds to wait before the database - // reports - // a lock timeout. The default value of -1 means wait forever. If specified, - // this value will be the default for all statements on the connection. Note - // a - // value of 0 means no wait. If lockTimeout is not set, getLockTimeout - // returns - // the default of -1. + /** + * Sets the lock timeout value. + * + * @param lockTimeout + * the number of milliseconds to wait before the database reports a lock timeout. The default value of -1 + * means wait forever. If specified, this value will be the default for all statements on the connection. + * Note a value of 0 means no wait. If lockTimeout is not set, getLockTimeout returns the default of -1. + */ @Override public void setLockTimeout(int lockTimeout) { setIntProperty(connectionProps, SQLServerDriverIntProperty.LOCK_TIMEOUT.toString(), lockTimeout); @@ -379,12 +388,13 @@ public int getLockTimeout() { SQLServerDriverIntProperty.LOCK_TIMEOUT.getDefaultValue()); } - // setPassword sets the password that will be used when connecting to SQL - // Server. - // Note getPassword is deliberately declared non-public for security - // reasons. - // If the password is not set, getPassword returns the default value of - // null. + /** + * Sets the password that will be used when connecting to SQL Server. + * + * @param password + * Note getPassword is deliberately declared non-public for security reasons. If the password is not set, + * getPassword returns the default value of null. + */ @Override public void setPassword(String password) { setStringProperty(connectionProps, SQLServerDriverStringProperty.PASSWORD.toString(), password); @@ -394,13 +404,14 @@ String getPassword() { return getStringProperty(connectionProps, SQLServerDriverStringProperty.PASSWORD.toString(), null); } - // portNumber is the TCP-IP port number used when opening a socket - // connection - // to SQL Server. If portNumber is not set, getPortNumber returns the - // default - // of 1433. Note as mentioned above, setPortNumber does not do any range - // checking on the port value passed in, invalid port numbers like 99999 can - // be passed in without triggering any error. + /** + * Sets the TCP-IP port number used when opening a socket connection to SQL Server. + * + * @param portNumber + * if not set, getPortNumber returns the default of 1433. Note as mentioned above, setPortNumber does not do + * any range checking on the port value passed in,\ invalid port numbers like 99999 can be passed in without + * triggering any error. + */ @Override public void setPortNumber(int portNumber) { setIntProperty(connectionProps, SQLServerDriverIntProperty.PORT_NUMBER.toString(), portNumber); @@ -412,14 +423,16 @@ public int getPortNumber() { SQLServerDriverIntProperty.PORT_NUMBER.getDefaultValue()); } - // selectMethod is the default cursor type used for the result set. This - // property is useful when you are dealing with large result sets and don't - // want to store the whole result set in memory on the client side. By - // setting - // the property to "cursor" you will be able to create a server side cursor - // that - // can fetch smaller chunks of data at a time. If selectMethod is not set, - // getSelectMethod returns the default value of "direct". + /** + * Sets the default cursor type used for the result set. + * + * @param selectMethod + * This(non-Javadoc) @see com.microsoft.sqlserver.jdbc.ISQLServerDataSource#setSelectMethod(java.lang.String) + * property is useful when you are dealing with large result sets and do not want to store the whole result + * set in memory on the client side. By setting the property to "cursor" you will be able to create a server + * side cursor that can fetch smaller chunks of data at a time. If selectMethod is not set, getSelectMethod + * returns the default value of "direct". + */ @Override public void setSelectMethod(String selectMethod) { setStringProperty(connectionProps, SQLServerDriverStringProperty.SELECT_METHOD.toString(), selectMethod); @@ -466,14 +479,14 @@ public boolean getSendTimeAsDatetime() { SQLServerDriverBooleanProperty.SEND_TIME_AS_DATETIME.getDefaultValue()); } - // If sendStringParametersAsUnicode is set to true (which is the default), - // string parameters are sent to the server in UNICODE format. If - // sendStringParametersAsUnicode - // is set to false, string parameters are sent to the server in the native - // TDS collation - // format of the database, not in UNICODE. If sendStringParametersAsUnicode - // is not set, - // getSendStringParametersAsUnicode returns the default of true. + /** + * Sets whether string parameters are sent to the server in UNICODE format. + * + * @param sendStringParametersAsUnicode + * if true (default), string parameters are sent to the server in UNICODE format. if false, string parameters + * are sent to the server in the native TDS collation format of the database, not in UNICODE. if set, returns + * the default of true. + */ @Override public void setSendStringParametersAsUnicode(boolean sendStringParametersAsUnicode) { setBooleanProperty(connectionProps, SQLServerDriverBooleanProperty.SEND_STRING_PARAMETERS_AS_UNICODE.toString(), @@ -499,9 +512,12 @@ public boolean getServerNameAsACE() { SQLServerDriverBooleanProperty.SERVER_NAME_AS_ACE.getDefaultValue()); } - // serverName is the host name of the target SQL Server. If serverName is - // not set, - // getServerName returns the default value of null is returned. + /** + * Sets the host name of the target SQL Server. + * + * @param serverName + * if not set, returns the default value of null is returned. + */ @Override public void setServerName(String serverName) { setStringProperty(connectionProps, SQLServerDriverStringProperty.SERVER_NAME.toString(), serverName); @@ -512,8 +528,13 @@ public String getServerName() { return getStringProperty(connectionProps, SQLServerDriverStringProperty.SERVER_NAME.toString(), null); } - // Specify an Service Principal Name (SPN) of the target SQL Server. - // https://msdn.microsoft.com/en-us/library/cc280459.aspx + /** + * Sets the Service Principal Name (SPN) of the target SQL Server. + * https://msdn.microsoft.com/en-us/library/cc280459.aspx + * + * @param serverSpn + * service principal name + */ @Override public void setServerSpn(String serverSpn) { setStringProperty(connectionProps, SQLServerDriverStringProperty.SERVER_SPN.toString(), serverSpn); @@ -524,9 +545,12 @@ public String getServerSpn() { return getStringProperty(connectionProps, SQLServerDriverStringProperty.SERVER_SPN.toString(), null); } - // serverName is the host name of the target SQL Server. If serverName is - // not set, - // getServerName returns the default value of null is returned. + /** + * Sets the fail over partner of the target SQL Server. + * + * @param serverName + * if not set, returns the default value of null. + */ @Override public void setFailoverPartner(String serverName) { setStringProperty(connectionProps, SQLServerDriverStringProperty.FAILOVER_PARTNER.toString(), serverName); @@ -549,9 +573,12 @@ public boolean getMultiSubnetFailover() { SQLServerDriverBooleanProperty.MULTI_SUBNET_FAILOVER.getDefaultValue()); } - // setUser set's the user name that will be used when connecting to SQL - // Server. - // If user is not set, getUser returns the default value of null. + /** + * Sets the user name that will be used when connecting to SQL Server. + * + * @param user + * if not set, returns the default value of null. + */ @Override public void setUser(String user) { setStringProperty(connectionProps, SQLServerDriverStringProperty.USER.toString(), user); @@ -562,12 +589,14 @@ public String getUser() { return getStringProperty(connectionProps, SQLServerDriverStringProperty.USER.toString(), null); } - // workstationID is the name of the client machine (or client workstation). - // workstationID is the host name of the client in other words. If - // workstationID - // is not set, the default value is constructed by calling - // InetAddress.getLocalHost().getHostName() - // or if getHostName() returns blank then getHostAddress().toString(). + /** + * Sets the name of the client machine (or client workstation). + * + * @param workstationID + * host name of the client. if not set, the default value is constructed by calling + * InetAddress.getLocalHost().getHostName() or if getHostName() returns blank then + * getHostAddress().toString(). + */ @Override public void setWorkstationID(String workstationID) { setStringProperty(connectionProps, SQLServerDriverStringProperty.WORKSTATION_ID.toString(), workstationID); @@ -587,13 +616,13 @@ public String getWorkstationID() { return getWSID; } - // If xopenStates is set to true, the driver will convert SQL states to - // XOPEN - // compliant states. The default is false which causes the driver to - // generate SQL 99 - // state codes. If xopenStates is not set, getXopenStates returns the - // default value - // of false. + /** + * Sets whether the driver will convert SQL states to XOPEN compliant states. + * + * @param xopenStates + * if true, the driver will convert SQL states to XOPEN compliant states. The default is false which causes + * the driver to generate SQL 99 state codes. If not set, getXopenStates returns the default value of false. + */ @Override public void setXopenStates(boolean xopenStates) { setBooleanProperty(connectionProps, SQLServerDriverBooleanProperty.XOPEN_STATES.toString(), xopenStates); @@ -652,26 +681,19 @@ public String getTrustManagerConstructorArg() { SQLServerDriverStringProperty.TRUST_MANAGER_CONSTRUCTOR_ARG.getDefaultValue()); } - // The URL property is exposed for backwards compatibility reasons. Also, - // several - // Java Application servers expect a setURL function on the DataSource and - // set it - // by default (JBoss and WebLogic). - - // Note for security reasons we do not recommend that customers include the - // password - // in the url supplied to setURL. The reason for this is third-party Java - // Application - // Servers will very often display the value set to URL property in their - // DataSource - // configuration GUI. We recommend instead that clients use the setPassword - // method - // to set the password value. The Java Application Servers will not display - // a password - // that is set on the DataSource in the configuration GUI. - - // Note if setURL is not called, getURL returns the default value of - // "jdbc:sqlserver://". + /** + * Sets the datasource URL. + * + * @param url + * The URL property is exposed for backwards compatibility reasons. Also, several Java Application servers + * expect a setURL function on the DataSource and set it by default (JBoss and WebLogic) Note for security + * reasons we do not recommend that customers include the password in the url supplied to setURL. The reason + * for this is third-party Java Application Servers will very often display the value set to URL property in + * their DataSource configuration GUI. We recommend instead that clients use the setPassword method to set + * the password value. The Java Application Servers will not display a password that is set on the DataSource + * in the configuration GUI. Note if setURL is not called, getURL returns the default value of + * "jdbc:sqlserver://". + */ @Override public void setURL(String url) { loggerExternal.entering(getClassNameLogging(), "setURL", url); @@ -691,9 +713,10 @@ public String getURL() { return url; } - // DataSource specific property setters/getters. - // Per JDBC specification 16.1.1 "...the only property that all DataSource - // implementations are required to support is the description property". + /** + * Sets the DataSource description. Per JDBC specification 16.1.1 "...the only property that all DataSource + * implementations are required to support is the description property". + */ @Override public void setDescription(String description) { loggerExternal.entering(getClassNameLogging(), "setDescription", description); @@ -701,6 +724,9 @@ public void setDescription(String description) { loggerExternal.exiting(getClassNameLogging(), "setDescription"); } + /** + * Returns the DataSource description + */ @Override public String getDescription() { loggerExternal.entering(getClassNameLogging(), "getDescription"); @@ -708,10 +734,14 @@ public String getDescription() { return dataSourceDescription; } - // packetSize is the size (in bytes) to use for the TCP/IP send and receive - // buffer. It is also the value used for the TDS packet size (SQL Server - // Network Packet Size). Validity of the value is checked at connect time. - // If no value is set for this property, its default value is 4KB. + /** + * Sets the packet size. + * + * @param packetSize + * the size (in bytes) to use for the TCP/IP send and receive buffer. It is also the value used for the TDS + * packet size (SQL Server Network Packet Size). Validity of the value is checked at connect time. If no + * value is set for this property, its default value is 4KB. + */ @Override public void setPacketSize(int packetSize) { setIntProperty(connectionProps, SQLServerDriverIntProperty.PACKET_SIZE.toString(), packetSize); @@ -836,31 +866,15 @@ public String getJASSConfigurationName() { SQLServerDriverStringProperty.JAAS_CONFIG_NAME.getDefaultValue()); } - // responseBuffering controls the driver's buffering of responses from SQL - // Server. - // Possible values are: - // - // "full" - Fully buffer the response at execution time. - // Advantages: - // 100% back compat with v1.1 driver - // Maximizes concurrency on the server - // Disadvantages: - // Consumes more client-side memory - // Client scalability limits with large responses - // More execute latency - // - // "adaptive" - Data Pipe adaptive buffering - // Advantages: - // Buffers only when necessary, only as much as necessary - // Enables handling very large responses, values - // Disadvantages - // Reduced concurrency on the server - // Internal functions for setting/getting property values. - - // Set a string property value. - // Caller will always supply a non-null props and propKey. - // Caller may supply a null propValue, in this case no property value is - // set. + /** + * Sets a property string value. + * + * @param props + * @param propKey + * @param propValue + * Caller will always supply a non-null props and propKey. Caller may supply a null propValue, in this case + * no property value is set. + */ private void setStringProperty(Properties props, String propKey, String propValue) { if (loggerExternal.isLoggable(java.util.logging.Level.FINER) && !propKey.contains("password") && !propKey.contains("Password")) { @@ -872,9 +886,15 @@ private void setStringProperty(Properties props, String propKey, String propValu loggerExternal.exiting(getClassNameLogging(), "set" + propKey); } - // Reads property value in String format. - // Caller will always supply a non-null props and propKey. - // Returns null if the specific property value is not set. + /** + * Returns a property value in String format. + * + * @param props + * @param propKey + * @param defaultValue + * @return Caller will always supply a non-null props and propKey. Returns null if the specific property value is + * not set. + */ private String getStringProperty(Properties props, String propKey, String defaultValue) { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), "get" + propKey); @@ -887,8 +907,14 @@ private String getStringProperty(Properties props, String propKey, String defaul return propValue; } - // Set an integer property value. - // Caller will always supply a non-null props and propKey. + /** + * Sets an integer property value. + * + * @param props + * @param propKey + * @param propValue + * Caller will always supply a non-null props and propKey. + */ private void setIntProperty(Properties props, String propKey, int propValue) { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), "set" + propKey, propValue); @@ -896,9 +922,10 @@ private void setIntProperty(Properties props, String propKey, int propValue) { loggerExternal.exiting(getClassNameLogging(), "set" + propKey); } - // Reads a property value in int format. - // Caller will always supply a non-null props and propKey. - // Returns defaultValue if the specific property value is not set. + /** + * Returns a property value in int format. Caller will always supply a non-null props and propKey. Returns + * defaultValue if the specific property value is not set. + */ private int getIntProperty(Properties props, String propKey, int defaultValue) { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), "get" + propKey); @@ -918,8 +945,9 @@ private int getIntProperty(Properties props, String propKey, int defaultValue) { return value; } - // Set a boolean property value. - // Caller will always supply a non-null props and propKey. + /** + * Set a boolean property value. Caller will always supply a non-null props and propKey. + */ private void setBooleanProperty(Properties props, String propKey, boolean propValue) { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), "set" + propKey, propValue); @@ -927,9 +955,10 @@ private void setBooleanProperty(Properties props, String propKey, boolean propVa loggerExternal.exiting(getClassNameLogging(), "set" + propKey); } - // Reads a property value in boolean format. - // Caller will always supply a non-null props and propKey. - // Returns defaultValue if the specific property value is not set. + /** + * Returns a property value in boolean format. Caller will always supply a non-null props and propKey. Returns + * defaultValue if the specific property value is not set. + */ private boolean getBooleanProperty(Properties props, String propKey, boolean defaultValue) { if (loggerExternal.isLoggable(java.util.logging.Level.FINER)) loggerExternal.entering(getClassNameLogging(), "get" + propKey); @@ -966,17 +995,12 @@ private Object getObjectProperty(Properties props, String propKey, Object defaul return propValue; } - // Returns a SQLServerConnection given username, password, and - // pooledConnection. - // Note that the DataSource properties set to connectionProps are used when - // creating - // the connection. - - // Both username and password can be null. - - // If pooledConnection is not null, then connection returned is attached to - // the pooledConnection - // and participates in connection pooling. + /** + * Returns a SQLServerConnection given username, password, and pooledConnection. Note that the DataSource properties + * set to connectionProps are used when creating the connection. Both username and password can be null. If + * pooledConnection is not null, then connection returned is attached to the pooledConnection and participates in + * connection pooling. + */ SQLServerConnection getConnectionInternal(String username, String password, SQLServerPooledConnection pooledConnection) throws SQLServerException { Properties userSuppliedProps; @@ -1087,10 +1111,12 @@ Reference getReferenceInternal(String dataSourceClassString) { return ref; } - // Initialize this datasource from properties found inside the reference - // ref. - // Called by SQLServerDataSourceObjectFactory to initialize new DataSource - // instance. + /** + * Initializes the datasource from properties found inside the reference + * + * @param ref + * Called by SQLServerDataSourceObjectFactory to initialize new DataSource instance. + */ void initializeFromReference(javax.naming.Reference ref) { // Enumerate all the StringRefAddr objects in the Reference and assign // properties appropriately. diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSourceObjectFactory.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSourceObjectFactory.java index 82af8db65..59fc884b1 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSourceObjectFactory.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataSourceObjectFactory.java @@ -14,22 +14,23 @@ /** - * SQLServerDataSourceObjectFactory is an object factory to materialize datasources from JNDI. + * Defines an object factory to materialize datasources from JNDI. */ - public final class SQLServerDataSourceObjectFactory implements ObjectFactory { // NOTE: Per ObjectFactory spec, the ObjectFactory class requires a public // class with public constructor. /** - * Initializes a new instance of the SQLServerDataSourceObjectFactory class. + * Constructs a SQLServerDataSourceObjectFactory. */ public SQLServerDataSourceObjectFactory() {} - // getObjectInstance is a factory for rehydrating references to SQLServerDataSource and its child classes. - // Caller gets the reference by calling SQLServerDataSource.getReference. - // References are used by JNDI to persist and rehydrate objects. + /** + * Returns an reference to the SQLServerDataSource instance getObjectInstance is a factory for rehydrating + * references to SQLServerDataSource and its child classes. Caller gets the reference by calling + * SQLServerDataSource.getReference. References are used by JNDI to persist and rehydrate objects. + */ public Object getObjectInstance(Object ref, Name name, Context c, Hashtable h) throws SQLServerException { // Create a new instance of a DataSource class from the given reference. try { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java index 634d2d85d..e64827187 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDataTable.java @@ -19,6 +19,9 @@ import java.util.UUID; +/** + * Represents the data table for SQL Server. + */ public final class SQLServerDataTable { int rowCount = 0; @@ -54,7 +57,7 @@ public synchronized void clear() { } /** - * Retrieves an iterator on the rows of the data table. + * Returns an iterator on the rows of the data table. * * @return an iterator on the rows of the data table. */ @@ -66,7 +69,7 @@ public synchronized Iterator> getIterator() { } /** - * Adds meta data for the specified column + * Adds meta data for the specified column. * * @param columnName * the name of the column @@ -82,7 +85,7 @@ public synchronized void addColumnMetadata(String columnName, int sqlType) throw } /** - * Adds meta data for the specified column + * Adds meta data for the specified column. * * @param column * the name of the column @@ -294,8 +297,8 @@ else if (val instanceof OffsetTime) } /** - * Retrieves java.util.Map object type of columnMetaData for all columns where column indexes are - * mapped with their respective {@link SQLServerDataColumn} Java object + * Returns the java.util.Map object type of columnMetaData for all columns where column indexes are + * mapped with their respective {@link SQLServerDataColumn} Java object. * * @return Map */ @@ -304,7 +307,7 @@ public synchronized Map getColumnMetadata() { } /** - * Returns name of TVP type set by {@link #setTvpName(String)} + * Returns name of TVP type set by {@link #setTvpName(String)}. * * @return tvpName */ @@ -313,7 +316,7 @@ public String getTvpName() { } /** - * Sets the TVP Name + * Sets the TVP Name. * * @param tvpName * the name of TVP diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java index 21b37244d..aca757bc9 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDatabaseMetaData.java @@ -20,7 +20,7 @@ /** - * SQLServerDatabaseMetaData provides JDBC database meta data. + * Provides the JDBC database meta data. * * The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. @@ -101,7 +101,7 @@ private static int nextInstanceID() { } /** - * This is a helper function to provide an ID string suitable for tracing. + * Provides a helper function to provide an ID string suitable for tracing. * * @return traceID string */ @@ -110,7 +110,7 @@ final public String toString() { } /** - * Create new database meta data + * Constructs a SQLServerDatabaseMetaData database meta data * * @param con * the connection @@ -233,8 +233,7 @@ private void checkClosed() throws SQLServerException { private static final String IS_AUTOINCREMENT = "IS_AUTOINCREMENT"; /** - * Make a simple query execute and return the result from it. This is to be used only for internal queries without - * any user input. + * Returns the result from a simple query. This is to be used only for internal queries without any user input. * * @param catalog * catalog the query to be made in @@ -259,8 +258,8 @@ private SQLServerResultSet getResultSetFromInternalQueries(String catalog, return rs; } - /* - * Note we pool the handles per object. + /** + * Returns the CallableStatement handle. Note we pool the handles per object. */ private CallableStatement getCallableStatementHandle(CallableHandles request, String catalog) throws SQLServerException { @@ -278,7 +277,7 @@ private CallableStatement getCallableStatementHandle(CallableHandles request, } /** - * Make the stored procedure call and return the result from it. + * Returns the result from the stored procedure call. * * @param catalog * catalog the query to be made in @@ -325,7 +324,7 @@ private SQLServerResultSet getResultSetWithProvidedColumnNames(String catalog, C } /** - * Switch database catalogs. + * Switches the database catalogs. * * @param catalog * the new catalog @@ -513,7 +512,7 @@ public java.sql.ResultSet getTables(String catalog, String schema, String table, /** * Accepts a SQL identifier (such as a column name or table name) and escapes the identifier so sql 92 wild card * characters can be escaped properly to be passed to functions like sp_columns or sp_tables. Assumes that the - * incoming identifier is unescaped. + * incoming identifier is un-escaped. * * @inID input identifier to escape. * @return the escaped value. @@ -2316,8 +2315,10 @@ public boolean locatorsUpdateCopy() throws SQLException { } -// Filter to convert DATA_TYPE column values from the ODBC types -// returned by SQL Server to their equivalent JDBC types. +/** + * Provides filter to convert DATA_TYPE column values from the ODBC types returned by SQL Server to their equivalent + * JDBC types. + */ final class DataTypeFilter extends IntColumnFilter { private static final int ODBC_SQL_GUID = -11; private static final int ODBC_SQL_WCHAR = -8; @@ -2365,9 +2366,9 @@ int oneValueToAnother(int precl) { } -// abstract class converts one value to another solely based on the column -// integer value -// apply to integer columns only +/** + * Converts one value to another solely based on the column integer value. Apply to integer columns only + */ abstract class IntColumnFilter extends ColumnFilter { abstract int oneValueToAnother(int value); @@ -2401,9 +2402,10 @@ final Object apply(Object value, JDBCType asJDBCType) throws SQLServerException } -// Filter to convert int identity column values from 0,1 to YES, NO -// There is a mismatch between what the stored proc returns and what the -// JDBC spec expects. +/** + * Provides filter to convert int identity column values from 0,1 to YES, NO There is a mismatch between what the stored + * proc returns and what the JDBC spec expects. + */ class IntColumnIdentityFilter extends ColumnFilter { private static String zeroOneToYesNo(int i) { return 0 == i ? "NO" : "YES"; @@ -2444,5 +2446,4 @@ final Object apply(Object value, JDBCType asJDBCType) throws SQLServerException return value; } } - -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java index 0245fc2c5..2af70a0cd 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerDriver.java @@ -21,10 +21,9 @@ /** - * SQLServerDriver implements the java.sql.Driver for SQLServerConnect. + * Implements the java.sql.Driver for SQLServerConnect. * */ - final class SQLServerDriverPropertyInfo { private final String name; @@ -195,12 +194,16 @@ enum ApplicationIntent { // the value of the enum private final String value; - // constructor that sets the string value of the enum + /** + * Constructs a ApplicationIntent that sets the string value of the enum. + */ private ApplicationIntent(String value) { this.value = value; } - // returns the string value of enum + /** + * Returns the string value of enum. + */ public String toString() { return value; } @@ -236,7 +239,7 @@ private SQLServerDriverObjectProperty(String name, String defaultValue) { } /** - * returning string due to structure of DRIVER_PROPERTIES_PROPERTY_ONLY + * Returns string due to structure of DRIVER_PROPERTIES_PROPERTY_ONLY. * * @return */ @@ -360,6 +363,9 @@ public String toString() { } +/** + * Provides methods to connect to a SQL Server database and to obtain information about the JDBC driver. + */ public final class SQLServerDriver implements java.sql.Driver { static final String PRODUCT_NAME = "Microsoft JDBC Driver " + SQLJdbcVersion.major + "." + SQLJdbcVersion.minor + " for SQL Server"; @@ -500,8 +506,9 @@ public final class SQLServerDriver implements java.sql.Driver { Boolean.toString(SQLServerDriverBooleanProperty.USE_BULK_COPY_FOR_BATCH_INSERT.getDefaultValue()), false, TRUE_FALSE),}; - // Properties that can only be set by using Properties. - // Cannot set in connection string + /** + * Properties that can only be set by using Properties. Cannot set in connection string + */ private static final SQLServerDriverPropertyInfo[] DRIVER_PROPERTIES_PROPERTY_ONLY = { // default required available choices // property name value property (if appropriate) @@ -558,8 +565,10 @@ public SQLServerDriver() { loggingClassName = "com.microsoft.sqlserver.jdbc." + "SQLServerDriver:" + instanceID; } - // Helper function used to fixup the case sensitivity, synonyms and remove unknown tokens from the - // properties + /** + * Provides Helper function used to fix the case sensitivity, synonyms and remove unknown tokens from the + * properties. + */ static Properties fixupProperties(Properties props) throws SQLServerException { // assert props !=null Properties fixedup = new Properties(); @@ -590,9 +599,11 @@ static Properties fixupProperties(Properties props) throws SQLServerException { return fixedup; } - // Helper function used to merge together the property set extracted from the url and the - // user supplied property set passed in by the caller. This function is used by both SQLServerDriver.connect - // and SQLServerDataSource.getConnectionInternal to centralize this property merging code. + /** + * Provides Helper function used to merge together the property set extracted from the url and the user supplied + * property set passed in by the caller. This function is used by both SQLServerDriver.connect and + * SQLServerDataSource.getConnectionInternal to centralize this property merging code. + */ static Properties mergeURLAndSuppliedProperties(Properties urlProps, Properties suppliedProperties) throws SQLServerException { if (null == suppliedProperties) @@ -624,7 +635,7 @@ static Properties mergeURLAndSuppliedProperties(Properties urlProps, } /** - * normalize the property names + * Returns the normalized the property names. * * @param name * name to normalize @@ -652,7 +663,7 @@ static String getNormalizedPropertyName(String name, Logger logger) { } /** - * get property-only names that do not work with connection string + * Returns the property-only names that do not work with connection string. * * @param name * to normalize @@ -674,7 +685,7 @@ static String getPropertyOnlyName(String name, Logger logger) { return null; } - /* L0 */ public java.sql.Connection connect(String Url, Properties suppliedProperties) throws SQLServerException { + public java.sql.Connection connect(String Url, Properties suppliedProperties) throws SQLServerException { loggerExternal.entering(getClassNameLogging(), "connect", "Arguments not traced."); SQLServerConnection result = null; @@ -713,7 +724,7 @@ private Properties parseAndMergeProperties(String Url, Properties suppliedProper return connectProperties; } - /* L0 */ public boolean acceptsURL(String url) throws SQLServerException { + public boolean acceptsURL(String url) throws SQLServerException { loggerExternal.entering(getClassNameLogging(), "acceptsURL", "Arguments not traced."); if (null == url) { @@ -768,7 +779,7 @@ public Logger getParentLogger() throws SQLFeatureNotSupportedException { return parentLogger; } - /* L0 */ public boolean jdbcCompliant() { + public boolean jdbcCompliant() { loggerExternal.entering(getClassNameLogging(), "jdbcCompliant"); loggerExternal.exiting(getClassNameLogging(), "jdbcCompliant", Boolean.TRUE); return true; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java index 881ce780a..6724596e0 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerException.java @@ -11,12 +11,6 @@ import java.util.logging.Level; -/** - * SQLServerException is thrown from any point in the driver that throws a java.sql.SQLException. SQLServerException - * handles both SQL 92 and XOPEN state codes. They are switchable via a user specified connection property. - * SQLServerExceptions are written to any open log files the user has specified. - */ - enum SQLState { STATEMENT_CANCELED("HY008"), DATA_EXCEPTION_NOT_SPECIFIC("22000"), @@ -51,6 +45,11 @@ final int getErrorCode() { } +/** + * Represents the exception thrown from any point in the driver that throws a java.sql.SQLException. SQLServerException + * handles both SQL 92 and XOPEN state codes. They are switchable via a user specified connection property. + * SQLServerExceptions are written to any open log files the user has specified. + */ public final class SQLServerException extends java.sql.SQLException { static final String EXCEPTION_XOPEN_CONNECTION_CANT_ESTABLISH = "08001"; static final String EXCEPTION_XOPEN_CONNECTION_DOES_NOT_EXIST = "08003"; @@ -90,7 +89,7 @@ final void setDriverErrorCode(int value) { } /** - * Log an exception to the driver log file + * Logs an exception to the driver log file. * * @param o * the io buffer that generated the exception @@ -132,7 +131,7 @@ static String getErrString(String errCode) { } /** - * Make a new SQLException + * Construct a SQLServerException. * * @param errText * the exception message @@ -162,14 +161,14 @@ public SQLServerException(String errText, Throwable cause) { ActivityCorrelator.setCurrentActivityIdSentFlag(); } - /* L0 */ public SQLServerException(Object obj, String errText, String errState, int errNum, boolean bStack) { + public SQLServerException(Object obj, String errText, String errState, int errNum, boolean bStack) { super(errText, errState, errNum); logException(obj, errText, bStack); ActivityCorrelator.setCurrentActivityIdSentFlag(); } /** - * Make a new SQLException + * Constructs a new SQLServerException. * * @param obj * the object @@ -182,8 +181,7 @@ public SQLServerException(String errText, Throwable cause) { * @param bStack * true to generate the stack trace */ - /* L0 */ public SQLServerException(Object obj, String errText, String errState, StreamError streamError, - boolean bStack) { + public SQLServerException(Object obj, String errText, String errState, StreamError streamError, boolean bStack) { super(errText, errState, streamError.getErrorNumber()); // Log SQL error with info from StreamError. @@ -193,7 +191,7 @@ public SQLServerException(String errText, Throwable cause) { } /** - * Build a new SQL Exception from an error detected by the driver. + * Constructs a SQLServerException from an error detected by the driver. * * @param con * the connection @@ -206,7 +204,7 @@ public SQLServerException(String errText, Throwable cause) { * true to generate the stack trace * @throws SQLServerException */ - /* L0 */static void makeFromDriverError(SQLServerConnection con, Object obj, String errText, String state, + static void makeFromDriverError(SQLServerConnection con, Object obj, String errText, String state, boolean bStack) throws SQLServerException { // The sql error code is 0 since the error was not returned from the database // The state code is supplied by the calling code as XOPEN compliant. @@ -232,7 +230,7 @@ public SQLServerException(String errText, Throwable cause) { } /** - * Build a new SQL Exception from a streamError detected by the driver. + * Builds a new SQL Exception from a streamError detected by the driver. * * @param con * the connection @@ -244,8 +242,8 @@ public SQLServerException(String errText, Throwable cause) { * true to generate the stack trace * @throws SQLServerException */ - /* L0 */ static void makeFromDatabaseError(SQLServerConnection con, Object obj, String errText, - StreamError streamError, boolean bStack) throws SQLServerException { + static void makeFromDatabaseError(SQLServerConnection con, Object obj, String errText, StreamError streamError, + boolean bStack) throws SQLServerException { String state = generateStateCode(con, streamError.getErrorNumber(), streamError.getErrorState()); SQLServerException theException = new SQLServerException(obj, @@ -278,13 +276,13 @@ static void ConvertConnectExceptionToSQLServerException(String hostName, int por } /** - * Map XOPEN states. + * Maps XOPEN states. * * @param state * the state * @return the mapped state */ - /* L0 */ static String mapFromXopen(String state) { + static String mapFromXopen(String state) { // Exceptions generated by the driver (not the database) are instanced with an XOPEN state code // since the SQL99 states cant be located on the web (must pay) and the XOPEN states appear to // be specific. Therefore if the driver is in SQL 99 mode we must map to SQL 99 state codes. @@ -307,7 +305,7 @@ static void ConvertConnectExceptionToSQLServerException(String hostName, int por } /** - * Generate the JDBC state code based on the error number returned from the database + * Generates the JDBC state code based on the error number returned from the database. * * @param con * the connection @@ -317,7 +315,7 @@ static void ConvertConnectExceptionToSQLServerException(String hostName, int por * the database state * @return the state code */ - /* L0 */ static String generateStateCode(SQLServerConnection con, int errNum, int databaseState) { + static String generateStateCode(SQLServerConnection con, int errNum, int databaseState) { // Generate a SQL 99 or XOPEN state from a database generated error code boolean xopenStates = (con != null && con.xopenStates); if (xopenStates) { @@ -360,7 +358,7 @@ static void ConvertConnectExceptionToSQLServerException(String hostName, int por } /** - * Append ClientConnectionId to an error message if applicable + * Appends ClientConnectionId to an error message if applicable. * * @param errMsg * - the orginal error message. diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java index 7358279bf..daa475b99 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerKeyVaultAuthenticationCallback.java @@ -5,10 +5,14 @@ package com.microsoft.sqlserver.jdbc; +/** + * Provides a callback delegate which is to be implemented by the client code + * + */ public interface SQLServerKeyVaultAuthenticationCallback { /** - * The authentication callback delegate which is to be implemented by the client code + * Returns the acesss token of the authentication request * * @param authority * - Identifier of the authority, a URL. @@ -19,4 +23,4 @@ public interface SQLServerKeyVaultAuthenticationCallback { * @return access token */ public String getAccessToken(String authority, String resource, String scope); -} \ No newline at end of file +} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerLob.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerLob.java index d7a0cf59c..0fdee293d 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerLob.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerLob.java @@ -10,7 +10,7 @@ abstract class SQLServerLob { /** - * Function for the result set to maintain blobs it has created + * Provides functionality for the result set to maintain blobs it has created. * * @throws SQLException */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java index 9e7144f12..da9db54b7 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java @@ -10,8 +10,8 @@ /** * - * This class represents metadata for a column. It is used in the ISQLServerDataRecord interface to pass column metadata - * to the table-valued parameter. + * Represents metadata for a column. It is used in the ISQLServerDataRecord interface to pass column metadata to the + * table-valued parameter. * */ public class SQLServerMetaData { @@ -29,7 +29,7 @@ public class SQLServerMetaData { static final int defaultSortOrdinal = -1; /** - * Creates a new SQLServerMetaData + * Constructs a SQLServerMetaData with the column name and SQL type. * * @param columnName * the name of the column @@ -42,7 +42,7 @@ public SQLServerMetaData(String columnName, int sqlType) { } /** - * creates a new SQLServerMetaData + * Constructs a SQLServerMetaData with the column name, SQL type, precision, and scale. * * @param columnName * the name of the column @@ -61,7 +61,7 @@ public SQLServerMetaData(String columnName, int sqlType, int precision, int scal } /** - * Creates a new SQLServerMetaData + * Constructs a SQLServerMetaData. * * @param columnName * the name of the column @@ -96,7 +96,7 @@ public SQLServerMetaData(String columnName, int sqlType, int precision, int scal } /** - * Initializes a new instance of SQLServerMetaData from another SQLServerMetaData object. + * Constructs a SQLServerMetaData from another SQLServerMetaData object. * * @param sqlServerMetaData * the object passed to initialize a new instance of SQLServerMetaData @@ -113,69 +113,82 @@ public SQLServerMetaData(SQLServerMetaData sqlServerMetaData) { } /** + * Returns the column name. * - * @return Retrieves the column name. + * @return column name */ public String getColumName() { return columnName; } /** + * Returns the java sql type. * - * @return Retrieves the java sql type. + * @return java sql type */ public int getSqlType() { return javaSqlType; } /** + * Returns the precision of the type passed to the column. * - * @return retrieves the precision of the type passed to the column. + * @return precision */ public int getPrecision() { return precision; } /** + * Returns the scale of the type passed to the column. * - * @return retrieves the scale of the type passed to the column. + * @return scale */ public int getScale() { return scale; } /** + * Returns whether the column uses the default server value. * - * @return returns whether the column uses the default server value. + * @return whether the column uses the default server value. */ public boolean useServerDefault() { return useServerDefault; } /** + * Returns whether the column is unique. * - * @return retrieves the whether the column is unique. + * @return whether the column is unique. */ public boolean isUniqueKey() { return isUniqueKey; } /** + * Returns the sort order. * - * @return retrieves the sort order. + * @return sort order */ public SQLServerSortOrder getSortOrder() { return sortOrder; } /** + * Returns the sort ordinal. * - * @return retrieves the sort ordinal. + * @return sort ordinal */ public int getSortOrdinal() { return sortOrdinal; } + /** + * Returns the collation. + * + * @return SQL collation + */ SQLCollation getCollation() { return this.collation; } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerNClob.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerNClob.java index 7988ba376..dfa9fb12d 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerNClob.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerNClob.java @@ -17,9 +17,8 @@ /** - * SQLServerNClob represents a National Character Set LOB object and implements java.sql.NClob. + * Represents a National Character Set LOB object and implements java.sql.NClob. */ - public final class SQLServerNClob extends SQLServerClobBase implements NClob { /** diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java index 3d00845f6..9e2603f75 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java @@ -21,7 +21,7 @@ /** - * SQLServerParameterMetaData provides JDBC 3.0 meta data for prepared statement parameters. + * Provides meta data for prepared statement parameters. * * The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. @@ -60,7 +60,7 @@ private static int nextInstanceID() { } /** - * This is a helper function to provide an ID string suitable for tracing. + * Provides a helper function to provide an ID string suitable for tracing. * * @return traceID string */ @@ -70,7 +70,7 @@ final public String toString() { } /** - * Parse the columns in a column set. + * Parses the columns in a column set. * * @param columnSet * the list of columns @@ -131,7 +131,7 @@ private String parseColumns(String columnSet, String columnStartToken) throws SQ } /** - * Parse the column set in an insert syntax. + * Parses the column set in an insert syntax. * * @param sql * the sql syntax @@ -203,7 +203,7 @@ class QueryMeta { Map queryMetaMap = null; /* - * Parse query metadata. + * Parses query metadata. */ private void parseQueryMeta(ResultSet rsQueryMeta) throws SQLServerException { Pattern datatypePattern = Pattern.compile("(.*)\\((.*)(\\)|,(.*)\\))"); @@ -325,7 +325,7 @@ private void parseQueryMetaFor2008(ResultSet rsQueryMeta) throws SQLServerExcept } /** - * Escape parser, using the tokenizer tokenizes escaped strings properly e.g.[Table Name, ] + * Parses escaped strings properly e.g.[Table Name, ] using tokenizer/ * * @param st * string tokenizer @@ -372,7 +372,7 @@ private class MetaInfo { } /** - * Parse a SQL syntax. + * Parses a SQL syntax. * * @param sql * String @@ -427,7 +427,7 @@ private MetaInfo parseStatement(String sql, String sTableMarker) throws SQLServe } /** - * Parse a SQL syntax. + * Parses a SQL syntax. * * @param sql * the syntax @@ -534,7 +534,7 @@ private void checkClosed() throws SQLServerException { } /** - * Create new parameter meta data. + * Construct a SQLServerParameterMetaData parameter meta data. * * @param st * the prepared statement @@ -894,7 +894,7 @@ public int isNullable(int param) throws SQLServerException { } /** - * Verify a supplied parameter index is valid + * Returns if a supplied parameter index is valid. * * @param param * the param index diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPooledConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPooledConnection.java index e37adc6cc..9d178bc91 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPooledConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPooledConnection.java @@ -18,9 +18,8 @@ /** - * SQLServerPooledConnection represents a database physical connection in a connection pool. If provides methods for the - * connection pool manager to manage the connection pool. Applications typically do not instantiate these connections - * directly. + * Represents a database physical connection in a connection pool. If provides methods for the connection pool manager + * to manage the connection pool. Applications typically do not instantiate these connections directly. */ public class SQLServerPooledConnection implements PooledConnection { @@ -57,7 +56,7 @@ public class SQLServerPooledConnection implements PooledConnection { } /** - * This is a helper function to provide an ID string suitable for tracing. + * Provides a helper function to provide an ID string suitable for tracing. * * @return traceID String */ @@ -72,7 +71,7 @@ private SQLServerConnection createNewConnection() throws SQLException { } /** - * Creates an object handle for the physical connection that this PooledConnection object represents. + * Returns an object handle for the physical connection that this PooledConnection object represents. * * @throws SQLException * when an error occurs @@ -121,11 +120,11 @@ public Connection getConnection() throws SQLException { } } - // Notify any interested parties (e.g. pooling managers) of a ConnectionEvent activity - // on the connection. Calling notifyEvent with null event will place the - // connection back in the pool. Calling notifyEvent with a non-null event is - // used to notify the pooling manager that the connection is bad and should be removed - // from the pool. + /** + * Notifies any interested parties (e.g. pooling managers) of a ConnectionEvent activity on the connection. Calling + * notifyEvent with null event will place the connection back in the pool. Calling notifyEvent with a non-null event + * is used to notify the pooling manager that the connection is bad and should be removed from the pool. + */ void notifyEvent(SQLServerException e) { if (pcLogger.isLoggable(Level.FINER)) pcLogger.finer(toString() + " Exception:" + e + safeCID()); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java index 2a4c4f0ec..e96b550e7 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java @@ -34,8 +34,8 @@ /** - * SQLServerPreparedStatement provides JDBC prepared statement functionality. SQLServerPreparedStatement provides - * methods for the user to supply parameters as any native Java type and many Java object types. + * Provides an implementation of java.sql.PreparedStatement interface that assists in preparing Statements for SQL + * Server. *

* SQLServerPreparedStatement prepares a statement using SQL Server's sp_prepexec and re-uses the returned statement * handle for each subsequent execution of the statement (typically using different parameters provided by the user) @@ -46,7 +46,6 @@ * The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. */ - public class SQLServerPreparedStatement extends SQLServerStatement implements ISQLServerPreparedStatement { /** Flag to indicate that it is an internal query to retrieve encryption metadata. */ boolean isInternalEncryptionQuery = false; @@ -116,7 +115,7 @@ private void setPreparedStatementHandle(int handle) { private boolean useBulkCopyForBatchInsert; /** - * Gets the prepared statement's useBulkCopyForBatchInsert value. + * Returns the prepared statement's useBulkCopyForBatchInsert value. * * @return Per the description. * @throws SQLServerException @@ -188,7 +187,7 @@ String getClassNameInternal() { } /** - * Create a new prepaed statement. + * Constructs a SQLServerPreparedStatement. * * @param conn * the connection @@ -238,7 +237,7 @@ String getClassNameInternal() { } /** - * Close the prepared statement's prepared handle. + * Closes the prepared statement's prepared handle. */ private void closePreparedHandle() { if (!hasPreparedStatementHandle()) @@ -336,7 +335,7 @@ final void closeInternal() { } /** - * Intialize the statement parameters. + * Intializes the statement parameters. * * @param nParams * Number of parameters to Intialize. @@ -382,7 +381,7 @@ private boolean buildPreparedStrings(Parameter[] params, boolean renewDefinition } /** - * Build the parameter type definitons for a JDBC prepared statement that will be used to prepare the statement. + * Builds the parameter type definitons for a JDBC prepared statement that will be used to prepare the statement. * * @param params * the statement parameters @@ -438,7 +437,7 @@ public java.sql.ResultSet executeQuery() throws SQLServerException, SQLTimeoutEx } /** - * Execute a query without cursoring for metadata. + * Executes a query without cursoring for metadata. * * @throws SQLServerException * @return ResultSet @@ -596,8 +595,8 @@ final void doExecutePreparedStatement(PrepStmtExecCmd command) throws SQLServerE } /** - * Should the execution be retried because the re-used cached handle could not be re-used due to server side state - * changes? + * Returns if the execution should be retried because the re-used cached handle could not be re-used due to server + * side state changes. */ private boolean retryBasedOnFailedReuseOfCachedHandle(SQLException e, int attempt, boolean needsPrepare, boolean isBatch) { @@ -613,7 +612,7 @@ private boolean retryBasedOnFailedReuseOfCachedHandle(SQLException e, int attemp } /** - * Consume the OUT parameter for the statement object itself. + * Consumes the OUT parameter for the statement object itself. * * When a prepared statement handle is expected as the first OUT parameter from PreparedStatement or * CallableStatement execution, then it gets consumed here. @@ -660,7 +659,7 @@ boolean onRetValue(TDSReader tdsReader) throws SQLServerException { } /** - * Send the statement parameters by RPC + * Sends the statement parameters by RPC. */ void sendParamsByRPC(TDSWriter tdsWriter, Parameter[] params) throws SQLServerException { char cParamName[]; @@ -965,7 +964,9 @@ private void getParameterEncryptionMetadata(Parameter[] params) throws SQLServer connection.resetCurrentCommand(); } - /** Manage re-using cached handles */ + /** + * Manages re-using cached handles. + */ private boolean reuseCachedHandle(boolean hasNewTypeDefinitions, boolean discardCurrentCacheItem) { // No re-use of caching for cursorable statements (statements that WILL use sp_cursor*) if (isCursorable(executeMethod)) @@ -1065,7 +1066,7 @@ public final java.sql.ResultSetMetaData getMetaData() throws SQLServerException } /** - * Retreive meta data for the statement before executing it. This is called in cases where the driver needs the meta + * Returns meta data for the statement before executing it. This is called in cases where the driver needs the meta * data prior to executing the statement. * * @throws SQLServerException @@ -1094,7 +1095,7 @@ private ResultSet buildExecuteMetaData() throws SQLServerException { /* -------------- JDBC API Implementation ------------------ */ /** - * Set the parameter value for a statement. + * Sets the parameter value for a statement. * * @param index * The index of the parameter to set starting at 1. @@ -2977,7 +2978,6 @@ public final void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLExce loggerExternal.exiting(getClassNameLogging(), "setSQLXML"); } - /* make sure we throw here */ @Override public final int executeUpdate(String sql) throws SQLServerException { loggerExternal.entering(getClassNameLogging(), "executeUpdate", sql); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java index 5f78cd072..609dc7e13 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResource.java @@ -9,7 +9,7 @@ /** - * A simple resource bundle containing the strings for localizing. + * Represents a simple resource bundle containing the strings for localizing. * */ public final class SQLServerResource extends ListResourceBundle { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSet.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSet.java index b017691bf..89502cd2a 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSet.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSet.java @@ -33,7 +33,7 @@ /** - * Indicates the type of the row received from the server + * Indicates the type of the row received from the server. */ enum RowType { ROW, @@ -43,7 +43,7 @@ enum RowType { /** - * Top-level JDBC ResultSet implementation + * Defines the Top-level JDBC ResultSet implementation. */ public class SQLServerResultSet implements ISQLServerResultSet, java.io.Serializable { @@ -188,7 +188,7 @@ final void setDeletedCurrentRow(boolean rowDeleted) { // The CekTable retrieved from the COLMETADATA token for this resultset. private CekTable cekTable = null; - /* Gets the CekTable */ + /* Returns the CekTable */ CekTable getCekTable() { return cekTable; } @@ -228,7 +228,7 @@ public SensitivityClassification getSensitivityClassification() { } /** - * Make a new result set + * Constructs a SQLServerResultSet. * * @param stmtIn * the generating statement @@ -434,7 +434,7 @@ public T unwrap(Class iface) throws SQLException { private SQLServerException rowErrorException = null; /** - * Check if the result set is closed + * Checks if the result set is closed * * @throws SQLServerException */ @@ -505,7 +505,7 @@ private void verifyResultSetIsUpdatable() throws SQLServerException { } /** - * Checks whether the result set has a current row. + * Returns whether the result set has a current row. * * @return true if there is a current row * @return false if the result set is positioned before the first row or after the last row. @@ -592,7 +592,7 @@ private void throwUnsupportedCursorOp() throws SQLServerException { } /** - * Close the result set. + * Closes the result set. * * Note that the public close() method performs all of the cleanup work through this internal method which cannot * throw any exceptions. This is done deliberately to ensure that ALL of the object's client-side and server-side @@ -631,7 +631,7 @@ public void close() throws SQLServerException { } /** - * Find a column index given a column name + * Finds a column index given a column name. * * @param columnName * the name of the column @@ -714,7 +714,7 @@ final Column getColumn(int columnIndex) throws SQLServerException { } /** - * This function initializes null compressed columns only when the row type is NBCROW and if the + * Initializes null compressed columns only when the row type is NBCROW and if the * areNullCompressedColumnsInitialized is false. In all other cases this will be a no-op. * * @throws SQLServerException @@ -763,7 +763,7 @@ private Column loadColumn(int index) throws SQLServerException { } /** - * Clear result set warnings + * Clears result set warnings. * * @throws SQLServerException * when an error occurs @@ -950,7 +950,7 @@ private void moveBackward(int rowsToMove) throws SQLServerException { } /** - * Update the current row's position if known. + * Updates the current row's position if known. * * If known, the current row is assumed to be at a valid position somewhere in the ResultSet. That is, the current * row is not before the first row or after the last row. @@ -964,7 +964,7 @@ private void updateCurrentRow(int rowsToMove) { } /** - * Initially moves the cursor to the first row of this ResultSet object, with subsequent calls moving the cursor to + * Moves the cursor to the first row of this ResultSet object initially, then subsequent calls move the cursor to * the second row, the third row, and so on. * * @return false when there are no more rows to read @@ -1072,6 +1072,8 @@ public boolean wasNull() throws SQLServerException { } /** + * Returns if the cursor is before the first row in this result set. + * * @return true if the cursor is before the first row in this result set, returns false otherwise or if the result * set contains no rows. */ @@ -1171,7 +1173,7 @@ public boolean isAfterLast() throws SQLException { } /** - * Retrieves whether the cursor is on the first row of this ResultSet object. + * Returns whether the cursor is on the first row of this ResultSet object. * * This method should be called only on ResultSet objects that are scrollable: TYPE_SCROLL_SENSITIVE, * TYPE_SCROLL_INSENSITIVE, TYPE_SS_SCROLL_STATIC, TYPE_SS_SCROLL_KEYSET, TYPE_SS_SCROLL_DYNAMIC. @@ -1218,7 +1220,7 @@ public boolean isFirst() throws SQLException { } /** - * Retrieves whether the cursor is on the last row of this ResultSet object. Note: + * Returns whether the cursor is on the last row of this ResultSet object. Note: * Calling the method isLast may be expensive because the JDBC driver might need to fetch ahead one row * in order to determine whether the current row is the last row in the result set. * diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java index 5da5fbf20..5f36d2d75 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerResultSetMetaData.java @@ -10,13 +10,12 @@ /** - * A ResultSetMetaData object can be used to obtain the meta data (types and type properties) of the columns in a - * ResultSet. + * Provides an implementation of the result set metadata to the SQL Server. A ResultSetMetaData object can be used to + * obtain the meta data (types and type properties) of the columns in a ResultSet. * * The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. */ - public final class SQLServerResultSetMetaData implements ISQLServerResultSetMetaData { private SQLServerConnection con; private final SQLServerResultSet rs; @@ -37,7 +36,7 @@ final public String toString() { } /** - * Create a new meta data object for the result set. + * Constructs a SQLServerResultSetMetaData meta data object for the result set. * * @param con * the connection diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSQLXML.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSQLXML.java index 22d60f3fa..b58a715c3 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSQLXML.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSQLXML.java @@ -50,9 +50,8 @@ /** - * SQLServerSQLXML represents an XML object and implements a java.sql.SQLXML. + * Represents an XML object and implements a java.sql.SQLXML. */ - final class SQLServerSQLXML implements java.sql.SQLXML { // Connection that created this SQLXML only set when created for setting data private final SQLServerConnection con; @@ -82,7 +81,11 @@ final public String toString() { return traceID; } - // Returns unique id for each instance. + /** + * Returns unique id for each instance. + * + * @return + */ private static int nextInstanceID() { return baseID.incrementAndGet(); } @@ -203,7 +206,7 @@ void checkWriteXML() throws SQLException { } /** - * Return an input stream to read data from this SQLXML + * Returns an input stream to read data from this SQLXML. * * @throws SQLException * when an error occurs @@ -218,8 +221,8 @@ public InputStream getBinaryStream() throws SQLException { } /** - * Retrieves a stream that can be used to write to the SQLXML value that this SQLXML object represents The user has - * to write the BOM for binary streams. + * Sets a stream that can be used to write to the SQLXML value that this SQLXML object represents The user has to + * write the BOM for binary streams. * * @throws SQLException * when an error occurs @@ -488,8 +491,9 @@ private DOMResult getDOMResult() throws SQLException { } -// We use this class to convert the byte information we have in the string to -// an inputstream which is used when sending to the info to the server +/** + * Converts the byte information in the string to an inputstream which is used when sending to the info to the server. + */ final class ByteArrayOutputStreamToInputStream extends ByteArrayOutputStream { ByteArrayInputStream getInputStream() throws SQLServerException { ByteArrayInputStream is = new ByteArrayInputStream(buf, 0, count); @@ -498,7 +502,10 @@ ByteArrayInputStream getInputStream() throws SQLServerException { } -// Resolves External entities in an XML with inline DTDs to empty string +/** + * Resolves External entities in an XML with inline DTDs to empty string. + * + */ final class SQLServerEntityResolver implements EntityResolver { public InputSource resolveEntity(String publicId, String systemId) { return new InputSource(new StringReader("")); diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSavepoint.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSavepoint.java index f061713db..94679be97 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSavepoint.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSavepoint.java @@ -9,8 +9,8 @@ /** - * SQLServerSavepoint implements JDBC 3.0 savepoints. A savepoint is checkpoint to which a transaction can be rolled - * back. Savepoints are defined relative to a connection. + * Provides an implementation of JDBC Interface java.sql.Savepoint. A savepoint is checkpoint to which a transaction can + * be rolled back. Savepoints are defined relative to a connection. *

* The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. @@ -22,7 +22,7 @@ public final class SQLServerSavepoint implements ISQLServerSavepoint { private final SQLServerConnection con; /** - * Create a new savepoint + * Constructs a SQLServerSavepoint. * * @param con * the connection diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java index 38d722c3e..d8f01ef78 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSpatialDatatype.java @@ -94,14 +94,14 @@ abstract class SQLServerSpatialDatatype { protected abstract void serializeToWkb(boolean noZM); /** - * Deserialize the buffer (that contains WKB representation of Geometry/Geography data), and stores it into multiple - * corresponding data structures. + * Deserializes the buffer (that contains WKB representation of Geometry/Geography data), and stores it into + * multiple corresponding data structures. * */ protected abstract void parseWkb(); /** - * Create the WKT representation of Geometry/Geography from the deserialized data. + * Constructs the WKT representation of Geometry/Geography from the deserialized data. * * @param sd * the Geometry/Geography instance. @@ -875,7 +875,7 @@ && checkEmptyKeyword(parentShapeIndex, InternalSpatialDatatype.valueOf(nextToken } /** - * Reads a CurvePolygon WKT + * Reads a CurvePolygon WKT. * * @throws SQLServerException * if an exception occurs @@ -915,7 +915,7 @@ protected void readCurvePolygon() throws SQLServerException { } /** - * Reads a MultiPolygon WKT + * Reads a MultiPolygon WKT. * * @param thisShapeIndex * shape index of current shape @@ -947,7 +947,7 @@ protected void readMultiPolygonWkt(int thisShapeIndex, String nextToken) throws } /** - * Reads a Segment WKT + * Reads a Segment WKT. * * @param segmentType * segment type @@ -987,7 +987,7 @@ protected void readSegmentWkt(int segmentType, boolean isFirstIteration) throws } /** - * Reads a CompoundCurve WKT + * Reads a CompoundCurve WKT. * * @param isFirstIteration * flag that indicates if this is the first iteration from the loop outside @@ -1043,7 +1043,7 @@ protected String getNextStringToken() { } /** - * Populates the various data structures contained within the Geometry/Geography instace. + * Populates the various data structures contained within the Geometry/Geography instance. */ protected void populateStructures() { if (pointList.size() > 0) { @@ -1650,7 +1650,7 @@ private void skipWhiteSpaces() { /** - * Class to hold and represent the internal makings of a Figure. + * Represents the internal makings of a Figure. * */ class Figure { @@ -1677,7 +1677,7 @@ public void setFiguresAttribute(byte fa) { /** - * Class to hold and represent the internal makings of a Shape. + * Represents the internal makings of a Shape. * */ class Shape { @@ -1711,7 +1711,7 @@ public void setFigureOffset(int fo) { /** - * Class to hold and represent the internal makings of a Segment. + * Represents the internal makings of a Segment. * */ class Segment { @@ -1728,7 +1728,7 @@ public byte getSegmentType() { /** - * Class to hold and represent the internal makings of a Point. + * Represents the internal makings of a Point. * */ class Point { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java index 44803122b..ec37e6ffe 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerStatement.java @@ -29,9 +29,10 @@ /** - * SQLServerStatment provides the basic implementation of JDBC statement functionality. It also provides a number of - * base class implementation methods for the JDBC prepared statement and callable Statements. SQLServerStatement's basic - * role is to execute SQL statements and return update counts and resultset rows to the user application. + * Provides an implementation of java.sql.Statement JDBC Interface to assist in creating Statements against SQL Server. + * It also provides a number of base class implementation methods for the JDBC prepared statement and callable + * Statements. SQLServerStatement's basic role is to execute SQL statements and return update counts and resultset rows + * to the user application. * * Documentation for specific public methods that are undocumented can be found under Sun's standard JDBC documentation * for class java.sql.Statement. Those methods are part of Sun's standard JDBC documentation and therefore their @@ -48,7 +49,6 @@ * The API javadoc for JDBC API methods that this class implements are not repeated here. Please see Sun's JDBC API * interfaces javadoc for those details. */ - public class SQLServerStatement implements ISQLServerStatement { final static char LEFT_CURLY_BRACKET = 123; final static char RIGHT_CURLY_BRACKET = 125; @@ -103,7 +103,7 @@ final boolean wasExecuted() { Parameter[] inOutParam; // Parameters for prepared stmts and stored procedures /** - * The statements connection. + * The statement's connection. */ final SQLServerConnection connection; @@ -162,7 +162,7 @@ protected SQLServerStatementColumnEncryptionSetting getStmtColumnEncriptionSetti } /** - * ExecuteProperties encapsulates a subset of statement property values as they were set at execution time. + * Encapsulates a subset of statement property values as they were set at execution time. */ final class ExecuteProperties { final private boolean wasResponseBufferingSet; @@ -267,7 +267,7 @@ synchronized void incrResultSetCount() { } /** - * decrement opened result set counter + * Decrement opened result set counter. */ synchronized void decrResultSetCount() { resultSetCount--; @@ -346,7 +346,7 @@ final int getCursorType() { } /** - * Indicates whether to request a server cursor when executing this statement. + * Returns whether to request a server cursor when executing this statement. * * Executing a statement with execute() or executeQuery() requests a server cursor in all scrollability and * updatability combinations except direct forward-only, read-only. @@ -464,7 +464,7 @@ boolean onDone(TDSReader tdsReader) throws SQLServerException { static final private java.util.logging.Logger stmtlogger = java.util.logging.Logger .getLogger("com.microsoft.sqlserver.jdbc.internals.SQLServerStatement"); - /** The statement's id for logging info */ + /** Returns the statement's id for logging info */ @Override public String toString() { return traceID; @@ -483,7 +483,7 @@ private static int nextStatementID() { } /** - * The regular statement constructor + * Constructs a SQLServerStatement * * @param con * The statements connections. @@ -635,7 +635,7 @@ final java.util.logging.Logger getStatementLogger() { } /** - * Close the statement. + * Closes the statement. * * Note that the public close() method performs all of the cleanup work through this internal method which cannot * throw any exceptions. This is done deliberately to ensure that ALL of the object's client-side and server-side @@ -933,7 +933,7 @@ private void doExecuteStatementBatch(StmtBatchExecCmd execCmd) throws SQLServerE } /** - * Reset the state to get the statement for reexecute callable statement overrides this. + * Resets the state to get the statement for reexecute callable statement overrides this. */ final void resetForReexecute() throws SQLServerException { ensureExecuteResultsReader(null); @@ -945,7 +945,7 @@ final void resetForReexecute() throws SQLServerException { } /** - * Determine if the SQL is a SELECT. + * Determines if the SQL is a SELECT. * * @param sql * The statment SQL. @@ -969,7 +969,7 @@ final boolean isSelect(String sql) throws SQLServerException { * The statment SQL. * @return True if the statement is an insert. */ - /* L0 */ final boolean isInsert(String sql) throws SQLServerException { + final boolean isInsert(String sql) throws SQLServerException { checkClosed(); // Used to check just the first letter which would cause // "Set" commands to return true... @@ -985,7 +985,7 @@ final boolean isSelect(String sql) throws SQLServerException { } /** - * Replace a JDBC parameter marker with the parameter's string value + * Replaces a JDBC parameter marker with the parameter's string value * * @param str * the parameter syntax @@ -1004,7 +1004,7 @@ static String replaceParameterWithString(String str, char marker, String replace } /** - * Set a JDBC parameter to null. (Used only when processing LOB column sources.) + * Sets a JDBC parameter to null. (Used only when processing LOB column sources.) * * @param sql * the parameter syntax @@ -1314,7 +1314,7 @@ final void processResults() throws SQLServerException { } /** - * Check for more results in the TDS stream + * Returns more results in the TDS stream. * * @return true if the next result is a ResultSet object; false if it is an integer (indicating that it is an update * count or there are no more results). @@ -1364,7 +1364,7 @@ final void clearLastResult() { } /** - * Get the next result in the TDS response token stream, which may be a result set, update count or exception. + * Returns the next result in the TDS response token stream, which may be a result set, update count or exception. * * @return true if another result (ResultSet or update count) was available; false if there were no more results. */ @@ -1646,7 +1646,7 @@ else if (nextResult.isUpdateCount()) { } /** - * Consume the OUT parameter for the statement object itself. + * Consumes the OUT parameter for the statement object itself. * * Normal Statement objects consume the server cursor OUT params when present. PreparedStatement and * CallableStatement objects override this method to consume the prepared statement handle as well. @@ -1748,7 +1748,7 @@ public void clearBatch() throws SQLServerException { } /** - * Send a batch of statements to the database. + * Sends a batch of statements to the database. */ @Override public int[] executeBatch() throws SQLServerException, BatchUpdateException, SQLTimeoutException { @@ -1902,7 +1902,7 @@ public long[] executeLargeBatch() throws SQLServerException, BatchUpdateExceptio } // executeLargeBatch /** - * Return the statement's connection + * Returns the statement's connection. * * @throws SQLServerException * when an error occurs @@ -1922,15 +1922,6 @@ public final java.sql.Connection getConnection() throws SQLServerException { /* ----------------- Server side cursor support -------------------------- */ - /** - * Open a server side cursor. - * - * @param sql - * The SQL query. - * @exception SQLServerException - * The SQL query was invalid. - */ - final int getResultSetScrollOpt() { int scrollOpt = (null == inOutParam) ? 0 : TDS.SCROLLOPT_PARAMETERIZED_STMT; @@ -2340,7 +2331,7 @@ public final String getResponseBuffering() throws SQLServerException { /** - * Helper class that does some basic parsing work for SQL statements that are stored procedure calls. + * Provides a help class that does some basic parsing work for SQL statements that are stored procedure calls. * * - Determines whether the SQL uses JDBC call syntax ("{[? =] call procedure_name...}") or T-SQL EXECUTE syntax ("EXEC * [@p0 =] procedure_name..."). If JDBC call syntax is present, it gets rewritten as T-SQL EXECUTE syntax. @@ -2444,9 +2435,9 @@ enum State { .compile("\\{\\s*[lL][iI][mM][iI][tT]\\s+(((\\(|\\s)*)(\\d*|\\?)((\\)|\\s)*))\\s*\\}"); /** - * This function translates the LIMIT escape syntax, {LIMIT [OFFSET ]} SQL Server does not support - * LIMIT syntax, the LIMIT escape syntax is thus translated to use "TOP" syntax The OFFSET clause is not supported, - * and will throw an exception if used. + * Translates the LIMIT escape syntax, {LIMIT [OFFSET ]} SQL Server does not support LIMIT syntax, the + * LIMIT escape syntax is thus translated to use "TOP" syntax The OFFSET clause is not supported, and will throw an + * exception if used. * * @param sql * the SQL query @@ -2462,7 +2453,6 @@ enum State { * @return the number of characters that have been translated * */ - int translateLimit(StringBuffer sql, int indx, char endChar) throws SQLServerException { Matcher selectMatcher = selectPattern.matcher(sql); Matcher openQueryMatcher = openQueryPattern.matcher(sql); @@ -2505,18 +2495,17 @@ int translateLimit(StringBuffer sql, int indx, char endChar) throws SQLServerExc break; case OFFSET: // throw exception as OFFSET is not supported - throw new SQLServerException(SQLServerException.getErrString("R_limitOffsetNotSupported"), null, // SQLState - // is - // null - // as - // this - // error - // is - // generated - // in - // the - // driver - 0, // Use 0 instead of DriverError.NOT_SET to use the correct constructor + // SQLState is null as this error is generated in the driver + throw new SQLServerException(SQLServerException.getErrString("R_limitOffsetNotSupported"), null, 0, // Use + // 0 + // instead + // of + // DriverError.NOT_SET + // to + // use + // the + // correct + // constructor null); case LIMIT: // Check if the number of opening/closing parentheses surrounding the digits or "?" in LIMIT match @@ -2533,17 +2522,8 @@ int translateLimit(StringBuffer sql, int indx, char endChar) throws SQLServerExc closingParentheses++; } if (openingParentheses != closingParentheses) { - throw new SQLServerException(SQLServerException.getErrString("R_limitEscapeSyntaxError"), null, // SQLState - // is - // null - // as - // this - // error - // is - // generated - // in - // the - // driver + // SQLState is null as this error is generated in the driver + throw new SQLServerException(SQLServerException.getErrString("R_limitEscapeSyntaxError"), null, 0, // Use 0 instead of DriverError.NOT_SET to use the correct constructor null); } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java index cd2e4eb51..80eb9a03a 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerSymmetricKeyCache.java @@ -79,7 +79,7 @@ ConcurrentHashMap getCache() { } /** - * Retrieves key + * Returns key * * @param keyInfo * contains encryption meta data information diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAConnection.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAConnection.java index 81b28c5f3..bfb18780c 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAConnection.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAConnection.java @@ -15,7 +15,7 @@ /** - * SQLServerXAConnection provides JDBC connections that can participate in distributed (XA) transactions. + * Provides JDBC connections that can participate in distributed (XA) transactions. */ public final class SQLServerXAConnection extends SQLServerPooledConnection implements XAConnection { diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXADataSource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXADataSource.java index c15eb7d84..6ba0504b7 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXADataSource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXADataSource.java @@ -15,8 +15,8 @@ /** - * SQLServerXADataSource provides database connections for use in distributed (XA) transactions. SQLServerXADataSource - * also supports connection pooling of physical connections. + * Provides database connections for use in distributed (XA) transactions. SQLServerXADataSource also supports + * connection pooling of physical connections. * * The XADataSource and XAConnection interfaces, which are defined in the package javax.sql, are implemented by * sqlserver. An XAConnection object is a pooled connection that can participate in a distributed transaction. More @@ -40,13 +40,12 @@ * SQLServerXADataSource can be configured to integrate with Microsoft Distributed Transaction Coordinator (DTC) to * provide true, distributed transaction processing. */ - public final class SQLServerXADataSource extends SQLServerConnectionPoolDataSource implements XADataSource { static Logger xaLogger = Logger.getLogger("com.microsoft.sqlserver.jdbc.internals.XA"); /** - * Obtain a physical database connection to particate in an XA transaction with the specified user and password. + * Returns a physical database connection to particate in an XA transaction with the specified user and password. * This API should only be called by XA connection pool implementations, not regular JDBC application code. * * @return A new XAConnection @@ -79,7 +78,7 @@ public XAConnection getXAConnection(String user, String password) throws SQLExce } /** - * Obtain a physical database connection to particate in an XA transaction. This API should only be called by XA + * Returns a physical database connection to particate in an XA transaction. This API should only be called by XA * connection pool implementations, not regular JDBC application code. * * @return A new XAConnection @@ -115,9 +114,9 @@ private void readObject(java.io.ObjectInputStream stream) throws java.io.Invalid throw new java.io.InvalidObjectException(""); } - // This is 90% duplicate from the SQLServerDataSource, the serialization proxy pattern does not lend itself to - // inheritance - // so the duplication is necessary + /** + * Implements java.io.Serializable the same way as {@link SQLServerDataSource} + */ private static class SerializationProxy implements java.io.Serializable { private final Reference ref; private static final long serialVersionUID = 454661379842314126L; diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java index 44dbb3ac2..224996a90 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerXAResource.java @@ -24,9 +24,8 @@ /** - * Transaction id implementation used to recover transactions. + * Impelments Transaction id used to recover transactions. */ - final class XidImpl implements Xid { private final int formatId; private final byte gtrid[]; @@ -42,7 +41,7 @@ final class XidImpl implements Xid { */ /** - * Create a new XID + * Constructs a XidImpl. * * @param formatId * format id @@ -71,7 +70,7 @@ public int getFormatId() { } /** - * Used for tracing + * Returns trace id used for tracing. * * @return traceID string */ @@ -103,9 +102,9 @@ final class XAReturnValue { /** - * SQLServerXAResource provides an XAResource for XA distributed transaction management. XA transactions are implemented - * over SQL Server using Microsoft Distributed Transaction Manager (DTC). SQLServerXAResource makes calls to a SQL - * Server extended dll called SQLServer_XA.dll which interfaces with DTC. + * Provides an XAResource for XA distributed transaction management. XA transactions are implemented over SQL Server + * using Microsoft Distributed Transaction Manager (DTC). SQLServerXAResource makes calls to a SQL Server extended dll + * called SQLServer_XA.dll which interfaces with DTC. * * XA calls received by SQLServerXAResource (XA_START, XA_END, XA_PREPARE etc) are mapped to the corresponding calls to * DTC functions. @@ -113,7 +112,6 @@ final class XAReturnValue { * SQLServerXAResource may also be configured not to use DTC. In this case distributed transactions are simply * implemented as local transactions. */ - public final class SQLServerXAResource implements javax.transaction.xa.XAResource { /* * In the Java transaction API doc a 'resource manager' appears to be (for JDBC) a 'particular DBMS server that diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java b/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java index 2adff6694..281398d2d 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SqlVariant.java @@ -7,11 +7,6 @@ import java.text.MessageFormat; -/** - * This class holds information regarding the basetype of a sql_variant data. - * - */ - /** * Enum for valid probBytes for different TDSTypes * @@ -70,6 +65,10 @@ static sqlVariantProbBytes valueOf(int intValue) { } +/** + * Holds information regarding the basetype of a sql_variant data. + * + */ public class SqlVariant { private int baseType; @@ -82,14 +81,14 @@ public class SqlVariant { private JDBCType baseJDBCType; /** - * Constructor for sqlVariant + * Constructs a SqlVariant. */ SqlVariant(int baseType) { this.baseType = baseType; } /** - * Check if the basetype for variant is of time value + * Returns if the basetype for variant is of time value. * * @return */ @@ -102,7 +101,7 @@ void setIsBaseTypeTimeValue(boolean isBaseTypeTime) { } /** - * store the base type for sql-variant + * Sets the base type for sql-variant. * * @param baseType */ @@ -111,7 +110,7 @@ void setBaseType(int baseType) { } /** - * retrieves the base type for sql-variant + * Returns the base type for sql-variant. * * @return */ @@ -120,7 +119,7 @@ int getBaseType() { } /** - * Store the basetype as jdbc type + * Stores the basetype as JDBC type. * * @param baseJDBCType */ @@ -129,7 +128,7 @@ void setBaseJDBCType(JDBCType baseJDBCType) { } /** - * retrieves the base type as jdbc type + * Returns the base type as JDBC type. * * @return */ @@ -138,7 +137,7 @@ JDBCType getBaseJDBCType() { } /** - * stores the scale if applicable + * Sets the scale if applicable. * * @param scale */ @@ -147,7 +146,7 @@ void setScale(int scale) { } /** - * retrieves the scale + * Returns the scale. * * @return */ @@ -156,7 +155,7 @@ int getScale() { } /** - * stores the precision if applicable + * Sets the precision if applicable. * * @param precision */ @@ -165,7 +164,7 @@ void setPrecision(int precision) { } /** - * retrieves the precision + * Returns the precision. * * @return */ @@ -174,7 +173,7 @@ int getPrecision() { } /** - * stores the collation if applicable + * Sets the collation if applicable. * * @param collation */ @@ -183,7 +182,7 @@ void setCollation(SQLCollation collation) { } /** - * Retrieves the collation + * Returns the collation. * * @return */ @@ -192,7 +191,7 @@ SQLCollation getCollation() { } /** - * stores the maximum length + * Sets the maximum length. * * @param maxLength */ @@ -201,7 +200,7 @@ void setMaxLength(int maxLength) { } /** - * retrieves the maximum length + * Returns the maximum length. * * @return */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/StreamColumns.java b/src/main/java/com/microsoft/sqlserver/jdbc/StreamColumns.java index f89ba1807..df8b031fd 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/StreamColumns.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/StreamColumns.java @@ -29,7 +29,7 @@ final class StreamColumns extends StreamPacket { private boolean shouldHonorAEForRead = false; - /* Gets the CekTable */ + /* Returns the CekTable */ CekTable getCekTable() { return cekTable; } diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/StreamDone.java b/src/main/java/com/microsoft/sqlserver/jdbc/StreamDone.java index 1d0f4fc6a..282f9f11e 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/StreamDone.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/StreamDone.java @@ -241,7 +241,6 @@ final boolean cmdIsDMLOrDDL() { case CMD_SELECTINTO: // DDL - // Lifted from SQL Server 2005 Books Online at: // http://msdn2.microsoft.com/en-us/library/ms180824.aspx case CMD_CNST_CREATE: case CMD_DENY: diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java b/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java index c792a0cb9..d481117d8 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/StringUtils.java @@ -6,7 +6,7 @@ package com.microsoft.sqlserver.jdbc; /** - * Utility class for Strings. + * Provides a utility class for Strings. * * @since 6.1.2 */ @@ -25,7 +25,7 @@ private StringUtils() { } /** - * Checks if String is null + * Returns if String is null * * @param charSequence * {@link CharSequence} Can provide null @@ -37,7 +37,7 @@ public static boolean isEmpty(final CharSequence charSequence) { } /** - * Check if String is numeric or not. + * Returns if String is numeric or not. * * @param str * {@link String} @@ -48,7 +48,7 @@ public static boolean isNumeric(final String str) { } /** - * Check if string is integer or not + * Returns if string is integer or not * * @param str * {@link String} diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/ColumnSensitivity.java b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/ColumnSensitivity.java index 9d2a314c7..5bc4cab72 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/ColumnSensitivity.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/ColumnSensitivity.java @@ -10,13 +10,13 @@ /** - * This class is used to retrieve Sensitivity Information for columns as configured in Database. + * Represents the Data Classification Sensitivity Information for columns as configured in Database. */ public class ColumnSensitivity { private List sensitivityProperties; /** - * Constructor for ColumnSensitivity + * Constructs a ColumnSensitivity * * @param sensitivityProperties * List of sensitivity properties as received from SQL Server @@ -26,7 +26,7 @@ public ColumnSensitivity(List sensitivityProperties) { } /** - * Retrieves list of sensitivity properties as received from Server for this ColumnSensitivity + * Returns the list of sensitivity properties as received from Server for this ColumnSensitivity * information * * @return sensitivityProperties for this Class Object diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/InformationType.java b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/InformationType.java index 6bbb925e6..c6c0fc103 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/InformationType.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/InformationType.java @@ -6,14 +6,14 @@ package com.microsoft.sqlserver.jdbc.dataclassification; /** - * This class retrieves Information Types as recieved from SQL Server for the active resultSet + * Represents the Data Classification Information Types as received from SQL Server for the active resultSet */ public class InformationType { private String name; private String id; /** - * Constructor for Information Type + * Constructs a InformationType * * @param name * Name of Information Type @@ -26,7 +26,7 @@ public InformationType(String name, String id) { } /** - * Retrieves Name of this InformationType Object + * Returns the name of this InformationType Object * * @return Name of Information Type */ @@ -35,7 +35,7 @@ public String getName() { } /** - * Retrieves ID for this InformationType object + * Returns the ID for this InformationType object * * @return ID of Information Type */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/Label.java b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/Label.java index 5476cf6e7..0d481eddd 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/Label.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/Label.java @@ -6,14 +6,14 @@ package com.microsoft.sqlserver.jdbc.dataclassification; /** - * This class retrieves Labels as recieved from SQL Server for the active resultSet + * Represents the Data Classification Labels as received from SQL Server for the active resultSet */ public class Label { private String name; private String id; /** - * Constructor for Label + * Constructs a Label * * @param name * Name of Label @@ -26,7 +26,7 @@ public Label(String name, String id) { } /** - * Retrieves Name of this InformationType Object + * Returns the name of this InformationType Object * * @return Name of Information Type */ @@ -35,7 +35,7 @@ public String getName() { } /** - * Retrieves ID for this InformationType object + * Returns the ID for this InformationType object * * @return ID of Information Type */ diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/SensitivityClassification.java b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/SensitivityClassification.java index 233e0f459..7acffa514 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/SensitivityClassification.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/dataclassification/SensitivityClassification.java @@ -10,7 +10,8 @@ /** - * This class retrieves Sensitivity Classification data as recieved from SQL Server for the active resultSet + * Provides the functionlity to retrieve Sensitivity Classification data as received from SQL Server for the active + * resultSet */ public class SensitivityClassification { private List

* The returned value represents an instant in time as the number of milliseconds since January 1, 1970, 00:00:00 * GMT. @@ -216,7 +216,7 @@ public java.sql.Timestamp getTimestamp() { } /** - * Gets this DateTimeOffset object's offset value. + * Returns this DateTimeOffset object's offset value. * * @return this DateTimeOffset object's minutes offset from GMT */ diff --git a/src/main/java/microsoft/sql/Types.java b/src/main/java/microsoft/sql/Types.java index e43e98d20..ec326fe3c 100644 --- a/src/main/java/microsoft/sql/Types.java +++ b/src/main/java/microsoft/sql/Types.java @@ -6,8 +6,7 @@ package microsoft.sql; /** - * The class that defines the constants that are used to identify the SQL types that are specific to Microsoft SQL - * Server. + * Defines the constants that are used to identify the SQL types that are specific to Microsoft SQL Server. * * This class is never instantiated. */ diff --git a/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java b/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java index 57cb40307..a59187826 100644 --- a/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java +++ b/src/test/java/com/microsoft/sqlserver/jdbc/resultset/DataClassificationTest.java @@ -55,7 +55,8 @@ private void createTable(Connection connection, Statement stmt) throws SQLExcept String createQuery = "CREATE TABLE " + tableName + " (" + "[Id] [int] IDENTITY(1,1) NOT NULL," + "[CompanyName] [nvarchar](40) NOT NULL," + "[ContactName] [nvarchar](50) NULL," + "[ContactTitle] [nvarchar](40) NULL," + "[City] [nvarchar](40) NULL," - + "[CountryName] [nvarchar](40) NULL," + "[Phone] [nvarchar](30) MASKED WITH (FUNCTION = 'default()') NULL," + + "[CountryName] [nvarchar](40) NULL," + + "[Phone] [nvarchar](30) MASKED WITH (FUNCTION = 'default()') NULL," + "[Fax] [nvarchar](30) MASKED WITH (FUNCTION = 'default()') NULL)"; stmt.execute(createQuery);