-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issues with apostrophe being passed in table name + Improvements in SQLServerParameterMetadata #780
Conversation
cheenamalhotra
commented
Aug 8, 2018
•
edited
Loading
edited
- Fixes issue SQLServerBulkCopy / getDestinationMetadata fails when there's an apostrophe in the table name #775
- Fixes Null Pointer Exception reported in Executing a PreparedStatement with SET SHOWPLAN_ALL ON or SET SHOWPLAN_XML ON does not return a ResultSet. #778
- Updates Junit tests to test apostrophe(') in randomized table name
Codecov Report
@@ Coverage Diff @@
## dev #780 +/- ##
=========================================
Coverage 48.53% 48.53%
- Complexity 2806 2810 +4
=========================================
Files 116 116
Lines 27862 27862
Branches 4641 4647 +6
=========================================
Hits 13523 13523
- Misses 12197 12206 +9
+ Partials 2142 2133 -9
Continue to review full report at Codecov.
|
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
Show resolved
Hide resolved
* Object name to be passed as String | ||
* @return Converted object name | ||
*/ | ||
static String escapeQuotes(String name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we rename this method to escapeSingleQuotes
?
static String doubleQuoteTableName = "\"peter\"\"\"\"test" + UUID + "\""; | ||
static String unsupportedTableName = "[BulkCopyUnsupportedTable'" + UUID + "]"; | ||
static String squareBracketTableName = "[peter]]]]test'" + UUID + "]"; | ||
static String doubleQuoteTableName = "\"peter\"\"\"\"test'" + UUID + "\""; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove peter
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java
Show resolved
Hide resolved
rsProcedureMeta.getColumn(8).setFilter(new ZeroFixupFilter()); | ||
rsProcedureMeta.getColumn(9).setFilter(new ZeroFixupFilter()); | ||
rsProcedureMeta.getColumn(17).setFilter(new ZeroFixupFilter()); | ||
// DO NOT close the Statement as resultSet 'rsProcedureMeta' is required by other APIs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try-with-resources will close the statement though. Is this comment still accurate?
bFound = rsProcedureMeta.absolute(param); | ||
} else { | ||
bFound = rsProcedureMeta.absolute(param + 1); // Note row 1 is the 'return value' meta data | ||
if ((stmtParent).bReturnValueSyntax && isTVP) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't figure out why the variable would be named bFound
. Please rename it to a descriptive one.
src/main/java/com/microsoft/sqlserver/jdbc/SQLServerParameterMetaData.java
Show resolved
Hide resolved
return queryMetaMap.size(); | ||
} else { | ||
// Row 1 is Return Type metadata | ||
return procMetadata.size() - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if the size is 0?