odbc_write_table: describe parameters only if column data is coherent #587
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.
Fixes #586
When writing out our oracle specific implementation of
odbcConnectionColumns
we snooped on how the OEM driver implements theSQLColumns
ODBC API call. As a result we inherited some issues - for example, the OEM query always returns0
for theDATA_TYPE
field in the result ( we returnNA
).This is a problem, because if the output of
odbcConnectionColumns/SQLColumns
is available, ourdbWriteTable
implementation will attempt to use it as a performance optimization / to reduce the number of round-trips to the server to describe each of the parameters of theINSERT
query.With this patch, we attempt to optimize ( pre-describe the parameters ) only if we have a coherent result from the
odbcConnectionColumns
query. Coherent is defined asdata_type
is notNA
and the number of rows ( each row describing an individual parameter ) is equal to the number of parameters in theINSERT
query.Beyond this patch, we should snoop on the SIMBA driver as well to see if it has a better / more complete way of querying column types of existing tables, and use this to update the ORACLE specific implementation.
Finally, probably also worth thinking about