Skip to content

0.7.0

Choose a tag to compare

@ocean ocean released this 09 Dec 02:12
· 437 commits to main since this release

πŸš€ EctoLibSql v0.7.0 - Performance & Feature Release

Major performance improvements, new connection management features, and comprehensive SQLite configuration support.

πŸ› Bug Fixes

  • ON CONFLICT Support (Issue #25) - Full upsert support with composite unique indexes

    • :on_conflict: :nothing with conflict targets
    • :on_conflict: :replace_all for upserts
    • Custom field replacement with {fields, _, targets}
  • Binary ID Type System (Issue #23) - Complete resolution

    • Fixed autogenerate(:binary_id) to generate string UUIDs
    • Fixed INSERT without RETURNING clause (was causing CaseClauseError)
    • Fixed BLOB encoding in Rust NIF (now returns Elixir binaries)
  • Remote Test Stability - Fixed vector operations test failures from stale data

⚑ Performance Improvements

Prepared Statement Caching - Statements are now cached and reused with automatic binding cleanup, delivering ~10-15x faster query execution for repeated queries. Benchmark: 100 cached executions in ~33ms (~330Β΅s per query).

✨ New Features

Connection Management

  • busy_timeout/2 - Configure database lock timeout (default: 5000ms)
  • reset/1 - Reset connection state without closing
  • interrupt/1 - Cancel long-running queries

PRAGMA Configuration

New EctoLibSql.Pragma module with comprehensive SQLite configuration:

  • Foreign keys control (enable_foreign_keys/1, disable_foreign_keys/1)
  • Journal mode (set_journal_mode/2 - WAL, DELETE, MEMORY, etc.)
  • Cache size (set_cache_size/2)
  • Synchronous level (set_synchronous/2 - OFF, NORMAL, FULL, EXTRA)
  • Table introspection (table_info/2, table_list/1)
  • User version tracking (user_version/1, set_user_version/2)

Transaction Features

  • Savepoints - Nested transaction support with partial rollback
    • create_savepoint/2 - Create named savepoint
    • release_savepoint_by_name/2 - Commit savepoint changes
    • rollback_to_savepoint_by_name/2 - Rollback to savepoint
  • Transaction Ownership Validation - Prevents cross-connection transaction manipulation

Batch Operations

  • execute_batch_sql/2 - Execute multiple SQL statements (non-transactional)
  • execute_transactional_batch_sql/2 - Atomic batch execution

Prepared Statement Introspection

  • stmt_parameter_count/2 - Get number of parameters
  • stmt_column_count/2 - Get number of result columns
  • stmt_column_name/3 - Get column name by index

Advanced Replica Sync

  • get_frame_number_for_replica/1 - Monitor replication frame
  • sync_until_frame/2 - Wait for specific frame (30s timeout)
  • flush_and_get_frame/1 - Push pending writes
  • max_write_replication_index/1 - Read-your-writes consistency tracking

πŸ”’ Security Fixes

  • SQL Injection Prevention - Added strict alphanumeric validation for savepoint names
  • Prepared Statement Validation - Enhanced parameter binding checks

πŸ“š Documentation

  • Updated AGENTS.md with all new features
  • Updated README.md with concise examples

πŸ”„ Backward Compatibility

All changes are backward compatible. Prepared statement API unchanged - caching happens transparently with improved performance.

Full Changelog: https://github.com/ocean/ecto_libsql/blob/main/CHANGELOG.md
Full list of changes: 0.6.0...0.7.0