Skip to content

Commit a86a6c1

Browse files
committed
Improved JDBC test [skip ci]
1 parent 0fea938 commit a86a6c1

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

src/test/java/com/pgvector/JDBCJavaTest.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@
1717

1818
public class JDBCJavaTest {
1919
@Test
20-
void testReadText() throws SQLException {
21-
example(false);
20+
void testVectorReadText() throws SQLException {
21+
vectorExample(false);
2222
}
2323

2424
@Test
25-
void testReadBinary() throws SQLException {
26-
example(true);
25+
void testVectorReadBinary() throws SQLException {
26+
vectorExample(true);
2727
}
2828

29-
void example(boolean readBinary) throws SQLException {
29+
void vectorExample(boolean readBinary) throws SQLException {
3030
Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/pgvector_java_test");
3131
if (readBinary) {
3232
conn.unwrap(PGConnection.class).setPrepareThreshold(-1);
@@ -70,8 +70,20 @@ void example(boolean readBinary) throws SQLException {
7070
}
7171

7272
@Test
73-
void testHalfvec() throws SQLException {
73+
void testHalfvecReadText() throws SQLException {
74+
halfvecExample(false);
75+
}
76+
77+
@Test
78+
void testHalfvecReadBinary() throws SQLException {
79+
halfvecExample(true);
80+
}
81+
82+
void halfvecExample(boolean readBinary) throws SQLException {
7483
Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5432/pgvector_java_test");
84+
if (readBinary) {
85+
conn.unwrap(PGConnection.class).setPrepareThreshold(-1);
86+
}
7587

7688
Statement setupStmt = conn.createStatement();
7789
setupStmt.executeUpdate("CREATE EXTENSION IF NOT EXISTS vector");

0 commit comments

Comments
 (0)