forked from hibernate/hibernate-orm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ adding support and test correction for mariadb 11.6.2 snapshot isolation
- Loading branch information
Showing
16 changed files
with
481 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
hibernate-vector/src/main/java/org/hibernate/vector/BinaryVectorJdbcType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
/* | ||
* SPDX-License-Identifier: LGPL-2.1-or-later | ||
* Copyright Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.vector; | ||
|
||
import org.hibernate.dialect.Dialect; | ||
import org.hibernate.sql.ast.spi.SqlAppender; | ||
import org.hibernate.type.SqlTypes; | ||
import org.hibernate.type.descriptor.ValueBinder; | ||
import org.hibernate.type.descriptor.ValueExtractor; | ||
import org.hibernate.type.descriptor.WrapperOptions; | ||
import org.hibernate.type.descriptor.java.JavaType; | ||
import org.hibernate.type.descriptor.jdbc.ArrayJdbcType; | ||
import org.hibernate.type.descriptor.jdbc.BasicBinder; | ||
import org.hibernate.type.descriptor.jdbc.BasicExtractor; | ||
import org.hibernate.type.descriptor.jdbc.JdbcType; | ||
import org.hibernate.type.spi.TypeConfiguration; | ||
|
||
import java.sql.CallableStatement; | ||
import java.sql.PreparedStatement; | ||
import java.sql.ResultSet; | ||
import java.sql.SQLException; | ||
|
||
public class BinaryVectorJdbcType extends ArrayJdbcType { | ||
|
||
public BinaryVectorJdbcType(JdbcType elementJdbcType) { | ||
super( elementJdbcType ); | ||
} | ||
|
||
@Override | ||
public int getDefaultSqlTypeCode() { | ||
return SqlTypes.VECTOR; | ||
} | ||
|
||
@Override | ||
public <T> JavaType<T> getJdbcRecommendedJavaTypeMapping( | ||
Integer precision, | ||
Integer scale, | ||
TypeConfiguration typeConfiguration) { | ||
return typeConfiguration.getJavaTypeRegistry().resolveDescriptor( float[].class ); | ||
} | ||
|
||
@Override | ||
public void appendWriteExpression(String writeExpression, SqlAppender appender, Dialect dialect) { | ||
appender.append( writeExpression ); | ||
} | ||
|
||
@Override | ||
public <X> ValueExtractor<X> getExtractor(JavaType<X> javaTypeDescriptor) { | ||
return new BasicExtractor<>( javaTypeDescriptor, this ) { | ||
@Override | ||
protected X doExtract(ResultSet rs, int paramIndex, WrapperOptions options) throws SQLException { | ||
return javaTypeDescriptor.wrap( rs.getObject( paramIndex, float[].class ), options ); | ||
} | ||
|
||
@Override | ||
protected X doExtract(CallableStatement statement, int index, WrapperOptions options) throws SQLException { | ||
return javaTypeDescriptor.wrap( statement.getObject( index, float[].class ), options ); | ||
} | ||
|
||
@Override | ||
protected X doExtract(CallableStatement statement, String name, WrapperOptions options) throws SQLException { | ||
return javaTypeDescriptor.wrap( statement.getObject( name, float[].class ), options ); | ||
} | ||
|
||
}; | ||
} | ||
|
||
@Override | ||
public <X> ValueBinder<X> getBinder(final JavaType<X> javaTypeDescriptor) { | ||
return new BasicBinder<>( javaTypeDescriptor, this ) { | ||
|
||
@Override | ||
protected void doBind(PreparedStatement st, X value, int index, WrapperOptions options) throws SQLException { | ||
st.setObject( index, value ); | ||
} | ||
|
||
@Override | ||
protected void doBind(CallableStatement st, X value, String name, WrapperOptions options) | ||
throws SQLException { | ||
st.setObject( name, value, java.sql.Types.ARRAY ); | ||
} | ||
|
||
@Override | ||
public Object getBindValue(X value, WrapperOptions options) { | ||
return value; | ||
} | ||
}; | ||
} | ||
} |
Oops, something went wrong.