Repository navigation
Support setting a database's default character set and collation on create - #176
Closed
MartinKoeditz wants to merge 3 commits into
Closed
MartinKoeditz wants to merge 3 commits into
MartinKoeditz wants to merge 3 commits into
Conversation
…reate CreateDatabaseOptions gained defaultCharSet, defaultCollation and pageSize. The existing DPB-based creation path (isc_dpb_lc_ctype etc.) has no DPB item for a database's default character set/collation - that can only be expressed through a full CREATE DATABASE statement, the same way isql does it. When defaultCharSet is set, AttachmentImpl.createDatabase() now builds that statement and executes it via IUtil::executeCreateDatabase instead of going through the dispatcher's DPB-based createDatabase.
Verifies both that the database's default character set is actually persisted (via rdb$database.rdb$character_set_name) and, more importantly, that the default collation is genuinely in effect: a column created without any explicit COLLATE clause is compared against a differently cased, unaccented literal, which only matches under UNICODE_CI_AI.
…ing executeCreateDatabase executeCreateDatabase takes a bare CREATE DATABASE statement with no DPB, and that statement's grammar has no clause for forcedWrite/role/setDatabaseReadWriteMode - those are DPB-only. Switching unconditionally would silently drop them for every caller (e.g. the shared test suite's default forcedWrite: false).
Contributor
Author
|
Closing this — it turned out the same result can be achieved after creation with plain SQL (ALTER DATABASE SET DEFAULT CHARACTER SET … / ALTER CHARACTER SET … SET DEFAULT COLLATION …, Firebird 3+), so no driver change is needed. Thanks! |
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.
CreateDatabaseOptions gains defaultCharSet, defaultCollation and pageSize. The existing DPB-based creation path (isc_dpb_lc_ctype etc.) has no DPB item for a database's default character set/collation — that can only be expressed through a full CREATE DATABASE statement, the same way isql does it. When defaultCharSet is set, AttachmentImpl.createDatabase() now builds that statement and executes it via IUtil::executeCreateDatabase instead of going through the dispatcher's DPB-based createDatabase. The DPB path is kept as the default for callers who don't need this (it also supports forcedWrite/role/setDatabaseReadWriteMode, which the bare CREATE DATABASE grammar has no clause for).
Includes a test verifying both that the default character set is persisted and that the default collation is genuinely in effect (case/accent-insensitive comparison without an explicit COLLATE clause).