From bd89a10ffdc6a6cc4e8da231d6183cf5bf85443f Mon Sep 17 00:00:00 2001 From: v-susanh Date: Wed, 28 Nov 2018 16:01:34 -0800 Subject: [PATCH] Add SQLServerMetadata constructor to set precision for string types (#876) * added contructor for string length * added comments * updated javadoc * updated javadoc --- .../sqlserver/jdbc/SQLServerMetaData.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java index da9db54b7..dfb43f756 100644 --- a/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java +++ b/src/main/java/com/microsoft/sqlserver/jdbc/SQLServerMetaData.java @@ -60,6 +60,23 @@ public SQLServerMetaData(String columnName, int sqlType, int precision, int scal this.scale = scale; } + /** + * Constructs a SQLServerMetaData with the column name, SQL type, and length (for String data). + * The length is used to differentiate large strings from strings with length less than 4000 characters. + * + * @param columnName + * the name of the column + * @param sqlType + * the SQL type of the column + * @param length + * the length of the string type + */ + public SQLServerMetaData(String columnName, int sqlType, int length) { + this.columnName = columnName; + this.javaSqlType = sqlType; + this.precision = length; + } + /** * Constructs a SQLServerMetaData. *