Co-authored-by: rene-ye <rene-ye@users.noreply.github.com>
Showing 1 of 1 files from the diff.
@@ -4476,16 +4476,16 @@
Loading
4476 | 4476 | SQLCollation collation) throws SQLServerException { |
|
4477 | 4477 | boolean bValueNull = (sValue == null); |
|
4478 | 4478 | int nValueLen = bValueNull ? 0 : (2 * sValue.length()); |
|
4479 | - | boolean isShortValue = nValueLen <= DataTypes.SHORT_VARTYPE_MAX_BYTES; |
|
4480 | - | ||
4481 | 4479 | // Textual RPC requires a collation. If none is provided, as is the case when |
|
4482 | 4480 | // the SSType is non-textual, then use the database collation by default. |
|
4483 | 4481 | if (null == collation) |
|
4484 | 4482 | collation = con.getDatabaseCollation(); |
|
4485 | 4483 | ||
4486 | - | // Use PLP encoding on Yukon and later with long values and OUT parameters |
|
4487 | - | boolean usePLP = (!isShortValue || bOut); |
|
4488 | - | if (usePLP) { |
|
4484 | + | /* |
|
4485 | + | * Use PLP encoding if either OUT params were specified or if the user query exceeds |
|
4486 | + | * DataTypes.SHORT_VARTYPE_MAX_BYTES |
|
4487 | + | */ |
|
4488 | + | if (nValueLen > DataTypes.SHORT_VARTYPE_MAX_BYTES || bOut) { |
|
4489 | 4489 | writeRPCNameValType(sName, bOut, TDSType.NVARCHAR); |
|
4490 | 4490 | ||
4491 | 4491 | // Handle Yukon v*max type header here. |
@@ -4503,16 +4503,10 @@
Loading
4503 | 4503 | // Send the terminator PLP chunk. |
|
4504 | 4504 | writeInt(0); |
|
4505 | 4505 | } |
|
4506 | - | } else // non-PLP type |
|
4507 | - | { |
|
4506 | + | } else { // non-PLP type |
|
4508 | 4507 | // Write maximum length of data |
|
4509 | - | if (isShortValue) { |
|
4510 | - | writeRPCNameValType(sName, bOut, TDSType.NVARCHAR); |
|
4511 | - | writeShort((short) DataTypes.SHORT_VARTYPE_MAX_BYTES); |
|
4512 | - | } else { |
|
4513 | - | writeRPCNameValType(sName, bOut, TDSType.NTEXT); |
|
4514 | - | writeInt(DataTypes.IMAGE_TEXT_MAX_BYTES); |
|
4515 | - | } |
|
4508 | + | writeRPCNameValType(sName, bOut, TDSType.NVARCHAR); |
|
4509 | + | writeShort((short) DataTypes.SHORT_VARTYPE_MAX_BYTES); |
|
4516 | 4510 | ||
4517 | 4511 | collation.writeCollation(this); |
|
4518 | 4512 |
@@ -4521,10 +4515,7 @@
Loading
4521 | 4515 | writeShort((short) -1); // actual len |
|
4522 | 4516 | } else { |
|
4523 | 4517 | // Write actual length of data |
|
4524 | - | if (isShortValue) |
|
4525 | - | writeShort((short) nValueLen); |
|
4526 | - | else |
|
4527 | - | writeInt(nValueLen); |
|
4518 | + | writeShort((short) nValueLen); |
|
4528 | 4519 | ||
4529 | 4520 | // If length is zero, we're done. |
|
4530 | 4521 | if (0 != nValueLen) |
Files | Complexity | Coverage |
---|---|---|
src/main/java | 44.56% | 58.48% |
Project Totals (133 files) | 44.56% | 58.48% |
22801
22805
22805
22822
22777
22790
22801
22801
22823
22823
22612
22612
22655
22612
22684
22684
22701
22701
22716
22716
22728
22716
22746
22728
22746
22746
22746
22746
22777
22777
22823
22823
22835
22835
22823
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.