Skip to content

Fix issues with apostrophe being passed in table name + Improvements in SQLServerParameterMetadata#780

Merged
cheenamalhotra merged 21 commits intomicrosoft:devfrom
cheenamalhotra:issue775
Sep 25, 2018
Merged

Fix issues with apostrophe being passed in table name + Improvements in SQLServerParameterMetadata#780
cheenamalhotra merged 21 commits intomicrosoft:devfrom
cheenamalhotra:issue775

Conversation

@cheenamalhotra
Copy link
Copy Markdown
Member

@cheenamalhotra cheenamalhotra commented Aug 8, 2018

@codecov-io
Copy link
Copy Markdown

codecov-io commented Aug 9, 2018

Codecov Report

Merging #780 into dev will not change coverage.
The diff coverage is 37.16%.

Impacted file tree graph

@@            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
Flag Coverage Δ Complexity Δ
#JDBC42 48.06% <37.16%> (+0.41%) 2770 <1> (+34) ⬆️
#JDBC43 48.09% <37.16%> (-0.35%) 2777 <1> (-24)
Impacted Files Coverage Δ Complexity Δ
...oft/sqlserver/jdbc/SQLServerPreparedStatement.java 52.03% <100%> (-0.08%) 216 <0> (ø)
...c/main/java/com/microsoft/sqlserver/jdbc/Util.java 61.63% <100%> (+0.08%) 92 <1> (+1) ⬆️
...oft/sqlserver/jdbc/SQLServerParameterMetaData.java 24.56% <32.35%> (+0.36%) 31 <0> (ø) ⬇️
...om/microsoft/sqlserver/jdbc/SQLServerBulkCopy.java 52.6% <80%> (-0.01%) 261 <0> (-1)
...om/microsoft/sqlserver/jdbc/ReaderInputStream.java 45.05% <0%> (-3.3%) 16% <0%> (ø)
...m/microsoft/sqlserver/jdbc/SQLServerException.java 77.27% <0%> (-1.52%) 32% <0%> (-1%)
...rc/main/java/com/microsoft/sqlserver/jdbc/DDC.java 44.63% <0%> (-1.1%) 106% <0%> (-1%)
...n/java/com/microsoft/sqlserver/jdbc/Parameter.java 62.92% <0%> (-0.81%) 64% <0%> (ø)
...in/java/com/microsoft/sqlserver/jdbc/IOBuffer.java 55.93% <0%> (-0.14%) 0% <0%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 550d441...5c687ed. Read the comment docs.

@cheenamalhotra cheenamalhotra changed the title Fix issues with apostrophe being passed in table name Fix issues with apostrophe being passed in table name + Improvements in SQLServerParameterMetadata Aug 28, 2018
@cheenamalhotra cheenamalhotra added this to the 7.1.1 milestone Aug 30, 2018
lilgreenbird
lilgreenbird previously approved these changes Sep 18, 2018
* Object name to be passed as String
* @return Converted object name
*/
static String escapeQuotes(String name) {
Copy link
Copy Markdown
Contributor

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 unsupportedTableName = "[BulkCopyUnsupportedTable'" + UUID + "]";
static String squareBracketTableName = "[peter]]]]test'" + UUID + "]";
static String doubleQuoteTableName = "\"peter\"\"\"\"test'" + UUID + "\"";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove peter

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
Copy link
Copy Markdown
Contributor

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) {
Copy link
Copy Markdown
Contributor

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.

return queryMetaMap.size();
} else {
// Row 1 is Return Type metadata
return procMetadata.size() - 1;
Copy link
Copy Markdown
Contributor

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?

lilgreenbird
lilgreenbird previously approved these changes Sep 22, 2018
@cheenamalhotra cheenamalhotra merged commit 98d6962 into microsoft:dev Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants