Skip to content

[FEATURE REQUEST] ISQLServerDataRecord should allow custom ordering #1675

Open
@thaDude

Description

@thaDude

Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it

Implementations of ISQLServerDataRecord need to respect the order of columns in the server-side definition of the corresponding Table Valued Parameter (TVP), i.e ISQLServerDataRecord.getColumnMetaData(1) needs to return the SQLServerMetaData for the first column as per the definition of the TVP, input 2 needs to return the meta data for the second column and so forth.

This is inconvenient in the case of data which does not have this order naturally since it needs to be re-ordered.

Describe the preferred solution

Provide a possibility to dissociate order of the record and column order on the SQL side. For instance, through a mapping, similarly to what is done with SqlServerBulkCopy#addColumnMapping.

Maybe the driver could simply use name columnName attribute of the SQLServerMetaData returned by ISQLServerDataRecord#getColumnMetaData to generate TVP insertion statements like :

INSERT INTO @p3 (col_name_1, col_name,2, ...) VALUES (val_1, val_2, ...)

instead of what it currently generates:

INSERT INTO @p3 VALUES (val_1, val_2, ...)

Best regards,

David

Metadata

Metadata

Assignees

No one assigned

    Labels

    BacklogThe topic in question has been recognized and added to development backlogEnhancementAn enhancement to the driver. Lower priority than bugs.

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions