Skip to content

Commit

Permalink
Revert "Add support for TDSType.GUID (#1582) (#2324)"
Browse files Browse the repository at this point in the history
This reverts commit 9a8849b.
  • Loading branch information
tkyc authored Mar 25, 2024
1 parent 9a13e5d commit fe7f3ff
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 147 deletions.
27 changes: 0 additions & 27 deletions src/main/java/com/microsoft/sqlserver/jdbc/IOBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
import java.util.Set;
import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.UUID;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
Expand Down Expand Up @@ -4785,32 +4784,6 @@ void writeRPCBigDecimal(String sName, BigDecimal bdValue, int nScale, boolean bO
writeBytes(val, 0, val.length);
}

/**
* Append a UUID in RPC transmission format.
*
* @param sName
* the optional parameter name
* @param uuidValue
* the data value
* @param bOut
* boolean true if the data value is being registered as an output parameter
*/
void writeRPCUUID(String sName, UUID uuidValue, boolean bOut) throws SQLServerException {
writeRPCNameValType(sName, bOut, TDSType.GUID);

if (uuidValue == null) {
writeByte((byte) 0);
writeByte((byte) 0);

} else {
writeByte((byte) 0x10); // maximum length = 16
writeByte((byte) 0x10); // length = 16

byte[] val = Util.asGuidByteArray(uuidValue);
writeBytes(val, 0, val.length);
}
}

/**
* Appends a standard v*max header for RPC parameter transmission.
*
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/com/microsoft/sqlserver/jdbc/Parameter.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import java.time.OffsetTime;
import java.util.Calendar;
import java.util.Locale;
import java.util.UUID;


/**
Expand Down Expand Up @@ -1126,10 +1125,6 @@ void execute(DTV dtv, Boolean booleanValue) throws SQLServerException {
setTypeDefinition(dtv);
}

void execute(DTV dtv, UUID uuidValue) throws SQLServerException {
setTypeDefinition(dtv);
}

void execute(DTV dtv, byte[] byteArrayValue) throws SQLServerException {
// exclude JDBC typecasting for Geometry/Geography as these datatypes don't have a size limit.
if (null != byteArrayValue && byteArrayValue.length > DataTypes.SHORT_VARTYPE_MAX_BYTES
Expand Down
21 changes: 3 additions & 18 deletions src/main/java/com/microsoft/sqlserver/jdbc/dtv.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ abstract class DTVExecuteOp {

abstract void execute(DTV dtv, Boolean booleanValue) throws SQLServerException;

abstract void execute(DTV dtv, UUID uuidValue) throws SQLServerException;

abstract void execute(DTV dtv, byte[] byteArrayValue) throws SQLServerException;

abstract void execute(DTV dtv, Blob blobValue) throws SQLServerException;
Expand Down Expand Up @@ -293,11 +291,7 @@ final class SendByRPCOp extends DTVExecuteOp {
}

void execute(DTV dtv, String strValue) throws SQLServerException {
if (dtv.getJdbcType() == JDBCType.GUID) {
tdsWriter.writeRPCUUID(name, UUID.fromString(strValue), isOutParam);
} else {
tdsWriter.writeRPCStringUnicode(name, strValue, isOutParam, collation, dtv.isNonPLP);
}
tdsWriter.writeRPCStringUnicode(name, strValue, isOutParam, collation, dtv.isNonPLP);
}

void execute(DTV dtv, Clob clobValue) throws SQLServerException {
Expand Down Expand Up @@ -1132,10 +1126,6 @@ void execute(DTV dtv, Boolean booleanValue) throws SQLServerException {
tdsWriter.writeRPCBit(name, booleanValue, isOutParam);
}

void execute(DTV dtv, UUID uuidValue) throws SQLServerException {
tdsWriter.writeRPCUUID(name, uuidValue, isOutParam);
}

void execute(DTV dtv, byte[] byteArrayValue) throws SQLServerException {
if (null != cryptoMeta) {
tdsWriter.writeRPCNameValType(name, isOutParam, TDSType.BIGVARBINARY);
Expand Down Expand Up @@ -1547,11 +1537,8 @@ final void executeOp(DTVExecuteOp op) throws SQLServerException {
case VARCHAR:
case LONGVARCHAR:
case CLOB:
op.execute(this, (byte[]) null);
break;

case GUID:
op.execute(this, (UUID) null);
op.execute(this, (byte[]) null);
break;

case TINYINT:
Expand Down Expand Up @@ -1632,7 +1619,7 @@ final void executeOp(DTVExecuteOp op) throws SQLServerException {
byte[] bArray = Util.asGuidByteArray((UUID) value);
op.execute(this, bArray);
} else {
op.execute(this, UUID.fromString(String.valueOf(value)));
op.execute(this, String.valueOf(value));
}
} else if (JDBCType.SQL_VARIANT == jdbcType) {
op.execute(this, String.valueOf(value));
Expand Down Expand Up @@ -2207,8 +2194,6 @@ void execute(DTV dtv, Short shortValue) throws SQLServerException {}

void execute(DTV dtv, Boolean booleanValue) throws SQLServerException {}

void execute(DTV dtv, UUID uuidValue) throws SQLServerException {}

void execute(DTV dtv, byte[] byteArrayValue) throws SQLServerException {}

void execute(DTV dtv, Blob blobValue) throws SQLServerException {
Expand Down
97 changes: 0 additions & 97 deletions src/test/java/com/microsoft/sqlserver/jdbc/datatypes/GuidTest.java

This file was deleted.

0 comments on commit fe7f3ff

Please sign in to comment.