abstract class
Memo::Dialect::Base
- Memo::Dialect::Base
- Reference
- Object
Overview
Abstract interface for SQL dialect differences between SQLite and PostgreSQL.
Most SQL in Memo is cross-database compatible. This module only abstracts the patterns that differ:
- Insert-and-return-ID (last_insert_rowid vs RETURNING)
- Conflict handling (INSERT OR IGNORE, INSERT OR REPLACE)
- Implicit rowid (SQLite) vs explicit column (PostgreSQL)
- FTS5 (SQLite) vs tsvector/GIN (PostgreSQL)
- Schema DDL (AUTOINCREMENT, BLOB, REAL types)
- DB path discovery (pragma vs connection string)
Direct Known Subclasses
Defined in:
memo/dialect/base.crInstance Method Summary
-
#db_file_path(db : DB::Database) : String | Nil
Get the database file path from a connection, if applicable.
-
#embedding_rowid_column : String
The column name for embedding row identity used as USearch key.
-
#fts_delete(db : DB::Database, source_id : Int64)
Delete FTS index entry for a source.
-
#fts_join_sql : String
Build FTS JOIN clause for search queries.
-
#fts_upsert(db : DB::Database, source_id : Int64, content : String)
Insert or update FTS index for a source.
-
#fts_where_sql : String
Build FTS WHERE clause for match queries.
-
#insert_or_ignore_sql(table : String, columns : String, placeholders : String) : String
Build INSERT OR IGNORE SQL.
-
#insert_returning_id(db : DB::Database, sql : String, *args) : Int64
Execute an INSERT and return the generated ID.
-
#schema_statements : Array(String)
Get schema DDL statements.
-
#upsert_sql(table : String, columns : String, placeholders : String, conflict_columns : String, update_columns : Array(String)) : String
Build upsert SQL (INSERT OR REPLACE equivalent).
Instance Method Detail
Get the database file path from a connection, if applicable.
SQLite: reads pragma_database_list PostgreSQL: returns nil (no local file)
The column name for embedding row identity used as USearch key.
SQLite: "rowid" (implicit) PostgreSQL: "eid" (explicit column)
Delete FTS index entry for a source.
Insert or update FTS index for a source.
Build INSERT OR IGNORE SQL.
Execute an INSERT and return the generated ID.
Build upsert SQL (INSERT OR REPLACE equivalent).