JdbcStoreDialect
public interface JdbcStoreDialect
io/agentscope/extensions/mysql/store/JdbcStoreDialect.java:50–180定义 JDBC 存储 Dialect契约的接口。位于 io.agentscope.extensions.mysql.store 包。核心成员包括 getCreateTableSql、getUpsertSql、getInsertSql、getCasUpdateSql、getSelectSql、getDeleteSql。
Database-specific SQL for JdbcStore.
Each dialect renders the four SQL statements that vary between vendors:
-
#getCreateTableSql— schema bootstrap, used whenJdbcStore.Builder#initializeSchema(true)is set. -
#getUpsertSql— unconditional write that incrementsversionon update. -
#getInsertSql— create-only insert, used by theBaseStore#putIfVersionCAS path whenexpectedVersion == 0; primary-key conflicts indicate the row already exists. -
#getCasUpdateSql— conditional update used by theBaseStore#putIfVersionCAS path whenexpectedVersion > 0; relies onWHERE version = ?returning zero rows on mismatch.
The fixed-shape SQL statements (#getSelectSql, #getDeleteSql,
#getSearchSql) have safe defaults in this interface.
All SQL templates use the %s placeholder for the table name so that callers can
customise it via JdbcStore.Builder#tableName.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
LOG | Logger | 日志字段。 The LOG field. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getCreateTableSql() | 获取 `getCreateTableSql`。 Returns the SQL to create the store table if it does not yet exist. |
public String getUpsertSql() | 获取 `getUpsertSql`。 Returns the SQL to insert-or-update an item, incrementing `version` on update. |
public String getInsertSql() | 获取插入 SQL。 Returns the SQL to insert a new row with `version=1`. |
public String getCasUpdateSql() | 获取 `getCasUpdateSql`。 Returns the SQL to conditionally update an item only when the stored version matches. |
default public String getSelectSql()default | 获取选择 SQL。 Returns the SQL to fetch a single item. |
default public String getDeleteSql()default | 获取删除 SQL。 Returns the SQL to delete a single item. |
default public String getSearchSql()default | 获取搜索 SQL。 Returns the SQL to list items whose namespace_path matches a `LIKE` pattern. |
default public char getLikeEscapeChar()default | 获取 `getLikeEscapeChar`。 The escape character paired with `#getSearchSql`'s `ESCAPE` clause. |
static public JdbcStoreDialect from(DataSource dataSource)static | 创建并返回实例。 Detects the dialect from the `DataSource`'s database product name. |
字段详情Field Detail
LOG
Logger LOG
日志字段。声明为 Logger LOG。
The LOG field.
io/agentscope/extensions/mysql/store/JdbcStoreDialect.java:52方法详情Method Detail
getCreateTableSql
public String getCreateTableSql()
获取 getCreateTableSql。
Returns the SQL to create the store table if it does not yet exist.
Stringio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:63getUpsertSql
public String getUpsertSql()
获取 getUpsertSql。
Returns the SQL to insert-or-update an item, incrementing version on update.
Stringio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:74getInsertSql
public String getInsertSql()
获取插入 SQL。
Returns the SQL to insert a new row with version=1.
Stringio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:85getCasUpdateSql
public String getCasUpdateSql()
获取 getCasUpdateSql。
Returns the SQL to conditionally update an item only when the stored version matches.
Stringio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:97getSelectSql
default public String getSelectSql()
获取选择 SQL。
Returns the SQL to fetch a single item.
Stringio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:105–107getDeleteSql
default public String getDeleteSql()
获取删除 SQL。
Returns the SQL to delete a single item.
Stringio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:114–116getSearchSql
default public String getSearchSql()
获取搜索 SQL。
Returns the SQL to list items whose namespace_path matches a LIKE pattern.
Stringio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:130–134getLikeEscapeChar
default public char getLikeEscapeChar()
获取 getLikeEscapeChar。
The escape character paired with #getSearchSql's ESCAPE clause.
chario/agentscope/extensions/mysql/store/JdbcStoreDialect.java:141–143from
static public JdbcStoreDialect from(DataSource dataSource)
创建并返回实例。
Detects the dialect from the DataSource's database product name.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
dataSource | DataSource | JDBC 数据来源到探针;必须不为`null`。the JDBC data source to probe; must not be `null` |
JdbcStoreDialectio/agentscope/extensions/mysql/store/JdbcStoreDialect.java:154–179