-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat-IQueryAbility-支持对PG数据类型进行相关的数组比较操作
- Loading branch information
Showing
8 changed files
with
155 additions
and
12 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
27 changes: 27 additions & 0 deletions
27
...ase-std/src/main/java/net/ximatai/muyun/database/std/argument/PgArrayArgumentFactory.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,27 @@ | ||
package net.ximatai.muyun.database.std.argument; | ||
|
||
import org.jdbi.v3.core.argument.AbstractArgumentFactory; | ||
import org.jdbi.v3.core.argument.Argument; | ||
import org.jdbi.v3.core.config.ConfigRegistry; | ||
import org.postgresql.jdbc.PgArray; | ||
|
||
import java.sql.SQLException; | ||
import java.sql.Types; | ||
|
||
public class PgArrayArgumentFactory extends AbstractArgumentFactory<PgArray> { | ||
|
||
public PgArrayArgumentFactory() { | ||
super(Types.ARRAY); // 指定数据库类型为 ARRAY | ||
} | ||
|
||
@Override | ||
protected Argument build(PgArray value, ConfigRegistry config) { | ||
return (position, statement, ctx) -> { | ||
try { | ||
statement.setArray(position, value); | ||
} catch (SQLException e) { | ||
throw new RuntimeException("Error setting PgArray argument", e); | ||
} | ||
}; | ||
} | ||
} |
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