Skip to content
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

feat: allow using UUID in PreparedStatement #365

Merged
merged 1 commit into from Mar 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -45,6 +45,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.UUID;

/** This class handles the parameters of a {@link PreparedStatement}. */
class JdbcParameterStore {
Expand Down Expand Up @@ -507,6 +508,8 @@ private Builder setParamWithKnownType(ValueBinder<Builder> binder, Object value,
}
} else if (value instanceof URL) {
return binder.to(((URL) value).toString());
} else if (value instanceof UUID) {
return binder.to(((UUID) value).toString());
}
throw JdbcSqlExceptionFactory.of(value + " is not a valid string", Code.INVALID_ARGUMENT);
case Types.DATE:
Expand Down Expand Up @@ -649,6 +652,8 @@ private Builder setParamWithUnknownType(ValueBinder<Builder> binder, Object valu
return binder.to(String.valueOf((char[]) value));
} else if (URL.class.isAssignableFrom(value.getClass())) {
return binder.to(((URL) value).toString());
} else if (UUID.class.isAssignableFrom(value.getClass())) {
return binder.to(((UUID) value).toString());
} else if (byte[].class.isAssignableFrom(value.getClass())) {
return binder.to(ByteArray.copyFrom((byte[]) value));
} else if (InputStream.class.isAssignableFrom(value.getClass())) {
Expand Down