Skip to content

Preserve empty SQLite strings#17

Merged
antonsergeev88 merged 2 commits intomainfrom
codex/check-c-string-to-swift-string-conversion
Dec 28, 2025
Merged

Preserve empty SQLite strings#17
antonsergeev88 merged 2 commits intomainfrom
codex/check-c-string-to-swift-string-conversion

Conversation

@antonsergeev88
Copy link
Copy Markdown
Owner

Motivation

  • Ensure empty C strings returned by SQLite are preserved as empty Swift String values rather than being folded to nil.
  • Make NULL and empty-string return values distinct in the Swift wrapper to avoid losing information from SQLite metadata and APIs.
  • Align wrapper behavior with the intent of providing a thin, 1:1 mapping to SQLite semantics while keeping rawValue escape hatches.
  • Address conversions used for statement SQL, column metadata, bind parameter names, database filenames, and result-code error strings.

Description

  • Removed the guard !string.isEmpty checks that previously converted empty String to nil in Statement+SQL.swift, Statement+Column.swift, Statement+Bind.swift, Database+Filename.swift, and ResultCode.swift.
  • Continued to use String(cString: ...) for C-to-Swift conversions and preserved the existing guard let cString nil checks to keep NULL distinct.
  • No other API signatures or calling semantics were changed, and no new abstractions were introduced.
  • Commit message: Preserve empty SQLite strings to reflect the behavior change.

Testing

  • No automated tests were run for this change.
  • Existing tests in the repository were not modified by this patch.
  • Manual or CI validation was not requested in this rollout.
  • Consider adding Swift Test cases that assert empty vs nil distinctions for the affected accessors in a follow-up.

Codex Task

@antonsergeev88 antonsergeev88 merged commit 5df7392 into main Dec 28, 2025
1 check passed
@antonsergeev88 antonsergeev88 deleted the codex/check-c-string-to-swift-string-conversion branch December 28, 2025 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant