Repository navigation
Conversation
- Add new 'BlobSegmentSize' connection string property (range 512-65535 bytes) replacing the blob-specific role of PacketSize - Deprecate PacketSize on FbConnectionStringBuilder and FbConnection (use BlobSegmentSize instead) - Raise wire protocol blob segment limit from 32767 to 65535 bytes in GdsBlob, XdrReaderWriter (WriteBlobBuffer) and the native IFbClient interface (isc_get_segment / isc_put_segment now take unsigned shorts) - Plumb BlobSegmentSize through the full stack: ConnectionString -> GdsConnection / FesDatabase -> DatabaseBase -> BlobBase._segmentSize - Add tests for: connection string parsing/synonyms/validation, FbConnectionStringBuilder getter/setter, and blob read/write with BlobSegmentSize=65535 Fixes FirebirdSQL#1197
cincuranet
reviewed
Oct 9, 2026
cincuranet
left a comment
Member
There was a problem hiding this comment.
Regarding the obsoletion of PacketSize, I don't think we should put the attribute there. It is still valid setting for socket.
Comment on lines
+775
to
+776
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=65535"; | ||
| var cs = new ConnectionString(connStr); |
Member
There was a problem hiding this comment.
Suggested change
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=65535"; | |
| var cs = new ConnectionString(connStr); | |
| const string ConnectionString = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=65535"; | |
| var cs = new ConnectionString(ConnectionString); |
Comment on lines
+783
to
+784
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blobsegmentsize=32000"; | ||
| var cs = new ConnectionString(connStr); |
Member
There was a problem hiding this comment.
Suggested change
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blobsegmentsize=32000"; | |
| var cs = new ConnectionString(connStr); | |
| const string ConnectionString = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blobsegmentsize=32000"; | |
| var cs = new ConnectionString(ConnectionString); |
Comment on lines
+791
to
+792
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=100"; | ||
| var cs = new ConnectionString(connStr); |
Member
There was a problem hiding this comment.
Suggested change
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=100"; | |
| var cs = new ConnectionString(connStr); | |
| const string ConnectionString = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=100"; | |
| var cs = new ConnectionString(ConnectionString); |
Comment on lines
+799
to
+800
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=70000"; | ||
| var cs = new ConnectionString(connStr); |
Member
There was a problem hiding this comment.
Suggested change
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=70000"; | |
| var cs = new ConnectionString(connStr); | |
| const string ConnectionString = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=70000"; | |
| var cs = new ConnectionString(ConnectionString); |
Comment on lines
+803
to
+820
|
|
||
| [Test] | ||
| public void BlobSegmentSizeValidationMinBoundary() | ||
| { | ||
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=512"; | ||
| var cs = new ConnectionString(connStr); | ||
| Assert.DoesNotThrow(() => cs.Validate()); | ||
| Assert.AreEqual(512, cs.BlobSegmentSize); | ||
| } | ||
|
|
||
| [Test] | ||
| public void BlobSegmentSizeValidationMaxBoundary() | ||
| { | ||
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=65535"; | ||
| var cs = new ConnectionString(connStr); | ||
| Assert.DoesNotThrow(() => cs.Validate()); | ||
| Assert.AreEqual(65535, cs.BlobSegmentSize); | ||
| } |
Member
There was a problem hiding this comment.
I think this testing is too much. The the 65535 is actually tested by test above.
Suggested change
| [Test] | |
| public void BlobSegmentSizeValidationMinBoundary() | |
| { | |
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=512"; | |
| var cs = new ConnectionString(connStr); | |
| Assert.DoesNotThrow(() => cs.Validate()); | |
| Assert.AreEqual(512, cs.BlobSegmentSize); | |
| } | |
| [Test] | |
| public void BlobSegmentSizeValidationMaxBoundary() | |
| { | |
| const string connStr = "datasource=testserver;database=testdb.fdb;user=testuser;password=testpwd;blob segment size=65535"; | |
| var cs = new ConnectionString(connStr); | |
| Assert.DoesNotThrow(() => cs.Validate()); | |
| Assert.AreEqual(65535, cs.BlobSegmentSize); | |
| } |
| @@ -33,16 +33,18 @@ internal abstract class DatabaseBase | |||
| public abstract int Handle { get; } | |||
| public Charset Charset { get; } | |||
| public int PacketSize { get; } | |||
Member
There was a problem hiding this comment.
I guess we can remove PacketSize here, isn't it? It is not used anymore.
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.
Fixes #1197.
Summary
This PR implements support for blob segment sizes up to 65535 bytes (64 KiB − 1), as supported by Firebird since version 2.1 (and fully reliable in Firebird 3.0+).
Changes
New
BlobSegmentSizeconnection string propertyBlobSegmentSizeis a new connection string key (synonym:blobsegmentsize) that controls the segment size used when reading/writing blobs.PacketSizedefault).FbConnectionStringBuilder.BlobSegmentSizeandFbConnection.BlobSegmentSize.PacketSizedeprecationFbConnectionStringBuilder.PacketSizeandFbConnection.PacketSizeare marked[Obsolete]with a message pointing toBlobSegmentSize.PacketSizestill works—it continues to control socket buffer sizing—but it is no longer used as the blob segment size.Raised wire protocol limits
GdsBlob.GetSegment(all 4 variants): cap changed fromshort.MaxValue - 12(32755) toushort.MaxValue(65535).XdrReaderWriter.WriteBlobBuffer: guard changed fromshort.MaxValuetoushort.MaxValue.IFbClient.isc_get_segment/isc_put_segment: parameter types changed fromshort/ref shorttoushort/ref ushort, matching the Firebird C API's actualunsigned shorttypes.FesBlobupdated accordingly.Stack plumbing
BlobSegmentSizeflows through the full stack:Tests
ConnectionStringTests: 7 new tests (default, parsing, synonym, validation boundaries).FbConnectionStringBuilderTests: 3 new tests (default, setter, getter).FbBlobTests: 2 new integration tests exercising blob read/write withBlobSegmentSize = 65535.