AS AgentScopeAPI 手册 / API Reference
包package io.agentscope.extensions.jdbc.dialect

io.agentscope.extensions.jdbc.dialect

package io.agentscope.extensions.jdbc.dialect

io.agentscope.extensions.jdbc.dialect 属于状态·记忆·会话,跨调用持久化与多租户隔离。 该包共收录 4 个公开类型。

JDBC dialect layer: table-domain interfaces (table) + aggregate abstract class + vendor implementations (vendor).

This package is the assembly layer. io.agentscope.extensions.jdbc.dialect.AbstractJdbcDialect is the aggregate abstract class that implements all table-domain interfaces and the io.agentscope.extensions.jdbc.dialect.SandboxLockStrategy contract. It holds the unified table prefix with per-table overrides. io.agentscope.extensions.jdbc.dialect.BoundSql is the unified return type for business SQL ("SQL + bind params"). io.agentscope.extensions.jdbc.dialect.AbstractJdbcDialectBuilder handles SPI-based auto-detection and optional table creation.


(1) dialect.table: one interface per table (abstract DDL + ANSI business SQL defaults), methods prefixed with table short name

+--------------------+ +------------------------+ +--------------------+
| StoreDialect | | SessionStateDialect | | SnapshotDialect |
| DDL (abstract) | | DDL (abstract) | | DDL (abstract) |
| ANSI SQL (default) | | ANSI SQL (default) | | ANSI SQL (default) |
| base name "store" | | base name "sessions" | | base name "snaps" |
+--------+-----------+ +----------+-------------+ +--------+-----------+
| | |
v v v <- implements (aggregate implements all table-domain interfaces + SandboxLockStrategy)
+--------+--------------------------+--------------------------+-----------+
| AbstractJdbcDialect aggregate abstract class |
| Implements StoreDialect, SessionStateDialect, SnapshotDialect, SandboxLockStrategy |
| Holds tablePrefix + per-table overrides; from(DataSource) returns builder |
| build() detects DB -> binds DataSource -> assembles names -> auto-creates tables |
| createTableDdls() collects all DDL; tryEnter() default = table-based lock |
| Final name resolution: override > prefix + base |
+--------+--------------------------+--------------------------+-----------+
| | |
v v v <- extends (one class per database — ALL differences in one file)

(2) dialect.vendor: override only DDL + divergent SQL + lock (if native), inherit ANSI defaults

+----------------------+ +----------------------+ +------------------+ +------------------+
| MysqlDialect | | PostgresDialect | | H2Dialect | | SqliteDialect |
| ON DUPLICATE KEY | | ON CONFLICT | | MERGE INTO | | ON CONFLICT |
| LONGTEXT/LONGBLOB | | TEXT/BYTEA | | CLOB/BLOB | | TEXT/BLOB |
| tryEnter: GET_LOCK | | tryEnter: inherited | | tryEnter: inherited | | tryEnter: inherited |
+----------------------+ +----------------------+ +------------------+ +------------------+

(3) Adding a database with native locks = override tryEnter() in the vendor class (no separate strategy class)

Adding a new table

  • Create a table-domain interface in table (methods prefixed with the table short name).

  • Add it to the aggregate's implements clause, plus name-override field + final resolver

  • builder method + add a line to createTableDdls().

  • Override the abstract DDL in each vendor class.

Adding a new database

  • Create a vendor class extending io.agentscope.extensions.jdbc.dialect.AbstractJdbcDialect.

  • Override DDL, divergent SQL, and supports(). Override tryEnter() only if the database has native advisory locks.

  • Register the class in META-INF/services/io.agentscope.extensions.jdbc.dialect.AbstractJdbcDialect.

所属构件Artifacts agentscope-extensions-jdbc

接口Interfaces

类型Type种类Kind说明Description
SandboxLockStrategy接口interface
定义沙箱锁 Strategy契约的接口。
Distributed lock contract implemented by `AbstractJdbcDialect`.

类Classes

类型Type种类Kind说明Description
AbstractJdbcDialect类class
抽象 JDBC Dialect,在多次调用之间保存和恢复会话与记忆数据。
Aggregate dialect abstract class — implements all table-domain interfaces and the `SandboxLockStrategy` contract.
AbstractJdbcDialectBuilder类class
抽象 JDBC Dialect 构建器,用于构建并配置目标实例。
Builder for `AbstractJdbcDialect` — chainable configuration then `#build()`.

记录Records

类型Type种类Kind说明Description
BoundSql记录record
承载 Bound SQL数据的记录类型。
An assembled SQL statement with its bind parameters.
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.