refactor(plugins)!: typed PluginCellValue for binary cells#1190
Merged
Conversation
…ar, and Copy as INSERT/UPDATE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1188 by replacing the implicit String-as-bytes contract with a typed
PluginCellValue(.null/.text(String)/.bytes(Data)) that flows end-to-end from plugin to display to SQL emission. The visible 48-byte BYTEA value\xd38ce566...534fnow displays as0xD38CE566...534Fwith48 bytes, and edits to high-byte binary cells round-trip correctly through the database.PluginQueryResult.rows: [[PluginCellValue]],QueryResult.rows: [[PluginCellValue]],Row.values: ContiguousArray<PluginCellValue>. Every driver plugin (PostgreSQL, MySQL, SQLite, MSSQL, Oracle, DuckDB, Cassandra, MongoDB, DynamoDB, BigQuery, etc.) emits.bytes(Data)for its native binary column types.LibPQByteaDecoder: parses libpq text-format BYTEA (\xHH...hex and\nnnoctal escape) intoDataat the plugin boundary.RowChange.cellChanges,RowChange.originalRow,ParameterizedStatement.parameters, andSQLStatementGeneratorall consume typedPluginCellValue..bytes(Data)parameters survive through the adapter and bind via libpq's binary parameter format (paramFormats[i] = 1) instead of being UTF-8-re-encoded text. The same path is in place for MySQL/MariaDB blob binding and SQLitesqlite3_bind_blob.BlobHexEditorView(sidebar) andHexEditorContentView(popover) commitDatathrough new typed paths (commitBytescallback /setFieldToBytes/commitBinaryEdit) so a hex edit produces.bytes(Data)directly, not a Latin-1 String wrap.DataGridView+Click.swift. Binary bytes that incidentally contain\n,\f, or{no longer route through the multi-line/JSON text editor.This rides the still-unreleased PluginKit ABI v11; no version bump.
Test plan
LibPQByteaDecoder*suites (26 tests): hex format edge cases, octal escapes, encode round-trip across all 256 byte values, exact-value regression for Wrong binary hex value #1188.BlobFormattingService*suites (13 tests): byte count, compact hex, hex dump, editable hex, parse hex.SQLStatementGeneratorBinaryTests(4 tests):.bytesnewValue producesDataparameter (not String) on UPDATE/INSERT;.nullproducesnil(not String); exact Wrong binary hex value #1188 48-byte value round-trips through the SQL emission asData._sqlx_migrationsrows, confirmed display + sidebar + hex editor all show48 bytesand the correct hex.xcodebuild test.