microsoft / ODBC-Specification

Microsoft ODBC Specification
Other
121 stars 40 forks source link

What additional metadata could we define for improved interoperability? #2

Open mikepizzo opened 8 years ago

mikepizzo commented 8 years ago

Column Expression? Database Description?

What about DateTime Precision?

Encoding? so the client can determine whether they can use SQL_C_CHAR/SQL_C_WCHAR? Or require drivers to return in encoding advertised by driver?

monty241 commented 7 years ago

entityfield.pdf We are working on an ODBC-driver for our SQL engine that have backing stores in REST, XML, Teradata, etc. It works great for .NET applications, but ODBC is hard, due to large legacy and variants found even when not covering Linux or Mac.

This is a full list of the non-trivial properties we can have on a column in our lowest layer, it is more functional than the current ODBC implementations and I understand the question, but in fact our developer community would benefit from publishing more metadata also through ODBC instead of querying the platform-dependent native metadata:

    /// <param name="dotnetDataType">The .NET data type of the field.</param>
    /// <param name="databaseDataType">The data type as exposed by the database system. Oracle for example could give 'clob' and 'varchar' to define a 'string'.</param>
    /// <param name="maxLength">The maximum size of a field.</param>
    /// <param name="fetchByDefault">True if the field is fetched by default, or false if it is being fetched when accessed.</param>
    /// <param name="documentation">Documentation of the field.</param>
    /// <param name="example">Example of the field.</param>
    /// <param name="displayControl">The control to use in to display the field.</param>
    /// <param name="precision">The precision in case of a numeric field.</param>
    /// <param name="scale">The scale in case of a numeric field.</param>
    /// <param name="labelSingular">The translatable label in singular.</param>
    /// <param name="labelPlural">The translatable label in plural.</param>
    /// <param name="labelSingularPrefix">The translatable label prefix in singular.</param>
    /// <param name="labelPluralPrefix">The translatable label prefix in plural.</param>
    /// <param name="nullable">True if the field is nullable. False if not.</param>
    /// <param name="derivedValue">True if the field contains a value derived by an expression. False if not.</param>
    /// <param name="displayInFilter">True if the field should be included in a search control. False if not.</param>
    /// <param name="displayInLOV">True if the field should be included in a picklist control. False if not.</param>
    /// <param name="displayInRecord">True if the field should be included in a single record control. False if not.</param>
    /// <param name="displayInResults">True if the field should be included in a multiple records/list control. False if not.</param>
    /// <param name="influencesInsert">True if the field contains a value stored in the database. False if not.</param>
    /// <param name="userChangeable">True if the field's value may be changed at any time by a human user with sufficient access rights. False if not.</param>
    /// <param name="displayOrder">Relative position of the field compared to other fields when displayed.</param>
    /// <param name="displayLengthAverage">Average length in characters of the displayed field's value.</param>
    /// <param name="displayLengthSD">Standard deviation of length in characters of the displayed field's value.</param>
    /// <param name="labelHeading">Label of an optional heading to be inserted just before this field when displayed.</param>
    /// <param name="checkSpelling">True if the value of the field should preferably be checked for spelling and grammar errors in a user interface. False if not.</param>
    /// <param name="minimumLength">The minimum required length for a text field.</param>
    /// <param name="minimumLengthPadding">The side on which padding has to be applied if the minimum length is not met.</param>

These are supplemented for a column by the following properties when we use our own metadata repository (no .NET documentation available, so manually added): fields (created by, in, when, session & last updated when, by, in, session) of the metadata entry

From a friended con-collegeau metadata repository party I know they open up similar properties to their developers community on the data model.

On some platforms we've also metadata on partitioning: when the data is physically partitioned (across servers or schemas or an ORG_ID column or whatever), there are some indicators what columns are involved in the partitioning.

I will add extra comment regarding tables and encoding.

monty241 commented 7 years ago

For precisions/scale/size and encoding, I would be happy when ODBC in case of character sequence would be able to incorporate some standardized encoding information on the column metadata.

The metadata itself I think should always either be ASCII 7-bit or UTF8 or UTF16 with legacy additions, advertising somewhere how to interpret them differently when necessary.

For datetime and other non-character types I think you could piggy-back on encoding the precision in some standards. The value space from which the values are taken differs between UTF8 and ASCII 7-bit (although it a discrete space), and the same holds for date with seconds precision, milli or even more accurate.

monty241 commented 7 years ago

ObjectDefinition.pdf

For a table we utilize a base definition, which includes (see attached PDF):

When supplemented by a metadata repository, we also use: