Class SqliteJdbcStoreDialect
- All Implemented Interfaces:
JdbcStoreDialect
JdbcStore. Requires SQLite 3.24 or newer for ON CONFLICT
... DO UPDATE (UPSERT) support.-
Field Summary
Fields inherited from interface io.agentscope.extensions.mysql.store.JdbcStoreDialect
LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the SQL to conditionally update an item only when the stored version matches.Returns the SQL to create the store table if it does not yet exist.Returns the SQL to insert a new row withversion=1.Returns the SQL to insert-or-update an item, incrementingversionon update.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.agentscope.extensions.mysql.store.JdbcStoreDialect
getDeleteSql, getLikeEscapeChar, getSearchSql, getSelectSql
-
Constructor Details
-
SqliteJdbcStoreDialect
public SqliteJdbcStoreDialect()
-
-
Method Details
-
getCreateTableSql
Description copied from interface:JdbcStoreDialectReturns the SQL to create the store table if it does not yet exist.The table must have columns:
namespace_path VARCHAR(2048),item_key VARCHAR(255),value_json(TEXT-like),version BIGINT,updated_at BIGINT, plus a primary key on(namespace_path, item_key).- Specified by:
getCreateTableSqlin interfaceJdbcStoreDialect- Returns:
- CREATE TABLE statement; must use
%sfor the table name
-
getUpsertSql
Description copied from interface:JdbcStoreDialectReturns the SQL to insert-or-update an item, incrementingversionon update.Bind parameters in order:
(namespace_path, item_key, value_json, updated_at)— the dialect is responsible for settingversion=1on insert andversion=version+1on update.- Specified by:
getUpsertSqlin interfaceJdbcStoreDialect- Returns:
- UPSERT statement; must use
%sfor the table name
-
getInsertSql
Description copied from interface:JdbcStoreDialectReturns the SQL to insert a new row withversion=1.Bind parameters in order:
(namespace_path, item_key, value_json, updated_at). Used byputIfVersion(... expectedVersion=0): a primary-key violation indicates the row already exists and the CAS attempt has failed.- Specified by:
getInsertSqlin interfaceJdbcStoreDialect- Returns:
- INSERT statement; must use
%sfor the table name
-
getCasUpdateSql
Description copied from interface:JdbcStoreDialectReturns the SQL to conditionally update an item only when the stored version matches.Bind parameters in order:
(value_json, updated_at, namespace_path, item_key, expectedVersion). Implementations must setversion = version + 1. The caller treats an affected-row count of1as success.- Specified by:
getCasUpdateSqlin interfaceJdbcStoreDialect- Returns:
- UPDATE statement; must use
%sfor the table name
-