Description:
For years now I have been using a series of functions that dynamically build a simple form based on an SQL query and a few declarations, when needed. The controls I display depend on the column types of the data. For example, if the column is of type BOOLEAN, the functions would output a checkbox. It formats its output differently if the column is declared MONEY than if it is reported as DECIMAL
It would be good if MySql did report back the actual type specified in the CREATE statement, whatever the type used internatlly for storage might be.
This would also be very helpfull for strongly typed languages, where not everyting that evaluates to 0 is false or true otherwise. You would be burdened with casting one variable type to another when you actually had the column types declared properly.
Actually, I'm reporting this as a feature request and not as a bug simply because it is documented.
How to repeat:
Not required, it is documented so.
Suggested fix:
Report back the actual column type specified in the CREATE statement
Now, if this is possible, I would like to sugest the following.
Adding a system table with metadata about the columns (and about the tables as well) would allow to add the proper column type, but also other user-defined column types. Thus, I could define the types Euro and Pesetas as equivalent to MONEY (which should exist as a system synonym for DECIMAL with about 4 decimals).
Those user-defined column types would be stored in a separate system table which would already be populated with the existing column types such as BOOLEAN. Queries for the column type should return this type, the other should be reported as Underlaying-Type, since, usually, it is irrelevant to the application.
In the meta-data table, additional data could be stored, such as:
- Descriptions for both tables and columns.
- Sugested display name or caption, for automated reporting or form building tools.
- Prefered output formatting
- Accepted input mask (Regular Expression)
- Eventually, other, user-defined.