Introduce SqlFieldType Abstraction and Enhance MySQL Result Handling; - #2589
Open
karthikeyan-netizen wants to merge 5 commits into
Open
karthikeyan-netizen wants to merge 5 commits into
karthikeyan-netizen wants to merge 5 commits into
Conversation
an-tao
requested changes
Sep 14, 2026
an-tao
left a comment
Member
There was a problem hiding this comment.
Since this PR introduces a new public type abstraction, could we add a metadata test covering the MySQL field types?
At minimum, I think the test should cover:
TINYINT
SMALLINT
MEDIUMINT
INT
BIGINT
FLOAT
DOUBLE
DECIMAL(M,D)
CHAR/VARCHAR
TEXT/TINYTEXT/MEDIUMTEXT/LONGTEXT
BLOB/TINYBLOB/MEDIUMBLOB/LONGBLOB
BINARY/VARBINARY
DATE/TIME/DATETIME
BIT
JSON
YEAR
This would also make it much harder to accidentally regress the mapping when new database metadata support is added.
…, including numeric, text, binary, date/time, JSON, ENUM/SET, BOOLEAN, and GEOMETRY types.
…nversion, including numeric, text, binary, date/time, JSON, ENUM/SET, BOOLEAN, and GEOMETRY types." This reverts commit 948d899.
…, including numeric, text, binary, date/time, JSON, ENUM/SET, BOOLEAN, and GEOMETRY types.
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
This pull request introduces a new
SqlFieldTypeenumeration and enhances MySQL result handling to provide explicit SQL field type representation, improved type safety, and thread-safe metadata access.The goal is to provide a structured SQL field type abstraction for MySQL while preserving backward compatibility.
Motivation
Currently, Drogon does not provide a unified abstraction for SQL field types in MySQL result handling. This PR addresses that gap by introducing:
SqlFieldTypeenumeration to represent SQL-native data typesSqlFieldTypemapping logicThis enables stronger type awareness and prepares the foundation for future database-related enhancements.
Changes Introduced
1. SqlFieldType Enumeration
SqlFieldTypeenum with complete MySQL FIELD_TYPE_* mappings2. MySQL Result Enhancements
MysqlResultImplto expose and utilizeSqlFieldTypeResultandResultImplto support the new abstraction3. Safety & Code Quality Improvements
ColumnMetastruct designed with immutable (const) members to prevent accidental mutation4. Related Adjustments
field.*,Result.*, and related implementations) to maintain consistent integrationCompatibility
Production Validation
Notes
I welcome feedback regarding:
SqlFieldTypeabstraction