Skip to content

Comments

feat: Add sqlite3_compileoption_used and sqlite3_compileoption_get#5

Merged
codekeyz merged 1 commit intocodekeyz:mainfrom
developerjamiu:main
Feb 19, 2026
Merged

feat: Add sqlite3_compileoption_used and sqlite3_compileoption_get#5
codekeyz merged 1 commit intocodekeyz:mainfrom
developerjamiu:main

Conversation

@developerjamiu
Copy link
Contributor

Problem

The Dart sqlite3 package (package:sqlite3) unconditionally calls sqlite3_compileoption_used via FFI during initialization to check whether ENABLE_COLUMN_METADATA is available. Since this library doesn't export that symbol, any SELECT query crashes at runtime with:

Failed to lookup symbol 'sqlite3_compileoption_used': /usr/lib/libsqlite3.so: undefined symbol: sqlite3_compileoption_used

Root Cause

The sqlite3 Dart package evaluates a lazy global in bindings.dart:

final hasColumnMetadata =
    ffiBindings.sqlite3_compileoption_used('ENABLE_COLUMN_METADATA') != 0;

This is triggered on the first SELECT query via _selectResults_tableNameshasColumnMetadata. The FFI lookup fails because the symbol doesn't exist in the library.

Fix

Added two functions from the SQLite C API:

  • sqlite3_compileoption_used(const char*) — returns 1 for ENABLE_COLUMN_METADATA (since sqlite3_column_table_name is already implemented), 0 for everything else
  • sqlite3_compileoption_get(int) — returns the compile option at index N, or NULL if out of range

Both match the official SQLite API signatures.

@codekeyz codekeyz self-requested a review February 19, 2026 10:24
@codekeyz codekeyz self-assigned this Feb 19, 2026
@codekeyz codekeyz added the bug Something isn't working label Feb 19, 2026
@codekeyz
Copy link
Owner

Approved, will test shortly.

@codekeyz codekeyz merged commit 42f0ef3 into codekeyz:main Feb 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants