Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Microsoft/mssql-jdbc into Az…
Browse files Browse the repository at this point in the history
…ure-DW-Junit

# Conflicts:
#	src/test/java/com/microsoft/sqlserver/jdbc/bvt/BvtTest.java
#	src/test/java/com/microsoft/sqlserver/testframework/AbstractTest.java
  • Loading branch information
peterbae committed Dec 17, 2018
2 parents 88028fa + b6bae75 commit 164cdcb
Show file tree
Hide file tree
Showing 22 changed files with 415 additions and 106 deletions.
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Bug report
about: Report a bug to help us improve
title: "[BUG]"
labels: bug
assignees: ''

---

## Driver version
<!--- Provide the JDBC driver version (e.g. 7.0.0). -->

## SQL Server version
<!--- Provide the output of executing `SELECT @@VERSION` on your target SQL Server. -->

## Client Operating System
<!--- Provide the Operating System the client application is running on. -->

## JAVA/JVM version
<!--- Provide the JAVA/JVM version (e.g. java version "1.8.0", IBM J9 VM). -->

## Table schema
<!--- Provide the table schema. -->

## Problem description
<!--- Provide full details of the problem. -->
1. Expected behaviour:
2. Actual behaviour:
3. Error message/stack trace:
4. Any other details that can be helpful:

## JDBC trace logs
<!--- Provide the JDBC trace logs. Instructions can be found here: https://docs.microsoft.com/sql/connect/jdbc/tracing-driver-operation?view=sql-server-2017 -->

## Reproduction code
<!--- Provide standalone JAVA code that reproduces the issue, preferably raw JDBC code. -->
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Feature Request
about: Suggest an idea for this project
title: "[FEATURE REQUEST]"
labels: enhancement
assignees: ''

---

## Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it
<!--- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] --->

## Describe the preferred solution
<!--- A clear and concise description of what you want to happen. --->

## Describe alternatives you've considered
<!--- A clear and concise description of any alternative solutions or features you've considered. --->

## Additional context
<!--- Add any other context or screenshots about the feature request here. --->

## Reference Documentations/Specifications
<!--- Provide links to JDBC Specifications or any other related documentation. --->

<!--- Optional --->
## Reference Implementation
<!--- Provide link to any available implementation references --->
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Question
about: Discuss an idea to see if it would be an appropriate Issue.
title: "[QUESTION]"
labels: question
assignees: ''

---

## Question
<!--- What is the question that you have? Please be detailed and give examples. --->

## Relevant Issues and Pull Requests
<!--- If there are relevant issues and pull requests please list and link them here. --->
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/bug_fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Bug Fix
about: Fix for a driver issue
title: "Fix | "

---

## Problem description
<!--- Provide full details of the problem if no corresponding GitHub issue exists. --->

### Fixes existing GitHub issue
<!--- Provide link to GitHub issue above. --->

## Fix Description
<!--- Briefly describe the fix implementation. --->

## New Public APIs
<!--- List any new public APIs added with this Fix. --->

16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Feature
about: Propose a new feature to the driver
title: "Feature | "

---

## Brief Description
<!--- Briefly describe the feature introduced with the PR. --->

<!--- Optional --->
### Fixes existing GitHub issue
<!--- Provide link to GitHub issue above. --->

## New Public APIs
<!--- List any new public APIs added with this Feature. --->
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/improvements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Improvements
about: Improve driver's performance/code quality
title: "Improvement | "

---

## Brief Description
<!--- Briefly describe the changes introduced with the PR. --->
16 changes: 16 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/other.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Other
about: Propose a custom change to the project source code.
title: "Other | "

---

## Brief Description
<!--- Briefly describe the feature introduced with the PR. --->

<!--- Optional --->
### Fixes existing GitHub issue
<!--- Provide link to GitHub issue above. --->

## New Public APIs
<!--- List any new public APIs added with this Feature. --->
9 changes: 9 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE/release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
name: Release
about: Push changes for release preparations
title: "Release | "

---

## Brief Description
<!--- Briefly describe the changes introduced with the PR. --->
4 changes: 2 additions & 2 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -4587,10 +4587,10 @@ void writeTVPRows(TVP value) throws SQLServerException {
int tokenType = tdsReader.peekTokenType();

if (TDS.TDS_ERR == tokenType) {
StreamError databaseError = new StreamError();
SQLServerError databaseError = new SQLServerError();
databaseError.setFromTDS(tdsReader);

SQLServerException.makeFromDatabaseError(con, null, databaseError.getMessage(), databaseError,
SQLServerException.makeFromDatabaseError(con, null, databaseError.getErrorMessage(), databaseError,
false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package com.microsoft.sqlserver.jdbc;

import java.lang.reflect.Method;
import java.net.IDN;
import java.net.InetAddress;
import java.net.UnknownHostException;
Expand Down
110 changes: 110 additions & 0 deletions src/main/java/com/microsoft/sqlserver/jdbc/SQLServerError.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Microsoft JDBC Driver for SQL Server Copyright(c) Microsoft Corporation All rights reserved. This program is made
* available under the terms of the MIT License. See the LICENSE file in the project root for more information.
*/

package com.microsoft.sqlserver.jdbc;

import java.io.Serializable;

/**
* SQLServerError represents a TDS error or message event.
*/
public final class SQLServerError extends StreamPacket implements Serializable {
/**
* Always update serialVersionUID when prompted
*/
private static final long serialVersionUID = -7304033613218700719L;
private String errorMessage = "";
private int errorNumber;
private int errorState;
private int errorSeverity;
private String serverName;
private String procName;
private long lineNumber;

/**
* Returns error message as received from SQL Server
*
* @return Error Message
*/
public String getErrorMessage() {
return errorMessage;
}

/**
* Returns error number as received from SQL Server
*
* @return Error Number
*/
public int getErrorNumber() {
return errorNumber;
}

/**
* Returns error state as received from SQL Server
*
* @return Error State
*/
public int getErrorState() {
return errorState;
}

/**
* Returns Severity of error (as int value) as received from SQL Server
*
* @return Error Severity
*/
public int getErrorSeverity() {
return errorSeverity;
}

/**
* Returns name of the server where exception occurs as received from SQL Server
*
* @return Server Name
*/
public String getServerName() {
return serverName;
}

/**
* Returns name of the stored procedure where exception occurs as received from SQL Server
*
* @return Procedure Name
*/
public String getProcedureName() {
return procName;
}

/**
* Returns line number where the error occurred in Stored Procedure returned by <code>getProcedureName()</code> as
* received from SQL Server
*
* @return Line Number
*/
public long getLineNumber() {
return lineNumber;
}

SQLServerError() {
super(TDS.TDS_ERR);
}

void setFromTDS(TDSReader tdsReader) throws SQLServerException {
if (TDS.TDS_ERR != tdsReader.readUnsignedByte())
assert false;
setContentsFromTDS(tdsReader);
}

void setContentsFromTDS(TDSReader tdsReader) throws SQLServerException {
tdsReader.readUnsignedShort(); // token length (ignored)
errorNumber = tdsReader.readInt();
errorState = tdsReader.readUnsignedByte();
errorSeverity = tdsReader.readUnsignedByte(); // matches master.dbo.sysmessages
errorMessage = tdsReader.readUnicodeString(tdsReader.readUnsignedShort());
serverName = tdsReader.readUnicodeString(tdsReader.readUnsignedByte());
procName = tdsReader.readUnicodeString(tdsReader.readUnsignedByte());
lineNumber = tdsReader.readUnsignedInt();
}
}
Loading

0 comments on commit 164cdcb

Please sign in to comment.